diff --git a/doc/fixes34.1 b/doc/fixes34.1 index 0259499ec..d86b57b79 100644 --- a/doc/fixes34.1 +++ b/doc/fixes34.1 @@ -244,6 +244,7 @@ elevate the trouble priority of any cursed item which is preventing removal of a ring of levitation starving pets will eat more aggressively when a pet starves to death, say so instead of just "Fido dies." +starved pet raised from dead shouldn't immediately starve again Platform- and/or Interface-Specific Fixes diff --git a/src/dog.c b/src/dog.c index e482cdff8..c1a38a6f1 100644 --- a/src/dog.c +++ b/src/dog.c @@ -790,19 +790,28 @@ register struct obj *obj; * If the pet wasn't abused and was very tame, it might revive tame. */ void -wary_dog(mtmp, quietly) +wary_dog(mtmp, was_dead) struct monst *mtmp; -boolean quietly; +boolean was_dead; { - int has_edog; + struct edog *edog; + boolean quietly = was_dead; + mtmp->meating = 0; if (!mtmp->mtame) return; - has_edog = !mtmp->isminion; - if (has_edog && - ((EDOG(mtmp)->killed_by_u == 1) || (EDOG(mtmp)->abuse > 2))) { + edog = !mtmp->isminion ? EDOG(mtmp) : 0; + + /* if monster was starving when it died, undo that now */ + if (edog && edog->mhpmax_penalty) { + mtmp->mhpmax += edog->mhpmax_penalty; + mtmp->mhp += edog->mhpmax_penalty; /* heal it */ + edog->mhpmax_penalty = 0; + } + + if (edog && (edog->killed_by_u == 1 || edog->abuse > 2)) { mtmp->mpeaceful = mtmp->mtame = 0; - if (EDOG(mtmp)->abuse >= 0 && EDOG(mtmp)->abuse < 10) - if (!rn2(EDOG(mtmp)->abuse + 1)) mtmp->mpeaceful = 1; + if (edog->abuse >= 0 && edog->abuse < 10) + if (!rn2(edog->abuse + 1)) mtmp->mpeaceful = 1; if(!quietly && cansee(mtmp->mx, mtmp->my)) { if (haseyes(youmonst.data)) { if (haseyes(mtmp->data)) @@ -817,10 +826,10 @@ boolean quietly; } } } else { - /* chance it goes wild anyway - Pet Semetary */ - if (!rn2(mtmp->mtame)) { - mtmp->mpeaceful = mtmp->mtame = 0; - } + /* chance it goes wild anyway - Pet Semetary */ + if (!rn2(mtmp->mtame)) { + mtmp->mpeaceful = mtmp->mtame = 0; + } } if (!mtmp->mtame) { newsym(mtmp->mx, mtmp->my); @@ -830,10 +839,19 @@ boolean quietly; } /* if its still a pet, start a clean pet-slate now */ - if (has_edog && mtmp->mtame) { - EDOG(mtmp)->revivals++; - EDOG(mtmp)->killed_by_u = 0; - EDOG(mtmp)->abuse = 0; + if (edog && mtmp->mtame) { + edog->revivals++; + edog->killed_by_u = 0; + edog->abuse = 0; + edog->ogoal.x = edog->ogoal.y = -1; + if (was_dead || edog->hungrytime < monstermoves + 500L) + edog->hungrytime = monstermoves + 500L; + if (was_dead) { + edog->droptime = 0L; + edog->dropdist = 10000; + edog->whistletime = 0L; + edog->apport = 5; + } /* else lifesaved, so retain current values */ } } diff --git a/src/mon.c b/src/mon.c index 6d255d13c..c2a51f53e 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1334,14 +1334,6 @@ struct monst *mtmp; mtmp->mcanmove = 1; mtmp->mfrozen = 0; if (mtmp->mtame && !mtmp->isminion) { - struct edog *edog = EDOG(mtmp); - if (edog->hungrytime < moves+500) - edog->hungrytime = moves+500; - if (edog->mhpmax_penalty) { - /* was starving */ - mtmp->mhpmax += edog->mhpmax_penalty; - edog->mhpmax_penalty = 0; - } wary_dog(mtmp, FALSE); } if (mtmp->mhpmax <= 0) mtmp->mhpmax = 10;