add drain power points
This commit is contained in:
parent
db471b0cb9
commit
2870b6b587
@ -65,7 +65,6 @@ export class BanishEffect extends PowerEffect {
|
||||
const rollOpts = {
|
||||
title: 'Spirit roll to resist banishment',
|
||||
flavor: 'Roll Spirit to resist banishment!',
|
||||
modCallback: getPowerModifiers,
|
||||
targetNumber: this.data.tn,
|
||||
};
|
||||
await requestRollFromTokens(this.targets, 'ability', 'spirit', rollOpts);
|
||||
|
||||
83
src/module/powers/drainPowerPoints.js
Normal file
83
src/module/powers/drainPowerPoints.js
Normal file
@ -0,0 +1,83 @@
|
||||
import { requestRollFromTokens } from '../helpers.js';
|
||||
import { PowerEffect } from './basePowers.js';
|
||||
|
||||
export class DrainPowerPointsEffect extends PowerEffect {
|
||||
get name() {
|
||||
return 'Drain Power Points';
|
||||
}
|
||||
|
||||
get icon() {
|
||||
return 'icons/magic/control/debuff-energy-hold-teal-blue.webp';
|
||||
}
|
||||
|
||||
get duration() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
get basePowerPoints() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
get usePrimaryEffect() {
|
||||
return false;
|
||||
}
|
||||
|
||||
get isTargeted() {
|
||||
return true;
|
||||
}
|
||||
|
||||
get isRaisable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
get oneTarget() {
|
||||
return true;
|
||||
}
|
||||
|
||||
get modifiers() {
|
||||
return [
|
||||
...super.modifiers,
|
||||
{
|
||||
type: 'checkbox',
|
||||
name: 'Power',
|
||||
id: 'power',
|
||||
epic: false,
|
||||
effect: false,
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
type: 'number',
|
||||
default: 4,
|
||||
name: 'Opposed Target Number',
|
||||
id: 'tn',
|
||||
epic: false,
|
||||
effect: false,
|
||||
value: 0,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
async sideEffects() {
|
||||
await super.sideEffects();
|
||||
const rollOpts = {
|
||||
title: 'Resist Drain Power Points',
|
||||
flavor: 'Resist the energy drain!',
|
||||
mods: [{ label: 'Different Arcane Background', value: 2, ignore: true }],
|
||||
targetNumber: this.data.tn,
|
||||
};
|
||||
await requestRollFromTokens(this.targets, 'ability', 'spirit', rollOpts);
|
||||
}
|
||||
|
||||
get description() {
|
||||
return (
|
||||
super.description +
|
||||
`
|
||||
<p>An opposed roll of the caster's arcane activation roll vs the target's
|
||||
Spirit. Caster's success means the victim loses
|
||||
[[/r ${this.data.power ? '2' : '1'}d6]] power points. If the caster gets
|
||||
a raise over the opponent, the stolen power points augment the caster's
|
||||
own total.</p>
|
||||
`
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -19,6 +19,7 @@ import { DetectConcealArcanaEffect } from './detectConcealArcana.js';
|
||||
import { DisguiseEffect } from './disguise.js';
|
||||
import { DispelEffect } from './dispel.js';
|
||||
import { DivinationEffect } from './divination.js';
|
||||
import { DrainPowerPointsEffect } from './drainPowerPoints.js';
|
||||
|
||||
const PowerClasses = {
|
||||
'arcane-protection': ArcaneProtectionEffect,
|
||||
@ -45,6 +46,7 @@ const PowerClasses = {
|
||||
disguise: DisguiseEffect,
|
||||
dispel: DispelEffect,
|
||||
divination: DivinationEffect,
|
||||
'drain-power-points': DrainPowerPointsEffect,
|
||||
'lower-trait': BoostLowerTraitEffect,
|
||||
};
|
||||
|
||||
|
||||
@ -95,6 +95,9 @@ export async function preDamageRollModifiers(actor, item, roll, modifiers, optio
|
||||
export async function getPowerModifiers(token) {
|
||||
const modifiers = [];
|
||||
_addArcaneModifiers(token, modifiers);
|
||||
for (const modifier of modifiers) {
|
||||
modifier.value *= -1;
|
||||
}
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
@ -119,9 +122,9 @@ function _addRangeModifiers(token, target, options, modifiers) {
|
||||
|
||||
function _addArcaneModifiers(target, modifiers) {
|
||||
if (_findItem(target.actor, 'edge', 'improved-arcane-resistance')) {
|
||||
modifiers.push({ label: 'Arcane Resistance', value: '-4', ignore: true });
|
||||
modifiers.push({ label: 'Arcane Resistance', value: -4, ignore: true });
|
||||
} else if (_findItem(target.actor, 'edge', 'arcane-resistance')) {
|
||||
modifiers.push({ label: 'Arcane Resistance', value: '-2', ignore: true });
|
||||
modifiers.push({ label: 'Arcane Resistance', value: -2, ignore: true });
|
||||
}
|
||||
const effect = target.actor.effects.find((e) => !e.disabled && e.name.toLowerCase().includes('arcane protection'));
|
||||
if (effect) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user