summon ally
This commit is contained in:
parent
6fe743130d
commit
a6e2bc7bdc
@ -20,7 +20,7 @@ class BaseSummonEffect extends ActorFolderEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get summonCount() {
|
get summonCount() {
|
||||||
return 1 + (this?.data?.additional ?? 0);
|
return 1 + (this?.data?.additionalAllies ?? 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
get additionalName() {
|
get additionalName() {
|
||||||
@ -79,6 +79,7 @@ class BaseSummonEffect extends ActorFolderEffect {
|
|||||||
|
|
||||||
async prepIncreasedTrait() {
|
async prepIncreasedTrait() {
|
||||||
if (!(this.hasIncreasedTrait && this?.data?.increasedTrait)) {
|
if (!(this.hasIncreasedTrait && this?.data?.increasedTrait)) {
|
||||||
|
this.data.increasedTraitCount = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const skillSet = new Set();
|
const skillSet = new Set();
|
||||||
@ -125,6 +126,7 @@ class BaseSummonEffect extends ActorFolderEffect {
|
|||||||
const mode = CONST.ACTIVE_EFFECT_MODES.ADD;
|
const mode = CONST.ACTIVE_EFFECT_MODES.ADD;
|
||||||
const value = 2;
|
const value = 2;
|
||||||
const priority = 0;
|
const priority = 0;
|
||||||
|
let count = 0;
|
||||||
this.data.increasedTraitChanges = [];
|
this.data.increasedTraitChanges = [];
|
||||||
for (const attr of attrList) {
|
for (const attr of attrList) {
|
||||||
if (formData[attr]) {
|
if (formData[attr]) {
|
||||||
@ -134,6 +136,7 @@ class BaseSummonEffect extends ActorFolderEffect {
|
|||||||
mode,
|
mode,
|
||||||
priority,
|
priority,
|
||||||
});
|
});
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const skill of skillList) {
|
for (const skill of skillList) {
|
||||||
@ -144,8 +147,17 @@ class BaseSummonEffect extends ActorFolderEffect {
|
|||||||
mode,
|
mode,
|
||||||
priority,
|
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() {}
|
async prePrep() {}
|
||||||
@ -220,6 +232,17 @@ class BaseSummonEffect extends ActorFolderEffect {
|
|||||||
await this.applyActiveEffects(this.source, [maintainDoc]);
|
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 {
|
export class SummonAllyEffect extends BaseSummonEffect {
|
||||||
@ -257,8 +280,7 @@ export class SummonAllyEffect extends BaseSummonEffect {
|
|||||||
if (!template) {
|
if (!template) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
this.data.combatEdges = template.items.filter((i) => i.type === 'edge');
|
const edges = template.items.filter((i) => i.type === 'edge').map((i) => i.name);
|
||||||
const edges = this.data.CombatEdges.map((i) => i.name);
|
|
||||||
edges.sort();
|
edges.sort();
|
||||||
edges.unshift('None');
|
edges.unshift('None');
|
||||||
const choices = {};
|
const choices = {};
|
||||||
@ -274,32 +296,39 @@ export class SummonAllyEffect extends BaseSummonEffect {
|
|||||||
|
|
||||||
get modifiers() {
|
get modifiers() {
|
||||||
const mods = super.modifiers;
|
const mods = super.modifiers;
|
||||||
mods.push({
|
if ('flight_template' in this.data.actors) {
|
||||||
type: 'checkbox',
|
mods.push({
|
||||||
default: false,
|
type: 'checkbox',
|
||||||
name: 'Combat Edge (+1 per edge, up to 3)',
|
default: false,
|
||||||
id: 'combatEdge',
|
name: 'Flight',
|
||||||
value: 0,
|
id: 'flight',
|
||||||
epic: false,
|
value: 2,
|
||||||
effect: false,
|
epic: false,
|
||||||
});
|
effect: false,
|
||||||
mods.push({
|
});
|
||||||
type: 'checkbox',
|
}
|
||||||
default: false,
|
if ('combat-edge_template' in this.data.actors) {
|
||||||
name: 'Flight',
|
const { choices, effects, values } = this._edges;
|
||||||
id: 'flight',
|
for (let i = 1; i <= 3; i++) {
|
||||||
value: 2,
|
mods.push({
|
||||||
epic: false,
|
type: 'select',
|
||||||
effect: false,
|
name: `Combat Edge #${i}`,
|
||||||
});
|
id: `combatEdge${i}`,
|
||||||
const { choices, effects, values } = this._edges;
|
default: 'None',
|
||||||
|
epic: false,
|
||||||
|
choices,
|
||||||
|
effects,
|
||||||
|
values,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
return mods;
|
return mods;
|
||||||
}
|
}
|
||||||
|
|
||||||
async prePrep() {
|
async prePrep() {
|
||||||
await super.prePrep();
|
await super.prePrep();
|
||||||
if (this.data.raise && this.data.actors['raise_template']) {
|
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) {
|
for (const item of raiseTemplate.items) {
|
||||||
const raiseItemDoc = await raiseTemplate.getEmbeddedDocument('Item', item.id);
|
const raiseItemDoc = await raiseTemplate.getEmbeddedDocument('Item', item.id);
|
||||||
this.data.embeddedUpdates.Item[item.name] = raiseItemDoc;
|
this.data.embeddedUpdates.Item[item.name] = raiseItemDoc;
|
||||||
@ -356,6 +385,27 @@ export class SummonAllyEffect extends BaseSummonEffect {
|
|||||||
|
|
||||||
async parseValues() {
|
async parseValues() {
|
||||||
await super.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) {
|
async createSecondaryEffects(maintId) {
|
||||||
@ -374,4 +424,17 @@ export class SummonAllyEffect extends BaseSummonEffect {
|
|||||||
}
|
}
|
||||||
return effects;
|
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