From ca67d2a004ef61ceb1ded81f435119caa53af1f2 Mon Sep 17 00:00:00 2001 From: dolorous Date: Mon, 19 May 2008 18:07:20 +0000 Subject: 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 --- crawl-ref/source/fight.cc | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/fight.cc') 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; } -- cgit v1.2.3-54-g00ecf