diff --git a/src/module/powers/confusion.js b/src/module/powers/confusion.js new file mode 100644 index 0000000..4b5581f --- /dev/null +++ b/src/module/powers/confusion.js @@ -0,0 +1,112 @@ +import { PowerEffect } from './basePowers.js'; + +export class ConfusionEffect extends PowerEffect { + get name() { + return 'Confusion'; + } + + get icon() { + return 'icons/magic/control/hypnosis-mesmerism-swirl.webp'; + } + + get duration() { + return 0; + } + + get isTargeted() { + return true; + } + + get usePrimaryEffect() { + return false; + } + + get basePowerPoints() { + return 2; + } + + get hasAoe() { + return true; + } + + get modifiers() { + const mods = super.modifiers; + mods.push({ + type: 'select', + default: 'mbt', + name: 'Area of Effect', + id: 'aoe', + epic: false, + choices: { + sbt: 'Small Blast Template', + mbt: 'Medium Blast Template', + lbt: 'Large Blast Template', + }, + effects: { sbt: null, mbt: null, lbt: null }, + values: { sbt: 0, mbt: 0, lbt: 1 }, + }); + mods.push({ + name: 'Greater Confusion', + value: 2, + id: 'greater', + epic: true, + type: 'checkbox', + effect: false, + }); + return mods; + } + + get powerPoints() { + let total = super.powerPoints; + total += this.data.aoe === 'l' ? 1 : 0; + return total; + } + + get menuButtons() { + const data = [ + { label: 'Apply with Distracted', value: 'distracted' }, + { label: 'Apply with Vulnerable', value: 'vulnerable' }, + { label: 'Apply with both (raise)', value: 'raise' }, + { label: 'Cancel', value: 'cancel' }, + ]; + return data; + } + + async parseValues() { + await super.parseValues(); + this.data.distracted = this.data.button === 'distracted' || this.data.button === 'raise'; + this.data.vulnerable = this.data.button === 'vulnerable' || this.data.button === 'raise'; + } + + get description() { + const size = this.data.aoe.toUpperCase(); + let effect = 'Vulnerable'; + if (this.data.raise) { + effect = 'both Distracted and Vulnerable'; + } else if (this.data.distracted) { + effect = 'Distracted'; + } + if (this.data.Greater) { + effect += ' as well as Shaken'; + } + return ( + super.description + + ` +

The targets in the ${size} are ${effect}.

` + ); + } + + async createSecondaryEffects(maintId) { + const docs = await super.createSecondaryEffects(maintId); + if (this.data.distracted) { + PowerEffect.getStatus('SWADE.Distr', 'Distracted', false).then((v) => docs.push(v)); + } + if (this.data.vulnerable) { + PowerEffect.getStatus('SWADE.Vuln', 'Vulnerable', false).then((v) => docs.push(v)); + } + if (this.data.greater) { + PowerEffect.getStatus('SWADE.Shaken', 'Shaken', false).then((v) => docs.push(v)); + } + return docs; + } +} diff --git a/src/module/powers/curse.js b/src/module/powers/curse.js new file mode 100644 index 0000000..dad1ad2 --- /dev/null +++ b/src/module/powers/curse.js @@ -0,0 +1,64 @@ +import { PowerEffect } from './basePowers.js'; + +export class CurseEffect extends PowerEffect { + get name() { + return 'Curse'; + } + + get icon() { + return 'icons/magic/control/voodoo-doll-pain-damage-purple.webp'; + } + + get duration() { + return 500 * 24 * 60 * 6; + } + + get isTargeted() { + return true; + } + + get oneTarget() { + return true; + } + + get isRaisable() { + return false; + } + + get basePowerPoints() { + return 5; + } + + get modifiers() { + const mods = super.modifiers; + mods.push({ + name: 'Turn to Stone', + type: 'checkbox', + value: 5, + id: 'turntostone', + epic: true, + effect: false, + }); + return mods; + } + + get description() { + let desc = super.description; + desc += `

The victim must defend with a Spirit roll opposed by the + caster's arcane skill roll. Failure means the victim suffers a level + of Fatigue immediately.

`; + if (this.data.turntostone) { + desc += `

On every following run the victim must make a Spirit roll + or take a level of Fatigue. When Incapacitated, the victim turns to + stone, with a Hardness equal to his Tougness.

`; + } else { + desc += `

At sunset every day, the victim suffers a level of Fatigue. + When Incapacitated by this, he makes a Vigor roll each day to avoid + death.

`; + } + desc += `

Breaking the curse: The curse can be lifted by + the original caster at will, and ends if the caster is slain. Dispel at -2 + also removes the curse, but each individual may only try once.

`; + return desc; + } +} diff --git a/src/module/powers/powers.js b/src/module/powers/powers.js index e5367a6..3e717a0 100644 --- a/src/module/powers/powers.js +++ b/src/module/powers/powers.js @@ -11,179 +11,8 @@ import { BoltEffect } from './bolt.js'; import { BurrowEffect } from './burrow.js'; import { BoostLowerTraitEffect } from './boostLowerTrait.js'; import { BurstEffect } from './burst.js'; - -class ConfusionEffect extends PowerEffect { - get name() { - return 'Confusion'; - } - - get icon() { - return 'icons/magic/control/hypnosis-mesmerism-swirl.webp'; - } - - get duration() { - return 0; - } - - get isTargeted() { - return true; - } - - get usePrimaryEffect() { - return false; - } - - get basePowerPoints() { - return 2; - } - - get hasAoe() { - return true; - } - - get menuInputs() { - const inputs = super.menuInputs; - inputs.push({ - type: 'select', - label: 'Area of Effect', - options: [ - { html: 'Small Blast Template (0)', value: 's', selected: false }, - { html: 'Medium Blast Template (0)', value: 'm', selected: true }, - { html: 'Large Blast Template (+1)', value: 'l', selected: false }, - ], - }); - return inputs; - } - - get modifiers() { - const mods = super.modifiers; - mods.push({ - name: 'Greater Confusion', - value: 2, - id: 'greater', - epic: true, - effect: false, - }); - return mods; - } - - get powerPoints() { - let total = super.powerPoints; - total += this.data.aoe === 'l' ? 1 : 0; - return total; - } - - get menuButtons() { - const data = [ - { label: 'Apply with Distracted', value: 'distracted' }, - { label: 'Apply with Vulnerable', value: 'vulnerable' }, - { label: 'Apply with both (raise)', value: 'raise' }, - { label: 'Cancel', value: 'cancel' }, - ]; - return data; - } - - async parseValues() { - await super.parseValues(); - this.data.distracted = this.data.button === 'distracted' || this.data.button === 'raise'; - this.data.vulnerable = this.data.button === 'vulnerable' || this.data.button === 'raise'; - this.data.aoe = this.data.values.shift(); - } - - get description() { - const size = this.data.aoe === 'l' ? 'LBT' : this.data.aoe === 's' ? 'SBT' : 'MBT'; - let effect = 'Vulnerable'; - if (this.data.raise) { - effect = 'both Distracted and Vulnerable'; - } else if (this.data.distracted) { - effect = 'Distracted'; - } - if (this.data.mods.has('Greater')) { - effect += ' as well as Shaken'; - } - return ( - super.description + - ` -

The targets in the ${size} are ${effect}.

` - ); - } - - async createSecondaryEffects(maintId) { - const docs = await super.createSecondaryEffects(maintId); - if (this.data.distracted) { - PowerEffect.getStatus('SWADE.Distr', 'Distracted', false).then((v) => docs.push(v)); - } - if (this.data.distracted) { - PowerEffect.getStatus('SWADE.Vuln', 'Vulnerable', false).then((v) => docs.push(v)); - } - if (this.data.mods.has('greater')) { - PowerEffect.getStatus('SWADE.Shaken', 'Shaken', false).then((v) => docs.push(v)); - } - return docs; - } -} - -class CurseEffect extends PowerEffect { - get name() { - return 'Curse'; - } - - get icon() { - return 'icons/magic/control/voodoo-doll-pain-damage-purple.webp'; - } - - get duration() { - return 500 * 24 * 60 * 6; - } - - get isTargeted() { - return true; - } - - get oneTarget() { - return true; - } - - get isRaisable() { - return false; - } - - get basePowerPoints() { - return 5; - } - - get modifiers() { - const mods = super.modifiers; - mods.push({ - name: 'Turn to Stone', - value: 5, - id: 'turntostone', - epic: true, - effect: false, - }); - return mods; - } - - get description() { - let desc = super.description; - desc += `

The victim must defend with a Spirit roll opposed by the - caster's arcane skill roll. Failure means the victim suffers a level - of Fatigue immediately.

`; - if (this.data.mods.has('turntostone')) { - desc += `

On every following run the victim must make a Spirit roll - or take a level of Fatigue. When Incapacitated, the victim turns to - stone, with a Hardness equal to his Tougness.

`; - } else { - desc += `

At sunset every day, the victim suffers a level of Fatigue. - When Incapacitated by this, he makes a Vigor roll each day to avoid - death.

`; - } - desc += `

Breaking the curse: The curse can be lifted by - the original caster at will, and ends if the caster is slain. Dispel at -2 - also removes the curse, but each individual may only try once.

`; - return desc; - } -} +import { ConfusionEffect } from './confusion.js'; +import { CurseEffect } from './curse.js'; class DamageFieldEffect extends PowerEffect { get name() {