134 lines
3.5 KiB
JavaScript
134 lines
3.5 KiB
JavaScript
import { PowerEffect } from './basePowers.js';
|
|
|
|
export class DispelEffect extends PowerEffect {
|
|
get name() {
|
|
return 'Dispel';
|
|
}
|
|
|
|
get icon() {
|
|
return 'icons/magic/symbols/triangle-glowing-green.webp';
|
|
}
|
|
|
|
get duration() {
|
|
return this?.data?.antiMagic ? 5 : 0;
|
|
}
|
|
|
|
get usePrimaryEffect() {
|
|
return !!this?.data?.antiMagic;
|
|
}
|
|
|
|
get basePowerPoints() {
|
|
return 1;
|
|
}
|
|
|
|
get isTargeted() {
|
|
return true;
|
|
}
|
|
|
|
get hasAoe() {
|
|
return true;
|
|
}
|
|
|
|
get modifiers() {
|
|
return [
|
|
...super.modifiers,
|
|
{
|
|
name: 'Anti-Magic Field',
|
|
type: 'checkbox',
|
|
value: 8,
|
|
id: 'antiMagic',
|
|
epic: true,
|
|
effect: false,
|
|
},
|
|
{
|
|
type: 'select',
|
|
default: 'none',
|
|
name: 'Area of Effect',
|
|
id: 'aoe',
|
|
epic: false,
|
|
choices: {
|
|
none: 'None',
|
|
sbt: 'Small Blast Template',
|
|
mbt: 'Medium Blast Template',
|
|
lbt: 'Large Blast Template',
|
|
},
|
|
effects: { none: null, sbt: null, mbt: null, lbt: null },
|
|
values: { none: 0, sbt: 1, mbt: 2, lbt: 3 },
|
|
},
|
|
{
|
|
name: 'Disenchant',
|
|
type: 'checkbox',
|
|
value: 1,
|
|
id: 'disenchant',
|
|
epic: true,
|
|
effect: false,
|
|
},
|
|
{
|
|
name: 'Multiple Powers',
|
|
type: 'checkbox',
|
|
value: 8,
|
|
id: 'multiple',
|
|
epic: false,
|
|
effect: false,
|
|
},
|
|
{
|
|
name: 'Remove Curse',
|
|
type: 'checkbox',
|
|
value: 2,
|
|
id: 'removeCurse',
|
|
epic: true,
|
|
effect: false,
|
|
},
|
|
];
|
|
}
|
|
|
|
get effectName() {
|
|
return this.data.antiMagic ? 'Anti-Magic Field' : super.effectName;
|
|
}
|
|
|
|
getPrimaryEffectChanges() {
|
|
if (this.data.antiMagic) {
|
|
const base = 'flags.swade.auras.antiMagicField';
|
|
const priority = 0;
|
|
const mode = foundry.CONST.ACTIVE_EFFECT_MODES.OVERRIDE;
|
|
return [
|
|
{ key: `${base}.enabled`, value: true, priority, mode },
|
|
{ key: `${base}.walls`, value: true, priority, mode },
|
|
{ key: `${base}.color`, value: '#ff00cc', priority, mode },
|
|
{ key: `${base}.alpha`, value: 0.1, priority, mode },
|
|
{ key: `${base}.radius`, value: 1.5, priority, mode },
|
|
{ key: `${base}.visibleTo`, value: [-1, 0, 1], priority, mode },
|
|
];
|
|
}
|
|
return super.getPrimaryEffectChanges();
|
|
}
|
|
|
|
get description() {
|
|
let text = super.description;
|
|
if (this.data.antiMagic) {
|
|
text += `<p>Magic items, effects, and powers within the anti magic field
|
|
have no effect. Summoned creatures must make a Spirit roll each round or
|
|
or take a wound.</p>`;
|
|
return text;
|
|
}
|
|
const multi = this.data.multiple || this.data.aoe;
|
|
const affected = `${multi ? 'all' : 'a single'}
|
|
${this.data.disenchant ? 'magic item' : 'power'}${multi ? 's' : ''}
|
|
${this.data.aoe === 'none' ? 'cast by or on the recipient' : 'within a ' + this.data.aoe.toUpperCase()}`;
|
|
text += `<p>Attempt to dispel ${affected}. `;
|
|
if (this.data.disenchant) {
|
|
text += `The item(s) magical abilities are negated for ${this.data.raise ? 'two rounds' : 'one round'}`;
|
|
} else {
|
|
text += `Each target must make an opposed arcane skill (spirit for Mystic Powers)
|
|
roll or have the power(s) end immediately.`;
|
|
}
|
|
if (this.data.removeCurse) {
|
|
text += `The normal -2 penalty to remove a curse is ignored.`;
|
|
} else {
|
|
text += `If the effect is a Curse, there is a -2 penalty to the dispeller's roll`;
|
|
}
|
|
text += '</p>';
|
|
return text;
|
|
}
|
|
}
|