From 5427d738ff797f871595aad0ce48b1efdaa2716e Mon Sep 17 00:00:00 2001 From: Mike Bloy Date: Sat, 11 Jan 2025 12:51:02 -0600 Subject: [PATCH] fix pace based powers to work with swade 4.2 --- src/module/powers/basePowers.js | 4 ++-- src/module/powers/slothSpeed.js | 14 +++----------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/module/powers/basePowers.js b/src/module/powers/basePowers.js index 3387630..f2091a3 100644 --- a/src/module/powers/basePowers.js +++ b/src/module/powers/basePowers.js @@ -364,7 +364,7 @@ export class PowerEffect { icon: 'icons/magic/control/debuff-chains-shackle-movement-red.webp', changes: [ { - key: 'system.stats.speed.value', + key: 'system.pace', value: -2, priority: 0, mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD, @@ -376,7 +376,7 @@ export class PowerEffect { icon: 'icons/skills/movement/feet-winged-sandals-tan.webp', changes: [ { - key: 'system.stats.speed.value', + key: 'system.pace', value: 2, priority: 0, mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD, diff --git a/src/module/powers/slothSpeed.js b/src/module/powers/slothSpeed.js index 5f41f2f..e47c470 100644 --- a/src/module/powers/slothSpeed.js +++ b/src/module/powers/slothSpeed.js @@ -99,23 +99,15 @@ export class SlothSpeedEffect extends PowerEffect { getPrimaryEffectChanges() { const changes = [ { - key: 'system.stats.speed.value', - value: -1, + key: 'system.pace', + value: this.data.direction === 'Sloth' ? 0.5 : 2, priority: 0, - mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD, + mode: foundry.CONST.ACTIVE_EFFECT_MODES.MULTIPLY, }, ]; return [...super.getPrimaryEffectChanges(), ...changes]; } - async primaryDocForTarget(doc, target) { - const newDoc = await super.primaryDocForTarget(doc, target); - const modValue = this.data.direction === 'Sloth' ? -0.5 : 1; - const idx = newDoc.changes.length - 1; - newDoc.changes[idx].value = Math.ceil(target.actor.system.stats.speed.value * modValue); - return newDoc; - } - get effectName() { let name = `${this.data.raise ? 'major' : 'minor'} ${this.data.direction}`; const parts = [];