From 1c970b171e2b1e8f1a140eec9dfea6b76d472efe Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 13 Apr 2015 19:36:49 +0300 Subject: [PATCH] Some monsters can eat through iron bars Any monster with rusting or corrosion attack can eat through the bars. This includes rust monsters, grey oozes, and black puddings. Original patch by Malcolm Ryan --- doc/fixes35.0 | 1 + include/extern.h | 1 + src/hack.c | 20 +++++++++++++++----- src/mondata.c | 1 + src/monmove.c | 17 ++++++++++++++++- 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index ae084f321..c18e548ae 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -899,6 +899,7 @@ pudding corpses behave somewhat differently than before mithril armor should have silver color lichen corpse is an acid indicator camera may contain a picture-painting demon +some monsters can eat through iron bars Platform- and/or Interface-Specific Fixes diff --git a/include/extern.h b/include/extern.h index 227396f54..f5600661d 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1367,6 +1367,7 @@ E boolean FDECL(onscary, (int,int,struct monst *)); E void FDECL(monflee, (struct monst *, int, BOOLEAN_P, BOOLEAN_P)); E int FDECL(dochug, (struct monst *)); E int FDECL(m_move, (struct monst *,int)); +E void FDECL(dissolve_bars, (int,int)); E boolean FDECL(closed_door, (int,int)); E boolean FDECL(accessible, (int,int)); E void FDECL(set_apparxy, (struct monst *)); diff --git a/src/hack.c b/src/hack.c index ebf1ce891..e8e095da5 100644 --- a/src/hack.c +++ b/src/hack.c @@ -347,7 +347,7 @@ still_chewing(x,y) if (!boulder && IS_ROCK(lev->typ) && !may_dig(x,y)) { You("hurt your teeth on the %s.", - IS_TREE(lev->typ) ? "tree" : "hard stone"); + lev->typ == IRONBARS ? "bars" : (IS_TREE(lev->typ) ? "tree" : "hard stone")); nomul(0); return 1; } else if (context.digging.pos.x != x || context.digging.pos.y != y || @@ -362,9 +362,10 @@ still_chewing(x,y) context.digging.effort = (IS_ROCK(lev->typ) && !IS_TREE(lev->typ) ? 30 : 60) + u.udaminc; You("start chewing %s %s.", - (boulder || IS_TREE(lev->typ)) ? "on a" : "a hole in the", + (boulder || IS_TREE(lev->typ) || lev->typ == IRONBARS) ? "on a" : "a hole in the", boulder ? "boulder" : - IS_TREE(lev->typ) ? "tree" : IS_ROCK(lev->typ) ? "rock" : "door"); + IS_TREE(lev->typ) ? "tree" : IS_ROCK(lev->typ) ? "rock" : + lev->typ == IRONBARS ? "bar" : "door"); watch_dig((struct monst *)0, x, y, FALSE); return 1; } else if ((context.digging.effort += (30 + u.udaminc)) <= 100) { @@ -373,7 +374,8 @@ still_chewing(x,y) context.digging.chew ? "continue" : "begin", boulder ? "boulder" : IS_TREE(lev->typ) ? "tree" : - IS_ROCK(lev->typ) ? "rock" : "door"); + IS_ROCK(lev->typ) ? "rock" : + lev->typ == IRONBARS ? "bars" : "door"); context.digging.chew = TRUE; watch_dig((struct monst *)0, x, y, FALSE); return 1; @@ -418,6 +420,9 @@ still_chewing(x,y) } else if (IS_TREE(lev->typ)) { digtxt = "chew through the tree."; lev->typ = ROOM; + } else if (lev->typ == IRONBARS) { + digtxt = "eat through the bars."; + dissolve_bars(x,y); } else if (lev->typ == SDOOR) { if (lev->doormask & D_TRAPPED) { lev->doormask = D_NODOOR; @@ -630,10 +635,15 @@ int mode; if (Passes_walls && may_passwall(x,y)) { ; /* do nothing */ } else if (tmpr->typ == IRONBARS) { + if ((dmgtype(youmonst.data, AD_RUST) || + dmgtype(youmonst.data, AD_CORR)) && + mode == DO_MOVE && still_chewing(x,y)) { + return FALSE; + } if (!(Passes_walls || passes_bars(youmonst.data))) { if (iflags.mention_walls) You("cannot pass through the bars."); - return FALSE; + return FALSE; } } else if (tunnels(youmonst.data) && !needspick(youmonst.data)) { /* Eat the rock. */ diff --git a/src/mondata.c b/src/mondata.c index 98c3244f5..0c26a6005 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -285,6 +285,7 @@ struct permonst *mptr; { return (boolean) (passes_walls(mptr) || amorphous(mptr) || unsolid(mptr) || is_whirly(mptr) || verysmall(mptr) || + dmgtype(mptr, AD_CORR) || dmgtype(mptr, AD_RUST) || (slithy(mptr) && !bigmonst(mptr))); } diff --git a/src/monmove.c b/src/monmove.c index 81eb563d3..a7a3ca46f 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -1180,7 +1180,14 @@ postmov: add_damage(mtmp->mx, mtmp->my, 0L); } } else if (levl[mtmp->mx][mtmp->my].typ == IRONBARS) { - if (flags.verbose && canseemon(mtmp)) + if (may_dig(mtmp->mx,mtmp->my) && + (dmgtype(ptr, AD_RUST) || dmgtype(ptr, AD_CORR))) { + if (canseemon(mtmp)) + pline("%s eats through the iron bars.", + Monnam(mtmp)); + dissolve_bars(mtmp->mx, mtmp->my); + return(3); + } else if (flags.verbose && canseemon(mtmp)) Norep("%s %s %s the iron bars.", Monnam(mtmp), /* pluralization fakes verb conjugation */ makeplural(locomotion(ptr, "pass")), @@ -1266,6 +1273,14 @@ postmov: return(mmoved); } +void +dissolve_bars(x, y) +register int x, y; +{ + levl[x][y].typ = (Is_special(&u.uz) || *in_rooms(x,y,0)) ? ROOM : CORR; + newsym(x, y); +} + boolean closed_door(x, y) register int x, y;