swade-mb-helpers/src/module/powers/invisibility.js

80 lines
1.8 KiB
JavaScript

import { moduleName } from '../globals.js';
import { PowerEffect } from './basePowers.js';
export class InvisibliltyEffect extends PowerEffect {
get name() {
return 'Invisibility';
}
get duration() {
return 5;
}
get icon() {
return 'icons/svg/invisible.svg';
}
get hasAdditionalRecipients() {
return true;
}
get additionalRecipientCost() {
return 3;
}
get basePowerPoints() {
return 5;
}
get isTargeted() {
return true;
}
get isRaisable() {
return true;
}
get modifiers() {
const mods = super.modifiers;
mods.push({
name: 'Duration',
type: 'checkbox',
id: 'Duration',
value: 2,
epic: true,
effect: false,
});
return mods;
}
get description() {
let text =
super.description +
`
<p>The subject is invisible, except for a vague blur or outline.
Any action taken against it that requires sight is made at
${this.data.raise ? -6 : -4}, including Notice rolls. This penalty is
reduced by 2 if the invisible character's position is given away by some
environmental circumstance.</p>
`;
if (this.data.duration) {
text += `<p>This long-duration invisibility ends immediately if the subject
attempts a damage-causing attack or targets an unwilling character with a
power.</p>`;
}
return text;
}
async parseValues() {
await super.parseValues();
const doc = await PowerEffect.getStatus('EFFECT.StatusInvisible', 'Invisible');
doc.description = `<p>From <strong>${this.source.name}</strong> casting <em>${this.name}</em></p>`;
doc.flags = mergeObject(doc.flags ?? {}, { [moduleName]: { powerEffect: true } });
this.basePrimaryEffectDoc = doc;
}
get basePrimaryEffect() {
return this.basePrimaryEffectDoc;
}
}