From 19036a55ba3c1f5c9a4e09b3a82ef2caa07f8bdf Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 24 Feb 2008 19:15:20 +0000 Subject: Fix 1892007: (oklob) plants being confusable (There's probably some source of poison or other where I forgot to add the mons_class_is_confuseable check. Feel free to add as needed.) Fix 1897271: potions of poison being treatened like poisoned ammo (There's actually a much bigger issue: now that randart names are configurable players could name half of their randarts "poisoned" and make them *be* poisoned. In short, the beam string comparison find("poison") needs to be replaced with something more sensible.) Also some more comment clean-up. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3461 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 16 ++++++++++++---- crawl-ref/source/dat/database/speak.txt | 4 ++++ crawl-ref/source/delay.cc | 7 +++++-- crawl-ref/source/fight.cc | 4 +++- crawl-ref/source/item_use.cc | 4 ++-- crawl-ref/source/monstuff.cc | 6 +++++- crawl-ref/source/mstuff2.cc | 8 ++++---- crawl-ref/source/spells4.cc | 2 -- 8 files changed, 35 insertions(+), 16 deletions(-) diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index b7eff94ea5..a2c7096746 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -1919,6 +1919,12 @@ static bool monster_resists_mass_enchantment(monsters *monster, else if (wh_enchant == ENCH_CONFUSION || mons_holiness(monster) == MH_NATURAL) { + if (wh_enchant == ENCH_CONFUSION && + !mons_class_is_confusable(monster->type)) + { + return (true); + } + if (check_mons_resist_magic( monster, pow )) { simple_monster_message(monster, mons_immune_magic(monster) ? @@ -2094,19 +2100,21 @@ int mons_ench_f2(monsters *monster, bolt &pbolt) return (MON_AFFECTED); case BEAM_CONFUSION: /* 4 = confusion */ + if (!mons_class_is_confusable(monster->type)) + return (MON_UNAFFECTED); + if (monster->add_ench( mon_enchant(ENCH_CONFUSION, 0, whose_kill(pbolt)))) { - // put in an exception for fungi, plants and other things you won't - // notice becoming confused. + // put in an exception for things you won't notice becoming confused. if (simple_monster_message(monster, " appears confused.")) pbolt.obvious_effect = true; } return (MON_AFFECTED); case BEAM_INVISIBILITY: /* 5 = invisibility */ - // Store the monster name before it becomes an "it" -- bwr { + // Store the monster name before it becomes an "it" -- bwr const std::string monster_name = monster->name(DESC_CAP_THE); if (!monster->has_ench(ENCH_INVIS) @@ -4054,7 +4062,7 @@ static int affect_monster(bolt &beam, monsters *mon) /* looks for missiles which aren't poison but are poison*ed* */ - if (beam.name.find("poison") != std::string::npos + if (beam.name.find("poisoned") != std::string::npos && beam.flavour != BEAM_POISON && beam.flavour != BEAM_POISON_ARROW) { diff --git a/crawl-ref/source/dat/database/speak.txt b/crawl-ref/source/dat/database/speak.txt index bd558d162d..b00ac3f199 100644 --- a/crawl-ref/source/dat/database/speak.txt +++ b/crawl-ref/source/dat/database/speak.txt @@ -1704,6 +1704,10 @@ VISUAL:@The_monster@ grins with merry abandon. @The_monster@ howls with blood-lust! +@The_monster@ honks. + +VISUAL:@The_monster@ pantomimes your execution. + VISUAL:@The_monster@ pokes out @possessive@ tongue. @The_monster@ says, "Come and play with me!" diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index cc3fc96a8e..c08debf08d 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -130,9 +130,12 @@ static int recite_to_monsters(int x, int y, int pow, int unused) case 2: case 3: case 4: - if (!mons->add_ench(mon_enchant(ENCH_CONFUSION, 0, KC_YOU, - (16 + random2avg(13, 2)) * 10))) + if (!mons_class_is_confusable(mons->type) + || !mons->add_ench(mon_enchant(ENCH_CONFUSION, 0, KC_YOU, + (16 + random2avg(13, 2)) * 10))) + { return (0); + } simple_monster_message(mons, " looks confused."); break; case 5: diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 81ab6e8995..e7717f1476 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -2134,7 +2134,9 @@ bool melee_attack::apply_damage_brand() // here. Generalise. const int hdcheck = (defender->holiness() == MH_NATURAL? random2(30) : random2(22)); - if (hdcheck >= defender->get_experience_level()) + + if (mons_class_is_confusable(def->type) && + hdcheck >= defender->get_experience_level()) { // declaring these just to pass to the enchant function bolt beam_temp; diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 422d50e887..23906398d2 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -1467,7 +1467,7 @@ void fire_target_behaviour::announce_new_ammo(bool redraw) void fire_target_behaviour::find_next_ammo() { - const int start = item == ENDOFPACK - 1? 0 : item + 1; + const int start = (item == ENDOFPACK - 1)? 0 : item + 1; const int next = get_fire_item_index(start, true, false); // We should never get back ENDOFPACK. @@ -1480,7 +1480,7 @@ void fire_target_behaviour::find_next_ammo() void fire_target_behaviour::find_prev_ammo() { - const int start = item == 0? ENDOFPACK - 1 : item - 1; + const int start = (item == 0)? ENDOFPACK - 1 : item - 1; const int next = get_fire_item_index(start, false, false); // We should never get back ENDOFPACK. diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 85e7250b04..757c65cae2 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -5972,11 +5972,15 @@ static void mons_in_cloud(monsters *monster) beam.flavour = BEAM_CONFUSION; beam.thrower = cloud.beam_thrower(); + if (cloud.whose == KC_FRIENDLY) beam.beam_source = ANON_FRIENDLY_MONSTER; - if (1 + random2(27) >= monster->hit_dice) + if (mons_class_is_confusable(monster->type) + && 1 + random2(27) >= monster->hit_dice) + { mons_ench_f2(monster, beam); + } hurted += (random2(3) * 10) / speed; break; // to damage routine at end {dlb} diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc index 0d043a6451..20e87d6951 100644 --- a/crawl-ref/source/mstuff2.cc +++ b/crawl-ref/source/mstuff2.cc @@ -314,14 +314,14 @@ void mons_trap(struct monsters *monster) if (mons_friendly(monster)) { beem.colour = ((temp_rand < 3) ? CYAN : //paralyze - 3 in 16 - (temp_rand < 7) ? RED // confuse - 4 in 16 - : BLACK); // slow - 9 in 16 + (temp_rand < 7) ? RED // confuse - 4 in 16 + : BLACK); // slow - 9 in 16 } else { beem.colour = ((temp_rand < 3) ? BLUE : //haste - 3 in 16 {dlb} - (temp_rand < 7) ? MAGENTA //invis - 4 in 16 {dlb} - : GREEN); // heal - 9 in 16 {dlb} + (temp_rand < 7) ? MAGENTA //invis - 4 in 16 {dlb} + : GREEN); // heal - 9 in 16 {dlb} } mons_ench_f2(monster, beem); diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 238435739f..83651b3f68 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -1588,8 +1588,6 @@ bool backlight_monsters(int x, int y, int pow, int garbage) bool cast_evaporate(int pow, bolt& beem, int potion) { - // experimenting with allowing the potion to be thrown... we're - // still making it have to be "in hands" at this point. -- bwr struct dist spelld; if (potion == -1) -- cgit v1.2.3-54-g00ecf