diff --git a/src/module/powers/havoc.js b/src/module/powers/havoc.js new file mode 100644 index 0000000..3eadae9 --- /dev/null +++ b/src/module/powers/havoc.js @@ -0,0 +1,107 @@ +import { requestRollFromTokens } from '../helpers.js'; +import { PowerEffect } from './basePowers.js'; + +export class HavocEffect extends PowerEffect { + get name() { + return 'Havoc'; + } + + get icon() { + return 'icons/magic/air/wind-vortex-swirl-blue-purple.webp'; + } + + get duration() { + return 0; + } + + get isTargeted() { + return true; + } + + get usePrimaryEffect() { + return false; + } + + get isDamaging() { + return true; + } + + get basePowerPoints() { + return 3; + } + + get hasAoe() { + return true; + } + + get modifiers() { + const mods = super.modifiers; + mods.push( + { + name: 'Area of Effect', + id: 'aoe', + type: 'select', + default: 'mbt', + choices: { + mbt: 'Medium Blast Template', + cone: 'Cone Template', + lbt: 'Large Blast Template', + }, + effects: { cone: null, mbt: null, lbt: null }, + values: { cone: 0, mbt: 0, lbt: 1 }, + epic: false, + }, + { + name: 'Greater Havoc', + value: 2, + id: 'greater', + epic: true, + effect: false, + }, + ); + return mods; + } + + get description() { + const pushBack = this.data.greater ? '3d6' : '2d6'; + const dmg = this.data.greater ? '2d4' : '2d6'; + const size = this.data.aoe === 'cone' ? 'Cone template originating from the caster' : this.data.aoe.toUpperCase(); + return ( + super.description + + `

The vortex covers a ${size}. Creatures + caught inside are Distracted, then must make a + Strength${this.data.raise ? ' -2' : ''} check or be flung + [[/r ${pushBack}]]". If they strike a hard surface, they take ${dmg} damage. +

` + ); + } + + async createSecondaryEffects() { + const docs = await super.createSecondaryEffects(); + docs.push(await PowerEffect.getStatus('SWADE.Distr', 'Distracted', false)); + return docs; + } + + async sideEffects() { + await super.sideEffects(); + + const resistMods = function (token) { + const mods = []; + if (token.actor.effects.find((e) => e.name === 'Flying')) { + mods.push({ label: 'Flying', value: -2 }); + } + return mods; + }; + + const options = { + title: 'Resisting Havoc', + flavor: 'Havoc!', + mods: [], + modCallback: resistMods, + }; + if (this.data.raise) { + options.mods.push({ label: 'vs Raise', value: -2 }); + } + await requestRollFromTokens(this.targets, 'attribute', 'strength', options); + } +} diff --git a/src/module/powers/powers.js b/src/module/powers/powers.js index bf53fbf..c2055e4 100644 --- a/src/module/powers/powers.js +++ b/src/module/powers/powers.js @@ -29,6 +29,7 @@ import { FarsightEffect } from './farsight.js'; import { FearEffect } from './fear.js'; import { FlyEffect } from './fly.js'; import { GrowthShrinkEffect } from './growthShrink.js'; +import { HavocEffect } from './havoc.js'; const PowerClasses = { 'arcane-protection': ArcaneProtectionEffect, @@ -67,6 +68,7 @@ const PowerClasses = { growth: GrowthShrinkEffect, 'growth-shrink': GrowthShrinkEffect, growthshrink: GrowthShrinkEffect, + havoc: HavocEffect, 'lower-trait': BoostLowerTraitEffect, shrink: GrowthShrinkEffect, };