From 8cbb227becdc172839b901aedf972022dc73118d Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Mon, 8 Dec 2008 20:15:03 +0000 Subject: Apply a bunch of trunk commits, mostly by Haran, namely: 6766 (partly), 6834 (partly), 6867, 6892, 6903, 6906, 6908, 6909, 6927, 6928, 6929, 6943, 6945, 6946 * Message/description tweaks. * Fix enchanting hides not updating AC. * Fix incorrect score calculation. * All 't' commands now take a turn. * Don't prompt when swapping into dangerous terrain. * Fix backwards stealth check. * Fix off-by-1 error when selecting starting weapon. * Lichform discards holy wrath weapons. * Reinitialise zap counter for recharged wands, mention charges. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.4@7786 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 18 ++++++++++++++++++ crawl-ref/source/dat/descript/spells.txt | 2 +- crawl-ref/source/decks.cc | 5 +++++ crawl-ref/source/directn.cc | 10 +++++++--- crawl-ref/source/effects.cc | 20 +++++++++++++++----- crawl-ref/source/fight.cc | 5 ++++- crawl-ref/source/hiscores.cc | 4 ++-- crawl-ref/source/item_use.cc | 7 +++++-- crawl-ref/source/itemname.cc | 2 ++ crawl-ref/source/itemprop.h | 3 ++- crawl-ref/source/items.cc | 15 +++++++++++++-- crawl-ref/source/monstuff.cc | 9 ++++++++- crawl-ref/source/mstuff2.cc | 2 +- crawl-ref/source/mutation.cc | 4 ++-- crawl-ref/source/newgame.cc | 2 +- crawl-ref/source/player.cc | 7 +++++-- crawl-ref/source/transfor.cc | 32 ++++++++++++++++++++++---------- 17 files changed, 113 insertions(+), 34 deletions(-) diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 7c561a11a5..7aabcfaa40 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -3486,6 +3486,12 @@ static int _check_adjacent(dungeon_feature_type feat, int &dx, int &dy) // to be opened (eg if you type ctrl + dir). static void _open_door(int move_x, int move_y, bool check_confused) { + if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT) + { + mpr("You can't open doors in your present form."); + return; + } + struct dist door_move; int dx, dy; // door x, door y @@ -3665,6 +3671,18 @@ static void _open_door(int move_x, int move_y, bool check_confused) static void _close_door(int door_x, int door_y) { + if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT) + { + mpr("You can't close doors in your present form."); + return; + } + + if (you.attribute[ATTR_HELD]) + { + mpr("You can't close doors while held in a net."); + return; + } + struct dist door_move; int dx, dy; // door x, door y diff --git a/crawl-ref/source/dat/descript/spells.txt b/crawl-ref/source/dat/descript/spells.txt index 5313355c7e..7a7ef1d68d 100644 --- a/crawl-ref/source/dat/descript/spells.txt +++ b/crawl-ref/source/dat/descript/spells.txt @@ -257,7 +257,7 @@ This spell temporarily infuses the weapon held by the caster with the essence of %%%% Extension -This spell extends the duration of most beneficial enchantments affecting the caster. +This spell extends the duration of most enchantments affecting the caster. %%%% Far Strike diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 35ecee1e58..fdcf348bf8 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -1064,6 +1064,11 @@ bool deck_triple_draw() const int num_cards = cards_in_deck(deck); + // We have to identify the deck before removing cards from it. + // Otherwise, _remember_drawn_card() will implicitly call + // _deck_ident() when the deck might have no cards left. + _deck_ident(deck); + if (num_cards == 1) { // Only one card to draw, so just draw it. diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index c89dd48cf5..d901af3893 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -2331,8 +2331,9 @@ static void _describe_monster(const monsters *mon) { if (mons_is_sleeping(mon)) { - mprf(MSGCH_EXAMINE, "%s appears to be resting.", - mon->pronoun(PRONOUN_CAP).c_str()); + mprf(MSGCH_EXAMINE, "%s appears to be %s.", + mon->pronoun(PRONOUN_CAP).c_str(), + mons_is_confused(mon) ? "sleepwalking" : "resting"); } // Applies to both friendlies and hostiles else if (mons_is_fleeing(mon)) @@ -2448,8 +2449,11 @@ std::string get_monster_desc(const monsters *mon, bool full_desc, // Note that the only difference between DESC_BASENAME and DESC_PLAIN // is that basename will ignore mname, so the monster _must_ be named // for this to make any sense. - if (!(mon->mname).empty() && desc != mon->name(DESC_BASENAME)) + if (!(mon->mname).empty() && desc != mon->name(DESC_BASENAME) + && mon->type != MONS_PLAYER_GHOST) + { desc += " the " + mon->name(DESC_BASENAME); + } } std::string weap = ""; diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 869c00756e..dfd013c784 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -1830,8 +1830,8 @@ bool recharge_wand(int item_slot) break; } - // Don't display zap counts any more. - wand.plus2 = ZAPCOUNT_UNKNOWN; + // Reinitialize zap counts. + wand.plus2 = ZAPCOUNT_RECHARGED; const int new_charges = std::max( @@ -1841,9 +1841,18 @@ bool recharge_wand(int item_slot) 1 + random2avg( ((charge_gain - 1) * 3) + 1, 3 ))); const bool charged = new_charges > wand.plus; - mprf("%s %s for a moment.", + + std::string desc; + if (charged && item_ident(wand, ISFLAG_KNOW_PLUSES)) + { + snprintf(info, INFO_SIZE, " and now has %d charges", new_charges); + desc = info; + } + mprf("%s %s for a moment%s.", wand.name(DESC_CAP_YOUR).c_str(), - charged? "glows" : "flickers"); + charged? "glows" : "flickers", + desc.c_str()); + wand.plus = new_charges; } else // It's a rod. @@ -1972,7 +1981,7 @@ void yell(bool force) if (!you.duration[DUR_BERSERKER]) { - std::string previous = ""; + std::string previous; if (!(you.prev_targ == MHITNOT || you.prev_targ == MHITYOU)) { monsters *target = &menv[you.prev_targ]; @@ -2077,6 +2086,7 @@ void yell(bool force) return; } + you.turn_is_over = true; you.pet_target = mons_targd; // Allow patrolling for "Stop fighting!" and "Wait here!" _set_friendly_foes(keyn == 's' || keyn == 'w'); diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 676c72386a..dd585a1410 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -1167,6 +1167,9 @@ bool melee_attack::player_aux_unarmed() if (!ely_block && (to_hit >= def->ev || one_chance_in(30))) { + // Upset the monster. + behaviour_event(def, ME_WHACK, MHITYOU); + if (attack_shield_blocked(true)) continue; if (player_apply_aux_unarmed()) @@ -1536,7 +1539,7 @@ int melee_attack::player_stab(int damage) if (stab_bonus) { - // Lets make sure we have some damage to work with... + // Let's make sure we have some damage to work with... damage = std::max(1, damage); if (mons_is_sleeping(def)) diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc index 07ce416980..edd1d42afe 100644 --- a/crawl-ref/source/hiscores.cc +++ b/crawl-ref/source/hiscores.cc @@ -960,7 +960,7 @@ void scorefile_entry::init() * + 0.1 * Experience above 3,000,000 * + (distinct Runes +2)^2 * 1000, winners with distinct runes >= 3 only * + value of Inventory, for winners only - * + (250,000 * distinct Runes) * (25,000/(turns/rune)), for winners only + * + (250,000 * d. runes) * (25,000/(turns/d. runes)), for winners only * */ @@ -1020,7 +1020,7 @@ void scorefile_entry::init() if (calc_item_values) // winners only { points += (250000 * num_diff_runes) - * ( 25000 * num_diff_runes / (1+you.num_turns) ); + * ((25000.0 * num_diff_runes) / (1+you.num_turns)); } // Players will have a hard time getting 1/10 of this (see XP cap): diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 9d16c2914a..32be70e0d3 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -3554,6 +3554,9 @@ void zap_wand( int slot ) // Take off a charge. wand.plus--; + // Zap counts count from the last recharge. + if (wand.plus2 == ZAPCOUNT_RECHARGED) + wand.plus2 = 0; // Increment zap count. if (wand.plus2 >= 0) wand.plus2++; @@ -4057,9 +4060,9 @@ bool enchant_armour( int &ac_change, bool quiet, item_def &arm ) arm.name(DESC_CAP_YOUR).c_str()); } - ac_change = arm.plus; + ac_change = property(arm, PARM_AC); hide2armour(arm); - ac_change = arm.plus - ac_change; + ac_change = property(arm, PARM_AC) - ac_change; if (is_cursed) do_uncurse_item( arm ); diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc index bbbbbd301a..75483d22b8 100644 --- a/crawl-ref/source/itemname.cc +++ b/crawl-ref/source/itemname.cc @@ -1287,6 +1287,8 @@ std::string item_def::name_aux( description_level_type desc, { if (item_plus2 == ZAPCOUNT_EMPTY) buff << " {empty}"; + else if (item_plus2 == ZAPCOUNT_RECHARGED) + buff << " {recharged}"; else if (item_plus2 > 0) buff << " {zapped: " << item_plus2 << '}'; } diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h index 23e3fd56af..37e541916c 100644 --- a/crawl-ref/source/itemprop.h +++ b/crawl-ref/source/itemprop.h @@ -570,7 +570,8 @@ enum wand_type // mitm[].subtype enum zap_count_type { ZAPCOUNT_EMPTY = -1, - ZAPCOUNT_UNKNOWN = -2 + ZAPCOUNT_UNKNOWN = -2, + ZAPCOUNT_RECHARGED = -3 }; void init_properties(void); diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 2f7f552d3e..eed2f0be2d 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -2134,10 +2134,14 @@ void drop() static void _autoinscribe_item( item_def& item ) { - /* if there's an inscription already, do nothing */ - if ( item.inscription.size() > 0 ) + // If there's an inscription already, do nothing - except + // for automatically generated inscriptions + if (!item.inscription.empty() && item.inscription != "god gift") return; + const std::string old_inscription = item.inscription; + item.inscription.clear(); + std::string iname = _autopickup_item_name(item); for ( unsigned i = 0; i < Options.autoinscriptions.size(); ++i ) @@ -2161,6 +2165,13 @@ static void _autoinscribe_item( item_def& item ) item.inscription += str; } } + if ( !old_inscription.empty() ) + { + if ( item.inscription.empty() ) + item.inscription = old_inscription; + else + item.inscription = old_inscription + ", " + item.inscription; + } } static void _autoinscribe_floor_items() diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index a651eacd98..494de41b99 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -1831,6 +1831,13 @@ bool swap_check(monsters *monster, coord_def &loc) const int mgrid = grd[monster->x][monster->y]; + // Don't move onto dangerous terrain. + if (is_grid_dangerous(mgrid)) + { + canned_msg(MSG_UNTHINKING_ACT); + return (false); + } + if (mons_is_caught(monster)) { simple_monster_message(monster, " is held in a net!"); @@ -2753,7 +2760,7 @@ static void _handle_behaviour(monsters *mon) { if (mon->foe == MHITYOU) { - if (random2(you.skills[SK_STEALTH]/3)) + if (one_chance_in(you.skills[SK_STEALTH]/3)) { mon->target_x = you.x_pos; mon->target_y = you.y_pos; diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc index 9caa666a62..dbf42916b3 100644 --- a/crawl-ref/source/mstuff2.cc +++ b/crawl-ref/source/mstuff2.cc @@ -1562,7 +1562,7 @@ bool mons_throw(struct monsters *monster, struct bolt &pbolt, int hand_used) } } else if (dec_mitm_item_quantity( hand_used, 1 )) - monster->inv[returning ? MSLOT_WEAPON : MSLOT_MISSILE] = NON_ITEM; + monster->inv[returning ? hand_used : MSLOT_MISSILE] = NON_ITEM; return (true); } // end mons_throw() diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index eb71937c0d..f0b36f027a 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -1453,7 +1453,7 @@ static void _display_vampire_attributes() //Alive Full Satiated Thirsty Near... Bloodless {"Metabolism ", "very fast ", "fast ", "fast ", "normal ", "slow ", "none "}, - {"Regeneration ", "very fast ", "fast ", "normal ", "normal ", "slow ", "none "}, + {"Regeneration ", "very fast ", "fast ", "normal ", "slow ", "slow ", "none "}, {"Stealth boost ", "none ", "none ", "none ", "minor ", "major ", "large "}, @@ -1464,7 +1464,7 @@ static void _display_vampire_attributes() {"Cold resistance ", " ", " ", " ", " + ", " + ", " ++ "}, - {"Negative resistance ", " ", " ", " ", " + ", " ++ ", " +++ "}, + {"Negative resistance ", " ", " ", " + ", " ++ ", " +++ ", " +++ "}, {"Torment resistance ", " ", " ", " ", " ", " ", " + "}, diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index 7c89bc1810..86f4d07c52 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -2376,7 +2376,7 @@ static bool _choose_weapon() } } while (keyin != '*' && keyin != '+' - && (keyin < 'a' || keyin > ('a' + num_choices) + && (keyin < 'a' || keyin >= ('a' + num_choices) || startwep_restrictions[keyin - 'a'] == CC_BANNED)); } diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index ea0f6fceb9..8176cf067b 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -698,8 +698,11 @@ bool you_tran_can_wear(int eq, bool check_mutation) if (transform == TRAN_STATUE) { - if (eq == EQ_BODY_ARMOUR || eq == EQ_GLOVES || eq == EQ_SHIELD) + if (eq == EQ_BODY_ARMOUR || eq == EQ_GLOVES || eq == EQ_SHIELD + || eq == EQ_BOOTS) + { return (false); + } return (true); } @@ -4258,7 +4261,7 @@ bool wearing_amulet(jewellery_type amulet, bool calc_unid) { if ( extrinsic_amulet_effect(amulet) ) return (true); - + if (you.equip[EQ_AMULET] == -1) return (false); diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc index af37ccf225..3da96206e3 100644 --- a/crawl-ref/source/transfor.cc +++ b/crawl-ref/source/transfor.cc @@ -67,6 +67,10 @@ static void _init_equipment_removal(std::set &rem_stuff, } break; + case TRAN_LICH: + rem_stuff.clear(); + break; + case TRAN_BLADE_HANDS: rem_stuff.erase(EQ_CLOAK); rem_stuff.erase(EQ_HELMET); @@ -337,7 +341,7 @@ bool transform(int pow, transformation_type which_trans, bool quiet) } // We drop everything except jewellery by default. - equipment_type default_rem[] = { + const equipment_type default_rem[] = { EQ_WEAPON, EQ_CLOAK, EQ_HELMET, EQ_GLOVES, EQ_BOOTS, EQ_SHIELD, EQ_BODY_ARMOUR }; @@ -433,11 +437,6 @@ bool transform(int pow, transformation_type which_trans, bool quiet) return (true); case TRAN_BLADE_HANDS: - rem_stuff.erase(EQ_CLOAK); - rem_stuff.erase(EQ_HELMET); - rem_stuff.erase(EQ_BOOTS); - rem_stuff.erase(EQ_BODY_ARMOUR); - if (check_for_cursed_equipment( rem_stuff )) return (false); @@ -533,10 +532,9 @@ bool transform(int pow, transformation_type which_trans, bool quiet) return (true); case TRAN_LICH: - // Don't need to remove anything. - - // also AC +3, cold +1, neg +3, pois +1, is_undead, res magic +50, + // AC +3, cold +1, neg +3, pois +1, is_undead, res magic +50, // spec_death +1, and drain attack (if empty-handed) + if (you.duration[DUR_DEATHS_DOOR]) { if (!quiet) @@ -548,8 +546,23 @@ bool transform(int pow, transformation_type which_trans, bool quiet) return (false); } + // Remove holy wrath weapons if necessary. + if (you.weapon() + && get_weapon_brand(*you.weapon()) == SPWPN_HOLY_WRATH) + { + rem_stuff.insert(EQ_WEAPON); + } + + if (check_for_cursed_equipment(rem_stuff, quiet)) + return (false); + + if (check_transformation_stat_loss(rem_stuff, quiet)) + return (false); + mpr("Your body is suffused with negative energy!"); + remove_equipment(rem_stuff); + // undead cannot regenerate -- bwr if (you.duration[DUR_REGENERATION]) { @@ -560,7 +573,6 @@ bool transform(int pow, transformation_type which_trans, bool quiet) // silently removed since undead automatically resist poison -- bwr you.duration[DUR_RESIST_POISON] = 0; - // no remove_equip you.attribute[ATTR_TRANSFORMATION] = TRAN_LICH; you.duration[DUR_TRANSFORMATION] = 20 + random2(pow) + random2(pow); -- cgit v1.2.3