fix pace based powers to work with swade 4.2

This commit is contained in:
Mike Bloy 2025-01-11 12:51:02 -06:00
parent 1c4595c72f
commit 5427d738ff
2 changed files with 5 additions and 13 deletions

View File

@ -364,7 +364,7 @@ export class PowerEffect {
icon: 'icons/magic/control/debuff-chains-shackle-movement-red.webp', icon: 'icons/magic/control/debuff-chains-shackle-movement-red.webp',
changes: [ changes: [
{ {
key: 'system.stats.speed.value', key: 'system.pace',
value: -2, value: -2,
priority: 0, priority: 0,
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD, mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,
@ -376,7 +376,7 @@ export class PowerEffect {
icon: 'icons/skills/movement/feet-winged-sandals-tan.webp', icon: 'icons/skills/movement/feet-winged-sandals-tan.webp',
changes: [ changes: [
{ {
key: 'system.stats.speed.value', key: 'system.pace',
value: 2, value: 2,
priority: 0, priority: 0,
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD, mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,

View File

@ -99,23 +99,15 @@ export class SlothSpeedEffect extends PowerEffect {
getPrimaryEffectChanges() { getPrimaryEffectChanges() {
const changes = [ const changes = [
{ {
key: 'system.stats.speed.value', key: 'system.pace',
value: -1, value: this.data.direction === 'Sloth' ? 0.5 : 2,
priority: 0, priority: 0,
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD, mode: foundry.CONST.ACTIVE_EFFECT_MODES.MULTIPLY,
}, },
]; ];
return [...super.getPrimaryEffectChanges(), ...changes]; 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() { get effectName() {
let name = `${this.data.raise ? 'major' : 'minor'} ${this.data.direction}`; let name = `${this.data.raise ? 'major' : 'minor'} ${this.data.direction}`;
const parts = []; const parts = [];