From a9559c01f4db8ed99e36def8a15cdac146d17dd2 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 1 May 2022 15:09:17 -0700 Subject: [PATCH] pets and portals Extend pull request #737, commit d6ab241b8c39830de41c61f6fc2df5760d239cb9, to magic portals. If hero is on or next to a magic portal, have pets behave as if food they want is being carried, like PR #737 did for hero standing on stairs. (To be on one, hero must have come through from the other side and not moved off the receiving portal yet, or else is in the endgame but no longer carrying the Amulet.) --- src/dogmove.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/dogmove.c b/src/dogmove.c index f09b006a1..6669f4c72 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -594,7 +594,8 @@ dog_goal(register struct monst *mtmp, struct edog *edog, appr = 1; } /* if you have dog food it'll follow you more closely; if you are - on stairs (or ladder), it will behave as if you have dog food */ + on stairs (or ladder) or on or next to a magic portal, it will + behave as if you have dog food */ if (appr == 0) { if (On_stairs(u.ux, u.uy)) { appr = 1; @@ -604,6 +605,18 @@ dog_goal(register struct monst *mtmp, struct edog *edog, appr = 1; break; } + if (appr == 0) { + struct trap *t; + + /* assume at most one magic portal per level; + [should this be limited to known portals?] */ + for (t = g.ftrap; t; t = t->ntrap) + if (t->ttyp == MAGIC_PORTAL) { + if (/*t->tseen &&*/ distu(t->tx, t->ty) <= 2) + appr = 1; + break; + } + } } } } else