From 7d52150177817250dc5648c0e54136b5fa14ab18 Mon Sep 17 00:00:00 2001 From: dolorous Date: Fri, 9 Jan 2009 00:08:25 +0000 Subject: Refix [2484631], in a way that won't require changes to draining or rotting attacks: Put the draining attack code back where it was, and instead explicitly check for a death-by-banishment when determining whether to skip chaos_killed_defender(). Sorry for any confusion. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8342 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/fight.cc | 40 ++++++++++++++++++++++------------------ crawl-ref/source/fight.h | 1 + 2 files changed, 23 insertions(+), 18 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index b106f8c4f1..170dec3c05 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -423,7 +423,7 @@ std::string melee_attack::anon_name(description_level_type desc, { case DESC_CAP_THE: case DESC_CAP_A: - return (actor_invisible? "It" : "Something"); + return (actor_invisible ? "It" : "Something"); case DESC_CAP_YOUR: return ("Its"); case DESC_NOCAP_YOUR: @@ -478,6 +478,17 @@ std::string melee_attack::wep_name(description_level_type desc, return (name); } +bool melee_attack::is_banished(const actor *defn) const +{ + if (!defn) + return (false); + + if (defn->atype() == ACT_PLAYER) + return (you.banished); + else + return (def->flags & MF_BANISHED); +} + bool melee_attack::is_water_attack(const actor *attk, const actor *defn) const { @@ -2058,6 +2069,15 @@ void melee_attack::drain_monster() def_name(DESC_NOCAP_THE).c_str()); } + if (one_chance_in(5)) + { + def->hit_dice--; + def->experience = 0; + } + + def->max_hit_points -= 2 + random2(3); + def->hurt(attacker, 2 + random2(3), BEAM_NEG, false); + special_damage = 1 + (random2(damage_done) / 2); attacker->god_conduct(DID_NECROMANCY, 2); } @@ -4544,10 +4564,6 @@ void melee_attack::mons_perform_attack_rounds() mons_set_weapon(attk); to_hit = mons_to_hit(); - const bool draining_attack = damage_brand == SPWPN_DRAINING - || (attk.flavour == AF_DRAIN_XP - && attacker != defender); - const bool chaos_attack = damage_brand == SPWPN_CHAOS || (attk.flavour == AF_CHAOS && attacker != defender); @@ -4647,7 +4663,7 @@ void melee_attack::mons_perform_attack_rounds() // Defender banished. Bail before chaos_killed_defender() // is called, since the defender is still alive in the // Abyss. - if (!defender->alive()) + if (!defender->alive() && is_banished(defender)) { if (chaos_attack && attacker->alive()) chaos_affects_attacker(); @@ -4656,18 +4672,6 @@ void melee_attack::mons_perform_attack_rounds() break; } - if (draining_attack && defender->atype() == ACT_MONSTER) - { - if (one_chance_in(5)) - { - def->hit_dice--; - def->experience = 0; - } - - def->max_hit_points -= 2 + random2(3); - def->hurt(attacker, 2 + random2(3), BEAM_NEG, false); - } - defender->hurt(attacker, damage_done + special_damage); if (!defender->alive()) diff --git a/crawl-ref/source/fight.h b/crawl-ref/source/fight.h index b96c6785cb..b463ab75fa 100644 --- a/crawl-ref/source/fight.h +++ b/crawl-ref/source/fight.h @@ -170,6 +170,7 @@ public: private: void init_attack(); + bool is_banished(const actor *) const; bool is_water_attack(const actor *, const actor *) const; void check_hand_half_bonus_eligible(); void check_autoberserk(); -- cgit v1.2.3-54-g00ecf