more starving pets
The fact that a pet was starving to death got recorded with its corpse; if that corpse was revived via undead turning, the resulting monster would immediately starve again if it stayed tame. Similarly, if one got petrified while nearly starved, reanimating the statue would produce a starving pet. Make revival and reanimation use the same code as life-saving, where hunger status gets reset.
This commit is contained in:
@@ -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
|
||||
|
||||
50
src/dog.c
50
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 */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user