add smite and fix VAE usage

This commit is contained in:
Mike Bloy 2024-06-02 17:05:45 -05:00
parent a8354b4983
commit 805f50c631
7 changed files with 114 additions and 7 deletions

View File

@ -154,7 +154,7 @@ export class PowerEffect {
name, name,
changes, changes,
description: `<p>From <strong>${this.source.name}</strong> casting <em>${this.name}</em></p>`, description: `<p>From <strong>${this.source.name}</strong> casting <em>${this.name}</em></p>`,
duration: { rounds: 99 }, duration: {},
flags: { flags: {
[moduleName]: { [moduleName]: {
powerEffect: true, powerEffect: true,
@ -456,14 +456,24 @@ export class PowerEffect {
const name = 'effects' in mod ? mod.effects[modValue].name : mod.name; const name = 'effects' in mod ? mod.effects[modValue].name : mod.name;
const changes = 'effects' in mod ? mod.effects[modValue].changes : mod.changes; const changes = 'effects' in mod ? mod.effects[modValue].changes : mod.changes;
const doc = this.createEffectDocument(icon, name, changes); const doc = this.createEffectDocument(icon, name, changes);
doc.statuses = doc.statuses ?? [];
doc.statuses.push('powerEffect');
if (this.duration === 0 && !this.usePrimaryEffect) { if (this.duration === 0 && !this.usePrimaryEffect) {
// set secondary effects of instant spells to expire on victim's next // set secondary effects of instant spells to expire on victim's next
// turn // turn
doc.duration.rounds = 1; doc.duration.rounds = 1;
doc.flags.swade.expiration = CONFIG.SWADE.CONST.STATUS_EFFECT_EXPIRATION.EndOfTurnAuto; doc.flags.swade.expiration = CONFIG.SWADE.CONST.STATUS_EFFECT_EXPIRATION.EndOfTurnAuto;
} else { } else {
doc.duration.seconds = 594;
doc.flags[moduleName].maintId = maintId; doc.flags[moduleName].maintId = maintId;
if (moduleHelpers.useVAE) {
doc.flags['visual-active-effects'] = {
data: {
inclusion: 1,
},
};
} else {
doc.duration.seconds = 594;
}
} }
docs.push(doc); docs.push(doc);
} }
@ -532,12 +542,18 @@ export class PowerEffect {
async createPrimaryEffect(maintId) { async createPrimaryEffect(maintId) {
const doc = this.basePrimaryEffect; const doc = this.basePrimaryEffect;
if (moduleHelpers.useVAE) { if (moduleHelpers.useVAE) {
doc.flags['visual-active-effects'] = { data: { content: this.description } }; doc.flags['visual-active-effects'] = {
data: {
content: this.description,
inclusion: 1,
},
};
} else { } else {
doc.description += this.description; doc.description += this.description;
} }
doc.statuses = doc.statuses ?? [];
doc.statuses.push('powerEffect');
doc.flags[moduleName].maintId = maintId; doc.flags[moduleName].maintId = maintId;
doc.duration.seconds = 594;
const effectButtons = this.primaryEffectButtons; const effectButtons = this.primaryEffectButtons;
if (effectButtons.length > 0) { if (effectButtons.length > 0) {
doc.flags[moduleName].buttons = effectButtons; doc.flags[moduleName].buttons = effectButtons;
@ -561,6 +577,8 @@ export class PowerEffect {
doc.flags.swade.loseTurnOnHold = true; doc.flags.swade.loseTurnOnHold = true;
doc.flags[moduleName].maintainingId = maintId; doc.flags[moduleName].maintainingId = maintId;
doc.flags[moduleName].targetIds = this.targets.map((t) => t.id); doc.flags[moduleName].targetIds = this.targets.map((t) => t.id);
doc.statuses = doc.statuses ?? [];
doc.statuses.push('powerMaintainEffect');
const effectButtons = this.maintEffectButtons; const effectButtons = this.maintEffectButtons;
if (effectButtons.length > 0) { if (effectButtons.length > 0) {
doc.flags[moduleName].buttons = effectButtons; doc.flags[moduleName].buttons = effectButtons;

View File

@ -51,6 +51,7 @@ export class EntangleEffect extends PowerEffect {
type: 'checkbox', type: 'checkbox',
default: false, default: false,
name: 'Tough', name: 'Tough',
id: 'tough',
value: 1, value: 1,
epic: false, epic: false,
effect: false, effect: false,

View File

@ -51,7 +51,7 @@ export class FlyEffect extends PowerEffect {
const doc = await PowerEffect.getStatus(docLabel, docName, false); const doc = await PowerEffect.getStatus(docLabel, docName, false);
doc.description = `<p>From <strong>${this.source.name}</strong> casting <em>${this.name}</em></p>`; doc.description = `<p>From <strong>${this.source.name}</strong> casting <em>${this.name}</em></p>`;
doc.flags = mergeObject(doc.flags ?? {}, { [moduleName]: { powerEffect: true } }); doc.flags = mergeObject(doc.flags ?? {}, { [moduleName]: { powerEffect: true } });
(doc.duration = { rounds: 99 }), (this.baseEffectDoc = doc); this.baseEffectDoc = doc;
} }
get basePrimaryEffect() { get basePrimaryEffect() {

View File

@ -70,7 +70,6 @@ export class InvisibliltyEffect extends PowerEffect {
const doc = await PowerEffect.getStatus('EFFECT.StatusInvisible', 'Invisible'); const doc = await PowerEffect.getStatus('EFFECT.StatusInvisible', 'Invisible');
doc.description = `<p>From <strong>${this.source.name}</strong> casting <em>${this.name}</em></p>`; doc.description = `<p>From <strong>${this.source.name}</strong> casting <em>${this.name}</em></p>`;
doc.flags = mergeObject(doc.flags ?? {}, { [moduleName]: { powerEffect: true } }); doc.flags = mergeObject(doc.flags ?? {}, { [moduleName]: { powerEffect: true } });
(doc.duration = { rounds: 99 }), (this.baseEffectDoc = doc);
this.basePrimaryEffectDoc = doc; this.basePrimaryEffectDoc = doc;
} }

View File

@ -52,6 +52,7 @@ import { ScryingEffect } from './scrying.js';
import { ShapeChangeEffect } from './shapeChange.js'; import { ShapeChangeEffect } from './shapeChange.js';
import { SlothSpeedEffect } from './slothSpeed.js'; import { SlothSpeedEffect } from './slothSpeed.js';
import { SlumberEffect } from './slumber.js'; import { SlumberEffect } from './slumber.js';
import { SmiteEffect } from './smite.js';
const PowerClasses = { const PowerClasses = {
'arcane-protection': ArcaneProtectionEffect, 'arcane-protection': ArcaneProtectionEffect,
@ -121,6 +122,7 @@ const PowerClasses = {
sloth: SlothSpeedEffect, sloth: SlothSpeedEffect,
speed: SlothSpeedEffect, speed: SlothSpeedEffect,
slumber: SlumberEffect, slumber: SlumberEffect,
smite: SmiteEffect,
}; };
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */

View File

@ -34,7 +34,6 @@ export class ProtectionEffect extends PowerEffect {
await super.parseValues(); await super.parseValues();
const doc = await PowerEffect.getStatus('SWADE.Protection', 'Protection', false); const doc = await PowerEffect.getStatus('SWADE.Protection', 'Protection', false);
doc.flags = mergeObject(doc.flags ?? {}, { [moduleName]: { powerEffect: true } }); doc.flags = mergeObject(doc.flags ?? {}, { [moduleName]: { powerEffect: true } });
(doc.duration = { rounds: 99 }), (this.baseEffectDoc = doc);
this.data.effect = doc; this.data.effect = doc;
} }

View File

@ -0,0 +1,88 @@
import { moduleName } from '../globals.js';
import { PowerEffect } from './basePowers.js';
export class SmiteEffect extends PowerEffect {
get name() {
return 'Smite';
}
get duration() {
return 5;
}
get icon() {
return 'systems/swade/assets/icons/status/status_smite.svg';
}
get isDamaging() {
return true;
}
get basePowerPoints() {
return 2;
}
get isTargeted() {
return true;
}
get hasAdditionalRecipients() {
return true;
}
get additionalRecipientCost() {
return 1;
}
get modifiers() {
return [
...super.modifiers,
{
type: 'checkbox',
default: false,
name: 'Greater Smite',
id: 'greater',
value: 2,
epic: true,
effect: false,
},
];
}
async parseValues() {
await super.parseValues();
this.baseDoc = await PowerEffect.getStatus('SWADE.Smite', 'Smite', false);
this.baseDoc.flags = mergeObject(this.baseDoc.flags ?? {}, {
[moduleName]: { powerEffect: true },
});
this.data.bonus = (this.data.raise ? 4 : 2) + (this.data.greater ? 2 : 0);
this.baseDoc.changes = [...this.getPrimaryEffectChanges()];
}
get basePrimaryEffect() {
return this.baseDoc;
}
getPrimaryEffectChanges() {
return [
...super.getPrimaryEffectChanges(),
{
key: 'system.stats.globalMods.damage',
value: this.data.bonus,
priority: 0,
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,
},
];
}
get description() {
let text = `
<p>Increase damage by ${this.data.bonus} on one weapon or load of ammunition.
`;
if (this.data.greater) {
text += 'The weapon is considered a Heavy Weapon.';
}
text += '</p>';
return super.description + text;
}
}