#3964
vanilla
Define several generic monster strategies, which a monster will follow to the best of its ability, and can be swapped out for other strategies given certain triggers:
- Default: Monster roams aimlessly unless they can see hostiles, in which case they beeline towards those hostiles. Smarter monsters might remember the last place they saw a hostile and beeline towards that square when the hostile goes out of sight.
- Lure: Active only when a monster is fleeing and knows about a trap in the vicinity. It tries to get the trap between itself and you.
- Blocking: Monster tries to get between the player and a certain space. Won’t work well when there’s only one of it, but will do nicely in small or large groups.
- Zombie resurrection: If zombies can resurrect each other through physical contact, living zombies will try to move towards zombie corpses they can see.
- Throw weapon versus wielding it: Mostly useful for things like daggers or knives. Most monsters should be smart enough not to throw away their last melee weapon when they know they can hit for more damage with it. They will, however, unwield weapons and hit you with fists if their only weapon left is grossly unfit for melee (i.e. crossbow).
- Darkness: Try not to move out of darkness / into darkness unless there’s no other choice. If in the wrong one and doing nothing special, beeline towards the nearest visible way out of it. Most useful for gremlins who want to stay in darkness.
- Passwall: if monsters cannot take physical items with them when they phase through walls, they will not actually pass through walls while carrying any items they care about, unless they are fleeing, in which case they will abandon the items.
- Food smells: If the hero is carrying a lot of food in open inventory, monster AI may be more effective at tracking the player, depending on if the food is anything the monsters like to eat. Carrying around lots of fleshy food like tripe rations or meatballs helps carnivorous monsters track, carrying around produce helps herbivorous monsters track, tins don’t have any scent or effect, inediate pets get no tracking bonus.
- Hero displacement: Monsters often attack each other because they think the hero is displaced where another monster is. The smarter a monster is, the more chances it should have to re-roll this displacement roll as long as it keeps landing on other monsters. Or else, if there’s only one displaced image, smart monsters should conclude it’s not where the other monster is and lash out randomly at empty space.
- Bones ghost AI: camp on the bones pile, guarding it, never chase the hero away from it.
- Insects returning to the hive: bees periodically path back to their hive unless they’re actively chasing or combatting something. Ants do this too, and even pick up and bring back food items.
- Swarming AI (bees and possibly other insects): before moving, they calculate if they can see any others of the same monster, and if so, they are disincentivized for moving into a space where they would lose sight of all such monsters. This should keep swarms actually cohesive but still able to move along corridors and pursue the player.
- No reason to move: the monster doesn’t move, or moves infrequently and randomly, unless it sees you as an enemy. It can have a normal speed and doesn’t need to be sleeping or peaceful or anything. If it no longer detects you, it may return to its state of not pursuing you.