This commit is contained in:
Mike Bloy 2024-05-20 23:54:32 -05:00
parent d85c11088a
commit 3062e1bfcb
2 changed files with 109 additions and 0 deletions

107
src/module/powers/havoc.js Normal file
View File

@ -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 +
`<p>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.
</p>`
);
}
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);
}
}

View File

@ -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,
};