fix github issue #608 - #untrap vs web

Reported by Vivit-R, the chance of freeing a monster from being
trapped in a web was very small and failure resulted in creation of
a new web at the hero's spot, eventually making it impossible to
attempt to #untrap the monster (if hero escaped the new web and moved
to another spot adjacent to trapped monster, eventually surrounding
it with webs).  [That's actually misleading.  Escaping the new web
but staying at the same spot lets the player try again; repeat as
needed....  But chance of failure still seemed way too high.]

This reduces the chance of failure from 29/30 to 6/7 and makes the
chance of spreading the web after failure be 1/3 instead of 100%.  It
also supplies missing feedback about the monster still being trapped
if the attempt to make a new web fails.

Closes #608
This commit is contained in:
PatR
2021-11-18 18:30:19 -08:00
parent 937eef4b9b
commit d26537c4c9
2 changed files with 28 additions and 15 deletions

View File

@@ -679,6 +679,11 @@ prevent normal monster activity from picking up the mines' luckstone or the
and/or engraved Elbereth wasn't sufficient to guard the Sokoban prize
proceed a little further into dochat() if hero is deaf
stacks of 1 to 49 gold pieces weighed 0
the chance for #untrap to free a monster stuck in a web was very unlikely
unless was poly'd into spider form; make it less hard
if #untrap monst-from-web failure happened while hero was standing on a spot
where a new web couldn't be created (furniture, grave, magic portal),
the expected "<monst> remains entangled" feedback wasn't delivered
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -4370,13 +4370,13 @@ dountrap(void)
/* Probability of disabling a trap. Helge Hafting */
static int
untrap_prob(struct trap* ttmp)
untrap_prob(struct trap *ttmp)
{
int chance = 3;
/* Only spiders know how to deal with webs reliably */
if (ttmp->ttyp == WEB && !webmaker(g.youmonst.data))
chance = 30;
chance = 7; /* 3.7: used to be 30 */
if (Confusion || Hallucination)
chance++;
if (Blind)
@@ -4431,7 +4431,7 @@ cnv_trap_obj(
/* while attempting to disarm an adjacent trap, we've fallen into it */
static void
move_into_trap(struct trap* ttmp)
move_into_trap(struct trap *ttmp)
{
int bc = 0;
xchar x = ttmp->tx, y = ttmp->ty, bx, by, cx, cy;
@@ -4473,7 +4473,9 @@ move_into_trap(struct trap* ttmp)
* 2: succeeds
*/
static int
try_disarm(struct trap* ttmp, boolean force_failure)
try_disarm(
struct trap *ttmp,
boolean force_failure)
{
struct monst *mtmp = m_at(ttmp->tx, ttmp->ty);
int ttype = ttmp->ttyp;
@@ -4521,19 +4523,25 @@ try_disarm(struct trap* ttmp, boolean force_failure)
if (DEADMONSTER(mtmp))
killed(mtmp);
} else if (ttype == WEB) {
if (!webmaker(g.youmonst.data)) {
struct trap *ttmp2 = maketrap(u.ux, u.uy, WEB);
struct trap *ttmp2 = t_at(u.ux, u.uy);
if (ttmp2) {
pline_The(
"webbing sticks to you. You're caught too!");
dotrap(ttmp2, NOWEBMSG);
if (u.usteed && u.utrap) {
/* you, not steed, are trapped */
dismount_steed(DISMOUNT_FELL);
}
if (!webmaker(g.youmonst.data)
/* don't always try to spread the web */
&& !rn2(3)
/* is there already a trap at hero's spot?
if so, don't clobber it with spreading web */
&& (ttmp2
? (ttmp2->ttyp == WEB)
/* make a new web to trap hero in */
: (ttmp2 = maketrap(u.ux, u.uy, WEB)) != 0)) {
pline_The("web sticks to you. You're caught too!");
dotrap(ttmp2, NOWEBMSG);
if (u.usteed && u.utrap) {
/* you, not steed, are trapped */
dismount_steed(DISMOUNT_FELL);
}
} else
}
if (mtmp->mtrapped)
pline("%s remains entangled.", Monnam(mtmp));
}
} else if (under_u) {