From 2dda9d76a4cc03a27c5ed73bc7ffb3d04d7a9d35 Mon Sep 17 00:00:00 2001 From: Mike Bloy Date: Sun, 19 May 2024 00:33:37 -0500 Subject: [PATCH] empathy --- src/module/powers/basePowers.js | 14 ++++- src/module/powers/empathy.js | 105 ++++++++++++++++++++++++++++++++ src/module/powers/powers.js | 2 + 3 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 src/module/powers/empathy.js diff --git a/src/module/powers/basePowers.js b/src/module/powers/basePowers.js index fb222ed..0cc5e4a 100644 --- a/src/module/powers/basePowers.js +++ b/src/module/powers/basePowers.js @@ -422,6 +422,18 @@ export class PowerEffect { return changes; } + getMaintainEffectChanges() { + const changes = [ + { + key: 'flags.swade-mb-helpers.powerMaintained', + value: 1, + priority: 0, + mode: foundry.CONST.ACTIVE_EFFECT_MODES.OVERRIDE, + }, + ]; + return changes; + } + get description() { return ''; } @@ -473,7 +485,7 @@ export class PowerEffect { if (!this.usePrimaryEffect) { icon = this.icon; } - const doc = this.createEffectDocument(icon, `Maintaining ${this.effectName}`, []); + const doc = this.createEffectDocument(icon, `Maintaining ${this.effectName}`, this.getMaintainEffectChanges()); doc.duration.rounds = this.duration; if (moduleHelpers.useVAE) { doc.flags['visual-active-effects'] = { data: { content: this.description } }; diff --git a/src/module/powers/empathy.js b/src/module/powers/empathy.js new file mode 100644 index 0000000..525e86d --- /dev/null +++ b/src/module/powers/empathy.js @@ -0,0 +1,105 @@ +import { PowerEffect } from './basePowers.js'; + +export class EmpathyEffect extends PowerEffect { + get name() { + return 'Empathy'; + } + + get duration() { + return 5 * (this?.data?.duration ?? false ? 10 : 1); + } + + get icon() { + return 'icons/skills/social/diplomacy-handshake-yellow.webp'; + } + + get hasAdditionalRecipients() { + return true; + } + + get additionalRecipientCost() { + return 1; + } + + get basePowerPoints() { + return 1; + } + + get isTargeted() { + return true; + } + + get modifiers() { + return [ + ...super.modifiers, + { + name: 'Charm', + type: 'checkbox', + id: 'charm', + value: 2, + epic: false, + effect: false, + }, + { + name: 'Duration', + type: 'checkbox', + id: 'duration', + value: 1, + epic: false, + effect: false, + }, + { + name: 'Truth', + type: 'checkbox', + id: 'truth', + value: 2, + epic: true, + effect: false, + }, + ]; + } + + get effectName() { + const extra = []; + if (this.data.charm) { + extra.push('Charm'); + } + if (this.data.truth) { + extra.push('Truth'); + } + const extraText = extra.length ? ` (${extra.join(', ')})` : ''; + return this.name + extraText; + } + + getMaintainEffectChanges() { + const mode = foundry.CONST.ACTIVE_EFFECT_MODES.ADD; + const value = this.data.raise ? 2 : 1; + return ['Intimidation', 'Persuasion', 'Performance', 'Taunt', 'Riding'].map(function (skill) { + return { + key: `@Skill{${skill}}[system.die.modifier]`, + priority: 0, + mode, + value, + }; + }); + } + + get description() { + let text = super.description; + text += ` +

Opposed by Spirit. If the target fails, caster gets + +${this.data.raise ? 2 : 1} to Intimidation, Persuasion, Performance, + Taunt or Riding (if target is an animal) rolls vs the target, except for + rolls to activate powers.

`; + if (this.data.charm) { + text += `

an Uncooperative target is made + ${this.data.raise ? 'Friendly' : 'Cooperative'}. + The spell ends instantly if the caster's group attacks the victim's group.

`; + } + if (this.data.truth) { + text += '

The caster knows if the targets believe they are telling the truth.

'; + } + + return text; + } +} diff --git a/src/module/powers/powers.js b/src/module/powers/powers.js index c8d905c..7e7aa1b 100644 --- a/src/module/powers/powers.js +++ b/src/module/powers/powers.js @@ -22,6 +22,7 @@ import { DispelEffect } from './dispel.js'; import { DivinationEffect } from './divination.js'; import { DrainPowerPointsEffect } from './drainPowerPoints.js'; import { ElementalManipulationEffect } from './elementalManipulation.js'; +import { EmpathyEffect } from './empathy.js'; const PowerClasses = { 'arcane-protection': ArcaneProtectionEffect, @@ -51,6 +52,7 @@ const PowerClasses = { divination: DivinationEffect, 'drain-power-points': DrainPowerPointsEffect, 'elemental-manipulation': ElementalManipulationEffect, + empathy: EmpathyEffect, 'lower-trait': BoostLowerTraitEffect, };