add growth shrink
This commit is contained in:
parent
36520fcee2
commit
ae3bc394e7
@ -43,6 +43,9 @@ export class PowerFormApplication extends FormApplication {
|
||||
modifier.isRadio = modifier.type === 'radio';
|
||||
modifier.isNumber = modifier.type === 'number';
|
||||
modifier.isText = modifier.type === 'text';
|
||||
if (modifier.isNumber) {
|
||||
modifier.step = modifier?.step ?? 1;
|
||||
}
|
||||
if (modifier.isSelect || modifier.isRadio) {
|
||||
for (const choice in modifier.choices) {
|
||||
let val = '';
|
||||
@ -63,6 +66,7 @@ export class PowerFormApplication extends FormApplication {
|
||||
number: 0,
|
||||
total: 0,
|
||||
},
|
||||
extraDescription: this.powerEffect.extraDescription,
|
||||
targets: [],
|
||||
buttons: this.powerEffect.menuButtons,
|
||||
};
|
||||
@ -154,6 +158,10 @@ export class PowerEffect {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
get extraDescription() {
|
||||
return '';
|
||||
}
|
||||
|
||||
get icon() {
|
||||
return 'icons/magic/symbols/question-stone-yellow.webp';
|
||||
}
|
||||
|
||||
@ -10,11 +10,22 @@ export class GrowthShrinkEffect extends PowerEffect {
|
||||
}
|
||||
|
||||
get basePowerPoints() {
|
||||
return 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
get duration() {
|
||||
return 5;
|
||||
return this?.data?.duration ? 50 : 5;
|
||||
}
|
||||
|
||||
get extraDescription() {
|
||||
const target = this.targets?.[0];
|
||||
let text = super.extraDescription + '<p>Minimum Size is -2. ';
|
||||
if (target) {
|
||||
text += `${target.name} is of Size ${target.actor.system.stats.size}. `;
|
||||
}
|
||||
text += `Select the number of Size steps to change the target. 2 points per
|
||||
step. Negative is shrink, positive is growth.</p>`;
|
||||
return text;
|
||||
}
|
||||
|
||||
get isTargeted() {
|
||||
@ -25,9 +36,25 @@ export class GrowthShrinkEffect extends PowerEffect {
|
||||
return true;
|
||||
}
|
||||
|
||||
get isRaisable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
get modifiers() {
|
||||
const curSize = this.targets?.[0]?.actor?.system?.stats?.size ?? 0;
|
||||
const minSteps = -2 - curSize;
|
||||
return [
|
||||
...super.modifiers,
|
||||
{
|
||||
name: 'Size Steps',
|
||||
default: 1,
|
||||
type: 'number',
|
||||
min: minSteps,
|
||||
value: 0,
|
||||
id: 'steps',
|
||||
epic: false,
|
||||
effect: false,
|
||||
},
|
||||
{
|
||||
name: 'Duration',
|
||||
id: 'duration',
|
||||
@ -48,4 +75,67 @@ export class GrowthShrinkEffect extends PowerEffect {
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
async parseValues() {
|
||||
await super.parseValues();
|
||||
const steps = this.data.steps;
|
||||
const curSize = this.targets?.[0]?.actor?.system?.stats?.size ?? 0;
|
||||
const minSteps = -2 - curSize;
|
||||
this.data.steps = Math.max(steps, minSteps);
|
||||
}
|
||||
|
||||
get powerPoints() {
|
||||
return super.powerPoints + Math.abs(this.data.steps) * 2;
|
||||
}
|
||||
|
||||
getPrimaryEffectChanges() {
|
||||
const steps = this.data.steps;
|
||||
const changes = super.getPrimaryEffectChanges();
|
||||
if (steps === 0) {
|
||||
return changes;
|
||||
}
|
||||
changes.push({
|
||||
key: 'system.stats.size',
|
||||
value: steps,
|
||||
priority: 0,
|
||||
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,
|
||||
});
|
||||
if (steps < 0 && this.data.power) {
|
||||
changes.push({
|
||||
key: 'system.stats.toughness.value',
|
||||
value: steps * -1,
|
||||
priority: 0,
|
||||
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,
|
||||
});
|
||||
} else {
|
||||
changes.push({
|
||||
key: 'system.attributes.strength.die.sides',
|
||||
value: steps * 2,
|
||||
priority: 0,
|
||||
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,
|
||||
});
|
||||
}
|
||||
return changes;
|
||||
}
|
||||
|
||||
get effectName() {
|
||||
if (this.data.steps >= 0) {
|
||||
return 'Growth';
|
||||
}
|
||||
return 'Shrink';
|
||||
}
|
||||
|
||||
get description() {
|
||||
let text = super.description;
|
||||
if (this.data.steps >= 0) {
|
||||
text += `<p>Grow the target by ${this.data.steps} steps.</p>`;
|
||||
} else {
|
||||
text += `<p>Shrink the target by ${this.data.steps} steps`;
|
||||
if (this.data.power) {
|
||||
text += ' while retaining Strength and Toughness';
|
||||
}
|
||||
text += '.</p>';
|
||||
}
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@ import { EnvironmentalProtectionEffect } from './environmentalProtection.js';
|
||||
import { FarsightEffect } from './farsight.js';
|
||||
import { FearEffect } from './fear.js';
|
||||
import { FlyEffect } from './fly.js';
|
||||
import { GrowthShrinkEffect } from './growthShrink.js';
|
||||
|
||||
const PowerClasses = {
|
||||
'arcane-protection': ArcaneProtectionEffect,
|
||||
@ -37,8 +38,8 @@ const PowerClasses = {
|
||||
blast: BlastEffect,
|
||||
blind: BlindEffect,
|
||||
bolt: BoltEffect,
|
||||
'boostlower-trait': BoostLowerTraitEffect,
|
||||
'boost-lower-trait': BoostLowerTraitEffect,
|
||||
'boostlower-trait': BoostLowerTraitEffect,
|
||||
'boost-trait': BoostLowerTraitEffect,
|
||||
burrow: BurrowEffect,
|
||||
burst: BurstEffect,
|
||||
@ -63,7 +64,11 @@ const PowerClasses = {
|
||||
farsight: FarsightEffect,
|
||||
fear: FearEffect,
|
||||
fly: FlyEffect,
|
||||
growth: GrowthShrinkEffect,
|
||||
'growth-shrink': GrowthShrinkEffect,
|
||||
growthshrink: GrowthShrinkEffect,
|
||||
'lower-trait': BoostLowerTraitEffect,
|
||||
shrink: GrowthShrinkEffect,
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
@ -6,6 +6,11 @@
|
||||
<p>Apply the affects of {{name}}.</p>
|
||||
</section>
|
||||
</header>
|
||||
{{#if extraDescription }}
|
||||
<div>
|
||||
{{{extraDescription}}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if basePowerPoints}}
|
||||
<p><strong>Base Power Points</strong>: {{basePowerPoints}}
|
||||
{{/if}}
|
||||
@ -33,7 +38,13 @@
|
||||
{{/if}}
|
||||
{{#if isNumber}}
|
||||
<label for="{{id}}">{{#if epic}}⭐ {{/if}}{{name}}:</label>
|
||||
<input name="{{id}}" type="number" value="{{default}}" step="1" min="0">
|
||||
<input name="{{id}}"
|
||||
type="number"
|
||||
value="{{default}}"
|
||||
{{#if step}}step="{{step}}"{{/if}}
|
||||
{{#if min}}min="{{min}}"{{/if}}
|
||||
{{#if max}}max="{{max}}"{{/if}}
|
||||
>
|
||||
{{/if}}
|
||||
{{#if isSelect}}
|
||||
<label>{{#if epic}}⭐ {{/if}}{{name}}:</label>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user