BARGETHROUGH tweaks (trunk only)
Prevent monster with barge-through capability--currently only the
astral Riders--from swapping places with another monster which has that
same capability. Otherwise, if the target one moves after the barger,
it might just repeat the maneuver, undoing the first swap. If there's
no room to move anywhere else--maybe they've barged through a crowd into
a narrow spot--they could get stuck swapping and re-swapping every turn.
I've also allowed swapping with baby long worms and with adult ones
which lack a tail. When testing that, something strange happened and
the displacer was drawn on the map as a long worm tail. mdisplacem()'s
place_worm_seg() must have been responsible, but I don't understand how
the bit of code involved could kick in for a worm without tail segments.
I've reorganized mdisplacem() to avoid this occurrence, I hope....
Also, barge-through swapping with a mimic exposes it as a mimic;
swapping with an eating pet causes the meal to end. No fixes entries;
this is post-3.4.3 code.
This commit is contained in:
21
src/mon.c
21
src/mon.c
@@ -1247,13 +1247,19 @@ mm_displacement(magr, mdef)
|
||||
struct monst *magr, /* monster that is currently deciding where to move */
|
||||
*mdef; /* another monster which is next to it */
|
||||
{
|
||||
struct permonst *pa = magr->data;
|
||||
struct permonst *pd = mdef->data;
|
||||
if ((pa->mflags3 & M3_DISPLACES) &&
|
||||
!is_longworm(pd) && /* no displacing longworms */
|
||||
!mdef->mtrapped && /* complex to do right */
|
||||
(is_rider(pa) || /* riders can move anything */
|
||||
pa->msize >= pd->msize)) /* same or smaller only */
|
||||
struct permonst *pa = magr->data,
|
||||
*pd = mdef->data;
|
||||
|
||||
/* if attacker can't barge through, there's nothing to do;
|
||||
or if defender can barge through too, don't let attacker
|
||||
do so, otherwise they might just end up swapping places
|
||||
again when defender gets its chance to move */
|
||||
if ((pa->mflags3 & M3_DISPLACES) != 0 &&
|
||||
(pd->mflags3 & M3_DISPLACES) == 0 &&
|
||||
/* no displacing trapped monsters or multi-location longworms */
|
||||
!mdef->mtrapped && (!mdef->wormno || !count_wsegs(mdef)) &&
|
||||
/* riders can move anything; others, same size or smaller only */
|
||||
(is_rider(pa) || pa->msize >= pd->msize))
|
||||
return ALLOW_MDISP;
|
||||
return 0L;
|
||||
}
|
||||
@@ -1266,6 +1272,7 @@ register int x,y;
|
||||
/* Is the square close enough for the monster to move or attack into? */
|
||||
{
|
||||
register int distance = dist2(mon->mx, mon->my, x, y);
|
||||
|
||||
if (distance==2 && mon->data==&mons[PM_GRID_BUG]) return 0;
|
||||
return((boolean)(distance < 3));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user