diff options
-rw-r--r-- | crawl-ref/source/fight.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 7 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.h | 3 | ||||
-rw-r--r-- | crawl-ref/source/view.cc | 6 |
4 files changed, 12 insertions, 8 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 417753447a..66bcf8cc8c 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -865,7 +865,9 @@ bool melee_attack::player_attack() } // Always upset monster regardless of damage. - behaviour_event(defender_as_monster(), ME_WHACK, MHITYOU); + // However, successful stabs inhibit shouting. + behaviour_event(defender_as_monster(), ME_WHACK, MHITYOU, + coord_def(), !stab_attempt); if (damage_done > 0 && !defender->is_summoned() diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 207d028900..f46476aa02 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -2491,7 +2491,7 @@ static bool _wounded_damaged(int monster_type) // //--------------------------------------------------------------- void behaviour_event(monsters *mon, mon_event_type event, int src, - coord_def src_pos) + coord_def src_pos, bool allow_shout) { ASSERT(src >= 0 && src <= MHITYOU); ASSERT(!crawl_state.arena || src != MHITYOU); @@ -2504,6 +2504,7 @@ void behaviour_event(monsters *mon, mon_event_type event, int src, bool sourceWontAttack = false; bool setTarget = false; bool breakCharm = false; + bool was_sleeping = mons_is_sleeping(mon); if (src == MHITYOU) sourceWontAttack = true; @@ -2670,6 +2671,10 @@ void behaviour_event(monsters *mon, mon_event_type event, int src, break; } + // If it woke up, it might shout. + if (was_sleeping && !mons_is_sleeping(mon) && allow_shout) + handle_monster_shouts(mon); + if (setTarget) { if (src == MHITYOU) diff --git a/crawl-ref/source/monstuff.h b/crawl-ref/source/monstuff.h index 128b9d1f02..42ad3d480c 100644 --- a/crawl-ref/source/monstuff.h +++ b/crawl-ref/source/monstuff.h @@ -106,7 +106,8 @@ void monster_cleanup(monsters *monster); void behaviour_event(monsters *mon, mon_event_type event_type, - int src = MHITNOT, coord_def src_pos = coord_def()); + int src = MHITNOT, coord_def src_pos = coord_def(), + bool allow_shout = true); bool curse_an_item(bool decay_potions, bool quiet = false); diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index fa5994034d..b07df850cf 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -1004,11 +1004,8 @@ void flush_comes_into_view() void handle_monster_shouts(monsters* monster, bool force) { - if (!force && (!you.turn_is_over - || x_chance_in_y(you.skills[SK_STEALTH], 30))) - { + if (!force && x_chance_in_y(you.skills[SK_STEALTH], 30)) return; - } // Friendly or neutral monsters don't shout. if (!force && (mons_friendly(monster) || mons_neutral(monster))) @@ -1259,7 +1256,6 @@ void monster_grid(bool do_updates) && check_awaken(monster)) { behaviour_event(monster, ME_ALERT, MHITYOU); - handle_monster_shouts(monster); } // [enne] - It's possible that mgrd and monster->x/y are out of |