swade-mb-helpers/src/module/powers/arcaneProtection.js
2024-05-12 18:10:35 -05:00

60 lines
1.2 KiB
JavaScript

import { PowerEffect } from './basePowers.js';
export class ArcaneProtectionEffect extends PowerEffect {
get name() {
return 'Arcane Protection';
}
get duration() {
return 5;
}
get icon() {
return 'icons/magic/defensive/shield-barrier-flaming-pentagon-blue.webp';
}
get hasAdditionalRecipients() {
return true;
}
get additionalRecipientCost() {
return 1;
}
get isTargeted() {
return true;
}
get modifiers() {
const mods = super.modifiers;
mods.push({
name: 'Greater Arcane Protection',
id: 'greater',
value: 2,
type: 'checkbox',
default: false,
epic: true,
effect: false,
});
return mods;
}
get _penaltyAmount() {
return (this.data.raise ? -4 : -2) + (this.data.mods.has('greater') ? -2 : 0);
}
get description() {
let text = super.description;
text += `<p>Hostile powers are at ${this._penaltyAmount} when
targeting or damaging the affected character.</p>`;
return text;
}
get effectName() {
const greater = this.data.mods.has('greater');
const raise = this.data.raise;
const amount = this._penaltyAmount;
return `${greater ? 'Greater ' : ''}Arcane Protection (${raise ? 'major, ' : ''}${amount})`;
}
}