From: Pasi Kallinen Date: Mon, 30 Jan 2023 10:39:32 +0000 (+0200) Subject: Avoid repeating the god ray X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8eeeec41f54e889d3684670366ed44fec348cfac;p=nethack Avoid repeating the god ray My recent change to hit and wake monsters caused a recursive ghod_hitsu -> wakeup -> dobuzz -> buzz -> ghod_hitsu loop. Don't call the ghod_hitsu again if the priest is already angry. --- diff --git a/src/mon.c b/src/mon.c index 718b4def4..af2e7f734 100644 --- a/src/mon.c +++ b/src/mon.c @@ -3819,13 +3819,17 @@ wakeup(struct monst* mtmp, boolean via_attack) } finish_meating(mtmp); if (via_attack) { + boolean was_peaceful = mtmp->mpeaceful; + if (was_sleeping) growl(mtmp); setmangry(mtmp, TRUE); - if (mtmp->ispriest && *in_rooms(mtmp->mx, mtmp->my, TEMPLE)) - ghod_hitsu(mtmp); - if (mtmp->isshk && !*u.ushops) - hot_pursuit(mtmp); + if (was_peaceful) { + if (mtmp->ispriest && *in_rooms(mtmp->mx, mtmp->my, TEMPLE)) + ghod_hitsu(mtmp); + if (mtmp->isshk && !*u.ushops) + hot_pursuit(mtmp); + } } }