121 lines
2.5 KiB
JavaScript

import { PowerEffect } from './basePowers.js';
export class BarrierEffect extends PowerEffect {
get name() {
return 'Barrier';
}
get duration() {
return 5;
}
get icon() {
return 'icons/environment/settlement/fence-stone-brick.webp';
}
get isTargeted() {
return false;
}
get isDamaging() {
return true;
}
get basePowerPoints() {
return 2;
}
get usePrimaryEffect() {
return false;
}
get modifiers() {
const mods = super.modifiers;
mods.push({
type: 'select',
name: 'Damage',
id: 'damage',
epic: false,
choices: {
none: 'None',
damage: 'Damage',
immaterial: 'Damage (immaterial)',
deadly: '⭐ Deadly',
},
effects: { none: null, damage: null, immaterial: null, deadly: null },
values: { none: 0, damage: 1, immaterial: 0, deadly: 2 },
});
mods.push({
type: 'checkbox',
name: 'Hardened',
id: 'hardened',
value: 1,
epic: false,
effect: false,
});
mods.push({
type: 'checkbox',
name: 'Shaped',
id: 'shaped',
value: 1,
epic: false,
effect: false,
});
mods.push({
type: 'checkbox',
name: 'Size',
id: 'size',
value: 1,
epic: false,
effect: false,
});
return mods;
}
get _length() {
let height = 10;
if (this.data.raise) {
height *= 2;
}
if (this.data.size) {
height *= 2;
}
return `${height}" (${height * 2} yards)`;
}
get _height() {
return `${this.data.size ? '2" (4' : '1" (2'} yards)`;
}
get _hardness() {
return (this.data.raise ? 12 : 10) + (this.data.hardened ? 2 : 0);
}
get maintEffectButtons() {
const buttons = super.primaryEffectButtons;
if (this.data.damage != 'none') {
const damage = this.data.damage === 'deadly' ? '2d6' : '2d4';
buttons.push({
label: `Damage (${damage})`,
type: 'damage',
formula: damage + 'x',
});
}
return buttons;
}
get description() {
let text = super.description;
text += `<p>A barrier ${this._height} tall and ${this._length} long, of hardness ${this._hardness}. `;
if (this.data.damage === 'deadly') {
text += 'It does 2d6 damage to anyone who contacts it. ';
} else if (this.data.damage != 'none') {
text += 'It does 2d4 damage to anyone who contacts it. ';
}
if (this.data.shaped) {
text += 'It was shaped into a circle, square, or rectangle. ';
}
text += '</p>';
return text;
}
}