hunger effects -- returns TRUE on starvation */
| 359 | |
| 360 | /* hunger effects -- returns TRUE on starvation */ |
| 361 | staticfn boolean |
| 362 | dog_hunger(struct monst *mtmp, struct edog *edog) |
| 363 | { |
| 364 | if (svm.moves > edog->hungrytime + DOG_WEAK) { |
| 365 | if (!carnivorous(mtmp->data) && !herbivorous(mtmp->data)) { |
| 366 | edog->hungrytime = svm.moves + DOG_WEAK; |
| 367 | /* but not too high; it might polymorph */ |
| 368 | } else if (!edog->mhpmax_penalty) { |
| 369 | /* starving pets are limited in healing */ |
| 370 | int newmhpmax = mtmp->mhpmax / 3; |
| 371 | mtmp->mconf = 1; |
| 372 | edog->mhpmax_penalty = mtmp->mhpmax - newmhpmax; |
| 373 | mtmp->mhpmax = newmhpmax; |
| 374 | if (mtmp->mhp > mtmp->mhpmax) |
| 375 | mtmp->mhp = mtmp->mhpmax; |
| 376 | if (DEADMONSTER(mtmp)) { |
| 377 | dog_starve(mtmp); |
| 378 | return TRUE; |
| 379 | } |
| 380 | if (cansee(mtmp->mx, mtmp->my)) |
| 381 | pline_mon(mtmp, "%s is confused from hunger.", Monnam(mtmp)); |
| 382 | else if (couldsee(mtmp->mx, mtmp->my)) |
| 383 | beg(mtmp); |
| 384 | else |
| 385 | You_feel("worried about %s.", y_monnam(mtmp)); |
| 386 | stop_occupation(); |
| 387 | } else if (svm.moves > edog->hungrytime + DOG_STARVE |
| 388 | || DEADMONSTER(mtmp)) { |
| 389 | dog_starve(mtmp); |
| 390 | return TRUE; |
| 391 | } |
| 392 | } |
| 393 | return FALSE; |
| 394 | } |
| 395 | |
| 396 | /* do something with object (drop, pick up, eat) at current position |
| 397 | * returns 1 if object eaten (since that counts as dog's move), 2 if died |
no test coverage detected