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 = `
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 += '
'; return super.description + text; } }