From c76ce1ff7cc500f6cf4ad89b1057001ec61ffc72 Mon Sep 17 00:00:00 2001 From: Mike Bloy Date: Sun, 19 May 2024 23:30:07 -0500 Subject: [PATCH] add fear --- src/module/powers/banish.js | 4 ++ src/module/powers/fear.js | 97 +++++++++++++++++++++++++++++++++++++ src/module/powers/powers.js | 2 + 3 files changed, 103 insertions(+) create mode 100644 src/module/powers/fear.js diff --git a/src/module/powers/banish.js b/src/module/powers/banish.js index 35e9ed2..b8a42e2 100644 --- a/src/module/powers/banish.js +++ b/src/module/powers/banish.js @@ -10,6 +10,10 @@ export class BanishEffect extends PowerEffect { return 0; } + get icon() { + return 'icons/magic/control/sihouette-hold-beam-green.webp'; + } + get basePowerPoints() { return 3; } diff --git a/src/module/powers/fear.js b/src/module/powers/fear.js new file mode 100644 index 0000000..059c93f --- /dev/null +++ b/src/module/powers/fear.js @@ -0,0 +1,97 @@ +import { PowerEffect } from './basePowers.js'; +import { requestFearRollFromTokens } from '../helpers.js'; + +export class FearEffect extends PowerEffect { + get name() { + return 'Fear'; + } + + get icon() { + return 'icons/magic/control/fear-fright-monster-grin-green.webp'; + } + + get duration() { + return 0; + } + + get basePowerPoints() { + return 2; + } + + get usePrimaryEffect() { + return false; + } + + get isTargeted() { + return true; + } + + get isRaisable() { + return true; + } + + get hasAoe() { + return true; + } + + get modifiers() { + const mods = super.modifiers; + mods.push({ + type: 'checkbox', + default: false, + name: 'Greater Fear', + id: 'greater', + epic: true, + effect: false, + value: 2, + }); + mods.push({ + 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: 2, mbt: 2, lbt: 3 }, + }); + return mods; + } + + async sideEffects() { + await super.sideEffects(); + const penalty = (this.data.raise ? -2 : 0) + (this.data.greater ? -2 : 0); + const rollOpts = { + title: 'Fear Check', + flavor: 'Roll Spirit for a Fear Check', + }; + if (penalty !== 0) { + rollOpts.fear = penalty; + } + await requestFearRollFromTokens(this.targets, rollOpts); + } + + get description() { + const penalty = (this.data.raise ? -2 : 0) + (this.data.greater ? -2 : 0); + return ( + super.description + + `

Target makes a Fear Check${penalty !== 0 ? ` at ${penalty}` : ''}. + Extras who fail are Panicked. Wild Cards who fail roll on the + Fear Table${penalty !== 0 ? ` adding ${penalty * -1} to the result` : ''}. +

` + ); + } + + get chatMessageEffects() { + const list = super.chatMessageEffects; + if (this.data.aoe !== 'none') { + list.push(this.data.aoe.toUpperCase()); + } + return list; + } +} diff --git a/src/module/powers/powers.js b/src/module/powers/powers.js index 8541001..96571c9 100644 --- a/src/module/powers/powers.js +++ b/src/module/powers/powers.js @@ -26,6 +26,7 @@ import { EmpathyEffect } from './empathy.js'; import { EntangleEffect } from './entangle.js'; import { EnvironmentalProtectionEffect } from './environmentalProtection.js'; import { FarsightEffect } from './farsight.js'; +import { FearEffect } from './fear.js'; const PowerClasses = { 'arcane-protection': ArcaneProtectionEffect, @@ -59,6 +60,7 @@ const PowerClasses = { entangle: EntangleEffect, 'environmental-protection': EnvironmentalProtectionEffect, farsight: FarsightEffect, + fear: FearEffect, 'lower-trait': BoostLowerTraitEffect, };