Displace a pet rather than stop travel

... and stop travel if you take damage from any source.

Original patch via Acehack by Alex Smith
This commit is contained in:
Pasi Kallinen
2015-12-21 19:12:02 +02:00
parent 4b876b1aec
commit 715fd7e3d9
3 changed files with 13 additions and 4 deletions

View File

@@ -52,6 +52,7 @@ stack splitting for dipping large quantities of potions was done poorly
dipping fruit juice into enlightenment gave different result than the inverse
make travel walk up to a trap and stop when the trap blocks the only
way forward, instead of trying to go straight line
travel will displace pets rather than stop
Platform- and/or Interface-Specific Fixes

View File

@@ -1370,8 +1370,9 @@ domove()
}
mtmp = m_at(x, y);
if (mtmp) {
if (mtmp && !is_safepet(mtmp)) {
/* Don't attack if you're running, and can see it */
/* It's fine to displace pets, though */
/* We should never get here if forcefight */
if (context.run && ((!Blind && mon_visible(mtmp)
&& ((mtmp->m_ap_type != M_AP_FURNITURE
@@ -1393,7 +1394,10 @@ domove()
/* attack monster */
if (mtmp) {
nomul(0);
/* don't stop travel when displacing pets; if the
displace fails for some reason, attack() in uhitm.c
will stop travel rather than domove */
if (!is_safepet(mtmp) || context.forcefight) nomul(0);
/* only attack if we know it's there */
/* or if we used the 'F' command to fight blindly */
/* or if it hides_under, in which case we call attack() to print
@@ -1409,7 +1413,7 @@ domove()
* attack_check(), which still wastes a turn, but prints a
* different message and makes the player remember the monster.
*/
if (context.nopick
if (context.nopick && !context.travel
&& (canspotmon(mtmp) || glyph_is_invisible(levl[x][y].glyph))) {
if (mtmp->m_ap_type && !Protection_from_shape_changers
&& !sensemon(mtmp))
@@ -2415,7 +2419,7 @@ lookaround()
&& mtmp->m_ap_type != M_AP_OBJECT
&& (!mtmp->minvis || See_invisible) && !mtmp->mundetected) {
if ((context.run != 1 && !mtmp->mtame)
|| (x == u.ux + u.dx && y == u.uy + u.dy))
|| (x == u.ux + u.dx && y == u.uy + u.dy && !context.travel))
goto stop;
}
@@ -2678,6 +2682,8 @@ boolean k_format;
u.uhp -= n;
if (u.uhp > u.uhpmax)
u.uhpmax = u.uhp; /* perhaps n was negative */
else
context.travel = context.travel1 = context.mv = context.run = 0;
context.botl = 1;
if (u.uhp < 1) {
killer.format = k_format;

View File

@@ -350,10 +350,12 @@ register struct monst *mtmp;
Strcpy(buf, y_monnam(mtmp));
buf[0] = highc(buf[0]);
You("stop. %s is in the way!", buf);
context.travel = context.travel1 = context.mv = context.run = 0;
return TRUE;
} else if ((mtmp->mfrozen || (!mtmp->mcanmove)
|| (mtmp->data->mmove == 0)) && rn2(6)) {
pline("%s doesn't seem to move!", Monnam(mtmp));
context.travel = context.travel1 = context.mv = context.run = 0;
return TRUE;
} else
return FALSE;