From e06572c22133aa3c664e9eadd47931d5d6a82f81 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Mon, 3 Oct 2022 15:32:22 +0200 Subject: [PATCH] Fix #77 --- modules/pegasus-utility.js | 31 ++++++++++++++++++++++++++++++- system.json | 4 ++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/modules/pegasus-utility.js b/modules/pegasus-utility.js index e7e3a34..355dee2 100644 --- a/modules/pegasus-utility.js +++ b/modules/pegasus-utility.js @@ -1148,6 +1148,16 @@ export class PegasusUtility { applyDef.actor.removeTacticianEffect() } } + //Delete all effects if no more tacticians (ie deleted case) + if (tacticianTokens.length == 0) { + let allTokens = canvas.tokens.placeables.filter(token => token.actor.type == "character") + for (let token of allTokens) { + if (token.actor.hasTacticianBonus()) { + token.actor.removeTacticianEffect() + } + } + } + } /* -------------------------------------------- */ @@ -1188,6 +1198,15 @@ export class PegasusUtility { applyDef.actor.removeEnhancerEffect() } } + // Delete all effects if no more tacticians (ie deleted case) + if (enhancerTokens.length == 0) { + let allTokens = canvas.tokens.placeables.filter(token => token.actor.type == "character") + for (let token of allTokens) { + if (token.actor.hasEnhancerBonus()) { + token.actor.removeEnhancerEffect() + } + } + } } /* -------------------------------------------- */ @@ -1227,6 +1246,16 @@ export class PegasusUtility { applyDef.actor.removeAgitatorHindrance() } } + // Delete all effects if no more tacticians (ie deleted case) + if (agitatorTokens.length == 0) { + let allTokens = canvas.tokens.placeables.filter(token => token.actor.type == "character") + for (let token of allTokens) { + if (token.actor.addAgitatorHindrance()) { + token.actor.removeAgitatorHindrance() + } + } + } + } /* -------------------------------------------- */ @@ -1234,7 +1263,7 @@ export class PegasusUtility { // Small optimization let now = Date.now() - if ( now - this.lastRoleEffectProcess < 300 ) { + if (now - this.lastRoleEffectProcess < 300) { return // Save some processing } this.lastRoleEffectProcess = now diff --git a/system.json b/system.json index 03cef06..5153797 100644 --- a/system.json +++ b/system.json @@ -253,7 +253,7 @@ ], "title": "Pegasus RPG", "url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg", - "version": "10.0.29", - "download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.29.zip", + "version": "10.0.30", + "download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.30.zip", "background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp" } \ No newline at end of file