From 7b6e06e7dfb876a56c99e2216a6071e0a652caf9 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 24 Jul 2008 07:29:40 +0000 Subject: Apply r6627, r6635, r6638 and r6645 (among others) to 0.4. Fixes Selective Amnesia crash, claws/ankus in the weapon option, randart bardings pretending to be boots and smaller stuff. Includes indication of monsters seeing/sensing invisible. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.4@6665 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 145 +++++++++++++++++++++++++++++-------------- crawl-ref/source/describe.cc | 2 +- crawl-ref/source/directn.cc | 24 +++++++ crawl-ref/source/initfile.cc | 8 +++ crawl-ref/source/makeitem.cc | 15 +++-- crawl-ref/source/mutation.cc | 2 +- crawl-ref/source/newgame.cc | 1 + crawl-ref/source/player.cc | 8 +-- crawl-ref/source/spells1.cc | 5 +- crawl-ref/source/spells4.cc | 27 ++++++-- crawl-ref/source/spl-book.cc | 2 +- 11 files changed, 171 insertions(+), 68 deletions(-) diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index ccff519f00..69614f6cc0 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -3623,6 +3623,99 @@ static std::string _beam_zapper(const bolt &beam) return menv[beam_src].name(DESC_PLAIN); } +static bool _beam_is_harmless(bolt &beam, monsters *mon) +{ + // For enchantments, this is already handled in _nasty_beam(). + if (beam.name[0] == '0') + return (!_nasty_beam(mon, beam)); + + // The others are handled here. + switch (beam.flavour) + { + case BEAM_DIGGING: + return (true); + + // Cleansing flame doesn't affect player's followers. + case BEAM_HOLY: + return (mons_is_holy(mon) + || is_good_god(you.religion) + && ( is_follower(mon) || mons_neutral(mon) )); + + case BEAM_STEAM: + return (mons_res_steam(mon) >= 3); + + case BEAM_FIRE: + return (mons_res_fire(mon) >= 3); + + case BEAM_COLD: + return (mons_res_cold(mon) >= 3); + + case BEAM_MIASMA: + case BEAM_NEG: + return (mons_res_negative_energy(mon) == 3); + + case BEAM_ELECTRICITY: + return (mons_res_elec(mon) >= 3); + + case BEAM_POISON: + return (mons_res_poison(mon) >= 3); + + case BEAM_ACID: + return (mons_res_acid(mon) >= 3); + + default: + return (false); + } +} + +static bool _beam_is_harmless_player(bolt &beam) +{ +#ifdef DEBUG_DIAGNOSTICS + mprf(MSGCH_DIAGNOSTICS, "beam flavour: %d", beam.flavour); +#endif + + // Shouldn't happen anyway since enchantments are either aimed at self + // (not prompted) or cast at monsters and don't explode or bounce. + if (beam.name[0] == '0') + return (false); + + // The others are handled here. + switch (beam.flavour) + { + case BEAM_DIGGING: + return (true); + + // Cleansing flame doesn't affect player's followers. + case BEAM_HOLY: + return (is_good_god(you.religion)); + + case BEAM_STEAM: + return (player_res_steam(false) >= 3); + + case BEAM_MIASMA: + case BEAM_NEG: + return (player_prot_life(false) >= 3); + + case BEAM_POISON: + return (player_res_poison(false)); + + case BEAM_POTION_STINKING_CLOUD: + return (player_res_poison(false) || player_mental_clarity(false)); + + case BEAM_ELECTRICITY: + return (player_res_electricity(false)); + + case BEAM_FIRE: + case BEAM_COLD: + case BEAM_ACID: + // Fire and ice can destroy inventory items, acid damage equipment. + return (false); + + default: + return (false); + } +} + // Returns amount of extra range used up by affectation of the player. static int _affect_player( bolt &beam, item_def *item ) { @@ -3637,10 +3730,11 @@ static int _affect_player( bolt &beam, item_def *item ) if (YOU_KILL(beam.thrower)) { // Don't ask if we're aiming at ourselves. - if (!beam.aimed_at_feet && !beam.dont_stop_player) + if (!beam.aimed_at_feet && !beam.dont_stop_player + && !_beam_is_harmless_player(beam)) { - if (yesno("That beam is likely to hit yourself. Continue " - "anyway?", false, 'n')) + if (yesno("That beam is likely to hit you. Continue anyway?", + false, 'n')) { beam.fr_count += 1; beam.fr_power += you.experience_level; @@ -4253,51 +4347,6 @@ static void _update_hurt_or_helped(bolt &beam, monsters *mon) } } -static bool _beam_is_harmless(bolt &beam, monsters *mon) -{ - // For enchantments, this is already handled in _nasty_beam(). - if (beam.name[0] == '0') - return (!_nasty_beam(mon, beam)); - - // The others are handled here. - switch (beam.flavour) - { - case BEAM_DIGGING: - return (true); - - // Cleansing flame doesn't affect player's followers. - case BEAM_HOLY: - return (mons_is_holy(mon) - || is_good_god(you.religion) - && ( is_follower(mon) || mons_neutral(mon) )); - - case BEAM_STEAM: - return (mons_res_steam(mon) >= 3); - - case BEAM_FIRE: - return (mons_res_fire(mon) >= 3); - - case BEAM_COLD: - return (mons_res_cold(mon) >= 3); - - case BEAM_MIASMA: - case BEAM_NEG: - return (mons_res_negative_energy(mon) == 3); - - case BEAM_ELECTRICITY: - return (mons_res_elec(mon) >= 3); - - case BEAM_POISON: - return (mons_res_poison(mon) >= 3); - - case BEAM_ACID: - return (mons_res_acid(mon) >= 3); - - default: - return (false); - } -} - // Returns amount of range used up by affectation of this monster. static int _affect_monster(bolt &beam, monsters *mon, item_def *item) { diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 7d59e1a6a3..519c54126b 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -2437,7 +2437,7 @@ void describe_monsters(monsters& mons) break; } case MONS_PLAYER_GHOST: - body << "The apparition of " << get_ghost_description(mons) + body << "$The apparition of " << get_ghost_description(mons) << ".$"; break; diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index 746ac18bb3..5805cabf9c 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -2347,6 +2347,30 @@ static void _describe_monster(const monsters *mon) mon->pronoun(PRONOUN_CAP).c_str()); } + if (mons_behaviour_perceptible(mon) && !mons_is_sleeping(mon) + && !mons_is_confused(mon) + && (mons_see_invis(mon) || mons_sense_invis(mon))) + { + if (you.invisible() && mon->foe == MHITYOU && !mons_is_fleeing(mon)) + { + if (mons_see_invis(mon)) + { + mprf(MSGCH_EXAMINE, "%s is watching you carefully.", + mon->pronoun(PRONOUN_CAP).c_str()); + } + else + { + mprf(MSGCH_EXAMINE, "%s is looking in your general direction.", + mon->pronoun(PRONOUN_CAP).c_str()); + } + } + else if (mon->foe == MHITNOT || mons_is_fleeing(mon)) + { + mprf(MSGCH_EXAMINE, "%s seems to be peering into the shadows.", + mon->pronoun(PRONOUN_CAP).c_str()); + } + } + std::string desc = ""; std::string last_desc = ""; std::string tmp = ""; diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index f3e9beee74..5d8ae48751 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -260,12 +260,16 @@ static int _str_to_weapon( const std::string &str ) return (WPN_SHORT_SWORD); else if (str == "mace") return (WPN_MACE); + else if (str == "ankus") + return (WPN_ANKUS); else if (str == "spear") return (WPN_SPEAR); else if (str == "trident") return (WPN_TRIDENT); else if (str == "hand axe" || str == "handaxe") return (WPN_HAND_AXE); + else if (str == "unarmed" || str == "claws") + return (WPN_UNARMED); else if (str == "random") return (WPN_RANDOM); @@ -280,12 +284,16 @@ std::string weapon_to_str( int weapon ) return "short sword"; case WPN_MACE: return "mace"; + case WPN_ANKUS: + return "ankus"; case WPN_SPEAR: return "spear"; case WPN_TRIDENT: return "trident"; case WPN_HAND_AXE: return "hand axe"; + case WPN_UNARMED: + return "claws"; case WPN_RANDOM: default: return "random"; diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc index 1c5773419e..07da7fbef3 100644 --- a/crawl-ref/source/makeitem.cc +++ b/crawl-ref/source/makeitem.cc @@ -1829,13 +1829,18 @@ static bool _try_make_armour_artefact(item_def& item, int force_type, // The other 98% are normal randarts. - // No randart hides. - hide2armour(item); - make_item_randart( item ); - // 10% of boots become barding. if (item.sub_type == ARM_BOOTS && one_chance_in(10)) - item.sub_type = coinflip() ? ARM_NAGA_BARDING : ARM_CENTAUR_BARDING; + { + item.sub_type = coinflip() ? ARM_NAGA_BARDING + : ARM_CENTAUR_BARDING; + } + else + hide2armour(item); // No randart hides. + + // Needs to be done after the barding chance else we get randart + // bardings named Boots of xy. + make_item_randart( item ); // Determine enchantment and cursedness. if (one_chance_in(5)) diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index 7734e09b4c..734c8c6450 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -127,7 +127,7 @@ const char *mutation_descrip[][3] = { "You are carnivorous and can eat meat at any time."}, {"You digest meat inefficiently.", "You digest meat very inefficiently.", - "You are primarily a herbivore."}, + "You are a herbivore."}, {"Your flesh is heat resistant.", "Your flesh is very heat resistant.", "Your flesh is almost immune to the effects of heat."}, diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index 93fc552356..450f4ddffe 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -5022,6 +5022,7 @@ bool _give_items_skills() else you.skills[SK_DARTS] = 1; + you.skills[SK_SHORT_BLADES] = 1; you.skills[SK_ENCHANTMENTS] = 4; you.skills[SK_SPELLCASTING] = 1; you.skills[SK_DODGING] = 2; diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 1611f4330e..e6c9d84a28 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -1546,12 +1546,12 @@ int player_res_poison(bool calc_unid, bool temp, bool items) // mutations: rp += player_mutation_level(MUT_POISON_RESISTANCE); + // Only thirsty vampires are naturally poison resistant. + if (you.species == SP_VAMPIRE && you.hunger_state < HS_SATIATED) + rp++; + if (temp) { - // Only thirsty vampires are naturally poison resistant. - if (you.species == SP_VAMPIRE && you.hunger_state < HS_SATIATED) - rp++; - // spells: if (you.duration[DUR_RESIST_POISON] > 0) rp++; diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index ca2c9294a7..c3900b4778 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -564,7 +564,6 @@ bool stinking_cloud( int pow, bolt &beem ) beem.damage = dice_def( 1, 0 ); beem.hit = 20; beem.type = dchar_glyph(DCHAR_FIRED_ZAP); - beem.flavour = BEAM_MMISSILE; beem.ench_power = pow; beem.beam_source = MHITYOU; beem.thrower = KILL_YOU; @@ -581,10 +580,11 @@ bool stinking_cloud( int pow, bolt &beem ) beem.smart_monster = true; beem.attitude = ATT_FRIENDLY; beem.fr_count = 0; + beem.flavour = BEAM_POTION_STINKING_CLOUD; beem.is_tracer = true; fire_beam(beem); - if (beem.fr_count > 0) + if (beem.beam_cancelled) { // We don't want to fire through friendlies. canned_msg(MSG_OK); @@ -593,6 +593,7 @@ bool stinking_cloud( int pow, bolt &beem ) } // Really fire. + beem.flavour = BEAM_MMISSILE; beem.is_tracer = false; fire_beam(beem); diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 1809fbc1a8..e3a949bd79 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -1338,26 +1338,31 @@ bool cast_evaporate(int pow, bolt& beem, int potion) beem.ench_power = pow; // used for duration only? beem.flavour = BEAM_POTION_STINKING_CLOUD; + beam_type tracer_flavour = BEAM_MMISSILE; switch (you.inv[potion].sub_type) { case POT_STRONG_POISON: - beem.flavour = BEAM_POTION_POISON; + beem.flavour = BEAM_POTION_POISON; + tracer_flavour = BEAM_POISON; beem.ench_power *= 2; break; case POT_DEGENERATION: beem.effect_known = false; - beem.flavour = (coinflip() ? BEAM_POTION_POISON : BEAM_POTION_MIASMA); + beem.flavour = (coinflip() ? BEAM_POTION_POISON : BEAM_POTION_MIASMA); + tracer_flavour = BEAM_MIASMA; beem.ench_power *= 2; break; case POT_POISON: - beem.flavour = BEAM_POTION_POISON; + beem.flavour = BEAM_POTION_POISON; + tracer_flavour = BEAM_POISON; break; case POT_DECAY: - beem.flavour = BEAM_POTION_MIASMA; + beem.flavour = BEAM_POTION_MIASMA; + tracer_flavour = BEAM_MIASMA; beem.ench_power *= 2; break; @@ -1366,12 +1371,12 @@ bool cast_evaporate(int pow, bolt& beem, int potion) // fall through case POT_CONFUSION: case POT_SLOWING: - beem.flavour = BEAM_POTION_STINKING_CLOUD; + tracer_flavour = beem.flavour = BEAM_POTION_STINKING_CLOUD; break; case POT_WATER: case POT_PORRIDGE: - beem.flavour = BEAM_POTION_STEAM; + tracer_flavour = beem.flavour = BEAM_STEAM; break; case POT_BLOOD: @@ -1382,6 +1387,10 @@ bool cast_evaporate(int pow, bolt& beem, int potion) case POT_BERSERK_RAGE: beem.effect_known = false; beem.flavour = (coinflip() ? BEAM_POTION_FIRE : BEAM_POTION_STEAM); + if (you.inv[potion].sub_type == POT_BERSERK_RAGE) + tracer_flavour = BEAM_FIRE; + else + tracer_flavour = BEAM_RANDOM; break; case POT_MUTATION: @@ -1399,6 +1408,7 @@ bool cast_evaporate(int pow, bolt& beem, int potion) case 3: beem.flavour = BEAM_POTION_MIASMA; break; default: beem.flavour = BEAM_POTION_RANDOM; break; } + tracer_flavour = BEAM_RANDOM; break; default: @@ -1415,6 +1425,7 @@ bool cast_evaporate(int pow, bolt& beem, int potion) case 7: beem.flavour = BEAM_POTION_PURP_SMOKE; break; default: beem.flavour = BEAM_POTION_STEAM; break; } + tracer_flavour = BEAM_RANDOM; break; } @@ -1427,6 +1438,9 @@ bool cast_evaporate(int pow, bolt& beem, int potion) beem.fr_count = 0; beem.beam_cancelled = false; beem.is_tracer = true; + + beam_type real_flavour = beem.flavour; + beem.flavour = tracer_flavour; fire_beam(beem); if (beem.beam_cancelled) @@ -1440,6 +1454,7 @@ bool cast_evaporate(int pow, bolt& beem, int potion) exercise( SK_THROWING, 1 ); // Really fire. + beem.flavour = real_flavour; beem.is_tracer = false; fire_beam(beem); diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc index 0ab544910f..2a1b9bf5a3 100644 --- a/crawl-ref/source/spl-book.cc +++ b/crawl-ref/source/spl-book.cc @@ -1244,7 +1244,7 @@ bool learn_spell(int book) } // You can always memorise selective amnesia: - if (you.spell_no == 21 && specspell != SPELL_SELECTIVE_AMNESIA) + if (you.spell_no >= 21 && specspell != SPELL_SELECTIVE_AMNESIA) { mpr("Your head is already too full of spells!"); return (false); -- cgit v1.2.3-54-g00ecf