From 4dee00dc2f9062dcd98cf5e5332b1bafa61bd7cc Mon Sep 17 00:00:00 2001 From: Martin Crawford Date: Thu, 17 Sep 2020 12:40:34 -0700 Subject: [PATCH] Event: combatantAdded missed hook `combatantAdded` event needs to be added to the `initiateCombat()` as it is not calling `addCombatant()` directly. There is no way to find the initial target otherewise as the `combatStart` event occurs before a target is added to the combatant list. --- src/Character.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Character.js b/src/Character.js index 493401ce..4666ee0b 100644 --- a/src/Character.js +++ b/src/Character.js @@ -251,6 +251,7 @@ class Character extends Metadatable(EventEmitter) { // this doesn't use `addCombatant` because `addCombatant` automatically // adds this to the target's combatants list as well this.combatants.add(target); + this.emit('combatantAdded', target); if (!target.isInCombat()) { // TODO: This hardcoded 2.5 second lag on the target needs to be refactored target.initiateCombat(this, 2500);