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.isRadio = modifier.type === 'radio';
|
||||||
modifier.isNumber = modifier.type === 'number';
|
modifier.isNumber = modifier.type === 'number';
|
||||||
modifier.isText = modifier.type === 'text';
|
modifier.isText = modifier.type === 'text';
|
||||||
|
if (modifier.isNumber) {
|
||||||
|
modifier.step = modifier?.step ?? 1;
|
||||||
|
}
|
||||||
if (modifier.isSelect || modifier.isRadio) {
|
if (modifier.isSelect || modifier.isRadio) {
|
||||||
for (const choice in modifier.choices) {
|
for (const choice in modifier.choices) {
|
||||||
let val = '';
|
let val = '';
|
||||||
@ -63,6 +66,7 @@ export class PowerFormApplication extends FormApplication {
|
|||||||
number: 0,
|
number: 0,
|
||||||
total: 0,
|
total: 0,
|
||||||
},
|
},
|
||||||
|
extraDescription: this.powerEffect.extraDescription,
|
||||||
targets: [],
|
targets: [],
|
||||||
buttons: this.powerEffect.menuButtons,
|
buttons: this.powerEffect.menuButtons,
|
||||||
};
|
};
|
||||||
@ -154,6 +158,10 @@ export class PowerEffect {
|
|||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get extraDescription() {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
get icon() {
|
get icon() {
|
||||||
return 'icons/magic/symbols/question-stone-yellow.webp';
|
return 'icons/magic/symbols/question-stone-yellow.webp';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,11 +10,22 @@ export class GrowthShrinkEffect extends PowerEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get basePowerPoints() {
|
get basePowerPoints() {
|
||||||
return 2;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
get duration() {
|
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() {
|
get isTargeted() {
|
||||||
@ -25,9 +36,25 @@ export class GrowthShrinkEffect extends PowerEffect {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isRaisable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
get modifiers() {
|
get modifiers() {
|
||||||
|
const curSize = this.targets?.[0]?.actor?.system?.stats?.size ?? 0;
|
||||||
|
const minSteps = -2 - curSize;
|
||||||
return [
|
return [
|
||||||
...super.modifiers,
|
...super.modifiers,
|
||||||
|
{
|
||||||
|
name: 'Size Steps',
|
||||||
|
default: 1,
|
||||||
|
type: 'number',
|
||||||
|
min: minSteps,
|
||||||
|
value: 0,
|
||||||
|
id: 'steps',
|
||||||
|
epic: false,
|
||||||
|
effect: false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Duration',
|
name: 'Duration',
|
||||||
id: '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 { FarsightEffect } from './farsight.js';
|
||||||
import { FearEffect } from './fear.js';
|
import { FearEffect } from './fear.js';
|
||||||
import { FlyEffect } from './fly.js';
|
import { FlyEffect } from './fly.js';
|
||||||
|
import { GrowthShrinkEffect } from './growthShrink.js';
|
||||||
|
|
||||||
const PowerClasses = {
|
const PowerClasses = {
|
||||||
'arcane-protection': ArcaneProtectionEffect,
|
'arcane-protection': ArcaneProtectionEffect,
|
||||||
@ -37,8 +38,8 @@ const PowerClasses = {
|
|||||||
blast: BlastEffect,
|
blast: BlastEffect,
|
||||||
blind: BlindEffect,
|
blind: BlindEffect,
|
||||||
bolt: BoltEffect,
|
bolt: BoltEffect,
|
||||||
'boostlower-trait': BoostLowerTraitEffect,
|
|
||||||
'boost-lower-trait': BoostLowerTraitEffect,
|
'boost-lower-trait': BoostLowerTraitEffect,
|
||||||
|
'boostlower-trait': BoostLowerTraitEffect,
|
||||||
'boost-trait': BoostLowerTraitEffect,
|
'boost-trait': BoostLowerTraitEffect,
|
||||||
burrow: BurrowEffect,
|
burrow: BurrowEffect,
|
||||||
burst: BurstEffect,
|
burst: BurstEffect,
|
||||||
@ -63,7 +64,11 @@ const PowerClasses = {
|
|||||||
farsight: FarsightEffect,
|
farsight: FarsightEffect,
|
||||||
fear: FearEffect,
|
fear: FearEffect,
|
||||||
fly: FlyEffect,
|
fly: FlyEffect,
|
||||||
|
growth: GrowthShrinkEffect,
|
||||||
|
'growth-shrink': GrowthShrinkEffect,
|
||||||
|
growthshrink: GrowthShrinkEffect,
|
||||||
'lower-trait': BoostLowerTraitEffect,
|
'lower-trait': BoostLowerTraitEffect,
|
||||||
|
shrink: GrowthShrinkEffect,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ---------------------------------------------------------------- */
|
/* ---------------------------------------------------------------- */
|
||||||
|
|||||||
@ -6,6 +6,11 @@
|
|||||||
<p>Apply the affects of {{name}}.</p>
|
<p>Apply the affects of {{name}}.</p>
|
||||||
</section>
|
</section>
|
||||||
</header>
|
</header>
|
||||||
|
{{#if extraDescription }}
|
||||||
|
<div>
|
||||||
|
{{{extraDescription}}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
{{#if basePowerPoints}}
|
{{#if basePowerPoints}}
|
||||||
<p><strong>Base Power Points</strong>: {{basePowerPoints}}
|
<p><strong>Base Power Points</strong>: {{basePowerPoints}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
@ -33,7 +38,13 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if isNumber}}
|
{{#if isNumber}}
|
||||||
<label for="{{id}}">{{#if epic}}⭐ {{/if}}{{name}}:</label>
|
<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}}
|
||||||
{{#if isSelect}}
|
{{#if isSelect}}
|
||||||
<label>{{#if epic}}⭐ {{/if}}{{name}}:</label>
|
<label>{{#if epic}}⭐ {{/if}}{{name}}:</label>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user