add entangle

This commit is contained in:
Mike Bloy 2024-05-19 18:44:20 -05:00
parent e92a2c3424
commit 6a7dd696ca
2 changed files with 116 additions and 0 deletions

View File

@ -0,0 +1,114 @@
import { moduleName } from '../globals.js';
import { PowerEffect } from './basePowers.js';
export class EntangleEffect extends PowerEffect {
get name() {
return 'Entangle';
}
get duration() {
return 0;
}
get icon() {
return 'icons/magic/nature/root-vine-entangled-humanoid.webp';
}
get isDamaging() {
return true;
}
get basePowerPoints() {
return 2;
}
get usePrimaryEffect() {
return false;
}
get isTargeted() {
return true;
}
get modifiers() {
return [
...super.modifiers,
{
type: 'select',
name: 'Damage',
id: 'damage',
epic: false,
default: 'none',
choices: {
none: 'None',
damage: 'Damage',
deadly: '⭐ Deadly',
},
effects: { none: null, damage: null, deadly: null },
values: { none: 0, damage: 2, deadly: 4 },
},
{
type: 'checkbox',
default: false,
name: 'Tough',
value: 1,
epic: false,
effect: false,
},
{
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 },
},
];
}
async createSecondaryEffects(maintId) {
const docs = await super.createSecondaryEffects(maintId);
const docLabel = this.data.raise ? 'SWADE.Bound' : 'SWADE.Entangled';
const docName = this.data.raise ? 'Bound' : 'Entangled';
const doc = await PowerEffect.getStatus(docLabel, docName, false);
doc.flags = mergeObject(doc.flags ?? {}, {
[moduleName]: {
powerEffect: true,
maintId,
},
});
if (this.data.damage !== 'none') {
const dmg = this.data.damage === 'deadly' ? '2d6' : '2d4';
doc.flags[moduleName].buttons = [
{
label: `Damage (${dmg})`,
type: 'damage',
formula: `${dmg}x`,
},
];
}
docs.push(doc);
return docs;
}
get description() {
let text = `
<p>Target(s) are restrained by something trapping-appropriate of Hardness
${this.data.tough ? 10 : 8}, and are ${this.data.raise ? 'Bound' : 'Entangled'}.
`;
if (this.data.damage !== 'none') {
text += `While restrained, victims take
${this.data.damage === 'deadly' ? '2d6' : '2d4'} damage at the end of
their turn.
`;
}
text += '</p>';
return super.description + text;
}
}

View File

@ -23,6 +23,7 @@ import { DivinationEffect } from './divination.js';
import { DrainPowerPointsEffect } from './drainPowerPoints.js'; import { DrainPowerPointsEffect } from './drainPowerPoints.js';
import { ElementalManipulationEffect } from './elementalManipulation.js'; import { ElementalManipulationEffect } from './elementalManipulation.js';
import { EmpathyEffect } from './empathy.js'; import { EmpathyEffect } from './empathy.js';
import { EntangleEffect } from './entangle.js';
const PowerClasses = { const PowerClasses = {
'arcane-protection': ArcaneProtectionEffect, 'arcane-protection': ArcaneProtectionEffect,
@ -53,6 +54,7 @@ const PowerClasses = {
'drain-power-points': DrainPowerPointsEffect, 'drain-power-points': DrainPowerPointsEffect,
'elemental-manipulation': ElementalManipulationEffect, 'elemental-manipulation': ElementalManipulationEffect,
empathy: EmpathyEffect, empathy: EmpathyEffect,
entangle: EntangleEffect,
'lower-trait': BoostLowerTraitEffect, 'lower-trait': BoostLowerTraitEffect,
}; };