Allow cutting a known spider web by force-fighting it

Original code from xNetHack by copperwater <aosdict@gmail.com>.
This commit is contained in:
Pasi Kallinen
2022-07-25 18:05:59 +03:00
parent 63997a6fe5
commit f07f065f7d
2 changed files with 34 additions and 0 deletions

View File

@@ -977,6 +977,7 @@ change Demonbane to a mace, make it the first sac gift for priests,
wielding Giantslayer prevents knockback from larger monsters
scared hostile monster which cannot move away will attack
prevent a fog cloud that has engulfed the hero from moving under closed doors
allow cutting a known spider web with wielded weapon by force-fighting the web
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -19,6 +19,7 @@ static boolean domove_bump_mon(struct monst *, int);
static boolean domove_attackmon_at(struct monst *, coordxy, coordxy,
boolean *);
static boolean domove_fight_ironbars(coordxy, coordxy);
static boolean domove_fight_web(coordxy, coordxy);
static boolean domove_swap_with_pet(struct monst *, coordxy, coordxy);
static boolean domove_fight_empty(coordxy, coordxy);
static boolean air_turbulence(void);
@@ -1738,6 +1739,35 @@ domove_fight_ironbars(coordxy x, coordxy y)
return FALSE;
}
/* force-fight a spider web with your weapon */
static boolean
domove_fight_web(coordxy x, coordxy y)
{
struct trap *trap = t_at(x, y);
if (g.context.forcefight && trap && trap->ttyp == WEB
&& trap->tseen && uwep) {
if (uwep->oartifact == ART_STING) {
/* guaranteed success */
pline("%s cuts through the web!",
bare_artifactname(uwep));
} else if (!is_blade(uwep)) {
You_cant("cut a web with %s!", an(xname(uwep)));
return TRUE;
} else if (rn2(20) > ACURR(A_STR) + uwep->spe) {
/* TODO: add failures, maybe make an occupation? */
You("hack ineffectually at some of the strands.");
return TRUE;
} else {
You("cut through the web.");
}
deltrap(trap);
newsym(x, y);
return TRUE;
}
return FALSE;
}
/* maybe swap places with a pet? returns TRUE if swapped places */
static boolean
domove_swap_with_pet(struct monst *mtmp, coordxy x, coordxy y)
@@ -2351,6 +2381,9 @@ domove_core(void)
if (domove_fight_ironbars(x, y))
return;
if (domove_fight_web(x, y))
return;
if (domove_fight_empty(x, y))
return;