From 6602300000ea348ddb98aef4ac4f33b75d9b802d Mon Sep 17 00:00:00 2001 From: zelgadis Date: Sat, 5 Jul 2008 08:17:43 +0000 Subject: Bug 2011077: if the damage from a lightning bolt causes an orc to surrender to the player, don't give penance if the lightning bolt bounces and hits the now friendly orc. Uses the same setup and logic as for preventing lightning bounces from causing penance with TSO. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6403 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/religion.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 04f111eacb..62c5f4485e 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -2762,13 +2762,20 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, // when the beam started then hits from bounces shouldn't count as // unchivalric attacks, but if the first hit from the beam *was* unchivalrous // then all the bounces should count as unchivalrous as well. +// +// Also do the same sort of check for harming a friendly monster, +// since a Beogh worshipper zapping an orc with lightning might cause it to +// become a follower on the first hit, and the second hit would be +// against a friendly orc. static FixedVector _first_attack_conduct; static FixedVector _first_attack_was_unchivalric; +static FixedVector _first_attack_was_friendly; void religion_turn_start() { _first_attack_conduct.init(true); _first_attack_was_unchivalric.init(false); + _first_attack_was_friendly.init(false); crawl_state.clear_god_acting(); } @@ -2778,7 +2785,14 @@ void set_attack_conducts(god_conduct_trigger conduct[3], const monsters *mon, const unsigned int midx = monster_index(mon); if (mons_friendly(mon)) - conduct[0].set(DID_ATTACK_FRIEND, 5, known, mon); + { + if(_first_attack_conduct[midx] + || _first_attack_was_friendly[midx]) + { + conduct[0].set(DID_ATTACK_FRIEND, 5, known, mon); + _first_attack_was_friendly[midx] = true; + } + } else if (mons_neutral(mon)) conduct[0].set(DID_ATTACK_NEUTRAL, 5, known, mon); -- cgit v1.2.3-54-g00ecf