Monster behavior

From NetHackWiki
(Redirected from MT HOSTILE)
Jump to navigation Jump to search
This article is about how a monster acts towards the hero. For how a monster moves and acts in general, see monster movement.

In NetHack, the behavior of a monster that the hero encounters is influenced by several factors, such as the monster attributes and other similar flags that they possess. A monster's behavior may be further influenced by whether or not they are peaceful or hostile towards the hero, which is generally determined when that monster is placed by the normal mechanisms of monster creation.[1]

Some monsters are set to be always peaceful, while others will be always hostile. A monster that is neither of these when randomly generated under most normal circumstances will be peaceful or hostile towards the hero, based on factors such as their own alignment value, the hero's alignment, the hero's alignment record, and the races of both the monster and the hero. There are also many ways to shift a monster's behavior towards the hero, e.g. making peaceful monsters hostile to them, and pacifying or even taming hostile monsters.

Peaceful monsters

A peaceful monster will not attack the hero, and simply moves around their current area somewhat randomly.

A hero that is not wielding a bloodthirsty weapon (i.e. Stormbringer) and moves into a peaceful monster will be given a 'yes/no' message prompt to confirm if they want to attack.[2] Safe-moving into a monster will simply print a message and use up the hero's turn. Wielding Stormbringer will ignore this prompt and safe-moving and attack any monster that the hero moves into, regardless of whether or not they are hostile (including during travel).

Killing a monster of an "always peaceful" type that is initially generated as peaceful will incur general penalties to alignment record, as well as murder penalties unless the hero is chaotic—no penalties will occur if that monster was generated hostile.

The following information pertains to an upcoming version (NetHack 3.7.0). If this version is now released, please verify that the information below is still accurate, then update the page to incorporate it.

The hero can displace peaceful monsters in the same way as pets, with the same conditions. Sleeping or paralyzed monsters cannot be displaced at all, but immobile monsters can with a 17 chance, and aligned priests, shopkeepers, guards, the Oracle, and quest leaders cannot ever be displaced.

Making peacefuls hostile

For angering the hero's god, see anger.

A hero can anger a peaceful monster and cause them to become hostile through one of several means:

  • Attacking a peaceful monster by answering "yes" to the confirmation prompt given when moving into one.
  • Attacking a peaceful monster by moving into them while wielding Stormbringer, which causes the hero to attack automatically.
Your bloodthirsty blade attacks!
  • Moving into a peaceful monster while the hero is blind and unable to perceive them or their location.
  • Hitting a peaceful monster with the arc of Cleaver.[3][4]
  • Hitting a peaceful monster with a spell, a zapped wand that damages them, or a thrown item.

A hero that makes a peaceful monster hostile in one of these ways will incur a -1 penalty to their alignment record, and the attacked monster may scream or otherwise react in a way that creates noise and awakens nearby sleeping monsters. Depending on the circumstances, other nearby peaceful monsters that witness this will also become hostile and may additionally become scared:

"Gasp!"
"Uh-oh."
"Oh my!"
"What?"
"Why?"

In addition, certain peaceful monsters also become hostile under specific conditions, while others have special behavior when they are made hostile:

  • Shopkeepers become hostile if the hero leaves their shop without paying off all their items and debts. Watchmen and watch captains on the same level will also become hostile.
  • Attacking a watchman or watch captain will cause all other watch members on the level to become hostile.

Hostile monsters

A hostile monster will generally pursue and attack the hero if they are given an opportunity. Not all hostile monsters will constantly advance towards the hero, which is dependent on the monster's other behaviors and traits, and some hostile monsters may be unable to actively attack the hero.

A hero that moves into a hostile monster will automatically fight them with their current wielded weapon.

Pacifying hostile monsters

Just as with making peaceful monsters hostile, the hero can pacify hostile monsters through several methods.

Tame monsters

Main articles: Pet and Tameness

Pets are monsters that are loyal to the hero and will not normally attack them, unless they are confused or subject to conflict. A pet whose tameness reaches 0 will become peaceful or hostile depending on the circumstances, and attacking a pet will decrease their tameness significantly—the article on tameness details what causes pets to lose tameness and how much pet abuse is required for a pet to become hostile.

Pets will attack peaceful and hostile monsters alike if they are strong enough to, and those monsters have a chance of retaliating against the pet each time. The hero is not held responsible for any monsters that a pet kills or any pets that are killed by retaliation from a monster that they attack.

The scroll of taming, magic harp and the charm monster spell are all capable of turning peaceful and hostile monsters into pets, and monsters that are not made tame or cannot be tamed will often become peaceful. Medusa, the various quest nemeses and the Wizard of Yendor cannot even be pacified.

Grudges

Main article: Grudge

Under very rare conditions, a monster that is not tame will deliberately attack another monster of its own accord, without the influence of confusion and with no regard to whether those monsters are peaceful or hostile towards the hero—this is informally referred to as a "grudge", after the Grudge Patch by Nephi that enables this behavior between several monster types.

While vanilla NetHack does enable aggression between specific non-tame monsters if they are adjacent to each other, only two monsters are subject to this:[5] purple worms will attack any shriekers that are adjacent to them.[6]

The following information pertains to an upcoming version (NetHack 3.7.0). If this version is now released, please verify that the information below is still accurate, then update the page to incorporate it.

More grudge-style interactions are introduced:

Monster behavior and standard monster creation

When determining if a randomly generated monster is peaceful or hostile, the first factor checked is the hero's race, which causes monsters of specific races to be peaceful or hostile as described in the table below:

Hero's base race Always peaceful races[7] Always hostile races[8]
Human[9] none gnomes
orcs
Elf[10] elves orcs
Dwarf[11] dwarves
gnomes
orcs
Gnome[12] dwarves
gnomes
humans
Orc[13] none humans
dwarves
elves

Note that all human monsters the hero normally encounters in practice will be either "always peaceful" or "always hostile"—this above information is still applicable for cases such as reverse genocide that is performed while the hero is confused, which will create player monsters of their role that will be peaceful or hostile based on those rules.

For monsters that are not any of the above races, whether or not they are hostile or peaceful is determined by the following:

  • A unicorn is always generated as peaceful to a co-aligned hero and always generated as hostile to a cross-aligned one.[14]
  • Minions sent by an angry god are always hostile.[15]
  • An Angel in the service of a deity is always generated as peaceful to a co-aligned hero and always generated as hostile to a cross-aligned one—if the Angel is a "renegade", however, they are always generated as peaceful to a cross-aligned hero and always generated as hostile to a co-aligned one.
  • An angelic being that is not an Angel serving a god is always generated as hostile if the hero is not lawful or they have a negative alignment record, and will otherwise be peaceful.[16]
  • A chaotic monster that is generated while the hero has the Amulet of Yendor will always be created hostile.[17]
  • A major demon summoned by same-race sacrifice will be peaceful to a chaotic hero and hostile otherwise.[18]
  • A lawful demon lord or prince is generated as peaceful so that they will try to bribe the hero upon meeting them, unless that hero is not lawful or else was wielding Excalibur at the time of that monster's creation.[19]
  • Monsters created by the summon nasties monster spell are always hostile unless they are random monsters selected to replace a summoned nasty type that has been removed by genocide.[20]
  • Monsters created by the summon insects monster spell are always hostile.[21]
  • A djinni generated from a magic lamp or smoky potion has a chance of granting a wish, disappearing, or remaining behind depending on the item's beatitude[22][23]—if the djinni does not remain behind as a tame monster and gives a message about being disturbed, it is then subjected to the normal odds of being peaceful or hostile as described in the bullet point below, i.e. they may be peaceful for a neutral hero.
  • If none of the above applies for the monster, then they will be peaceful with a probability of \frac{(15+AR)(1+MA)}{(16+AR)(2+MA)} (where AR is the player's alignment record and MA is the absolute value of the monster's alignment) if the hero is of the same alignment.[24] In essence, the monster will be created peaceful if the hero is co-aligned and has an alignment record above -14, and will otherwise be hostile.

In practice, this means that randomly generated neutral monsters will be peaceful towards a neutral hero 12 (50%) of the time at most, since all neutral monsters have 0 alignment. Additionally, orcs will only sometimes be generated peaceful towards a chaotic orcish hero.

Always-peaceful monsters

Some monsters are always peaceful when created randomly under normal circumstances, and these monsters will have the M2_PEACEFUL flag.[25][26][27]

These monsters are defined as "always peaceful":

Always-hostile monsters

Some monsters are always hostile when created randomly under normal circumstances, and these monsters will have the M2_HOSTILE flag.[28][29][30]

Specific level generation

Part of the process of level creation for specific areas–including special rooms, special levels and dungeon branches–is determining whether or not the monsters that are placed will be peaceful or hostile. This will often produce monsters that are hostile where they might normally peaceful and vice versa.

The following special rooms set the monsters generated within them during their creation as peaceful or hostile:

  • Monsters created to populate a throne room during level creation are always hostile.[31]

Figurines

Main article: Figurine

A monster generated from a figurine that is applied or animated with the stone to flesh spell will be hostile, peaceful or tame with odds dependent on the beatitude of that figurine—a blessed figurine is highly likely to produce a tame monster, while an uncursed figurine is highly likely to produce a peaceful monster, and a cursed figurine is highly likely to produce a hostile monster. See the article on figurines for more details.

Other cases

This section covers instances of monsters being generated as peaceful or hostile that are not sorted into the cases detailed above.

  • A hero that starts with a pet will always have that tame pet alongside them at the start of the game.
  • Schroedinger's Cat is a monster that will always be created as peaceful if it is alive when the large box containing it is opened.[32] This is distinct from the "always peaceful" monster behavior mentioned above.

Alignment record and monster behavior

In addition to influencing which monsters are peaceful or hostile towards them, a hero's alignment record is increased by killing monsters that are generated as hostile towards them, and is decreased by attacking monsters that are currently peaceful or tame.

The amount of alignment record that a hero gains or loses for attacking a given monster is calculated during the monster's creation and based on that monster's own alignment value—alignment record gain or loss for an already-generated monster is recalculated whenever it is tamed or becomes peaceful, but does not occur if a tame or peaceful monster becomes hostile (with the high cleric of Moloch being a special exception).

Strategy

The penalty for attacking peaceful monsters is manageable for late-game characters, but dangerous for characters with low levels and/or low alignment.

Before casting spells or firing missiles, it is generally advisable to check the status of a monster with the / or the ; key. This is only recommended for some monsters; for example, orcs will often be peaceful towards orcish player characters, and so should be checked, while others, such as rothes, are always generated hostile. If wielding Stormbringer, it is dangerous to blunder into a monster such as an aligned priest or shopkeeper, so it is advisable to wield a different weapon while moving in an area with peaceful monsters.

History

In NetHack 3.4.3 and some earlier versions, including variants based on those versions, attacking peaceful monsters with polearms does not ask the player for confirmation to do so—this is bug C343-305, and is fixed via commit bb5ade42 (imported from GruntHack).

Variants

SLASH'EM

In SLASH'EM, the koala's calming attack pacifies any successfully hit monster.

Killing a peaceful monster without angering it prints a message:[33]

The gods will probably not appreciate this...

References

  1. src/makemon.c in NetHack 3.6.7, line 2003: peace_minded() function
  2. src/uhitm.c in NetHack 3.6.7, line 344: safepet check
  3. src/uhitm.c in NetHack 3.6.7, line 522: hitum_cleave function
  4. src/uhitm.c in NetHack 3.6.7, line 567: target's location for Cleaver
  5. src/mon.c in NetHack 3.6.7, line 1556
  6. src/mon.c in NetHack 3.6.7, line 1562
  7. src/makemon.c in NetHack 3.6.7, line 2017
  8. src/makemon.c in NetHack 3.6.7, line 2019
  9. src/role.c in NetHack 3.6.7, line 630
  10. src/role.c in NetHack 3.6.7, line 651
  11. src/role.c in NetHack 3.6.7, line 672
  12. src/role.c in NetHack 3.6.7, line 693
  13. src/role.c in NetHack 3.6.7, line 714
  14. src/makemon.c in NetHack 3.6.6, line 1271
  15. src/minion.c in NetHack 3.6.6, line 221
  16. src/makemon.c in NetHack 3.6.6, line 2031: is_minion is used for this check, but all applicable monsters with M2_MINION are angelic beings
  17. src/makemon.c in NetHack 3.6.6, line 2027
  18. src/pray.c in NetHack 3.6.7, line 1426
  19. src/makemon.c in NetHack 3.6.6, line 1332
  20. src/wizard.c in NetHack 3.6.6, line 604
  21. src/mcastu.c in NetHack 3.6.6, line 605
  22. src/apply.c in NetHack 3.6.7, line 1484: dorub function, calls djinni_from_bottle
  23. src/potion.c in NetHack 3.6.7, line 2321: djinni_from_bottle() function
  24. src/makemon.c in NetHack 3.6.7, line 2039: per comment above, chance of being hostile is greater if the hero's alignment record is bad or or the monster is not strongly aligned
  25. src/makemon.c in NetHack 3.6.7, line 2008
  26. include/mondata.h in NetHack 3.6.7, line 124
  27. include/monflag.h in NetHack 3.6.7, line 128
  28. src/makemon.c in NetHack 3.6.7, line 2010
  29. include/mondata.h in NetHack 3.6.7, line 123
  30. include/monflag.h in NetHack 3.6.7, line 127
  31. src/mkroom.c in NetHack 3.6.6, line 256
  32. src/pickup.c in NetHack 3.6.6, line 2414
  33. mon.c in SLASH'EM 0.0.7E7F2, line 2167