add protection

This commit is contained in:
Mike Bloy 2024-05-25 23:00:28 -05:00
parent f80e551835
commit 864acdd722
2 changed files with 63 additions and 0 deletions

View File

@ -42,6 +42,7 @@ import { MindWipeEffect } from './mindWipe.js';
import { ObjectReadingEffect } from './objectReading.js'; import { ObjectReadingEffect } from './objectReading.js';
import { PlanarBindingEffect } from './planarBinding.js'; import { PlanarBindingEffect } from './planarBinding.js';
import { PlaneShiftEffect } from './planeShift.js'; import { PlaneShiftEffect } from './planeShift.js';
import { ProtectionEffect } from './protection.js';
const PowerClasses = { const PowerClasses = {
'arcane-protection': ArcaneProtectionEffect, 'arcane-protection': ArcaneProtectionEffect,
@ -97,6 +98,7 @@ const PowerClasses = {
'object-reading': ObjectReadingEffect, 'object-reading': ObjectReadingEffect,
'planar-binding': PlanarBindingEffect, 'planar-binding': PlanarBindingEffect,
'plane-shift': PlaneShiftEffect, 'plane-shift': PlaneShiftEffect,
protection: ProtectionEffect,
shrink: GrowthShrinkEffect, shrink: GrowthShrinkEffect,
}; };

View File

@ -0,0 +1,61 @@
import { moduleName } from '../globals.js';
import { PowerEffect } from './basePowers.js';
export class ProtectionEffect extends PowerEffect {
get name() {
return 'Protection';
}
get duration() {
return 5;
}
get icon() {
return 'systems/swade/assets/icons/status/status_protection.svg';
}
get hasAdditionalRecipients() {
return true;
}
get additionalRecipientCost() {
return 1;
}
get basePowerPoints() {
return 1;
}
get isTargeted() {
return true;
}
async parseValues() {
await super.parseValues();
const doc = await PowerEffect.getStatus('SWADE.Protection', 'Protection', false);
doc.flags = mergeObject(doc.flags ?? {}, { [moduleName]: { powerEffect: true } });
(doc.duration = { rounds: 99 }), (this.baseEffectDoc = doc);
this.data.effect = doc;
}
get basePrimaryEffect() {
this.data.effect.changes = this.getPrimaryEffectChanges();
return this.data.effect;
}
getPrimaryEffectChanges() {
const mode = CONST.ACTIVE_EFFECT_MODES.ADD;
const key = `system.stats.toughness.${this.data.raise ? 'value' : 'armor'}`;
return [...super.getPrimaryEffectChanges(), { key, mode, value: 2, priority: 0 }];
}
get description() {
let text =
super.description +
`
<p>Grant the recipients 2 points of ${this.data.raise ? 'toughness' : 'armor'}
</p>
`;
return text;
}
}