From 60d8e93b1adada2500c8f282bc31dd04b17b0935 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 7 Aug 2008 15:06:00 +0000 Subject: Apply Haran's commits 6773 and 6777-6784 to 0.4. * Fix 2037104: amulet of Controlled Flight not autoIDing. * Fix 2038973: explosive tracers leaking information about invisible monsters. * Fix 2039217: check shield status for non-weapons before wielding * Fix 2039734: non-Spriggan transmuters being cheated on UC * Fix 2037845: unstackedness was overriding finishing a deck * Fix 2038476: semicontrolled blink. * Fix 2038962: casting Divine Shield wasn't refreshing AC. * Fix 2038651: real/fake rakshasa identity being leaked in descriptions. * Fix 2035976: doubled inscriptions in equipped items in dump. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.4@6792 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/docs/changes.stone_soup | 5 ++++ crawl-ref/source/beam.cc | 3 +++ crawl-ref/source/decks.cc | 2 +- crawl-ref/source/directn.cc | 10 ++++++-- crawl-ref/source/it_use2.cc | 13 +++++++++++ crawl-ref/source/item_use.cc | 28 +++++++++++++++------- crawl-ref/source/newgame.cc | 4 +++- crawl-ref/source/output.cc | 49 +++++++++++++++++++++------------------ crawl-ref/source/player.cc | 46 ++++++++++++++++++------------------ crawl-ref/source/player.h | 2 ++ crawl-ref/source/religion.cc | 11 ++++----- crawl-ref/source/spells4.cc | 20 +++++++++------- 12 files changed, 119 insertions(+), 74 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/docs/changes.stone_soup b/crawl-ref/docs/changes.stone_soup index 892cda6ad2..1dc75c7ffa 100644 --- a/crawl-ref/docs/changes.stone_soup +++ b/crawl-ref/docs/changes.stone_soup @@ -6,8 +6,13 @@ Disclaimer: These are merely the highlights, not an exhaustive list of changes. * Fixed assertion failure upon high-scoring death. * Fixed Crawl spinning in CPU-pegging loop on disconnect on death screen. * Fixed time handling in dgl builds. +* Fixed semi-controlled Blink. * Fixed '{' inscription. +* Fixed Spriggans being capable to wield staves while wearing a shield. +* Fixed explosive tracers leaking information about invisible monsters. +* Fixed real/fake rakshasa identity being leaked in descriptions. * Fixed broken spacing on religion screen. +* Fixed doubled inscriptions in equipped items in dump. * Fixed monsters being created with both a shield and wielding a two-hander. * Fixed bad names for god-gifted unrandarts. * Warn player if interlevel travel intends to take detours. diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 0bed353d97..72d91b921b 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -3181,10 +3181,13 @@ int affect(bolt &beam, int x, int y, item_def *item) if (mid != NON_MONSTER) { monsters *mon = &menv[mid]; + const bool invisible = YOU_KILL(beam.thrower) && !you.can_see(mon); // Monsters submerged in shallow water can be targeted by beams // aimed at that spot. if (mon->alive() + // Don't stop tracers on invisible monsters. + && (!invisible || !beam.is_tracer) && (!mon->submerged() || beam.aimed_at_spot && beam.target() == mon->pos() && grd(mon->pos()) == DNGN_SHALLOW_WATER)) diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index c748782d10..35ecee1e58 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -1259,7 +1259,7 @@ void evoke_deck( item_def& deck ) // Nemelex likes gamblers. if (!no_brownie) { - brownie_points = 1; + brownie_points++; if (one_chance_in(3)) brownie_points++; } diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index 5f06f3f977..6e311e8faa 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -2453,8 +2453,14 @@ std::string get_monster_desc(const monsters *mon, bool full_desc, } std::string weap = ""; - if (mon->type != MONS_DANCING_WEAPON) + // We don't report rakshasa equipment in order not to give away the + // true rakshasa when it summons. + + if (mon->type != MONS_DANCING_WEAPON + && (mon->type != MONS_RAKSHASA || mons_friendly(mon))) + { weap = _describe_monster_weapon(mon); + } if (!weap.empty()) { @@ -2464,7 +2470,7 @@ std::string get_monster_desc(const monsters *mon, bool full_desc, } // Print the rest of the equipment only for full descriptions. - if (full_desc) + if (full_desc && (mon->type != MONS_RAKSHASA || mons_friendly(mon))) { const int mon_arm = mon->inv[MSLOT_ARMOUR]; const int mon_shd = mon->inv[MSLOT_SHIELD]; diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc index ad53a89f49..a603f0cd70 100644 --- a/crawl-ref/source/it_use2.cc +++ b/crawl-ref/source/it_use2.cc @@ -188,6 +188,19 @@ bool potion_effect( potion_type pot_eff, int pow, bool was_known ) if (!player_is_airborne()) mpr("You gently float upwards from the floor."); + // Amulets can auto-ID. + // FIXME: should also happen when putting on/removing amulet + // while levitating. + if (!you.duration[DUR_LEVITATION] + && wearing_amulet(AMU_CONTROLLED_FLIGHT) + && !extrinsic_amulet_effect(AMU_CONTROLLED_FLIGHT)) + { + item_def& amu(you.inv[you.equip[EQ_AMULET]]); + set_ident_type(amu.base_type, amu.sub_type, ID_KNOWN_TYPE); + set_ident_flags(amu, ISFLAG_KNOW_PROPERTIES); + mprf("You are wearing: %s", amu.name(DESC_INVENTORY_EQUIP).c_str()); + } + you.duration[DUR_LEVITATION] += 25 + random2(pow); if (you.duration[DUR_LEVITATION] > 100) diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index cafe9f8570..9d16c2914a 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -130,10 +130,17 @@ bool can_wield(const item_def *weapon, bool say_reason, } } - // We don't have to check explicitly for staves - all staves are wieldable - // by everyone. + // All non-weapons only need a shield check. if (weapon->base_type != OBJ_WEAPONS) - return (true); + { + if (!ignore_temporary_disability && is_shield_incompatible(*weapon)) + { + SAY(mpr("You can't wield that with a shield.")); + return (false); + } + else + return (true); + } if (player_size(PSIZE_TORSO) < SIZE_LARGE && item_mass( *weapon ) >= 300) { @@ -292,11 +299,12 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages) { if (you.equip[EQ_WEAPON] != -1) { + item_def& wpn = *you.weapon(); // Can we safely unwield this item? - if (has_warning_inscription(you.inv[you.equip[EQ_WEAPON]], OPER_WIELD)) + if (has_warning_inscription(wpn, OPER_WIELD)) { std::string prompt = "Really unwield "; - prompt += you.inv[you.equip[EQ_WEAPON]].name(DESC_INVENTORY); + prompt += wpn.name(DESC_INVENTORY); prompt += '?'; if (!yesno(prompt.c_str(), false, 'n')) return (false); @@ -317,15 +325,17 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages) return (true); } - if (!can_wield(&you.inv[item_slot], true)) + item_def& new_wpn(you.inv[item_slot]); + + if (!can_wield(&new_wpn, true)) return (false); // For non-auto_wield cases checked above. - if (auto_wield && !check_warning_inscriptions(you.inv[item_slot], OPER_WIELD)) + if (auto_wield && !check_warning_inscriptions(new_wpn, OPER_WIELD)) return (false); // Wield the weapon. - if (!safe_to_remove_or_wear(you.inv[item_slot], false)) + if (!safe_to_remove_or_wear(new_wpn, false)) return (false); // Go ahead and wield the weapon. @@ -337,7 +347,7 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages) // any oddness on wielding taken care of here wield_effects(item_slot, show_weff_messages); - mpr(you.inv[item_slot].name(DESC_INVENTORY_EQUIP).c_str()); + mpr(new_wpn.name(DESC_INVENTORY_EQUIP).c_str()); // Warn player about low str/dex or throwing skill. if (show_weff_messages) diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index 750d171260..7c89bc1810 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -5071,6 +5071,9 @@ bool _give_items_skills() _newgame_make_item(4, EQ_NONE, OBJ_POTIONS, POT_CONFUSION, -1, 2); _newgame_make_item(5, EQ_NONE, OBJ_POTIONS, POT_POISON); + // Do this early because it might be increased later. + you.skills[SK_UNARMED_COMBAT] = 1; + if (you.species == SP_SPRIGGAN) { _make_rod(you.inv[0], STAFF_STRIKING); @@ -5082,7 +5085,6 @@ bool _give_items_skills() you.skills[SK_UNARMED_COMBAT] += 2; you.skills[SK_FIGHTING] = 1; - you.skills[SK_UNARMED_COMBAT] = 1; you.skills[SK_DODGING] = 2; you.skills[SK_SPELLCASTING] = 2; you.skills[SK_TRANSMIGRATION] = 2; diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index d779c19fc9..141af28361 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -1191,10 +1191,14 @@ monster_pane_info::monster_pane_info(const monsters *m) // will break saves a little bit though. m_attitude = mons_attitude(m); + int mtype = m->type; + if ( mtype == MONS_RAKSHASA_FAKE ) + mtype = MONS_RAKSHASA; + // Currently, difficulty is defined as "average hp". Leaks too much info? - const monsterentry* me = get_monster_data(m->type); + const monsterentry* me = get_monster_data(mtype); // [ds] XXX: Use monster experience value as a better indicator of diff.? - m_difficulty = me->hpdice[0] * (me->hpdice[1] + (me->hpdice[2]>>1)) + m_difficulty = me->hpdice[0] * (me->hpdice[1] + (me->hpdice[2]/2)) + me->hpdice[3]; // [ds] XXX: Kill the magic numbers. @@ -1220,12 +1224,21 @@ bool monster_pane_info::less_than(const monster_pane_info& m1, else if (m1.m_attitude > m2.m_attitude) return (false); + int m1type = m1.m_mon->type; + int m2type = m2.m_mon->type; + + // Don't differentiate real rakshasas from fake ones. + if ( m1type == MONS_RAKSHASA_FAKE ) + m1type = MONS_RAKSHASA; + if ( m2type == MONS_RAKSHASA_FAKE ) + m2type = MONS_RAKSHASA; + // Force plain but different coloured draconians to be treated like the // same sub-type. - if (!zombified && m1.m_mon->type >= MONS_DRACONIAN - && m1.m_mon->type <= MONS_PALE_DRACONIAN - && m2.m_mon->type >= MONS_DRACONIAN - && m2.m_mon->type <= MONS_PALE_DRACONIAN) + if (!zombified && m1type >= MONS_DRACONIAN + && m1type <= MONS_PALE_DRACONIAN + && m2type >= MONS_DRACONIAN + && m2type <= MONS_PALE_DRACONIAN) { return (false); } @@ -1237,20 +1250,17 @@ bool monster_pane_info::less_than(const monster_pane_info& m1, return (false); // Force mimics of different types to be treated like the same one. - if (mons_is_mimic(m1.m_mon->type) - && mons_is_mimic(m2.m_mon->type)) - { + if (mons_is_mimic(m1type) && mons_is_mimic(m2type)) return (false); - } - if (m1.m_mon->type < m2.m_mon->type) + if (m1type < m2type) return (true); - else if (m1.m_mon->type > m2.m_mon->type) + else if (m1type > m2type) return (false); // Never distinguish between dancing weapons. // The above checks guarantee that *both* monsters are of this type. - if (m1.m_mon->type == MONS_DANCING_WEAPON) + if (m1type == MONS_DANCING_WEAPON) return (false); if (zombified) @@ -1271,7 +1281,7 @@ bool monster_pane_info::less_than(const monster_pane_info& m1, } } - if (m1.m_fullname && m2.m_fullname || m1.m_mon->type == MONS_PLAYER_GHOST) + if (m1.m_fullname && m2.m_fullname || m1type == MONS_PLAYER_GHOST) return (m1.m_mon->name(DESC_PLAIN) < m1.m_mon->name(DESC_PLAIN)); #if 0 // for now, sort brands together. @@ -1693,20 +1703,13 @@ static void _print_overview_screen_equip(column_composer& cols, const char* colname = colour_to_str(item.colour).c_str(); const char equip_char = index_to_letter(item_idx); - char buf2[50]; - if (item.inscription.empty()) - buf2[0] = 0; - else - snprintf(buf2, sizeof buf2, " {%s}", item.inscription.c_str()); - snprintf(buf, sizeof buf, - "%s%c - <%s>%s%s", + "%s%c - <%s>%s", slot, equip_char, colname, item.name(DESC_PLAIN, true).substr(0,42).c_str(), - colname, - buf2); + colname); equip_chars.push_back(equip_char); } else if (e_order[i] == EQ_WEAPON diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index bf87fa062a..ea0f6fceb9 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -4233,37 +4233,37 @@ int player_mental_clarity(bool calc_unid, bool items) return ((ret > 3) ? 3 : ret); } -bool wearing_amulet(jewellery_type amulet, bool calc_unid) +// Returns whether the player has the effect of the amulet +// from a non-amulet source. +bool extrinsic_amulet_effect(jewellery_type amulet) { - if (amulet == AMU_CONTROLLED_FLIGHT - && (you.duration[DUR_CONTROLLED_FLIGHT] - || player_genus(GENPC_DRACONIAN) - || you.attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON - || you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT)) + switch ( amulet ) { - return (true); + case AMU_CONTROLLED_FLIGHT: + return (you.duration[DUR_CONTROLLED_FLIGHT] + || player_genus(GENPC_DRACONIAN) + || you.attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON + || you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT); + case AMU_CLARITY: + return (player_mutation_level(MUT_CLARITY) > 0); + case AMU_RESIST_CORROSION: + case AMU_CONSERVATION: + return (player_equip_ego_type(EQ_CLOAK, SPARM_PRESERVATION) > 0); + default: + return false; } +} - if (amulet == AMU_CLARITY && player_mutation_level(MUT_CLARITY)) +bool wearing_amulet(jewellery_type amulet, bool calc_unid) +{ + if ( extrinsic_amulet_effect(amulet) ) return (true); - - if (amulet == AMU_RESIST_CORROSION || amulet == AMU_CONSERVATION) - { - // XXX: this is hackish {dlb} - if (player_equip_ego_type( EQ_CLOAK, SPARM_PRESERVATION )) - return (true); - } - + if (you.equip[EQ_AMULET] == -1) return (false); - if (you.inv[you.equip[EQ_AMULET]].sub_type == amulet - && ( calc_unid || item_type_known(you.inv[you.equip[EQ_AMULET]]) )) - { - return (true); - } - - return (false); + const item_def& amu(you.inv[you.equip[EQ_AMULET]]); + return (amu.sub_type == amulet && (calc_unid || item_type_known(amu))); } bool player_is_airborne(void) diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index 3e5be17898..81fbec8067 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -75,6 +75,8 @@ int player_wielded_item(); * called from: ability - acr - fight - food - it_use2 - item_use - items - * misc - mutation - ouch * *********************************************************************** */ + +bool extrinsic_amulet_effect(jewellery_type amulet); bool wearing_amulet(jewellery_type which_am, bool calc_unid = true); diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 7268981d02..9b5cb0d13d 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -2637,12 +2637,11 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, piety_change = level; ret = true; - // For a stacked deck, 0% chance of card countdown decrement - // drawing a card which doesn't use up the deck, and 40% - // on a card which does. For a non-stacked deck, an - // average 50% of decrement for drawing a card which doesn't - // use up the deck, and 80% on a card which does use up the - // deck. + // level == 0: stacked, deck not used up + // level == 1: used up or nonstacked + // level == 2: used up and nonstacked + // and there's a 1/3 chance of an additional bonus point + // for nonstacked cards. int chance = 0; switch (level) { diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 9104b18a6f..225a80ac06 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -2511,7 +2511,7 @@ void cast_divine_shield() // shield bonus up to 8 you.attribute[ATTR_DIVINE_SHIELD] = 3 + you.skills[SK_SHIELDS]/5; - return; + you.redraw_armour_class = true; } static int _quadrant_blink(int x, int y, int pow, int garbage) @@ -2533,8 +2533,10 @@ static int _quadrant_blink(int x, int y, int pow, int garbage) pow = 100; const int dist = random2(6) + 2; // 2-7 - const int ox = you.x_pos + (x - you.x_pos) * dist; - const int oy = you.y_pos + (y - you.y_pos) * dist; + + // This is where you would *like* to go. + const int base_x = you.x_pos + (x - you.x_pos) * dist; + const int base_y = you.y_pos + (y - you.y_pos) * dist; // This can take a while if pow is high and there's lots of translucent // walls nearby. @@ -2542,18 +2544,18 @@ static int _quadrant_blink(int x, int y, int pow, int garbage) bool found = false; for ( int i = 0; i < (pow*pow) / 500 + 1; ++i ) { - // Find a space near our target... - // First try to find a random square not adjacent to the player, + // Find a space near our base point... + // First try to find a random square not adjacent to the basepoint, // then one adjacent if that fails. - if (!random_near_space(ox, oy, tx, ty) - && !random_near_space(ox, oy, tx, ty, true)) + if (!random_near_space(base_x, base_y, tx, ty) + && !random_near_space(base_x, base_y, tx, ty, true)) { return 0; } // ... which is close enough, and also far enough from us. - if (distance(ox, oy, tx, ty) > 10 - && distance(you.x_pos, you.y_pos, tx, ty) < 8) + if (distance(base_x, base_y, tx, ty) > 10 + || distance(you.x_pos, you.y_pos, tx, ty) < 8) { continue; } -- cgit v1.2.3-54-g00ecf