diff options
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/acr.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 27 | ||||
-rw-r--r-- | crawl-ref/source/religion.h | 2 |
3 files changed, 29 insertions, 2 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 041e1de4de..3777d0951b 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -1389,7 +1389,7 @@ bool apply_berserk_penalty = false; // static void _input() { - crawl_state.clear_god_acting(); + religion_turn_start(); check_beholders(); if (crawl_state.is_replaying_keys() && crawl_state.is_repeating_cmd() diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 303e26716e..c531c96366 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -2758,19 +2758,44 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, return (ret); } +// These two arrays deal with the situation where a beam hits a non-fleeing +// monster, the monster starts to flee because of the damage, and then the +// beam bounces and hits the monster again. If the monster wasn't fleeing +// 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. +static FixedVector<bool, NUM_MONSTERS> _first_attack_conduct; +static FixedVector<bool, NUM_MONSTERS> _first_attack_was_unchivalric; + +void religion_turn_start() +{ + _first_attack_conduct.init(true); + _first_attack_was_unchivalric.init(false); + crawl_state.clear_god_acting(); +} + void set_attack_conducts(god_conduct_trigger conduct[3], const monsters *mon, bool known) { + const unsigned int midx = monster_index(mon); + if (mons_friendly(mon)) conduct[0].set(DID_ATTACK_FRIEND, 5, known, mon); else if (mons_neutral(mon)) conduct[0].set(DID_ATTACK_NEUTRAL, 5, known, mon); - if (is_unchivalric_attack(&you, mon, mon)) + if (is_unchivalric_attack(&you, mon, mon) + && (_first_attack_conduct[midx] + || _first_attack_was_unchivalric[midx])) + { conduct[1].set(DID_UNCHIVALRIC_ATTACK, 4, known, mon); + _first_attack_was_unchivalric[midx] = true; + } if (mons_is_holy(mon)) conduct[2].set(DID_ATTACK_HOLY, mon->hit_dice, known, mon); + + _first_attack_conduct[midx] = false; } void enable_attack_conducts(god_conduct_trigger conduct[3]) diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h index f925b5e4f2..f950a8902f 100644 --- a/crawl-ref/source/religion.h +++ b/crawl-ref/source/religion.h @@ -125,4 +125,6 @@ bool bless_follower(monsters *follower = NULL, bool god_hates_attacking_friend(god_type god, const actor *fr); bool god_likes_items(god_type god); +void religion_turn_start(); + #endif |