From 66a5899fafcf34e1e473b4cbac42938ce90300bb Mon Sep 17 00:00:00 2001 From: haranp Date: Wed, 11 Feb 2009 21:58:55 +0000 Subject: Fix [2035741]: give different messages when an attack is completely stopped by AC and when at least some of it bypasses AC but it is completely stopped by resistance. Fix bug where determine_damage() was ignoring AC. Fix negative energy always being known even if it hits something you can't see. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9027 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 52 +++++++++++++++++++++++++++++++++----------- crawl-ref/source/fight.cc | 4 ++-- crawl-ref/source/mon-util.cc | 2 +- 3 files changed, 42 insertions(+), 16 deletions(-) diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 34b544aa24..adc278cc61 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -2099,7 +2099,11 @@ int mons_adjust_flavoured(monsters *monster, bolt &pbolt, int hurted, if (!hurted) { if (doFlavouredEffects) - simple_monster_message(monster, " appears unharmed."); + { + simple_monster_message(monster, + (original > 0) ? " completely resists." + : " appears unharmed."); + } } else if (original > hurted) { @@ -2135,7 +2139,11 @@ int mons_adjust_flavoured(monsters *monster, bolt &pbolt, int hurted, if (!hurted) { if (doFlavouredEffects) - simple_monster_message(monster, " appears unharmed."); + { + simple_monster_message(monster, + (original > 0) ? " completely resists." + : " appears unharmed."); + } } else if (original > hurted) { @@ -2156,7 +2164,11 @@ int mons_adjust_flavoured(monsters *monster, bolt &pbolt, int hurted, if (!hurted) { if (doFlavouredEffects) - simple_monster_message(monster, " appears unharmed."); + { + simple_monster_message(monster, + (original > 0) ? " completely resists." + : " appears unharmed."); + } } break; @@ -2167,7 +2179,11 @@ int mons_adjust_flavoured(monsters *monster, bolt &pbolt, int hurted, if (!hurted) { if (doFlavouredEffects) - simple_monster_message(monster, " appears unharmed."); + { + simple_monster_message(monster, + (original > 0) ? " completely resists." + : " appears unharmed."); + } } break; @@ -2179,7 +2195,11 @@ int mons_adjust_flavoured(monsters *monster, bolt &pbolt, int hurted, if (!hurted && res > 0) { if (doFlavouredEffects) - simple_monster_message(monster, " appears unharmed."); + { + simple_monster_message(monster, + (original > 0) ? " completely resists." + : " appears unharmed."); + } } else if (res <= 0 && doFlavouredEffects && !one_chance_in(3)) poison_monster(monster, pbolt.whose_kill()); @@ -2212,29 +2232,31 @@ int mons_adjust_flavoured(monsters *monster, bolt &pbolt, int hurted, if (mons_res_negative_energy(monster) == 3) { if (doFlavouredEffects) - simple_monster_message(monster, " appears unharmed."); + simple_monster_message(monster, " completely resists."); hurted = 0; } else { - // Early out for tracer/no side effects. + // Early out if no side effects. if (!doFlavouredEffects) return (hurted); + if (you.can_see(monster)) + pbolt.obvious_effect = true; + monster->drain_exp(pbolt.agent()); - pbolt.obvious_effect = true; if (YOU_KILL(pbolt.thrower)) did_god_conduct(DID_NECROMANCY, 2, pbolt.effect_known); - } // end else + } break; case BEAM_MIASMA: if (mons_res_negative_energy(monster) == 3) { if (doFlavouredEffects) - simple_monster_message(monster, " appears unharmed."); + simple_monster_message(monster, " completely resists."); hurted = 0; } @@ -2323,7 +2345,11 @@ int mons_adjust_flavoured(monsters *monster, bolt &pbolt, int hurted, if (resist > 2) { if (doFlavouredEffects) - simple_monster_message(monster, " appears unharmed."); + { + simple_monster_message(monster, + (original > 0) ? " completely resists." + : " appears unharmed."); + } hurted = 0; } @@ -4034,7 +4060,7 @@ bool bolt::determine_damage(monsters* mon, int& preac, int& postac, int& final, postac = std::max(postac, 0); // Don't do side effects (beam might miss or be a tracer). - final = mons_adjust_flavoured(mon, *this, preac, false); + final = mons_adjust_flavoured(mon, *this, postac, false); return (true); } @@ -4455,7 +4481,7 @@ void bolt::affect_monster(monsters* mon) if (!engulfs && !test_beam_hit(beam_hit, random2(mon->ev))) { // If the PLAYER cannot see the monster, don't tell them anything! - if (player_monster_visible(mon) && mons_near(mon)) + if (you.can_see(mon)) { msg::stream << "The " << name << " misses " << mon->name(DESC_NOCAP_THE) << '.' << std::endl; diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index e9dc16ee95..317c7d2c72 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -184,11 +184,11 @@ int calc_your_to_hit( bool random_factor ) // be stochastic; if false, deterministic (e.g. for chardumps.) int calc_heavy_armour_penalty( bool random_factor ) { - const bool ur_armed = (you.equip[EQ_WEAPON] != -1); + const bool ur_armed = (you.weapon() != NULL); int heavy_armour = 0; // heavy armour modifiers for shield borne - if (you.shield()) + if (player_wearing_slot(EQ_SHIELD)) { switch (you.shield()->sub_type) { diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index ddaf81d597..b53296fa7b 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -5942,7 +5942,7 @@ bool monsters::drain_exp(actor *agent, bool quiet, int pow) if (x_chance_in_y(res_negative_energy(), 3)) return (false); - if (!quiet && mons_near(this) && player_monster_visible(this)) + if (!quiet && you.can_see(this)) mprf("%s is drained!", name(DESC_CAP_THE).c_str()); // If quiet, don't clean up the monster in order to credit properly. -- cgit v1.2.3-54-g00ecf