diff --git a/src/module/powers/basePowers.js b/src/module/powers/basePowers.js index 373d6eb..a82bcc0 100644 --- a/src/module/powers/basePowers.js +++ b/src/module/powers/basePowers.js @@ -117,7 +117,7 @@ export class PowerFormApplication extends FormApplication { formData.submit = ev?.submitter?.value ?? 'cancel'; if (formData.submit !== 'cancel') { this.powerEffect.formData = formData; - await this.powerEffect.applyEffect(); + this.powerEffect.applyEffect(); } } } @@ -447,6 +447,29 @@ export class PowerEffect { } } + enhanceSecondaryEffect(maintId, doc) { + doc.statuses = doc.statuses ?? []; + doc.statuses.push('powerEffect'); + if (this.duration === 0 && !this.usePrimaryEffect) { + // set secondary effects of instant spells to expire on victim's next + // turn + doc.duration.rounds = 1; + doc.flags.swade.expiration = CONFIG.SWADE.CONST.STATUS_EFFECT_EXPIRATION.EndOfTurnAuto; + } else { + doc.flags[moduleName].maintId = maintId; + if (moduleHelpers.useVAE) { + doc.flags['visual-active-effects'] = { + data: { + inclusion: 1, + }, + }; + } else { + doc.duration.seconds = 594; + } + } + return doc; + } + async createSecondaryEffects(maintId) { const docs = []; for (const mod of this.modifiers) { @@ -455,26 +478,7 @@ export class PowerEffect { const icon = 'effects' in mod ? mod.effects[modValue].icon : mod.icon; const name = 'effects' in mod ? mod.effects[modValue].name : mod.name; const changes = 'effects' in mod ? mod.effects[modValue].changes : mod.changes; - const doc = this.createEffectDocument(icon, name, changes); - doc.statuses = doc.statuses ?? []; - doc.statuses.push('powerEffect'); - if (this.duration === 0 && !this.usePrimaryEffect) { - // set secondary effects of instant spells to expire on victim's next - // turn - doc.duration.rounds = 1; - doc.flags.swade.expiration = CONFIG.SWADE.CONST.STATUS_EFFECT_EXPIRATION.EndOfTurnAuto; - } else { - doc.flags[moduleName].maintId = maintId; - if (moduleHelpers.useVAE) { - doc.flags['visual-active-effects'] = { - data: { - inclusion: 1, - }, - }; - } else { - doc.duration.seconds = 594; - } - } + const doc = this.enhanceSecondaryEffect(maintId, this.createEffectDocument(icon, name, changes)); docs.push(doc); } } diff --git a/src/module/powers/blind.js b/src/module/powers/blind.js index 1c0b7f5..77675c0 100644 --- a/src/module/powers/blind.js +++ b/src/module/powers/blind.js @@ -69,7 +69,7 @@ export class BlindEffect extends PowerEffect { const docs = await super.createSecondaryEffects(maintId); if (this.data.raise) { const strong = this.data.strong; - const doc = this.createEffectDocument(this.icon, `Blinded (${strong ? 'Strong, ' : ''}Raise)`, [ + let doc = this.createEffectDocument(this.icon, `Blinded (${strong ? 'Strong, ' : ''}Raise)`, [ { key: 'system.stats.globalMods.trait', value: -2, @@ -77,9 +77,8 @@ export class BlindEffect extends PowerEffect { mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD, }, ]); - doc.duration.seconds = 594; + doc = this.enhanceSecondaryEffect(maintId, doc); doc.description = this.description + '
This is the raise effect which can be shaken off separately.
'; - doc.flags[moduleName].maintId = maintId; docs.push(doc); } return docs; diff --git a/src/module/powers/boostLowerTrait.js b/src/module/powers/boostLowerTrait.js index 63d5592..22ef770 100644 --- a/src/module/powers/boostLowerTrait.js +++ b/src/module/powers/boostLowerTrait.js @@ -70,10 +70,8 @@ export class BoostLowerTraitEffect extends PowerEffect { mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD, }, ]; - const doc = this.createEffectDocument(this.icon, name, changes); - doc.duration.seconds = 594; + const doc = this.enhanceSecondaryEffect(maintId, this.createEffectDocument(this.icon, name, changes)); doc.description = this.description + 'This is the raise effect which can be shaken off separately.
'; - doc.flags[moduleName].maintId = maintId; docs.push(doc); } return docs; diff --git a/src/module/powers/powers.js b/src/module/powers/powers.js index 236c568..ddb03f3 100644 --- a/src/module/powers/powers.js +++ b/src/module/powers/powers.js @@ -56,6 +56,7 @@ import { SmiteEffect } from './smite.js'; import { SoundSilenceEffect } from './soundSilence.js'; import { SpeakLanguageEffect } from './speakLanguage.js'; import { StunEffect } from './stun.js'; +import { SummonAllyEffect } from './summon.js'; const PowerClasses = { 'arcane-protection': ArcaneProtectionEffect, @@ -132,6 +133,7 @@ const PowerClasses = { sound: SoundSilenceEffect, 'speak-language': SpeakLanguageEffect, stun: StunEffect, + 'summon-ally': SummonAllyEffect, }; /* ---------------------------------------------------------------- */ diff --git a/src/module/powers/summon.js b/src/module/powers/summon.js index c0657e5..2b422ef 100644 --- a/src/module/powers/summon.js +++ b/src/module/powers/summon.js @@ -1,4 +1,5 @@ /* globals Portal */ +import { moduleName } from '../globals.js'; import { ActorFolderEffect } from './basePowers.js'; class BaseSummonEffect extends ActorFolderEffect { @@ -80,16 +81,79 @@ class BaseSummonEffect extends ActorFolderEffect { if (!(this.hasIncreasedTrait && this?.data?.increasedTrait)) { return; } + const skillSet = new Set(); + for (const skill of this.targetActor.items.filter((i) => i.type === 'skill')) { + skillSet.add(skill.name); + } + for (const item of Object.values(this.data.embeddedUpdates.Item).filter((i) => i.type === 'skill')) { + skillSet.add(item.name); + } + const skillList = Array.from(skillSet); + skillList.sort(); + const attrList = ['Agility', 'Smarts', 'Spirit', 'Strength', 'Vigor']; + let html = `