swade-mb-helpers/src/module/powers/lightdarkness.js
2024-05-22 22:43:17 -05:00

99 lines
2.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { PowerEffect } from './basePowers.js';
export class LightDarknessEffect extends PowerEffect {
get name() {
return 'Light/Darkness';
}
get duration() {
return 100;
}
get icon() {
return this?.data?.direction === 'Darkness'
? 'icons/commodities/gems/pearl-purple-dark.webp'
: 'icons/magic/light/light-lantern-lit-white.webp';
}
get isTargeted() {
return false;
}
get basePowerPoints() {
return 2;
}
get usePrimaryEffect() {
return false;
}
get modifiers() {
return [
...super.modifiers,
{
sortOrder: -2,
name: 'Light or Darkness?',
id: 'direction',
type: 'radio',
default: 'Light',
epic: false,
choices: { Light: 'Light', Darkness: 'Darkness' },
effects: { Light: null, Darkness: null },
values: { Light: 0, Darkness: 0 },
},
{
name: 'Area Effect (Light only)',
id: 'area',
type: 'checkbox',
default: false,
value: 2,
epic: true,
effect: false,
},
{
name: 'True Darkness (Darkness only)',
id: 'truedark',
type: 'checkbox',
default: false,
value: 2,
epic: true,
effect: false,
},
{
name: 'Mobile',
id: 'mobile',
type: 'checkbox',
default: false,
value: 1,
epic: false,
effect: false,
},
];
}
get effectName() {
return this.data.direction;
}
get description() {
let text = super.description;
if (this.data.direction === 'Light') {
const size = this.data.area ? "with a radius of the caster's Smarts ×2" : 'in a LBT';
text += `<p>Bright illumination ${size}.
${this.data.raise ? 'Optionally with a raise, light is focused into a 5" beam.' : ''}`;
} else {
text += `<p>Block illumination
${this.data.truedark ? ', Infravision, Low Light Vision, and Darkvision' : ''}
in an area the size of a LBT, making the area ${this.data.raise ? 'Pitch Dark' : 'Dark'}`;
}
if (this.data.mobile) {
text += ` The power can move as a limited free action at a pace of the
caster's arcane skill die. Alternately, it may be attached to an
inanimate object`;
}
text += '</p>';
return text;
}
}