add sloth/speed

This commit is contained in:
Mike Bloy 2024-06-01 23:57:57 -05:00
parent 0c0fb1a3a8
commit 140381e1d1
4 changed files with 194 additions and 1 deletions

View File

@ -108,6 +108,7 @@ export class PowerFormApplication extends FormApplication {
data.recipients.count = this.powerEffect.additionalRecipientCount;
data.recipients.total = data.recipients.cost * data.recipients.count;
data.recipients.epic = this.powerEffect.additionalRecipientsIsEpic;
data.recipients.text = this.powerEffect.additionalRecipientText;
}
return data;
}
@ -217,6 +218,10 @@ export class PowerEffect {
return false;
}
get additionalRecipientText() {
return 'Additional Recipients';
}
get additionalRecipientCount() {
if (!this.hasAdditionalRecipients) {
return 0;

View File

@ -49,6 +49,7 @@ import { ResurrectionEffect } from './resurrection.js';
import { SanctuaryEffect } from './sanctuary.js';
import { ScryingEffect } from './scrying.js';
import { ShapeChangeEffect } from './shapeChange.js';
import { SlothSpeedEffect } from './slothSpeed.js';
const PowerClasses = {
'arcane-protection': ArcaneProtectionEffect,
@ -112,6 +113,10 @@ const PowerClasses = {
scrying: ScryingEffect,
'shape-change': ShapeChangeEffect,
shrink: GrowthShrinkEffect,
slothspeed: SlothSpeedEffect,
'sloth-speed': SlothSpeedEffect,
sloth: SlothSpeedEffect,
speed: SlothSpeedEffect,
};
/* ---------------------------------------------------------------- */

View File

@ -0,0 +1,183 @@
import { PowerEffect } from './basePowers.js';
export class SlothSpeedEffect extends PowerEffect {
get name() {
return 'Sloth/Speed';
}
get hasAdditionalRecipients() {
return (this?.data?.direction ?? 'Speed') == 'Speed';
}
get additionalRecipientCost() {
return 1;
}
get additionalRecipientText() {
return `${super.additionalRecipientText} (speed only)`;
}
get icon() {
return this?.data?.direction === 'Sloth'
? 'icons/magic/control/debuff-energy-snare-brown.webp'
: 'icons/skills/movement/figure-running-gray.webp';
}
get duration() {
return this?.data?.direction === 'Sloth' ? 0 : 5;
}
get isTargeted() {
return true;
}
get basePowerPoints() {
return 2;
}
get hasAoe() {
return true;
}
get modifiers() {
const mods = super.modifiers;
mods.push({
sortOrder: -2,
name: 'Sloth or Speed?',
id: 'direction',
type: 'radio',
default: 'Sloth',
epic: false,
choices: { Sloth: 'Sloth', Speed: 'Speed' },
effects: { Sloth: null, Speed: null },
values: { Sloth: 0, Speed: 0 },
});
mods.push({
type: 'select',
default: 'none',
name: 'Area of Effect (Sloth Only)',
id: 'aoe',
epic: false,
choices: {
none: 'None',
mbt: 'Medium Blast Template',
lbt: 'Large Blast Template',
},
effects: { none: null, mbt: null, lbt: null },
values: { none: 0, mbt: 2, lbt: 3 },
});
mods.push({
name: 'Dash (Speed only)',
id: 'dash',
type: 'checkbox',
default: false,
epic: false,
effect: false,
value: 2,
});
mods.push({
name: 'Quickness (Speed only)',
id: 'quickness',
type: 'checkbox',
default: false,
epic: false,
effect: false,
value: 2,
});
mods.push({
name: 'Strong (Sloth only)',
id: 'strong',
type: 'checkbox',
default: false,
value: 1,
epic: false,
effect: false,
});
return mods;
}
getPrimaryEffectChanges() {
const changes = [
{
key: 'system.stats.speed.value',
value: -1,
priority: 0,
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,
},
];
return [...super.getPrimaryEffectChanges(), ...changes];
}
async primaryDocForTarget(doc, target) {
const newDoc = await super.primaryDocForTarget(doc, target);
const modValue = this.data.direction === 'Sloth' ? -0.5 : 1;
const idx = newDoc.changes.length - 1;
newDoc.changes[idx].value = Math.ceil(target.actor.system.stats.speed.value * modValue);
return newDoc;
}
get effectName() {
let name = `${this.data.raise ? 'major' : 'minor'} ${this.data.direction}`;
const parts = [];
if (this.data.direction === 'Sloth' && this.data.strong) {
parts.push('strong');
}
if (this.data.direction === 'Speed') {
if (this.data.dash) {
parts.push('dash');
}
if (this.data.quickness) {
parts.push('quickness');
}
}
if (parts.length > 0) {
name = `${name} (${parts.join(', ')})`;
}
return name;
}
get description() {
let desc = super.description;
if (this.data.direction === 'Sloth') {
desc += `<p>Target's pace is reduced by half (round up). `;
if (this.data.raise) {
desc += `For the target, movement is also an action. `;
}
desc += `</p><p>The target tries to shake off the effects at the end of
subsequent turns with a Spirit roll${this.data.strong ? ' at -2' : ''}.</p>`;
} else {
desc += `<p>Target's pace is doubled. `;
if (this.data.raise) {
desc += `The target also ignores the -2 running penalty. `;
}
if (this.data.dash) {
desc += `When running, the target runs as if they rolled the maximum on
their running die. `;
}
if (this.data.quickness) {
desc += `The target's total Multi-Action penalty each turn is reduced by 2.`;
}
desc += '</p>';
}
return desc;
}
get primaryEffectButtons() {
const buttons = super.primaryEffectButtons;
if (this.data.direction === 'Sloth') {
const mods = [];
if (this.data.strong) {
mods.push({ label: 'Strong', value: -2 });
}
buttons.push({
label: `Shake off (Spirit${this.data.strong ? ' -2' : ''})`,
type: 'trait',
rollType: 'attribute',
rollDesc: 'Spirit',
flavor: 'Success shakes off the effects of sloth',
mods,
});
}
return buttons;
}
}

View File

@ -19,7 +19,7 @@
<strong>Targets</strong>:
{{#each targets}}{{#if @index}}, {{/if}}{{{this}}}{{/each}}
{{#if recipients.cost}}
<br>({{#if recipients.epic}}⭐ {{/if}}Additional Recipients
<br>({{#if recipients.epic}}⭐ {{/if}}{{recipients.text}}
{{recipients.cost}}pp each × {{recipients.count}} = {{recipients.total}})
{{/if}}
</p>