From eaf5b8a0663b1b29286fd5bcab85a9e1f75b505c Mon Sep 17 00:00:00 2001 From: Mike Bloy Date: Tue, 14 May 2024 14:10:33 -0500 Subject: [PATCH] add reorged blind power --- src/module/powers/blind.js | 110 ++++++++++++++++++++++++++++++++ src/module/powers/powers.js | 124 +----------------------------------- 2 files changed, 111 insertions(+), 123 deletions(-) create mode 100644 src/module/powers/blind.js diff --git a/src/module/powers/blind.js b/src/module/powers/blind.js new file mode 100644 index 0000000..f3b6508 --- /dev/null +++ b/src/module/powers/blind.js @@ -0,0 +1,110 @@ +import { moduleName } from '../globals.js'; +import { PowerEffect } from './basePowers.js'; + +export class BlindEffect extends PowerEffect { + get name() { + return 'Blind'; + } + + get icon() { + return 'icons/skills/wounds/injury-eyes-blood-red.webp'; + } + + get duration() { + return 0; + } + + get isTargeted() { + return true; + } + + get hasAoe() { + return true; + } + + get basePowerPoints() { + return 2; + } + + getPrimaryEffectChanges() { + const changes = [ + { + key: 'system.stats.globalMods.trait', + value: -2, + priority: 0, + mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD, + }, + ]; + return changes; + } + + get description() { + return ( + super.description + + `

${this.data.raise ? -4 : -2} penalty to all actions involving sight.

+

Shake off attempts at end of turns with a Vigor ${this.data.strong ? '-2 ' : ''} + roll as a free action. Success removes 2 points of penalties. + A raise removes the effect.

` + ); + } + + async createSecondaryEffects(maintId) { + const docs = await super.createSecondaryEffects(maintId); + if (this.data.raise) { + const strong = this.data.mods.has('strong'); + const doc = this.createEffectDocument(this.icon, `Blinded (${strong ? 'Strong, ' : ''}Raise)`, [ + { + key: 'system.stats.globalMods.trait', + value: -2, + priority: 0, + mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD, + }, + ]); + doc.duration.seconds = 594; + doc.description = this.description + '

This is the raise effect which can be shaken off separately.

'; + doc.flags[moduleName].maintId = maintId; + docs.push(doc); + } + return docs; + } + + get modifiers() { + const mods = super.modifiers; + mods.push({ + name: 'Strong', + type: 'checkbox', + value: 1, + id: 'strong', + epic: false, + effect: false, + }); + mods.push({ + type: 'select', + default: 'none', + name: 'Area of Effect', + id: 'aoe', + epic: true, + choices: { + none: 'None', + mbt: 'Medium Blast Template', + lbt: 'Large Blast Template', + }, + effects: { none: null, mbt: null, lbt: null }, + values: { none: 0, mbt: 2, lbt: 3 }, + }); + return mods; + } + + get effectName() { + const strong = this.data.strong; + return `Blinded${strong ? ' (Strong)' : ''}`; + } + + 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 3a6d88c..b07c77d 100644 --- a/src/module/powers/powers.js +++ b/src/module/powers/powers.js @@ -6,129 +6,7 @@ import { BanishEffect } from './banish.js'; import { BarrierEffect } from './barrier.js'; import { BeastFriendEffect } from './beastFriend.js'; import { BlastEffect } from './blast.js'; - -class BlindEffect extends PowerEffect { - get name() { - return 'Blind'; - } - - get icon() { - return 'icons/skills/wounds/injury-eyes-blood-red.webp'; - } - - get duration() { - return 0; - } - - get isTargeted() { - return true; - } - - get hasAoe() { - return true; - } - - get basePowerPoints() { - return 2; - } - - getPrimaryEffectChanges() { - const changes = [ - { - key: 'system.stats.globalMods.trait', - value: -2, - priority: 0, - mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD, - }, - ]; - return changes; - } - - get description() { - return ( - super.description + - `

${this.data.raise ? -4 : -2} penalty to all actions involving sight.

-

Shake off attempts at end of turns with a Vigor - ${this.data.mods.has('strong') ? '-2 ' : ''}roll as a free action. - Success removes 2 points of penalties. A raise removes the effect.

` - ); - } - - async createSecondaryEffects(maintId) { - const docs = await super.createSecondaryEffects(maintId); - if (this.data.raise) { - const strong = this.data.mods.has('strong'); - const doc = this.createEffectDocument(this.icon, `Blinded (${strong ? 'Strong, ' : ''}Raise)`, [ - { - key: 'system.stats.globalMods.trait', - value: -2, - priority: 0, - mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD, - }, - ]); - doc.duration.seconds = 594; - doc.description = this.description + '

This is the raise effect which can be shaken off separately.

'; - doc.flags[moduleName].maintId = maintId; - docs.push(doc); - } - return docs; - } - - get modifiers() { - const mods = super.modifiers; - mods.push({ - name: 'Strong', - value: 1, - id: 'strong', - epic: false, - effect: false, - }); - return mods; - } - - get menuInputs() { - const inputs = super.menuInputs; - inputs.push({ - type: 'select', - label: 'Area of Effect', - options: [ - { html: 'None', value: 0, selected: true }, - { html: 'Medium Blast Template (+2)', value: 2, selected: false }, - { html: 'Large Blast Template (+3)', value: 3, selected: false }, - ], - }); - return inputs; - } - - async parseValues() { - await super.parseValues(); - this.data.aoe = this.data.values.shift(); - } - - get powerPoints() { - let total = super.powerPoints; - total += this.data.aoe; - return total; - } - - get effectName() { - const strong = this.data.mods.has('strong'); - return `Blinded${strong ? ' (Strong)' : ''}`; - } - - get chatMessageEffects() { - const list = super.chatMessageEffects; - switch (this.data.aoe) { - case 2: - list.push('MBT'); - break; - case 3: - list.push('LBT'); - break; - } - return list; - } -} +import { BlindEffect } from './blind.js'; class BoltEffect extends PowerEffect { get name() {