rogueworld icon indicating copy to clipboard operation
rogueworld copied to clipboard

Make mobs alert other mobs when target found

Open Arcanorum opened this issue 2 years ago • 1 comments

Task description

It is currently too easy to pick off single mobs that are in a group and lure them away.

It would be better if when a mob notices a target (another character type of an opposing faction) then it would broadcast that information to any other mobs of the same faction within a certain range, so they too would be alerted of the target being found.

For example: There is a group of knights near each other facing in different directions. A bandit moves into the view range of a knight, so the knight notices it. The knight would check for all nearby knights (and any other characters that have a friendly faction relationship to the knight) and tell each one of them to focus on the bandit (if they don't already have a target).

References/notes

Character factions: https://github.com/Arcanorum/dungeonz/blob/master/server/src/gameplay/Factions.js Mob logic: https://github.com/Arcanorum/dungeonz/blob/master/server/src/entities/classes/destroyables/movables/characters/mobs/Mob.js

  • See onDamage for what the mob should do when it is damaged.
  • See getNearestHostileInLOS for when a hostile character is found by this mob.

Try with a range of 4 (in all directions) to check for other friendly mobs, though this may change depending on testing/feedback, as long as it is configurable.

Acceptance criteria

  • When a mob is damaged, it should check the source of the damage and if it is another character, then it should target that character, and also check for characters of a friendly faction within a 4 tile radius that do not have a target and set their target to the damaging character.
  • When a mob finds a character of a hostile faction, it should target that character, and also check for characters of a friendly faction within a 4 tile radius that do not have a target and set their target to the hostile character.
  • The 4 tile radius should be added as a property to the Mob prototype, something like alertRange.

Arcanorum avatar Jul 26 '21 17:07 Arcanorum

Zombie pigmen flashbacks.

Sebasflow23 avatar Aug 11 '21 20:08 Sebasflow23