diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-19 18:07:20 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-19 18:07:20 +0000 |
commit | ca67d2a004ef61ceb1ded81f435119caa53af1f2 (patch) | |
tree | b547d5be8fb4b0a4c55250b3b877d7b51fed10d4 /crawl-ref/source/fight.cc | |
parent | ad56ba63d755da4dca3d44947f3f86a26faf7aa3 (diff) | |
download | crawl-ref-ca67d2a004ef61ceb1ded81f435119caa53af1f2.tar.gz crawl-ref-ca67d2a004ef61ceb1ded81f435119caa53af1f2.zip |
And make attacks on god gifts consistent with beams the same way.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5134 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r-- | crawl-ref/source/fight.cc | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 4e8bdb957f..4d7b766c58 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -289,10 +289,9 @@ unchivalric_attack_type is_unchivalric_attack(const actor *attacker, { unchivalric_attack_type unchivalric = UCAT_NO_ATTACK; - // no unchivalric attacks on dead or abjured monsters, monsters that - // cannot fight (e.g. plants), or invisible monsters - if (defender->alive() && !defender->cannot_fight() - && player_monster_visible(def)) + // no unchivalric attacks on monsters that cannot fight (e.g. + // plants) or invisible monsters + if (!defender->cannot_fight() && player_monster_visible(def)) { // distracted (but not batty) if (def->foe != MHITYOU && !testbits(def->flags, MF_BATTY)) @@ -594,7 +593,7 @@ bool melee_attack::attack() // A lot of attack parameters get set in here. 'Ware. to_hit = calc_to_hit(); - // Allow god to get offended, etc. + // Allow setting of your allies' target, etc. attacker->attacking(defender); // The attacker loses nutrition. @@ -603,12 +602,25 @@ bool melee_attack::attack() check_autoberserk(); check_special_wield_effects(); + god_conduct_trigger conduct; + conduct.enabled = false; + + if (attacker->atype() == ACT_PLAYER && defender->atype() == ACT_MONSTER) + { + if (mons_friendly(def)) + conduct.set(DID_ATTACK_FRIEND, 5, true, def); + else if (mons_neutral(def)) + conduct.set(DID_ATTACK_NEUTRAL, 5, true, def); + } + // Trying to stay general beyond this point is a recipe for insanity. // Maybe when Stone Soup hits 1.0... :-) bool retval = ((attacker->atype() == ACT_PLAYER) ? player_attack() : (defender->atype() == ACT_PLAYER) ? mons_attack_you() : mons_attack_mons()); + conduct.enabled = true; + return retval; } |