add reorged blind power

This commit is contained in:
Mike Bloy 2024-05-14 14:10:33 -05:00
parent 6ec4d9019e
commit eaf5b8a066
2 changed files with 111 additions and 123 deletions

110
src/module/powers/blind.js Normal file
View File

@ -0,0 +1,110 @@
import { moduleName } from '../globals.js';
import { PowerEffect } from './basePowers.js';
export class BlindEffect extends PowerEffect {
get name() {
return 'Blind';
}
get icon() {
return 'icons/skills/wounds/injury-eyes-blood-red.webp';
}
get duration() {
return 0;
}
get isTargeted() {
return true;
}
get hasAoe() {
return true;
}
get basePowerPoints() {
return 2;
}
getPrimaryEffectChanges() {
const changes = [
{
key: 'system.stats.globalMods.trait',
value: -2,
priority: 0,
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,
},
];
return changes;
}
get description() {
return (
super.description +
`<p>${this.data.raise ? -4 : -2} penalty to all actions involving sight.</p>
<p>Shake off attempts at end of turns with a Vigor ${this.data.strong ? '-2 ' : ''}
roll as a free action. Success removes 2 points of penalties.
A raise removes the effect.</p>`
);
}
async createSecondaryEffects(maintId) {
const docs = await super.createSecondaryEffects(maintId);
if (this.data.raise) {
const strong = this.data.mods.has('strong');
const doc = this.createEffectDocument(this.icon, `Blinded (${strong ? 'Strong, ' : ''}Raise)`, [
{
key: 'system.stats.globalMods.trait',
value: -2,
priority: 0,
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,
},
]);
doc.duration.seconds = 594;
doc.description = this.description + '<p>This is the raise effect which can be shaken off separately.</p>';
doc.flags[moduleName].maintId = maintId;
docs.push(doc);
}
return docs;
}
get modifiers() {
const mods = super.modifiers;
mods.push({
name: 'Strong',
type: 'checkbox',
value: 1,
id: 'strong',
epic: false,
effect: false,
});
mods.push({
type: 'select',
default: 'none',
name: 'Area of Effect',
id: 'aoe',
epic: true,
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 },
});
return mods;
}
get effectName() {
const strong = this.data.strong;
return `Blinded${strong ? ' (Strong)' : ''}`;
}
get chatMessageEffects() {
const list = super.chatMessageEffects;
if (this.data.aoe !== 'none') {
list.push(this.data.aoe.toUpperCase());
}
return list;
}
}

View File

@ -6,129 +6,7 @@ import { BanishEffect } from './banish.js';
import { BarrierEffect } from './barrier.js';
import { BeastFriendEffect } from './beastFriend.js';
import { BlastEffect } from './blast.js';
class BlindEffect extends PowerEffect {
get name() {
return 'Blind';
}
get icon() {
return 'icons/skills/wounds/injury-eyes-blood-red.webp';
}
get duration() {
return 0;
}
get isTargeted() {
return true;
}
get hasAoe() {
return true;
}
get basePowerPoints() {
return 2;
}
getPrimaryEffectChanges() {
const changes = [
{
key: 'system.stats.globalMods.trait',
value: -2,
priority: 0,
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,
},
];
return changes;
}
get description() {
return (
super.description +
`<p>${this.data.raise ? -4 : -2} penalty to all actions involving sight.</p>
<p>Shake off attempts at end of turns with a Vigor
${this.data.mods.has('strong') ? '-2 ' : ''}roll as a free action.
Success removes 2 points of penalties. A raise removes the effect.</p>`
);
}
async createSecondaryEffects(maintId) {
const docs = await super.createSecondaryEffects(maintId);
if (this.data.raise) {
const strong = this.data.mods.has('strong');
const doc = this.createEffectDocument(this.icon, `Blinded (${strong ? 'Strong, ' : ''}Raise)`, [
{
key: 'system.stats.globalMods.trait',
value: -2,
priority: 0,
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,
},
]);
doc.duration.seconds = 594;
doc.description = this.description + '<p>This is the raise effect which can be shaken off separately.</p>';
doc.flags[moduleName].maintId = maintId;
docs.push(doc);
}
return docs;
}
get modifiers() {
const mods = super.modifiers;
mods.push({
name: 'Strong',
value: 1,
id: 'strong',
epic: false,
effect: false,
});
return mods;
}
get menuInputs() {
const inputs = super.menuInputs;
inputs.push({
type: 'select',
label: 'Area of Effect',
options: [
{ html: 'None', value: 0, selected: true },
{ html: 'Medium Blast Template (+2)', value: 2, selected: false },
{ html: 'Large Blast Template (+3)', value: 3, selected: false },
],
});
return inputs;
}
async parseValues() {
await super.parseValues();
this.data.aoe = this.data.values.shift();
}
get powerPoints() {
let total = super.powerPoints;
total += this.data.aoe;
return total;
}
get effectName() {
const strong = this.data.mods.has('strong');
return `Blinded${strong ? ' (Strong)' : ''}`;
}
get chatMessageEffects() {
const list = super.chatMessageEffects;
switch (this.data.aoe) {
case 2:
list.push('MBT');
break;
case 3:
list.push('LBT');
break;
}
return list;
}
}
import { BlindEffect } from './blind.js';
class BoltEffect extends PowerEffect {
get name() {