Apply dest. limit to monster trap door usage
To prevent monsters from falling past the bottom level or into the sanctum early, and to maintain consistency between monster and hero hole usage.
This commit is contained in:
committed by
Pasi Kallinen
parent
9f5b362601
commit
81285b661e
@@ -2796,6 +2796,7 @@ extern boolean burnarmor(struct monst *);
|
|||||||
extern int erode_obj(struct obj *, const char *, int, int);
|
extern int erode_obj(struct obj *, const char *, int, int);
|
||||||
extern boolean grease_protect(struct obj *, const char *, struct monst *);
|
extern boolean grease_protect(struct obj *, const char *, struct monst *);
|
||||||
extern struct trap *maketrap(coordxy, coordxy, int);
|
extern struct trap *maketrap(coordxy, coordxy, int);
|
||||||
|
extern d_level *clamp_hole_destination(d_level *);
|
||||||
extern void fall_through(boolean, unsigned);
|
extern void fall_through(boolean, unsigned);
|
||||||
extern struct monst *animate_statue(struct obj *, coordxy, coordxy, int, int *);
|
extern struct monst *animate_statue(struct obj *, coordxy, coordxy, int, int *);
|
||||||
extern struct monst *activate_statue_trap(struct trap *, coordxy, coordxy,
|
extern struct monst *activate_statue_trap(struct trap *, coordxy, coordxy,
|
||||||
|
|||||||
@@ -1540,6 +1540,7 @@ mlevel_tele_trap(
|
|||||||
return Trap_Effect_Finished;
|
return Trap_Effect_Finished;
|
||||||
} else {
|
} else {
|
||||||
assign_level(&tolevel, &trap->dst);
|
assign_level(&tolevel, &trap->dst);
|
||||||
|
(void) clamp_hole_destination(&tolevel);
|
||||||
}
|
}
|
||||||
} else if (tt == MAGIC_PORTAL) {
|
} else if (tt == MAGIC_PORTAL) {
|
||||||
if (In_endgame(&u.uz) && (mon_has_amulet(mtmp)
|
if (In_endgame(&u.uz) && (mon_has_amulet(mtmp)
|
||||||
|
|||||||
+17
-8
@@ -512,6 +512,20 @@ maketrap(coordxy x, coordxy y, int typ)
|
|||||||
return ttmp;
|
return ttmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* limit the destination of a hole or trapdoor to the furthest level you
|
||||||
|
should be able to fall to */
|
||||||
|
d_level *
|
||||||
|
clamp_hole_destination(d_level *dlev)
|
||||||
|
{
|
||||||
|
int bottom = dng_bottom(dlev);
|
||||||
|
dlev->dlevel = min(dlev->dlevel, bottom);
|
||||||
|
if (In_hell(dlev) && !u.uevent.invoked
|
||||||
|
&& dlev->dlevel == bottom)
|
||||||
|
dlev->dlevel--;
|
||||||
|
|
||||||
|
return dlev;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fall_through(
|
fall_through(
|
||||||
boolean td, /* td == TRUE : trap door or hole */
|
boolean td, /* td == TRUE : trap door or hole */
|
||||||
@@ -585,20 +599,15 @@ fall_through(
|
|||||||
int dist;
|
int dist;
|
||||||
|
|
||||||
if (t) {
|
if (t) {
|
||||||
dtmp.dnum = t->dst.dnum;
|
assign_level(&dtmp, &t->dst);
|
||||||
/* don't fall beyond the bottom, in case this came from a bones
|
/* don't fall beyond the bottom, in case this came from a bones
|
||||||
file with different dungeon size */
|
file with different dungeon size */
|
||||||
bottom = dng_bottom(&t->dst);
|
(void) clamp_hole_destination(&dtmp);
|
||||||
dtmp.dlevel = min(t->dst.dlevel, bottom);
|
|
||||||
if (In_hell(&t->dst) && !u.uevent.invoked
|
|
||||||
&& dtmp.dlevel == bottom)
|
|
||||||
dtmp.dlevel--;
|
|
||||||
} else {
|
} else {
|
||||||
dtmp.dnum = u.uz.dnum;
|
dtmp.dnum = u.uz.dnum;
|
||||||
dtmp.dlevel = newlevel;
|
dtmp.dlevel = newlevel;
|
||||||
}
|
}
|
||||||
/* XXX: dist won't be accurate if dtmp.dnum may not match u.uz.dnum */
|
dist = depth(&dtmp) - depth(&u.uz);
|
||||||
dist = dtmp.dlevel - dunlev(&u.uz);
|
|
||||||
if (dist > 1)
|
if (dist > 1)
|
||||||
You("fall down a %s%sshaft!", dist > 3 ? "very " : "",
|
You("fall down a %s%sshaft!", dist > 3 ? "very " : "",
|
||||||
dist > 2 ? "deep " : "");
|
dist > 2 ? "deep " : "");
|
||||||
|
|||||||
Reference in New Issue
Block a user