From: PatR Date: Sat, 4 Feb 2023 01:01:49 +0000 (-0800) Subject: breaking iron bars with weapon X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c212ee44c06cb5ef5fec1a7f02d7c48c13f46fd6;p=nethack breaking iron bars with weapon For strength over 18, A_CURR(A_STR) can return up to 125, giving the chance to break bars by hitting them with a warhammer a 50:50 chance. Switch to acurrstr() which returns at most 25. Allow heavy iron balls (wielded or thrown, regardless of whether they're chained to hero) to have a chance to break bars too. They are slightly more complicated because they don't use obj->spe like a weapon but are otherwise straightfoward. --- diff --git a/src/mthrowu.c b/src/mthrowu.c index 1a40dc3a7..0207d52e0 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -1259,8 +1259,17 @@ hit_bars( if (!(harmless_missile(otmp) || is_flimsy(otmp))) noise = 4 * 4; - if (your_fault && otmp->otyp == WAR_HAMMER) { - int chance = (melee_attk ? 40 : 60) - ACURR(A_STR) - otmp->spe; + if (your_fault && (otmp->otyp == WAR_HAMMER + || otmp->otyp == HEAVY_IRON_BALL)) { + /* iron ball isn't a weapon or wep-tool so doesn't use obj->spe; + weight is normally 480 but can be increased by increments + of 160 (scrolls of punishment read while already punished) */ + int spe = ((otmp->otyp == HEAVY_IRON_BALL) /* 3+ for iron ball */ + ? ((int) otmp->owt / IRON_BALL_W_INCR) + : otmp->spe); + /* chance: used in saving throw for the bars; more likely to + break those when 'chance' is _lower_; acurrstr(): 3..25 */ + int chance = (melee_attk ? 40 : 60) - acurrstr() - spe; if (!rn2(max(2, chance))) { You("break the bars apart!");