summon ally
This commit is contained in:
parent
6fe743130d
commit
a6e2bc7bdc
@ -20,7 +20,7 @@ class BaseSummonEffect extends ActorFolderEffect {
|
||||
}
|
||||
|
||||
get summonCount() {
|
||||
return 1 + (this?.data?.additional ?? 0);
|
||||
return 1 + (this?.data?.additionalAllies ?? 0);
|
||||
}
|
||||
|
||||
get additionalName() {
|
||||
@ -79,6 +79,7 @@ class BaseSummonEffect extends ActorFolderEffect {
|
||||
|
||||
async prepIncreasedTrait() {
|
||||
if (!(this.hasIncreasedTrait && this?.data?.increasedTrait)) {
|
||||
this.data.increasedTraitCount = 0;
|
||||
return;
|
||||
}
|
||||
const skillSet = new Set();
|
||||
@ -125,6 +126,7 @@ class BaseSummonEffect extends ActorFolderEffect {
|
||||
const mode = CONST.ACTIVE_EFFECT_MODES.ADD;
|
||||
const value = 2;
|
||||
const priority = 0;
|
||||
let count = 0;
|
||||
this.data.increasedTraitChanges = [];
|
||||
for (const attr of attrList) {
|
||||
if (formData[attr]) {
|
||||
@ -134,6 +136,7 @@ class BaseSummonEffect extends ActorFolderEffect {
|
||||
mode,
|
||||
priority,
|
||||
});
|
||||
count++;
|
||||
}
|
||||
}
|
||||
for (const skill of skillList) {
|
||||
@ -144,8 +147,17 @@ class BaseSummonEffect extends ActorFolderEffect {
|
||||
mode,
|
||||
priority,
|
||||
});
|
||||
count++;
|
||||
}
|
||||
}
|
||||
this.data.increasedTraitCount = count;
|
||||
}
|
||||
|
||||
get powerPoints() {
|
||||
let value = super.powerPoints;
|
||||
value += this.data.increasedTraitCount;
|
||||
let halfValue = Math.ceil(value / 2);
|
||||
return value + (this.data.additionalAllies ?? 0) * halfValue;
|
||||
}
|
||||
|
||||
async prePrep() {}
|
||||
@ -220,6 +232,17 @@ class BaseSummonEffect extends ActorFolderEffect {
|
||||
await this.applyActiveEffects(this.source, [maintainDoc]);
|
||||
}
|
||||
}
|
||||
|
||||
get description() {
|
||||
let desc = super.description;
|
||||
desc += `<p>Summon a ${this.targetActor.prototypeToken.name} ally to serve
|
||||
the caster. The Ally acts on the caster's action card, and follows commands
|
||||
to the best of its ability.</p>`;
|
||||
if (this.data.mindRider) {
|
||||
desc += `<p>The caster can sense and communicate through the ally.</p>`;
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
export class SummonAllyEffect extends BaseSummonEffect {
|
||||
@ -257,8 +280,7 @@ export class SummonAllyEffect extends BaseSummonEffect {
|
||||
if (!template) {
|
||||
return [];
|
||||
}
|
||||
this.data.combatEdges = template.items.filter((i) => i.type === 'edge');
|
||||
const edges = this.data.CombatEdges.map((i) => i.name);
|
||||
const edges = template.items.filter((i) => i.type === 'edge').map((i) => i.name);
|
||||
edges.sort();
|
||||
edges.unshift('None');
|
||||
const choices = {};
|
||||
@ -274,32 +296,39 @@ export class SummonAllyEffect extends BaseSummonEffect {
|
||||
|
||||
get modifiers() {
|
||||
const mods = super.modifiers;
|
||||
mods.push({
|
||||
type: 'checkbox',
|
||||
default: false,
|
||||
name: 'Combat Edge (+1 per edge, up to 3)',
|
||||
id: 'combatEdge',
|
||||
value: 0,
|
||||
epic: false,
|
||||
effect: false,
|
||||
});
|
||||
mods.push({
|
||||
type: 'checkbox',
|
||||
default: false,
|
||||
name: 'Flight',
|
||||
id: 'flight',
|
||||
value: 2,
|
||||
epic: false,
|
||||
effect: false,
|
||||
});
|
||||
const { choices, effects, values } = this._edges;
|
||||
if ('flight_template' in this.data.actors) {
|
||||
mods.push({
|
||||
type: 'checkbox',
|
||||
default: false,
|
||||
name: 'Flight',
|
||||
id: 'flight',
|
||||
value: 2,
|
||||
epic: false,
|
||||
effect: false,
|
||||
});
|
||||
}
|
||||
if ('combat-edge_template' in this.data.actors) {
|
||||
const { choices, effects, values } = this._edges;
|
||||
for (let i = 1; i <= 3; i++) {
|
||||
mods.push({
|
||||
type: 'select',
|
||||
name: `Combat Edge #${i}`,
|
||||
id: `combatEdge${i}`,
|
||||
default: 'None',
|
||||
epic: false,
|
||||
choices,
|
||||
effects,
|
||||
values,
|
||||
});
|
||||
}
|
||||
}
|
||||
return mods;
|
||||
}
|
||||
|
||||
async prePrep() {
|
||||
await super.prePrep();
|
||||
if (this.data.raise && this.data.actors['raise_template']) {
|
||||
const raiseTemplate = this.summonableActors.raise_template;
|
||||
const raiseTemplate = this.data.actors.raise_template;
|
||||
for (const item of raiseTemplate.items) {
|
||||
const raiseItemDoc = await raiseTemplate.getEmbeddedDocument('Item', item.id);
|
||||
this.data.embeddedUpdates.Item[item.name] = raiseItemDoc;
|
||||
@ -356,6 +385,27 @@ export class SummonAllyEffect extends BaseSummonEffect {
|
||||
|
||||
async parseValues() {
|
||||
await super.parseValues();
|
||||
const template = this.data.actors['combat-edge_template'];
|
||||
for (let i = 1; i <= 3; i++) {
|
||||
const edgeName = this.data[`combatEdge${i}`];
|
||||
if (edgeName === 'None') {
|
||||
continue;
|
||||
}
|
||||
const edgeId = template.items.find((i) => i.type === 'edge' && i.name === edgeName).id;
|
||||
const edge = await template.getEmbeddedDocument('Item', edgeId);
|
||||
this.data.embeddedUpdates.Item[edgeName] = edge;
|
||||
}
|
||||
if (this.data.flight && 'flight_template' in this.data.actors) {
|
||||
const flightTemplate = this.data.actors.flight_template;
|
||||
for (const item of flightTemplate.items) {
|
||||
const doc = await flightTemplate.getEmbeddedDocument('Item', item.id);
|
||||
this.data.embeddedUpdates.Item[item.name] = doc;
|
||||
}
|
||||
for (const effect of flightTemplate.effects.values()) {
|
||||
const doc = ActiveEffect.fromSource(effect);
|
||||
this.data.embeddedUpdates.ActiveEffect[effect.name] = doc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async createSecondaryEffects(maintId) {
|
||||
@ -374,4 +424,17 @@ export class SummonAllyEffect extends BaseSummonEffect {
|
||||
}
|
||||
return effects;
|
||||
}
|
||||
|
||||
get description() {
|
||||
let desc = super.description;
|
||||
if (this.targetActor.prototypeToken.name === 'Mirror Self') {
|
||||
desc = `<p>Summon a clone of ${this.source.name} with the same number of
|
||||
Power Points (after casting), but lowered skills, an Extra, and mundane
|
||||
equipment.</p>`;
|
||||
if (this.data.mindRider) {
|
||||
desc += `<p>The caster can sense and communicate through the ally.</p>`;
|
||||
}
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user