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

124 lines
3.4 KiB
JavaScript

import { PowerEffect } from './basePowers.js';
export class SoundSilenceEffect extends PowerEffect {
get name() {
return 'Sound/Silence';
}
get hasAdditionalRecipients() {
return false;
}
get icon() {
return (this?.data?.direction ?? 'Sound') === 'Sound'
? 'icons/magic/sonic/bell-alarm-red-purple.webp'
: 'icons/svg/silenced.svg';
}
get duration() {
return this?.data?.direction === 'Sound' ? (this.data.alarm === 'none' ? 0 : 6000) : 5;
}
get isTargeted() {
return this.data?.targeted && this?.data?.direction === 'Silence';
}
get basePowerPoints() {
return 1;
}
get hasAoe() {
return true;
}
get modifiers() {
const mods = super.modifiers;
mods.push({
sortOrder: -2,
name: 'Sound or Silence',
id: 'direction',
type: 'radio',
default: 'Sound',
epic: false,
choices: { Sound: 'Sound', Silence: 'Silence' },
effects: { Sound: null, Silence: null },
values: { Sound: 0, Silence: 0 },
});
mods.push({
name: 'Greater Sound/Silence',
id: 'greater',
default: false,
type: 'checkbox',
effect: false,
value: 1,
epic: true,
});
mods.push({
name: 'Mobile',
id: 'mobile',
default: false,
type: 'checkbox',
effect: false,
value: 1,
epic: false,
});
mods.push({
name: 'Targeted',
id: 'targeted',
default: false,
type: 'checkbox',
effect: false,
value: 0,
epic: false,
});
mods.push({
name: 'Alarm (Sound only)',
type: 'select',
id: 'alarm',
epic: false,
default: 'none',
choices: { none: 'No alarm', object: 'On Object', area: '10 yard area' },
effects: { none: null, object: null, area: null },
values: { none: 0, object: 1, area: 2 },
});
return mods;
}
get effectName() {
if (this.data.direction === 'Sound' && this.data.alarm !== 'none') {
return 'Alarm';
}
let name = `${this.data.raise ? 'major' : 'minor'} ${this.data.direction}`;
return name;
}
get description() {
let desc = super.description;
if (this.data.direction === 'Sound') {
desc += `<p>Mimic any known sound from a point within ranage. If used as
a test, resist with Smarts${this.data.greater ? ' -2' : ''}.</p>`;
if (this.data.alarm !== 'none') {
desc += `<p>A subtle ward is created on
${this.data.alarm === 'object' ? 'an object' : 'an area 10 yards in diameter'}
which will sound an alarm (to the caster only or audibly, caster's choice)
if the ward is disturbed. This lasts 10 hours. The caster may choose to
set a password that, if spoken, will allow the ward to be disturbed by
the speaking entity.</p>`;
}
} else if (this.data.targeted) {
desc += `<p>Silence an individual, causing
${this.data.raise ? 'complete silence' : '-4 to auditory Notice rolls'}
for that individual. Resisted with Spirit, -2 if a raise and -2 if Greater.</p>`;
} else {
desc += `<p>Silence a Large Blast Template, causing
${this.data.raise ? 'complete silence' : '-4 t auditory Notice rolls'}
within the area.</p>`;
}
if (!this.data.targete && this.data.mobile) {
desc += `<p>The caster can move the area up to his arcane skill die
type each round.</p>`;
}
return desc;
}
}