This commit is contained in:
2022-10-03 15:32:22 +02:00
parent 7bcd4d9c06
commit e06572c221
2 changed files with 32 additions and 3 deletions

View File

@@ -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