Tiny chance of breaking iron bars with war hammer

Also add some different sounds to hitting the iron bars,
and make it noisy.
This commit is contained in:
Pasi Kallinen
2023-01-26 18:21:50 +02:00
parent 7f4e69f885
commit f61e1e8e23
6 changed files with 30 additions and 8 deletions

View File

@@ -1213,7 +1213,9 @@ hit_bars(
struct obj *otmp = *objp;
int obj_type = otmp->otyp;
boolean nodissolve = (levl[barsx][barsy].wall_info & W_NONDIGGABLE) != 0,
your_fault = (breakflags & BRK_BY_HERO) != 0;
your_fault = (breakflags & BRK_BY_HERO) != 0,
melee_attk = (breakflags & BRK_MELEE) != 0;
int noise = 0;
if (your_fault
? hero_breaks(otmp, objx, objy, breakflags)
@@ -1235,11 +1237,29 @@ hit_bars(
if (!Deaf)
pline("%s!", (obj_type == BOULDER || obj_type == HEAVY_IRON_BALL)
? "Whang"
: harmless_missile(otmp) ? "Whap"
: is_flimsy(otmp) ? "Flapp"
: (otmp->oclass == COIN_CLASS
|| objects[obj_type].oc_material == GOLD
|| objects[obj_type].oc_material == SILVER)
? "Clink"
: "Clonk");
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 (!rn2(max(2, chance))) {
You("break the bars apart!");
dissolve_bars(barsx, barsy);
noise = noise * 2;
}
}
if (noise)
wake_nearto(barsx, barsy, noise);
}
}