add conjure item, more buttons

This commit is contained in:
Mike Bloy 2024-05-18 23:55:51 -05:00
parent 0d41527a5e
commit caee516d48
6 changed files with 143 additions and 2 deletions

View File

@ -90,6 +90,19 @@ export class BarrierEffect extends PowerEffect {
return (this.data.raise ? 12 : 10) + (this.data.hardened ? 2 : 0); return (this.data.raise ? 12 : 10) + (this.data.hardened ? 2 : 0);
} }
get maintEffectButtons() {
const buttons = super.primaryEffectButtons;
if (this.data.damage != 'none') {
const damage = this.data.damage === 'deadly' ? '2d6' : '2d4';
buttons.push({
label: `Damage (${damage})`,
type: 'damage',
formula: damage + 'x',
});
}
return buttons;
}
get description() { get description() {
let text = super.description; let text = super.description;
text += `<p>A barrier ${this._height} tall and ${this._length} long, of hardness ${this._hardness}. `; text += `<p>A barrier ${this._height} tall and ${this._length} long, of hardness ${this._hardness}. `;

View File

@ -447,6 +447,11 @@ export class PowerEffect {
return []; return [];
} }
get maintEffectButtons() {
// see the comment for primaryEffectButtons
return [];
}
async createPrimaryEffect(maintId) { async createPrimaryEffect(maintId) {
const doc = this.createEffectDocument(this.icon, this.effectName, this.getPrimaryEffectChanges()); const doc = this.createEffectDocument(this.icon, this.effectName, this.getPrimaryEffectChanges());
if (moduleHelpers.useVAE) { if (moduleHelpers.useVAE) {
@ -479,6 +484,10 @@ export class PowerEffect {
doc.flags.swade.loseTurnOnHold = true; doc.flags.swade.loseTurnOnHold = true;
doc.flags[moduleName].maintainingId = maintId; doc.flags[moduleName].maintainingId = maintId;
doc.flags[moduleName].targetIds = this.targets.map((t) => t.id); doc.flags[moduleName].targetIds = this.targets.map((t) => t.id);
const effectButtons = this.maintEffectButtons;
if (effectButtons.length > 0) {
doc.flags[moduleName].buttons = effectButtons;
}
return doc; return doc;
} }

View File

@ -0,0 +1,100 @@
import { PowerEffect } from './basePowers.js';
export class ConjureItemEffect extends PowerEffect {
get name() {
return 'Conjure Item';
}
get icon() {
return 'icons/commodities/tech/cog-steel-grey.webp';
}
get duration() {
return 0;
}
get isTargeted() {
return false;
}
get isRaisable() {
return true;
}
get basePowerPoints() {
return 2;
}
get modifiers() {
return [
{
name: 'Weight in pounds OR daily rations',
type: 'number',
default: 1,
value: 0,
id: 'weight',
epic: false,
effect: false,
},
{
name: 'Complete Set',
type: 'checkbox',
default: false,
value: 1,
id: 'complete',
epic: false,
effect: false,
},
{
name: 'Create Food and Water (Special)',
type: 'checkbox',
default: false,
value: 0,
id: 'rations',
epic: false,
effect: false,
},
{
name: 'Durable (+1 per pound)',
type: 'checkbox',
default: false,
value: 0,
id: 'durable',
epic: false,
effect: false,
},
];
}
get powerPoints() {
if (this.data.rations) {
return this.data.weight;
}
return this.data.weight * (this.data.durable ? 3 : 2) + (this.data.complete ? 1 : 0);
}
get description() {
if (this.data.rations) {
return (
super.description +
`<p>Conjure enough food and drink to feed ${this.data.weight} size 0
humanoid${this.data.weight > 1 ? 's' : ''} for 1 day. The food decays
and is inedible after 24 hours if not consumed.</p>`
);
}
let desc = super.description + `<p>Conjure an item up to ${this.data.weight} in pounds. `;
if (this.data.raise) {
desc += 'It is a more durable item than usual for its type. ';
}
if (this.data.complete) {
desc += 'Whatever is conjured is a complete set. ';
}
if (this.data.durable) {
desc += 'The item remains until it is dispelled or dismissed by the caster. ';
} else {
desc += 'The item lasts for one hour. ';
}
desc += 'Once it is dismissed or expires, the item fades from existance.</p>';
return desc;
}
}

View File

@ -66,6 +66,22 @@ export class DamageFieldEffect extends PowerEffect {
return mods; return mods;
} }
get primaryEffectButtons() {
const buttons = super.primaryEffectButtons;
let damage = '2d4';
if (this.data.greater) {
damage = '3d6';
} else if (this.data.damage) {
damage = '2d6';
}
buttons.push({
label: `Damage (${damage})`,
type: 'damage',
formula: `${damage}x`,
});
return buttons;
}
get description() { get description() {
let desc = super.description; let desc = super.description;
let area = 'all adjacent creatures'; let area = 'all adjacent creatures';

View File

@ -1,4 +1,4 @@
import { moduleName, moduleHelpers, log } from '../globals.js'; import { moduleName, moduleHelpers } from '../globals.js';
import { firstOwner, deleteActiveEffectsFromToken } from '../helpers.js'; import { firstOwner, deleteActiveEffectsFromToken } from '../helpers.js';
import { ArcaneProtectionEffect } from './arcaneProtection.js'; import { ArcaneProtectionEffect } from './arcaneProtection.js';
import { BanishEffect } from './banish.js'; import { BanishEffect } from './banish.js';
@ -11,6 +11,7 @@ import { BurrowEffect } from './burrow.js';
import { BoostLowerTraitEffect } from './boostLowerTrait.js'; import { BoostLowerTraitEffect } from './boostLowerTrait.js';
import { BurstEffect } from './burst.js'; import { BurstEffect } from './burst.js';
import { ConfusionEffect } from './confusion.js'; import { ConfusionEffect } from './confusion.js';
import { ConjureItemEffect } from './conjureItem.js';
import { CurseEffect } from './curse.js'; import { CurseEffect } from './curse.js';
import { DamageFieldEffect } from './damageField.js'; import { DamageFieldEffect } from './damageField.js';
import { DarksightEffect } from './darksight.js'; import { DarksightEffect } from './darksight.js';
@ -37,6 +38,7 @@ const PowerClasses = {
burst: BurstEffect, burst: BurstEffect,
'conceal-arcana': DetectConcealArcanaEffect, 'conceal-arcana': DetectConcealArcanaEffect,
confusion: ConfusionEffect, confusion: ConfusionEffect,
'conjure-item': ConjureItemEffect,
curse: CurseEffect, curse: CurseEffect,
'damage-field': DamageFieldEffect, 'damage-field': DamageFieldEffect,
darksight: DarksightEffect, darksight: DarksightEffect,

View File

@ -23,7 +23,8 @@
{{#if isCheckbox}} {{#if isCheckbox}}
<label class="checkbox"> <label class="checkbox">
<input type="checkbox" name="{{id}}" {{checked default}} /> <input type="checkbox" name="{{id}}" {{checked default}} />
{{#if epic}}⭐ {{/if}}{{name}} ({{numberFormat value decimals=0 sign=true}}) {{#if epic}}⭐ {{/if}}{{name}}
{{#if value}}({{numberFormat value decimals=0 sign=true}}){{/if}}
</label> </label>
{{/if}} {{/if}}
{{#if isText}} {{#if isText}}