kick/joust monster positioning (trunk only)
From a 7.5 year old news posting (with a reply by Kevin Hugo speaking
on behalf of slash'em...): when a monster "nimbly jumps to evade" hero's
kick, it can pass through walls and grid bugs can jump off their grid.
Likewise when a joust or staggering blow knocks a monster back, it could
move grid bugs diagonally. This fixes both cases.
Offhand I can't think of any other non-standard movement situations
which might need similar handling, but it wouldn't surprise me if there
are some. Leashed movement is close but I don't think maybe_mnexto helps.
This commit is contained in:
@@ -231,6 +231,8 @@ override non-silver vs shades for artifacts which deal extra damage to undead
|
|||||||
assorted mirror fixes--mainly visibility issues
|
assorted mirror fixes--mainly visibility issues
|
||||||
some monsters can't be strangled; self-polymorph can stop/restart strangulation
|
some monsters can't be strangled; self-polymorph can stop/restart strangulation
|
||||||
re-adjust gem generation probabilities when revisiting existing dungeon levels
|
re-adjust gem generation probabilities when revisiting existing dungeon levels
|
||||||
|
kick evasion shouldn't move monsters through walls
|
||||||
|
kick evasion and jousting/staggering blows shouldn't move grid bugs diagonally
|
||||||
|
|
||||||
|
|
||||||
Platform- and/or Interface-Specific Fixes
|
Platform- and/or Interface-Specific Fixes
|
||||||
|
|||||||
@@ -1289,6 +1289,7 @@ E void FDECL(killed, (struct monst *));
|
|||||||
E void FDECL(xkilled, (struct monst *,int));
|
E void FDECL(xkilled, (struct monst *,int));
|
||||||
E void FDECL(mon_to_stone, (struct monst*));
|
E void FDECL(mon_to_stone, (struct monst*));
|
||||||
E void FDECL(mnexto, (struct monst *));
|
E void FDECL(mnexto, (struct monst *));
|
||||||
|
E void FDECL(maybe_mnexto, (struct monst *));
|
||||||
E boolean FDECL(mnearto, (struct monst *,XCHAR_P,XCHAR_P,BOOLEAN_P));
|
E boolean FDECL(mnearto, (struct monst *,XCHAR_P,XCHAR_P,BOOLEAN_P));
|
||||||
E void FDECL(m_respond, (struct monst *));
|
E void FDECL(m_respond, (struct monst *));
|
||||||
E void FDECL(setmangry, (struct monst *));
|
E void FDECL(setmangry, (struct monst *));
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ doit:
|
|||||||
(void) passive(mon, FALSE, 1, AT_KICK, FALSE);
|
(void) passive(mon, FALSE, 1, AT_KICK, FALSE);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
mnexto(mon);
|
maybe_mnexto(mon);
|
||||||
if(mon->mx != x || mon->my != y) {
|
if(mon->mx != x || mon->my != y) {
|
||||||
if(glyph_is_invisible(levl[x][y].glyph)) {
|
if(glyph_is_invisible(levl[x][y].glyph)) {
|
||||||
unmap_object(x, y);
|
unmap_object(x, y);
|
||||||
|
|||||||
@@ -724,6 +724,8 @@ mhurtle(mon, dx, dy, range)
|
|||||||
dx = sgn(dx);
|
dx = sgn(dx);
|
||||||
dy = sgn(dy);
|
dy = sgn(dy);
|
||||||
if(!range || (!dx && !dy)) return; /* paranoia */
|
if(!range || (!dx && !dy)) return; /* paranoia */
|
||||||
|
/* don't let grid bugs be hurtled diagonally */
|
||||||
|
if (dx && dy && NODIAG(monsndx(mon->data))) return;
|
||||||
|
|
||||||
/* Send the monster along the path */
|
/* Send the monster along the path */
|
||||||
mc.x = mon->mx;
|
mc.x = mon->mx;
|
||||||
|
|||||||
22
src/mon.c
22
src/mon.c
@@ -2121,6 +2121,7 @@ mon_to_stone(mtmp)
|
|||||||
impossible("Can't polystone %s!", a_monnam(mtmp));
|
impossible("Can't polystone %s!", a_monnam(mtmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* might place monst on far side of a wall or boulder */
|
||||||
void
|
void
|
||||||
mnexto(mtmp) /* Make monster mtmp next to you (if possible) */
|
mnexto(mtmp) /* Make monster mtmp next to you (if possible) */
|
||||||
struct monst *mtmp;
|
struct monst *mtmp;
|
||||||
@@ -2148,6 +2149,27 @@ mnexto(mtmp) /* Make monster mtmp next to you (if possible) */
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* like mnexto() but requires destination to be directly accessible */
|
||||||
|
void
|
||||||
|
maybe_mnexto(mtmp)
|
||||||
|
struct monst *mtmp;
|
||||||
|
{
|
||||||
|
coord mm;
|
||||||
|
struct permonst *ptr = mtmp->data;
|
||||||
|
boolean diagok = !NODIAG(ptr - mons);
|
||||||
|
int tryct = 20;
|
||||||
|
|
||||||
|
do {
|
||||||
|
if (!enexto(&mm, u.ux, u.uy, ptr)) return;
|
||||||
|
if (couldsee(mm.x, mm.y) &&
|
||||||
|
/* don't move grid bugs diagonally */
|
||||||
|
(diagok || mm.x == mtmp->mx || mm.y == mtmp->my)) {
|
||||||
|
rloc_to(mtmp, mm.x, mm.y);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} while (--tryct > 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* mnearto()
|
/* mnearto()
|
||||||
* Put monster near (or at) location if possible.
|
* Put monster near (or at) location if possible.
|
||||||
* Returns:
|
* Returns:
|
||||||
|
|||||||
Reference in New Issue
Block a user