User:Killian/Pet food

From NetHackWiki
Jump to navigation Jump to search

Item types

  • Treat (DOGFOOD)
  • Suitable corpse (CADAVER)
  • Acceptable (ACCFOOD)
  • Human food (MANFOOD)
  • Apportable (APPORT)
  • Poison (POISON)
  • Uninteresting (UNDEF)
  • Taboo (TABU)

These classifications appear to affect the following:

  • Whether thrown food will tame or merely pacify a domestic animal
  • The effect of thrown food on a pet
  • Whether a pet will eat an item on the ground
  • Whether or not a pet will try to move to a particular square

They do not seem to affect whether a pet will pick up non-food items.

There are specific checks for DOGFOOD, CADAVER, ACCFOOD, MANFOOD, and UNDEF, and there is at least one generic comparison. There do not seem to be any specific checks for APPORT, POISON, or TABU.

A pet will never use an UNDEF item as its movement goal. If its goal is MANFOOD or worse, it will set gtyp to APPORT, which means that it won't consider any further items that are worse than apportable.

The main use of MANFOOD seems to be that pets can set it as their goal without being able to see it. There does not appear to be any other special treatment of human food.

Pet goal code won't consider goal items with a worse type than the current goal item. This appears to be the main prioritization mechanism. An equal-quality item that is ACCFOOD or better will only become the new goal if it is closer than the existing goal.

Curiously, a pet won't seek a non-food item unless either your square is lit, or its square is not lit.

Eating

As far as eating is concerned, there appear to be following de-facto categories:

Treat

  • Raises apport
  • Tames domestic animals
  • Pets will catch and eat
  • Pets will eat from the ground

Tasty corpse

  • Tames domestic animals
  • Pets will catch and eat if starving
  • Pets will eat from the ground

Acceptable

  • Tames domestic animals
  • Pets will catch and eat if starving
  • Pets will eat from the ground if starving

Barely acceptable

  • Pets will catch and eat if starving
  • Pets will eat from the ground if starving

Comestibles not falling into one of these categories will never be eaten. The “barely acceptable” category corresponds to foods that are ordinarily considered human food, but are reclassified as acceptable food when starving. The only time a monster will eat acceptable food when not starving is if it is a non-tame domestic animal being tamed, so this is the only real difference between the two categories for eating purposes.

Classification

  • Quest artifacts (and other artifacts, 5% of the time) are considered taboo if cursed, or apportable otherwise.

Food

  • Rider corpses are taboo.
  • Petrifying corpses are taboo for monsters that are not stoning-resistant.
  • For ghouls, old corpses (more than 50 turns) are treats, and other corpses are taboo. This seems to apply even to corpses that don't degrade, such as lizard or lichen corpses.
  • For monsters (other than ghouls) that are neither carnivores nor herbivores, cursed food is uninteresting and non-cursed food is apportable.
  • Petrifying eggs are considered poison by monsters not stoning-resistant. Other eggs are considered suitable corpses by carnivores, and human food by herbivores.
  • Corpses that are more than 50 turns old and are not lizards or F are considered poison. Acidic corpses are poison for monsters not acid-resistant. Poisonous corpses are poison for monsters not poison-resistant. Vegan corpses are considered suitable corpses by herbivores, and non-vegan corpses are considered suitable by carnivores. All other corpses are considered human food.
  • A clove of garlic is taboo for undead monsters. (Since no undead monster is also a carnivore/herbivore/omnivore, this is irrelevant.) It is acceptable to herbivores and to starving carnivores; otherwise it is considered human food.
  • Tins are considered acceptable to metallivores. (Since no metallivore monster is also a carnivore/herbivore/omnivore, this is irrelevant.) They are considered human food otherwise.
  • Apples and carrots are treats for herbivores. Carnivores will consider them acceptable if starving, and human food otherwise.
  • Bananas are considered treats for Y. They are acceptable to herbivores and starving carnivores, and are otherwise considered human food.
  • All other comestibles are considered acceptable by starving pets. Other fruits and vegetables are acceptable to herbivores, and other processed foods (including royal jelly) are acceptable to carnivores; they are otherwise considered human food.
Comestible Carnivore Herbivore
tripe ration T h
meatball T h
meat ring T h
meat stick T h
huge chunk of meat T h
kelp frond h (A) A
eucalyptus leaf h (A) A
apple h (A) T
orange h (A) A
pear h (A) A
melon h (A) A
banana h (A)* A*
carrot h (A) T
sprig of wolfsbane h (A) A
clove of garlic h (A) A
slime mold h (A) A
lump of royal jelly A h (A)
cream pie A h (A)
candy bar A h (A)
fortune cookie A h (A)
pancake A h (A)
lembas wafer A h (A)
cram ration A h (A)
food ration A h (A)
K-ration A h (A)
C-ration A h (A)
tin h h

Non-food

  • Any object made of silver is taboo for silver-hating monsters.

dog_invent

(from dog_invent in monmove.c)

Pets will only interact with the topmost item.

Pets will not pick up heavy iron balls, iron chains, boulders, statues, or scrolls of mail.

If the item is a treat or a suitable corpse (or acceptable to a starving pet), the pet will eat it. Pets do not seem to care if the food is cursed, though they will still try to avoid the square containing the cursed food.

If the pet is able to carry the item, and it is not cursed, there is a chance that it will pick up the item. The pet will immediately wield its best melee weapon and wear its best armor, if able, in case the new item is better.

There are two probability checks that must both succeed: (rn2(20) < edog->apport+3) and (rn2(udist) || !rn2(edog->apport)). This means the pet must first pass a d20 apport check (with a +3 bonus), and then must be relatively far from the player, have relatively low apport, or else simply be lucky.

The following restrictions apply to monsters picking up items: (from can_carry in mon.c)

  • Monsters marked M1_NOTAKE cannot pick up anything.
  • Monsters cannot take petrifying corpses, unless they are stoning-resistant or are wearing gloves.
  • Rider corpses cannot be taken.
  • Silver-hating monsters cannot take silver items. As an exception, covetous monsters may pick up the Bell of Opening.
  • Monsters being ridden cannot pick up anything.
  • Shopkeepers can always pick up anything, ignoring weight limits.
  • Peaceful monsters cannot pick up anything.
  • Rock-throwing monsters (M2_ROCKTHROW) can always pick up boulders, ignoring weight limits.
  • Nymphs can always pick up anything, except for statues and boulders, ignoring weight limits.
  • Otherwise, the monster must have enough weight capacity to pick up the item in question.

Pets eating

Thrown food

Throwing an egg or cream pie (or spitting venom) at a pet will never be treated as thrown food; it will hit or miss the pet as normal.

If the food is ACCFOOD or better, tamedog in dog.c is called. In order to catch and eat the food, the pet must be able to move, must not be confused or eating, and the food must be a treat (acceptable or better if the pet is hungry). If this is not the case, the food will miss the pet and fall to the floor. (If it is a suitable corpse, the pet should end up eating it on its next turn anyway.) Caught food is eaten with dog_eat, which is the same function used by pets eating from the ground.