From d6a57de13412f685b0f4edc48f2015fc642906ee Mon Sep 17 00:00:00 2001 From: sladecraven Date: Wed, 5 Oct 2022 14:44:12 +0200 Subject: [PATCH] Fix #98 hindrance stuff --- modules/pegasus-utility.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/pegasus-utility.js b/modules/pegasus-utility.js index 1deaa5f..aef1fc9 100644 --- a/modules/pegasus-utility.js +++ b/modules/pegasus-utility.js @@ -1213,11 +1213,15 @@ export class PegasusUtility { if (token.document.disposition == 0) { continue } - let disposition = ( token.document.disposition == -1) ? 1 : -1 - let ennemies = canvas.tokens.placeables.filter(newToken => newToken.actor.type == "character" && !newToken.document.hidden && newToken.document.disposition == disposition) - let neutrals = canvas.tokens.placeables.filter(newToken => newToken.actor.type == "character" && !newToken.document.hidden && newToken.document.disposition == 0) - if (neutrals ) { - ennemies = ennemies.concat(neutrals) + let ennemies = [] + if (token.document.disposition == -1) { + ennemies = canvas.tokens.placeables.filter(newToken => newToken.actor.type == "character" && !newToken.document.hidden && (newToken.document.disposition == 1 || newToken.document.disposition == 0 )) + } + if (token.document.disposition == 1) { + ennemies = canvas.tokens.placeables.filter(newToken => newToken.actor.type == "character" && !newToken.document.hidden && (newToken.document.disposition == -1 || newToken.document.disposition == 0 )) + } + if (token.document.disposition == 0) { + ennemies = canvas.tokens.placeables.filter(newToken => newToken.actor.type == "character" && !newToken.document.hidden && (newToken.document.disposition == -1 || newToken.document.disposition == 1 )) } for (let ennemy of ennemies) { if (ennemy.actor.id != token.actor.id) {