Pet displacement improvements
Pets can no longer be displaced out of a trap, because that was inconsistent with peaceful monsters refusing to be displaced out of a trap. The untaming-via-displacement-out-of-trap code is removed. Pets also now have a better survival instinct: they follow the code for peaceful displacement into a bad position, and refuse to swap places. This means it's no longer possible to accidentally kill a pet by levitating/walking over water and displacing it.
This commit is contained in:
committed by
Pasi Kallinen
parent
92b9db7630
commit
6134c6f165
+6
-21
@@ -1793,10 +1793,7 @@ domove_core()
|
|||||||
* previous location using the same conditions as in attack().
|
* previous location using the same conditions as in attack().
|
||||||
* there are special extenuating circumstances:
|
* there are special extenuating circumstances:
|
||||||
* (1) if the pet dies then your god angers,
|
* (1) if the pet dies then your god angers,
|
||||||
* (2) if the pet gets trapped then your god may disapprove,
|
* (2) if the pet gets trapped then your god may disapprove.
|
||||||
* (3) if the pet was already trapped and you attempt to free it
|
|
||||||
* not only do you encounter the trap but you may frighten your
|
|
||||||
* pet causing it to go wild! moral: don't abuse this privilege.
|
|
||||||
*
|
*
|
||||||
* Ceiling-hiding pets are skipped by this section of code, to
|
* Ceiling-hiding pets are skipped by this section of code, to
|
||||||
* be caught by the normal falling-monster code.
|
* be caught by the normal falling-monster code.
|
||||||
@@ -1836,15 +1833,14 @@ domove_core()
|
|||||||
/* can't swap places when pet won't fit thru the opening */
|
/* can't swap places when pet won't fit thru the opening */
|
||||||
You("stop. %s won't fit through.", upstart(y_monnam(mtmp)));
|
You("stop. %s won't fit through.", upstart(y_monnam(mtmp)));
|
||||||
didnt_move = TRUE;
|
didnt_move = TRUE;
|
||||||
} else if (mtmp->mpeaceful && !mtmp->mtame && mtmp->mtrapped) {
|
} else if ((mtmp->mpeaceful || mtmp->mtame) && mtmp->mtrapped) {
|
||||||
/* TODO: pets can get angered when displaced out of a trap.
|
/* Since peaceful monsters simply being unable to move out of traps
|
||||||
* Having peaceful monsters simply refuse is inconsistent.
|
* was inconsistent with pets being able to but being untamed in the
|
||||||
* Probably, pets should not be able to be displaced out of a
|
* process, apply this logic equally to pets and peacefuls. */
|
||||||
* trap like a pit or bear trap at all. */
|
|
||||||
You("stop. %s can't move out of that trap.",
|
You("stop. %s can't move out of that trap.",
|
||||||
upstart(y_monnam(mtmp)));
|
upstart(y_monnam(mtmp)));
|
||||||
didnt_move = TRUE;
|
didnt_move = TRUE;
|
||||||
} else if (mtmp->mpeaceful && !mtmp->mtame
|
} else if (mtmp->mpeaceful
|
||||||
&& (!goodpos(u.ux0, u.uy0, mtmp, 0)
|
&& (!goodpos(u.ux0, u.uy0, mtmp, 0)
|
||||||
|| t_at(u.ux0, u.uy0) != NULL
|
|| t_at(u.ux0, u.uy0) != NULL
|
||||||
|| mtmp->ispriest
|
|| mtmp->ispriest
|
||||||
@@ -1857,17 +1853,6 @@ domove_core()
|
|||||||
upstart(y_monnam(mtmp)));
|
upstart(y_monnam(mtmp)));
|
||||||
didnt_move = TRUE;
|
didnt_move = TRUE;
|
||||||
} else {
|
} else {
|
||||||
/* if trapped, there's a chance the pet goes wild */
|
|
||||||
if (mtmp->mtrapped) {
|
|
||||||
if (!rn2(mtmp->mtame)) {
|
|
||||||
mtmp->mtame = mtmp->mpeaceful = mtmp->msleeping = 0;
|
|
||||||
if (mtmp->mleashed)
|
|
||||||
m_unleash(mtmp, TRUE);
|
|
||||||
growl(mtmp);
|
|
||||||
} else {
|
|
||||||
yelp(mtmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
char pnambuf[BUFSZ];
|
char pnambuf[BUFSZ];
|
||||||
|
|
||||||
/* save its current description in case of polymorph */
|
/* save its current description in case of polymorph */
|
||||||
|
|||||||
Reference in New Issue
Block a user