add damage field

This commit is contained in:
Mike Bloy 2024-05-15 21:22:43 -05:00
parent dea2fa95c4
commit 2caa2a4633
2 changed files with 111 additions and 105 deletions

View File

@ -0,0 +1,110 @@
import { PowerEffect } from './basePowers.js';
export class DamageFieldEffect extends PowerEffect {
get name() {
return 'Damage Field';
}
get icon() {
return 'icons/magic/defensive/shield-barrier-blades-teal.webp';
}
get duration() {
return 5;
}
get basePowerPoints() {
return 4;
}
get isTargeted() {
return true;
}
get oneTarget() {
return true;
}
get isRaisable() {
return false;
}
get modifiers() {
const mods = super.modifiers;
mods.push({
type: 'checkbox',
name: 'Area of Effect',
value: 2,
id: 'aoe',
epic: false,
effect: false,
});
mods.push({
type: 'checkbox',
name: 'Damage',
value: 2,
id: 'damage',
epic: false,
effect: false,
});
mods.push({
type: 'checkbox',
name: 'Greater Damage Field',
value: 4,
id: 'greater',
epic: true,
effect: false,
});
mods.push({
type: 'checkbox',
name: 'Mobile',
value: 2,
id: 'mobile',
epic: false,
effect: false,
});
return mods;
}
get description() {
let desc = super.description;
let area = 'all adjacent creatures';
let damage = '2d4';
if (this.data.greater) {
damage = '3d6 (heavy weapon)';
} else if (this.data.damage) {
damage = '2d6';
}
if (this.data.aoe) {
area = 'all creatures within a MBT';
}
desc += `<p>At the end of the recipient's turn, ${area}
automatically take ${damage} damage.`;
if (this.data.mobile) {
desc += `The caster may detach the damage field from the recipient and
move it up to his Smarts die type each round, as a limited free action.`;
}
desc += '</p>';
return desc;
}
getPrimaryEffectChanges() {
const base = 'flags.swade.auras.damagefield';
const priority = 0;
const mode = foundry.CONST.ACTIVE_EFFECT_MODES.OVERRIDE;
const changes = [
{ key: `${base}.enabled`, value: true, priority, mode },
{ key: `${base}.walls`, value: true, priority, mode },
{ key: `${base}.color`, value: '#ffcc00', priority, mode },
{ key: `${base}.alpha`, value: 0.1, priority, mode },
{
key: `${base}.radius`,
value: this.data.aoe ? 1.5 : 0.5,
priority,
mode,
},
{ key: `${base}.visibleTo`, value: [-1, 0, 1], priority, mode },
];
return changes;
}
}

View File

@ -13,111 +13,7 @@ import { BoostLowerTraitEffect } from './boostLowerTrait.js';
import { BurstEffect } from './burst.js'; import { BurstEffect } from './burst.js';
import { ConfusionEffect } from './confusion.js'; import { ConfusionEffect } from './confusion.js';
import { CurseEffect } from './curse.js'; import { CurseEffect } from './curse.js';
import { DamageFieldEffect } from './damageField.js';
class DamageFieldEffect extends PowerEffect {
get name() {
return 'Damage Field';
}
get icon() {
return 'icons/magic/defensive/shield-barrier-blades-teal.webp';
}
get duration() {
return 5;
}
get basePowerPoints() {
return 4;
}
get isTargeted() {
return true;
}
get oneTarget() {
return true;
}
get isRaisable() {
return false;
}
get modifiers() {
const mods = super.modifiers;
mods.push({
name: 'Area of Effect',
value: 2,
id: 'aoe',
epic: false,
effect: false,
});
mods.push({
name: 'Damage',
value: 2,
id: 'damage',
epic: false,
effect: false,
});
mods.push({
name: 'Greater Damage Field',
value: 4,
id: 'greater',
epic: true,
effect: false,
});
mods.push({
name: 'Mobile',
value: 2,
id: 'mobile',
epic: false,
effect: false,
});
return mods;
}
get description() {
let desc = super.description;
let area = 'all adjacent creatures';
let damage = '2d4';
if (this.data.mods.has('greater')) {
damage = '3d6 (heavy weapon)';
} else if (this.data.mods.has('damage')) {
damage = '2d6';
}
if (this.data.mods.has('aoe')) {
area = 'all creatures within a MBT';
}
desc += `<p>At the end of the recipient's turn, ${area}
automatically take ${damage} damage.`;
if (this.data.mods.has('mobile')) {
desc += `The caster may detach the damage field from the recipient and
move it up to his Smarts die type each round, as a limited free action.`;
}
desc += '</p>';
return desc;
}
getPrimaryEffectChanges() {
const base = 'flags.swade.auras.damagefield';
const priority = 0;
const mode = foundry.CONST.ACTIVE_EFFECT_MODES.OVERRIDE;
const changes = [
{ key: `${base}.enabled`, value: true, priority, mode },
{ key: `${base}.walls`, value: true, priority, mode },
{ key: `${base}.color`, value: '#ffcc00', priority, mode },
{ key: `${base}.alpha`, value: 0.1, priority, mode },
{
key: `${base}.radius`,
value: this.data.mods.has('aoe') ? 1.5 : 0.5,
priority,
mode,
},
{ key: `${base}.visibleTo`, value: [-1, 0, 1], priority, mode },
];
return changes;
}
}
class DarksightEffect extends PowerEffect { class DarksightEffect extends PowerEffect {
get name() { get name() {