more linting and power conversion
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
import { PowerEffect } from './basePowers.js';
|
||||
export class BarrierEffect extends PowerEffect {
|
||||
get name() {
|
||||
return 'Barrier';
|
||||
}
|
||||
|
||||
get duration() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
get icon() {
|
||||
return 'icons/environment/settlement/fence-stone-brick.webp';
|
||||
}
|
||||
|
||||
get isTargeted() {
|
||||
return false;
|
||||
}
|
||||
|
||||
get isDamaging() {
|
||||
return true;
|
||||
}
|
||||
|
||||
get basePowerPoints() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
get usePrimaryEffect() {
|
||||
return false;
|
||||
}
|
||||
|
||||
get modifiers() {
|
||||
const mods = super.modifiers;
|
||||
mods.push({
|
||||
type: 'select',
|
||||
name: 'Damage',
|
||||
id: 'damage',
|
||||
epic: false,
|
||||
choices: {
|
||||
none: 'None',
|
||||
damage: 'Damage',
|
||||
immaterial: 'Damage (immaterial)',
|
||||
deadly: '⭐ Deadly',
|
||||
},
|
||||
effects: { none: null, damage: null, immaterial: null, deadly: null },
|
||||
values: { none: 0, damage: 1, immaterial: 0, deadly: 2 },
|
||||
});
|
||||
mods.push({
|
||||
type: 'checkbox',
|
||||
name: 'Hardened',
|
||||
id: 'hardened',
|
||||
value: 1,
|
||||
epic: false,
|
||||
effect: false,
|
||||
});
|
||||
mods.push({
|
||||
type: 'checkbox',
|
||||
name: 'Shaped',
|
||||
id: 'shaped',
|
||||
value: 1,
|
||||
epic: false,
|
||||
effect: false,
|
||||
});
|
||||
mods.push({
|
||||
type: 'checkbox',
|
||||
name: 'Size',
|
||||
id: 'size',
|
||||
value: 1,
|
||||
epic: false,
|
||||
effect: false,
|
||||
});
|
||||
return mods;
|
||||
}
|
||||
|
||||
get _length() {
|
||||
let height = 10;
|
||||
if (this.data.raise) {
|
||||
height *= 2;
|
||||
}
|
||||
if (this.data.size) {
|
||||
height *= 2;
|
||||
}
|
||||
return `${height}" (${height * 2} yards)`;
|
||||
}
|
||||
|
||||
get _height() {
|
||||
return `${this.data.size ? '2" (4' : '1" (2'} yards)`;
|
||||
}
|
||||
|
||||
get _hardness() {
|
||||
return (this.data.raise ? 12 : 10) + (this.data.hardened ? 2 : 0);
|
||||
}
|
||||
|
||||
get description() {
|
||||
let text = super.description;
|
||||
text += `<p>A barrier ${this._height} tall and ${this._length} long, of hardness ${this._hardness}. `;
|
||||
if (this.data.damage === 'deadly') {
|
||||
text += 'It does 2d6 damage to anyone who contacts it. ';
|
||||
} else if (this.data.damage != 'none') {
|
||||
text += 'It does 2d4 damage to anyone who contacts it. ';
|
||||
}
|
||||
if (this.data.shaped) {
|
||||
text += 'It was shaped into a circle, square, or rectangle. ';
|
||||
}
|
||||
text += '</p>';
|
||||
return text;
|
||||
}
|
||||
}
|
||||
@@ -371,7 +371,7 @@ export class PowerEffect {
|
||||
}
|
||||
|
||||
render() {
|
||||
let app = new PowerFormApplication(this).render(true);
|
||||
new PowerFormApplication(this).render(true);
|
||||
}
|
||||
|
||||
async applyEffect() {
|
||||
@@ -457,7 +457,6 @@ export class PowerEffect {
|
||||
return deepClone(docs);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
async primaryDocForTarget(doc, target) {
|
||||
const newDoc = deepClone(doc);
|
||||
newDoc.flags[moduleName].maintainingId = doc.flags[moduleName].maintId;
|
||||
@@ -559,7 +558,7 @@ export class PowerEffect {
|
||||
text += '</p>';
|
||||
const desc = this.description;
|
||||
if (desc) {
|
||||
text += `<details><summary>Description</summary>${desc}</details>`;
|
||||
text += `<details open><summary>Description</summary>${desc}</details>`;
|
||||
}
|
||||
const effects = this.chatMessageEffects;
|
||||
if (effects.length > 0) {
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
import { PowerEffect } from './basePowers.js';
|
||||
|
||||
export class BeastFriendEffect extends PowerEffect {
|
||||
get name() {
|
||||
return 'Beast Friend';
|
||||
}
|
||||
|
||||
get duration() {
|
||||
return (this.data.duration ? 30 : 10) * 6 * 60;
|
||||
}
|
||||
|
||||
get icon() {
|
||||
return 'icons/magic/nature/wolf-paw-glow-large-green.webp';
|
||||
}
|
||||
|
||||
get isTargeted() {
|
||||
return true;
|
||||
}
|
||||
|
||||
get usePrimaryEffect() {
|
||||
return true;
|
||||
}
|
||||
|
||||
get modifiers() {
|
||||
const mods = super.modifiers;
|
||||
const ppDefault = Math.max(
|
||||
this.targets.map((t) => Math.max(t.actor.system.stats.size, 1)).reduce((a, b) => a + b, 0),
|
||||
1,
|
||||
);
|
||||
mods.push(
|
||||
{
|
||||
name: 'Bestiarium',
|
||||
type: 'checkbox',
|
||||
value: 2,
|
||||
id: 'bestiarium',
|
||||
epic: true,
|
||||
effect: false,
|
||||
},
|
||||
{
|
||||
name: 'Duration',
|
||||
type: 'checkbox',
|
||||
value: 1,
|
||||
id: 'duration',
|
||||
epic: false,
|
||||
effect: false,
|
||||
},
|
||||
{
|
||||
name: 'Mind Rider',
|
||||
type: 'checkbox',
|
||||
value: 1,
|
||||
id: 'mindrider',
|
||||
epic: false,
|
||||
effect: false,
|
||||
},
|
||||
{
|
||||
name: 'Base power points',
|
||||
type: 'number',
|
||||
value: 0,
|
||||
default: ppDefault,
|
||||
id: 'basePP',
|
||||
epic: false,
|
||||
effect: false,
|
||||
},
|
||||
);
|
||||
return mods;
|
||||
}
|
||||
|
||||
get basePowerPoints() {
|
||||
return (
|
||||
this.data.basePP ??
|
||||
Math.max(
|
||||
this.targets.map((t) => Math.max(t.actor.system.stats.size, 1)).reduce((a, b) => a + b, 0),
|
||||
1,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
get description() {
|
||||
let text = super.description;
|
||||
if (this.data.raise) {
|
||||
text += '<p>Creatures will overcome instincts to follow orders.';
|
||||
} else {
|
||||
text += '<p>Creatures obey simple commands, subject to their insticts.';
|
||||
}
|
||||
if (this.data.bestiarium) {
|
||||
text += ' The caster may even effect magical beasts.';
|
||||
}
|
||||
return text;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
import { PowerEffect } from './basePowers.js';
|
||||
|
||||
export class BlastEffect extends PowerEffect {
|
||||
get name() {
|
||||
return 'Blast';
|
||||
}
|
||||
|
||||
get icon() {
|
||||
return 'icons/magic/fire/explosion-fireball-large-red-orange.webp';
|
||||
}
|
||||
|
||||
get duration() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
get isTargeted() {
|
||||
return true;
|
||||
}
|
||||
|
||||
get usePrimaryEffect() {
|
||||
return false;
|
||||
}
|
||||
|
||||
get isDamaging() {
|
||||
return true;
|
||||
}
|
||||
|
||||
get basePowerPoints() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
get hasAoe() {
|
||||
return true;
|
||||
}
|
||||
|
||||
get modifiers() {
|
||||
const mods = super.modifiers;
|
||||
mods.push(
|
||||
{
|
||||
name: 'Area of Effect',
|
||||
id: 'aoe',
|
||||
type: 'select',
|
||||
default: 'mbt',
|
||||
choices: {
|
||||
sbt: 'Small Blast Template',
|
||||
mbt: 'Medium Blast Template',
|
||||
lbt: 'Large Blast Template',
|
||||
},
|
||||
effects: { sbt: null, mbt: null, lbt: null },
|
||||
values: { sbt: 0, mbt: 0, lbt: 1 },
|
||||
epic: false,
|
||||
},
|
||||
{ name: 'Damage', value: 2, id: 'damage', epic: false, effect: false },
|
||||
{
|
||||
name: 'Greater Blast',
|
||||
value: 4,
|
||||
id: 'greater',
|
||||
epic: true,
|
||||
effect: false,
|
||||
},
|
||||
);
|
||||
return mods;
|
||||
}
|
||||
|
||||
get description() {
|
||||
const dmgDie = (this.data.greater ? 4 : this.data.damage ? 3 : 2) + (this.data.raise ? 1 : 0);
|
||||
const size = this.data.aoe.toUpperCase();
|
||||
return super.description + `<p>The blast covers a ${size} and does ${dmgDie}d6 damage</p>`;
|
||||
}
|
||||
}
|
||||
+4
-279
@@ -3,284 +3,9 @@ import { moduleName } from '../globals.js';
|
||||
import { PowerEffect } from './basePowers.js';
|
||||
import { ArcaneProtectionEffect } from './arcaneProtection.js';
|
||||
import { BanishEffect } from './banish.js';
|
||||
|
||||
class BarrierEffect extends PowerEffect {
|
||||
get name() {
|
||||
return 'Barrier';
|
||||
}
|
||||
|
||||
get duration() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
get icon() {
|
||||
return 'icons/environment/settlement/fence-stone-brick.webp';
|
||||
}
|
||||
|
||||
get isTargeted() {
|
||||
return false;
|
||||
}
|
||||
|
||||
get isDamaging() {
|
||||
return true;
|
||||
}
|
||||
|
||||
get basePowerPoints() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
get usePrimaryEffect() {
|
||||
return false;
|
||||
}
|
||||
|
||||
get modifiers() {
|
||||
const mods = super.modifiers;
|
||||
mods.push({
|
||||
name: 'Damage',
|
||||
id: 'damage',
|
||||
value: 1,
|
||||
epic: false,
|
||||
effect: false,
|
||||
});
|
||||
mods.push({
|
||||
name: 'Damage (immaterial trapping)',
|
||||
id: 'damage',
|
||||
value: 0,
|
||||
epic: false,
|
||||
effect: false,
|
||||
});
|
||||
mods.push({
|
||||
name: 'Deadly',
|
||||
id: 'deadly',
|
||||
value: 2,
|
||||
epic: true,
|
||||
effect: false,
|
||||
});
|
||||
mods.push({
|
||||
name: 'Hardened',
|
||||
id: 'hardened',
|
||||
value: 1,
|
||||
epic: false,
|
||||
effect: false,
|
||||
});
|
||||
mods.push({
|
||||
name: 'Shaped',
|
||||
id: 'shaped',
|
||||
value: 1,
|
||||
epic: false,
|
||||
effect: false,
|
||||
});
|
||||
mods.push({
|
||||
name: 'Size',
|
||||
id: 'size',
|
||||
value: 1,
|
||||
epic: false,
|
||||
effect: false,
|
||||
});
|
||||
return mods;
|
||||
}
|
||||
|
||||
get _length() {
|
||||
let height = 10;
|
||||
if (this.data.raise) {
|
||||
height *= 2;
|
||||
}
|
||||
if (this.data.mods.has('size')) {
|
||||
height *= 2;
|
||||
}
|
||||
return `${height}" (${height * 2} yards)`;
|
||||
}
|
||||
|
||||
get _height() {
|
||||
return `${this.data.mods.has('size') ? '2" (4' : '1" (2'} yards`;
|
||||
}
|
||||
|
||||
get _hardness() {
|
||||
return (this.data.raise ? 12 : 10) + (this.data.mods.has('hardened') ? 2 : 0);
|
||||
}
|
||||
|
||||
get description() {
|
||||
let text = super.description;
|
||||
text += `<p>A barrier ${this._height} tall and ${this._length} long, of hardness ${this._hardness}. `;
|
||||
if (this.data.mods.has('deadly')) {
|
||||
text += 'It does 2d6 damage to anyone who contacts it. ';
|
||||
} else if (this.data.mods.has('damage')) {
|
||||
text += 'It does 2d4 damage to anyone who contacts it. ';
|
||||
}
|
||||
if (this.data.mods.has('shaped')) {
|
||||
text += 'It was shaped into a circle, square, or rectangle. ';
|
||||
}
|
||||
text += '</p>';
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
class BeastFriendEffect extends PowerEffect {
|
||||
get name() {
|
||||
return 'Beast Friend';
|
||||
}
|
||||
|
||||
get duration() {
|
||||
return (this.data.mods.has('duration') ? 30 : 10) * 6 * 60;
|
||||
}
|
||||
|
||||
get icon() {
|
||||
return 'icons/magic/nature/wolf-paw-glow-large-green.webp';
|
||||
}
|
||||
|
||||
get isTargeted() {
|
||||
return true;
|
||||
}
|
||||
|
||||
get usePrimaryEffect() {
|
||||
return true;
|
||||
}
|
||||
|
||||
get modifiers() {
|
||||
const mods = super.modifiers;
|
||||
mods.push(
|
||||
{
|
||||
name: 'Bestiarium',
|
||||
value: 2,
|
||||
id: 'bestiarium',
|
||||
epic: true,
|
||||
effect: false,
|
||||
},
|
||||
{
|
||||
name: 'Duration',
|
||||
value: 1,
|
||||
id: 'duration',
|
||||
epic: false,
|
||||
effect: false,
|
||||
},
|
||||
{
|
||||
name: 'Mind Rider',
|
||||
value: 1,
|
||||
id: 'mindrider',
|
||||
epic: false,
|
||||
effect: false,
|
||||
},
|
||||
);
|
||||
return mods;
|
||||
}
|
||||
|
||||
get menuInputs() {
|
||||
const inputs = super.menuInputs;
|
||||
const pp = Math.max(
|
||||
this.targets.map((t) => Math.max(t.actor.system.stats.size, 1)).reduce((a, b) => a + b, 0),
|
||||
1,
|
||||
);
|
||||
inputs.push({ type: 'number', label: 'Base power points', options: pp });
|
||||
return inputs;
|
||||
}
|
||||
|
||||
async parseValues() {
|
||||
await super.parseValues();
|
||||
this.data.basePP = this.data.values.shift();
|
||||
}
|
||||
|
||||
get basePowerPoints() {
|
||||
return this?.data?.basePP || 2;
|
||||
}
|
||||
|
||||
get description() {
|
||||
let text = super.description;
|
||||
if (this.data.raise) {
|
||||
text += '<p>Creatures will overcome instincts to follow orders.';
|
||||
} else {
|
||||
text += '<p>Creatures obey simple commands, subject to their insticts.';
|
||||
}
|
||||
if (this.data.mods.has('bestiarium')) {
|
||||
text += ' The caster may even effect magical beasts.';
|
||||
}
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
class BlastEffect extends PowerEffect {
|
||||
get name() {
|
||||
return 'Blast';
|
||||
}
|
||||
|
||||
get icon() {
|
||||
return 'icons/magic/fire/explosion-fireball-large-red-orange.webp';
|
||||
}
|
||||
|
||||
get duration() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
get isTargeted() {
|
||||
return true;
|
||||
}
|
||||
|
||||
get usePrimaryEffect() {
|
||||
return false;
|
||||
}
|
||||
|
||||
get isDamaging() {
|
||||
return true;
|
||||
}
|
||||
|
||||
get basePowerPoints() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
get hasAoe() {
|
||||
return true;
|
||||
}
|
||||
|
||||
get menuInputs() {
|
||||
const inputs = super.menuInputs;
|
||||
inputs.push({
|
||||
type: 'select',
|
||||
label: 'Area of Effect',
|
||||
options: [
|
||||
{ html: 'Small Blast Template (0)', value: 's', selected: false },
|
||||
{ html: 'Medium Blast Template (0)', value: 'm', selected: true },
|
||||
{ html: 'Large Blast Template (+1)', value: 'l', selected: false },
|
||||
],
|
||||
});
|
||||
return inputs;
|
||||
}
|
||||
|
||||
get modifiers() {
|
||||
const mods = super.modifiers;
|
||||
mods.push(
|
||||
{ name: 'Damage', value: 2, id: 'damage', epic: false, effect: false },
|
||||
{
|
||||
name: 'Greater Blast',
|
||||
value: 4,
|
||||
id: 'greater',
|
||||
epic: true,
|
||||
effect: false,
|
||||
},
|
||||
);
|
||||
return mods;
|
||||
}
|
||||
|
||||
get powerPoints() {
|
||||
let total = super.powerPoints;
|
||||
total += this.data.aoe === 'l' ? 1 : 0;
|
||||
return total;
|
||||
}
|
||||
|
||||
async parseValues() {
|
||||
await super.parseValues();
|
||||
this.data.aoe = this.data.values.shift();
|
||||
}
|
||||
|
||||
get description() {
|
||||
const dmgDie =
|
||||
(this.data.mods.has('greater') ? 4 : this.data.mods.has('damage') ? 3 : 2) + (this.data.raise ? 1 : 0);
|
||||
const size = this.data.aoe === 'l' ? 'LBT' : this.data.aoe === 's' ? 'SBT' : 'MBT';
|
||||
return (
|
||||
super.description +
|
||||
`
|
||||
<p>The blast covers a ${size} and does ${dmgDie}d6 damage</p>`
|
||||
);
|
||||
}
|
||||
}
|
||||
import { BarrierEffect } from './barrier.js';
|
||||
import { BeastFriendEffect } from './beastFriend.js';
|
||||
import { BlastEffect } from './blast.js';
|
||||
|
||||
class BlindEffect extends PowerEffect {
|
||||
get name() {
|
||||
@@ -1448,5 +1173,5 @@ export async function powers(options = {}) {
|
||||
runner.render();
|
||||
return;
|
||||
}
|
||||
ui.notifications.error(`No power effect found for ${name}`);
|
||||
ui.notifications.error(`No power effect found for ${swid}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user