add telekinesis

This commit is contained in:
Mike Bloy 2024-06-04 23:30:25 -05:00
parent a6e2bc7bdc
commit e016437b73
3 changed files with 109 additions and 1 deletions

View File

@ -580,7 +580,11 @@ export class PowerEffect {
doc.flags.swade.expiration = CONFIG.SWADE.CONST.STATUS_EFFECT_EXPIRATION.EndOfTurnPrompt;
doc.flags.swade.loseTurnOnHold = true;
doc.flags[moduleName].maintainingId = maintId;
if (this.isTargeted) {
doc.flags[moduleName].targetIds = this.targets.map((t) => t.id);
} else {
doc.flags[moduleName].targetIds = [this.source.id];
}
doc.statuses = doc.statuses ?? [];
doc.statuses.push('powerMaintainEffect');
const effectButtons = this.maintEffectButtons;
@ -617,6 +621,11 @@ export class PowerEffect {
await this.applyActiveEffects(target, targetDocs);
}
}
} else {
const targetDocs = await this.secondaryDocsForTarget(secondaryDocs, this.source);
if (targetDocs.length > 0) {
await this.applyActiveEffects(this.source, targetDocs);
}
}
if (this.duration > 0) {
await this.applyActiveEffects(this.source, [maintainDoc]);

View File

@ -57,6 +57,7 @@ import { SoundSilenceEffect } from './soundSilence.js';
import { SpeakLanguageEffect } from './speakLanguage.js';
import { StunEffect } from './stun.js';
import { SummonAllyEffect } from './summon.js';
import { TelekinesisEffect } from './telekinesis.js';
const PowerClasses = {
'arcane-protection': ArcaneProtectionEffect,
@ -134,6 +135,7 @@ const PowerClasses = {
'speak-language': SpeakLanguageEffect,
stun: StunEffect,
'summon-ally': SummonAllyEffect,
telekinesis: TelekinesisEffect,
};
/* ---------------------------------------------------------------- */

View File

@ -0,0 +1,97 @@
import { PowerEffect } from './basePowers.js';
export class TelekinesisEffect extends PowerEffect {
get name() {
return 'Telekinesis';
}
get duration() {
return 5;
}
get icon() {
return 'icons/magic/movement/trail-streak-zigzag-yellow.webp';
}
get basePowerPoints() {
return 5;
}
get isTargeted() {
return false;
}
get usePrimaryEffect() {
return false;
}
get modifiers() {
const mods = super.modifiers;
mods.push({
name: 'Power',
type: 'checkbox',
id: 'power',
value: 3,
epic: false,
effect: false,
});
return mods;
}
get effectName() {
return `${this.data.raise ? 'major' : 'minor'} ${this.name} ${this.data.power ? '[Power] ' : ''}`;
}
get description() {
let desc = super.description;
let str = 'd10';
if (this.data.power && this.data.raise) {
str = 'd12+2';
} else if (this.data.power || this.data.raise) {
str = 'd12';
}
desc += `<p>Move objects with will alone. The power has a Strength of ${str}.
Resisted by an opposed arcane roll vs the target's Spirit when first targeted
and at the start of each of the target's turns thereafter.</p>
<h3>Uses:</h3>
<ul>
<li><strong>Bash</strong>: Bash the target into the floor, ceiling, or walls
for Str+d6 damage.</li>
<li><strong>Change Targets</strong>: Switch victim or tool as a free action.
Selecting an unwilling target is an action and is resisted as above.</li>
<li><strong>Manipulate</strong>: Use tool or weapon, using the caster's
arcane skill.</li>
<li><strong>Move</strong>: The target or tool may be moved up to the caster's
Smarts.</li>
</ul>`;
return desc;
}
get maintEffectButtons() {
let str = 'd10x';
if (this.data.power && this.data.raise) {
str = 'd12x+2';
} else if (this.data.power || this.data.raise) {
str = 'd12x';
}
let traitFormula = `1${str}[Strength]`;
if (this.source.actor.system.wildcard) {
traitFormula = `{${traitFormula},1d6x[Wild Die]}kh`;
}
return [
...super.primaryEffectButtons,
{
label: `Strength (${str.replace('x', '')})`,
type: 'roll',
formula: traitFormula,
flavor: 'Telekinesis Strength',
},
{
label: 'Damage (Str+d6)',
type: 'damage',
formula: `1${str}[Strength]+1d6x`,
flavor: 'Telekinesis Bash Damage',
},
];
}
}