diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-19 21:02:48 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-19 21:02:48 +0000 |
commit | 96edac1d649d50f9cfacf317c88007783657c55f (patch) | |
tree | f6df66bbb1e96cf067eb1c4dd3bf506cb167c056 /crawl-ref/source/fight.cc | |
parent | e40eb81627b79763549583a56ebd2cd1f91d337c (diff) | |
download | crawl-ref-96edac1d649d50f9cfacf317c88007783657c55f.tar.gz crawl-ref-96edac1d649d50f9cfacf317c88007783657c55f.zip |
Expand effect applicator functions to take an actor parameter, and use
it for holy word in order to generalize it. This way, monsters as well
as players may be able to use it in the future.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8598 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r-- | crawl-ref/source/fight.cc | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 16a72a5847..fdddab382c 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -266,48 +266,48 @@ unchivalric_attack_type is_unchivalric_attack(const actor *attacker, // No unchivalric attacks on monsters that cannot fight (e.g. // plants) or monsters the attacker can't see (either due to // invisibility or being behind opaque clouds). - if (!defender->cannot_fight() && attacker->can_see(defender)) + if (defender->cannot_fight() || (attacker && !attacker->can_see(defender))) + return (unchivalric); + + // Distracted (but not batty); this only applies to players. + if (attacker && attacker->atype() == ACT_PLAYER && def->foe != MHITYOU + && !mons_is_batty(def)) { - // Distracted (but not batty); this only applies to players. - if (attacker->atype() == ACT_PLAYER && def->foe != MHITYOU - && !mons_is_batty(def)) - { - unchivalric = UCAT_DISTRACTED; - } + unchivalric = UCAT_DISTRACTED; + } - // confused (but not perma-confused) - if (def->has_ench(ENCH_CONFUSION) - && !mons_class_flag(def->type, M_CONFUSED)) - { - unchivalric = UCAT_CONFUSED; - } + // confused (but not perma-confused) + if (def->has_ench(ENCH_CONFUSION) + && !mons_class_flag(def->type, M_CONFUSED)) + { + unchivalric = UCAT_CONFUSED; + } - // fleeing - if (mons_is_fleeing(def)) - unchivalric = UCAT_FLEEING; + // fleeing + if (mons_is_fleeing(def)) + unchivalric = UCAT_FLEEING; - // invisible - if (!attacker->visible_to(defender)) - unchivalric = UCAT_INVISIBLE; + // invisible + if (attacker && !attacker->visible_to(defender)) + unchivalric = UCAT_INVISIBLE; - // held in a net - if (mons_is_caught(def)) - unchivalric = UCAT_HELD_IN_NET; + // held in a net + if (mons_is_caught(def)) + unchivalric = UCAT_HELD_IN_NET; - // petrifying - if (mons_is_petrifying(def)) - unchivalric = UCAT_PETRIFYING; + // petrifying + if (mons_is_petrifying(def)) + unchivalric = UCAT_PETRIFYING; - // paralysed - if (def->cannot_act()) - unchivalric = UCAT_PARALYSED; + // paralysed + if (def->cannot_act()) + unchivalric = UCAT_PARALYSED; - // sleeping - if (mons_is_sleeping(def)) - unchivalric = UCAT_SLEEPING; - } + // sleeping + if (mons_is_sleeping(def)) + unchivalric = UCAT_SLEEPING; - return unchivalric; + return (unchivalric); } ////////////////////////////////////////////////////////////////////////// |