diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-09 00:08:25 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-09 00:08:25 +0000 |
commit | 7d52150177817250dc5648c0e54136b5fa14ab18 (patch) | |
tree | 8815010319dffe2ffad93ca65e0a8de2b44eb706 /crawl-ref/source/fight.cc | |
parent | f25770a09d5b82dedaf3cd21f93d797e4debf7cc (diff) | |
download | crawl-ref-7d52150177817250dc5648c0e54136b5fa14ab18.tar.gz crawl-ref-7d52150177817250dc5648c0e54136b5fa14ab18.zip |
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
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r-- | crawl-ref/source/fight.cc | 40 |
1 files changed, 22 insertions, 18 deletions
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()) |