add summon ally specific mods flight and combat edge
This commit is contained in:
parent
46a946df2c
commit
66ea4c4388
@ -621,7 +621,7 @@ class SummonEffect extends PowerEffect {
|
||||
this.icon = this.actor.prototypeToken.texture.src
|
||||
this.protoDoc = await this.actor.getTokenDocument()
|
||||
this.increasedTrait = !!(this.inputs[this.inputIndex + 2])
|
||||
this.inputIndex += 2
|
||||
this.inputIndex += 3
|
||||
this.spawnOptions = {
|
||||
controllingActor: this.token.actor,
|
||||
duplicates: this.number,
|
||||
@ -656,10 +656,6 @@ class SummonEffect extends PowerEffect {
|
||||
}
|
||||
|
||||
async prepAdditional () {
|
||||
await this.prepIncreasedTrait()
|
||||
}
|
||||
|
||||
async prepIncreasedTrait () {
|
||||
if (!this.increasedTrait) {
|
||||
return
|
||||
}
|
||||
@ -707,7 +703,8 @@ class SummonEffect extends PowerEffect {
|
||||
modKeys.push(`@Skill{${skillList[i]}}[system.die.sides]`)
|
||||
}
|
||||
}
|
||||
const effectDoc = shim.createEffectDocument(this.ICON, 'Increased Trait', this.durationRounds)
|
||||
const effectDoc = shim.createEffectDocument(
|
||||
this.ICON, 'Increased Trait', this.durationRounds)
|
||||
effectDoc.changes = modKeys.map(key => {
|
||||
return {
|
||||
key, mode: CONST.FOUNDRY.ACTIVE_EFFECT_MODES.ADD, value: '+2', priority: 0
|
||||
@ -730,6 +727,109 @@ class SummonAllyEffect extends SummonEffect {
|
||||
get actorFolder () {
|
||||
return `${super.actorFolder}/Summon Ally`
|
||||
}
|
||||
|
||||
async prepMenu () {
|
||||
await super.prepMenu()
|
||||
this.menuData.inputs = this.menuData.inputs.concat([
|
||||
{
|
||||
type: 'checkbox',
|
||||
label: 'Bite/Claw (+1)',
|
||||
options: false
|
||||
}, {
|
||||
type: 'checkbox',
|
||||
label: 'Up to 3 Combat Edges (+1 per)',
|
||||
options: false
|
||||
}, {
|
||||
type: 'checkbox',
|
||||
label: 'Flight (+3)',
|
||||
options: false
|
||||
}
|
||||
])
|
||||
}
|
||||
|
||||
async prepResult () {
|
||||
await super.prepResult()
|
||||
this.biteClaw = !!(this.inputs[this.inputIndex])
|
||||
this.combatEdge = !!(this.inputs[this.inputIndex + 1])
|
||||
this.flight = !!(this.inputs[this.inputIndex + 2])
|
||||
}
|
||||
|
||||
async prepAdditional () {
|
||||
await super.prepAdditional()
|
||||
await this.prepBiteClaw()
|
||||
await this.prepFlight()
|
||||
await this.prepCombatEdge()
|
||||
}
|
||||
|
||||
async prepCombatEdge () {
|
||||
if (!this.combatEdge || !('combat-edge_template' in this.summonableActors)) {
|
||||
return
|
||||
}
|
||||
const template = this.summonableActors['combat-edge_template']
|
||||
const edges = template.items.filter(i => i.type === 'edge').map(i => i.name)
|
||||
edges.sort()
|
||||
edges.unshift('None')
|
||||
const edgeMenuData = {
|
||||
inputs: [
|
||||
{ type: 'header', label: 'Choose Edges (+1 per choice)' },
|
||||
{ type: 'select', label: 'Edge 1', options: edges },
|
||||
{ type: 'select', label: 'Edge 2', options: edges },
|
||||
{ type: 'select', label: 'Edge 3', options: edges }
|
||||
],
|
||||
buttons: [
|
||||
{ label: 'Apply', value: 'apply' },
|
||||
{ label: 'Add no edges', value: 'cancel' }
|
||||
]
|
||||
}
|
||||
const edgeMenuOptions = {
|
||||
title: `${this.name} Combat Edge Selection`,
|
||||
defaultButton: 'Cancel',
|
||||
options: {}
|
||||
}
|
||||
const { buttons, inputs } = await shim.warpgateMenu(edgeMenuData, edgeMenuOptions)
|
||||
if (!buttons || buttons === 'cancel') {
|
||||
return
|
||||
}
|
||||
for (let i = 1; i <= 3; i++) {
|
||||
if (inputs[i] === 'None') {
|
||||
continue
|
||||
}
|
||||
const edge = template.items.getName(inputs[i])
|
||||
if (edge) {
|
||||
const doc = template.getEmbeddedDocument('Item', edge.id)
|
||||
this.spawnMutation.embedded.Item[edge.name] = doc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async prepBiteClaw () {
|
||||
if (!this.biteClaw || !('bite-claw_template' in this.summonableActors)) {
|
||||
return
|
||||
}
|
||||
const template = this.summonableActors['bite-claw_template']
|
||||
for (const item of template.items) {
|
||||
const doc = await template.getEmbeddedDocument('Item', item.id)
|
||||
this.spawnMutation.embedded.Item[item.name] = doc
|
||||
log(`Added ${item.name} to spawn mutation`)
|
||||
}
|
||||
}
|
||||
|
||||
async prepFlight () {
|
||||
if (!this.flight || !('flight_template' in this.summonableActors)) {
|
||||
return
|
||||
}
|
||||
const template = this.summonableActors.flight_template
|
||||
for (const item of template.items) {
|
||||
const doc = await template.getEmbeddedDocument('Item', item.id)
|
||||
this.spawnMutation.embedded.Item[item.name] = doc
|
||||
log(`Added ${item.name} to spawn mutation`)
|
||||
}
|
||||
for (const effect of template.effects.values()) {
|
||||
const doc = shim.ActiveEffect.fromSource(effect)
|
||||
this.spawnMutation.embedded.ActiveEffect[effect.name] = doc
|
||||
log(`Added ${effect.name} to spawn mutation`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const PowerClasses = {
|
||||
|
||||
@ -13,6 +13,10 @@ export class CONST {
|
||||
}
|
||||
|
||||
export class shim {
|
||||
static get ActiveEffect () {
|
||||
return ActiveEffect
|
||||
}
|
||||
|
||||
static get folders () {
|
||||
return game.folders
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user