From f11a4b168bd934bd4a285257bd5704ab59ef89ac Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sat, 19 Sep 2026 14:53:45 +0300 Subject: [PATCH] More strict checking of dishonourable attacks Move the caitiff check into thitmonst, the code responsible for object hitting a monster, intead of checking the caitiff in multiple places before calling that. Previously there were some cases where caitiff was not checked, eg. samurai could fire arrows at a peaceful monster without the dishonourable behaviour check. Now you will get the check even if you miss with the projectile. This may need to be adjusted for throwing beneficial potions at monsters... --- doc/fixes5-0-0.txt | 1 + src/apply.c | 2 -- src/dothrow.c | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/fixes5-0-0.txt b/doc/fixes5-0-0.txt index cba31fa8f..d96ae4910 100644 --- a/doc/fixes5-0-0.txt +++ b/doc/fixes5-0-0.txt @@ -1604,6 +1604,7 @@ when starting a new game as a monk, newsym(0,0) was being called (adjabil -> on the map yet) incorporate a fix to prevent segfault due to rolling boulder trap wands of digging generate less often lategame +more strict checking of dishonourable attacks Fixes to 5.0.0-x General Problems Exposed Via git Repository diff --git a/src/apply.c b/src/apply.c index 02bac8669..5c7ac71ac 100644 --- a/src/apply.c +++ b/src/apply.c @@ -3508,7 +3508,6 @@ use_pole(struct obj *obj, boolean autohit) return ECMD_FAIL; } - check_caitiff(mtmp); gn.notonhead = (gb.bhitpos.x != mtmp->mx || gb.bhitpos.y != mtmp->my); /* Snickersnee allows one free hit from a distance per turn */ @@ -3847,7 +3846,6 @@ use_grapple(struct obj *obj) flags.confirm = FALSE; (void) attack_checks(mtmp, uwep); flags.confirm = save_confirm; - check_caitiff(mtmp); (void) thitmonst(mtmp, uwep); return ECMD_TIME; } diff --git a/src/dothrow.c b/src/dothrow.c index 5c8997bcf..9a33e7a1b 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -2207,6 +2207,8 @@ thitmonst( dieroll = rnd(20); + check_caitiff(mon); + if (obj->oclass == WEAPON_CLASS || is_weptool(obj) || obj->oclass == GEM_CLASS) { if (hmode == HMON_KICKED) {