From b646524a9738453fd2c0f5312adb029a2fd69fd9 Mon Sep 17 00:00:00 2001 From: Mike Bloy Date: Sun, 2 Jun 2024 21:30:53 -0500 Subject: [PATCH] add sound/silence --- src/module/powers/powers.js | 5 ++ src/module/powers/soundSilence.js | 105 ++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 src/module/powers/soundSilence.js diff --git a/src/module/powers/powers.js b/src/module/powers/powers.js index 0bb8ec5..59de106 100644 --- a/src/module/powers/powers.js +++ b/src/module/powers/powers.js @@ -53,6 +53,7 @@ import { ShapeChangeEffect } from './shapeChange.js'; import { SlothSpeedEffect } from './slothSpeed.js'; import { SlumberEffect } from './slumber.js'; import { SmiteEffect } from './smite.js'; +import { SoundSilenceEffect } from './soundSilence.js'; const PowerClasses = { 'arcane-protection': ArcaneProtectionEffect, @@ -117,12 +118,16 @@ const PowerClasses = { scrying: ScryingEffect, 'shape-change': ShapeChangeEffect, shrink: GrowthShrinkEffect, + silence: SoundSilenceEffect, slothspeed: SlothSpeedEffect, 'sloth-speed': SlothSpeedEffect, sloth: SlothSpeedEffect, speed: SlothSpeedEffect, slumber: SlumberEffect, smite: SmiteEffect, + soundsilence: SoundSilenceEffect, + 'sound-silence': SoundSilenceEffect, + sound: SoundSilenceEffect, }; /* ---------------------------------------------------------------- */ diff --git a/src/module/powers/soundSilence.js b/src/module/powers/soundSilence.js new file mode 100644 index 0000000..b7f116e --- /dev/null +++ b/src/module/powers/soundSilence.js @@ -0,0 +1,105 @@ +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' ? 0 : 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, + }); + return mods; + } + + get effectName() { + let name = `${this.data.raise ? 'major' : 'minor'} ${this.data.direction}`; + return name; + } + + get description() { + let desc = super.description; + return desc; + } + + get primaryEffectButtons() { + const buttons = super.primaryEffectButtons; + if (this.data.direction === 'Silence' && this.data.targeted) { + const mods = []; + if (this.data.greater) { + mods.push({ label: 'Greater Silence', value: -2 }); + } + buttons.push({ + label: `Shake off (Smarts${this.data.greater ? ' -2' : ''})`, + type: 'trait', + rollType: 'attribute', + rollDesc: 'Smarts', + flavor: 'Success shakes off the effects of silence', + mods, + }); + } + return buttons; + } +}