From dd4735d50a310fb193f8370a7bcb1ccd6203fd7d Mon Sep 17 00:00:00 2001 From: Mike Bloy Date: Sat, 4 May 2024 19:26:52 -0500 Subject: [PATCH] refactoring the refactoring --- scripts/basePowers.js | 23 ++++-- scripts/powers.js | 176 +++++++++++++++++++++++------------------- 2 files changed, 114 insertions(+), 85 deletions(-) diff --git a/scripts/basePowers.js b/scripts/basePowers.js index af0c6fd..73d9fcb 100644 --- a/scripts/basePowers.js +++ b/scripts/basePowers.js @@ -73,6 +73,8 @@ export class PowerEffect { get isDamaging () { return false } get additionalRecipientCost () { return 0 } get isTargeted () { return false } + get isRaisable () { return true } + get hasAoe () { return false } get modifiers () { const mods = [] mods.push({ name: 'Adaptable Caster', id: 'adaptable', @@ -106,7 +108,9 @@ export class PowerEffect { mods.push({ name: 'Lingering Damage', id: 'lingeringdamage', value: 2, epic: false, effect: false}) } - mods.push({ name: 'Selective', id: 'selective', value: 1, epic: false, effect: false }) + if (this.hasAoe) { + mods.push({ name: 'Selective', id: 'selective', value: 1, epic: false, effect: false }) + } return mods } @@ -162,9 +166,12 @@ export class PowerEffect { get menuButtons () { const data = [ { label: 'Apply', value: 'apply' }, - { label: 'Apply with Raise', value: 'raise' }, - { label: 'Cancel', value: 'cancel' } ] + if (this.isRaisable) { + data.push({ label: 'Apply with Raise', value: 'raise' }) + } + data.push({ label: 'Cancel', value: 'cancel' }) + return data } @@ -239,14 +246,14 @@ export class PowerEffect { return changes } - getPrimaryEffectDescription () { + get description () { return "" } async createPrimaryEffect (maintId) { const doc = this.createEffectDocument(this.icon, this.effectName, this.getPrimaryEffectChanges()) - doc.description += this.getPrimaryEffectDescription() + doc.description += this.description doc.flags[moduleName].maintId = maintId doc.duration.seconds = 594 return doc @@ -259,7 +266,7 @@ export class PowerEffect { } const doc = this.createEffectDocument(icon, `Maintaining ${this.name}`, []) doc.duration.rounds = this.duration - doc.description += this.getPrimaryEffectDescription() + doc.description += this.description doc.flags.swade.expiration = CONFIG.SWADE.CONST.STATUS_EFFECT_EXPIRATION.EndOfTurnPrompt doc.flags.swade.loseTurnOnHold = true doc.flags[moduleName].maintainingId = maintId @@ -371,6 +378,10 @@ export class PowerEffect { text += ` on ${this.targets.map(t => t.name).join(', ')}` } text += '

' + const desc = this.description + if (desc) { + text += `
Description${desc}
` + } const effects = this.chatMessageEffects if (effects.length > 0) { text += '
Other Effects: