summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-05 08:17:43 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-05 08:17:43 +0000
commit6602300000ea348ddb98aef4ac4f33b75d9b802d (patch)
treec3efd5ce46d0c520804d3a50e61152b9b90ad9b5 /crawl-ref
parent06980b6f268f34a28700cdd39bbc7911310b4a80 (diff)
downloadcrawl-ref-6602300000ea348ddb98aef4ac4f33b75d9b802d.tar.gz
crawl-ref-6602300000ea348ddb98aef4ac4f33b75d9b802d.zip
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
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/religion.cc16
1 files changed, 15 insertions, 1 deletions
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<bool, NUM_MONSTERS> _first_attack_conduct;
static FixedVector<bool, NUM_MONSTERS> _first_attack_was_unchivalric;
+static FixedVector<bool, NUM_MONSTERS> _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);