summon increased effect
This commit is contained in:
parent
00d1bedaa0
commit
46a946df2c
@ -36,7 +36,7 @@ class PowerEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get durationRounds () {
|
get durationRounds () {
|
||||||
return this.baseDurationRounds()
|
return this.baseDurationRounds
|
||||||
}
|
}
|
||||||
|
|
||||||
get baseDurationRounds () {
|
get baseDurationRounds () {
|
||||||
@ -595,17 +595,22 @@ class SummonEffect extends PowerEffect {
|
|||||||
|
|
||||||
this.summonableActors = actors
|
this.summonableActors = actors
|
||||||
|
|
||||||
this.menuData.inputs.push({
|
this.menuData.inputs = this.menuData.inputs.concat([
|
||||||
type: 'select',
|
{
|
||||||
label: 'Creature to summon',
|
type: 'select',
|
||||||
options: Object.keys(actors).filter(
|
label: 'Creature to summon',
|
||||||
k => !k.includes('_template')).sort().map(actorData)
|
options: Object.keys(actors).filter(
|
||||||
})
|
k => !k.includes('_template')).sort().map(actorData)
|
||||||
this.menuData.inputs.push({
|
}, {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
label: 'Number to spawn (+half base cost per)',
|
label: 'Number to spawn (+half base cost per)',
|
||||||
options: 1
|
options: 1
|
||||||
})
|
}, {
|
||||||
|
type: 'checkbox',
|
||||||
|
label: 'Add Increased Trait(s)? (+1 per trait)',
|
||||||
|
options: false
|
||||||
|
}
|
||||||
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
async prepResult () {
|
async prepResult () {
|
||||||
@ -615,6 +620,8 @@ class SummonEffect extends PowerEffect {
|
|||||||
this.actor = shim.actors.get(this.actorId)
|
this.actor = shim.actors.get(this.actorId)
|
||||||
this.icon = this.actor.prototypeToken.texture.src
|
this.icon = this.actor.prototypeToken.texture.src
|
||||||
this.protoDoc = await this.actor.getTokenDocument()
|
this.protoDoc = await this.actor.getTokenDocument()
|
||||||
|
this.increasedTrait = !!(this.inputs[this.inputIndex + 2])
|
||||||
|
this.inputIndex += 2
|
||||||
this.spawnOptions = {
|
this.spawnOptions = {
|
||||||
controllingActor: this.token.actor,
|
controllingActor: this.token.actor,
|
||||||
duplicates: this.number,
|
duplicates: this.number,
|
||||||
@ -648,7 +655,69 @@ class SummonEffect extends PowerEffect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async prepAdditional () {
|
||||||
|
await this.prepIncreasedTrait()
|
||||||
|
}
|
||||||
|
|
||||||
|
async prepIncreasedTrait () {
|
||||||
|
if (!this.increasedTrait) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const traitMenuOptions = {
|
||||||
|
title: `${this.name} Summon Trait Increase`,
|
||||||
|
defaultButton: 'Cancel',
|
||||||
|
options: {}
|
||||||
|
}
|
||||||
|
const skillSet = new Set()
|
||||||
|
for (const skill of this.actor.items.filter(i => i.type === 'skill')) {
|
||||||
|
skillSet.add(skill.name)
|
||||||
|
}
|
||||||
|
for (const item of Object.values(this.spawnMutation.embedded.Item).filter(i => i.type === 'skill')) {
|
||||||
|
skillSet.add(item.name)
|
||||||
|
}
|
||||||
|
const skillList = Array.from(skillSet)
|
||||||
|
const attrList = ['Agility', 'Smarts', 'Spirit', 'Strength', 'Vigor']
|
||||||
|
skillList.sort()
|
||||||
|
const traitMenuData = {
|
||||||
|
inputs: [
|
||||||
|
{ type: 'header', label: 'Increase Attributes (+1 each)' }
|
||||||
|
],
|
||||||
|
buttons: [
|
||||||
|
{ label: 'Apply', value: 'apply' },
|
||||||
|
{ label: 'Increase no traits', value: 'cancel' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
traitMenuData.inputs = traitMenuData.inputs.concat(
|
||||||
|
attrList.map((x) => { return { type: 'checkbox', label: x, options: false } }))
|
||||||
|
traitMenuData.inputs.push({ type: 'header', label: 'Increase Skills (+1 each)' })
|
||||||
|
traitMenuData.inputs = traitMenuData.inputs.concat(
|
||||||
|
skillList.map((x) => { return { type: 'checkbox', label: x, options: false } }))
|
||||||
|
const { buttons, inputs } = await shim.warpgateMenu(traitMenuData, traitMenuOptions)
|
||||||
|
if (!buttons || buttons === 'cancel') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const modKeys = []
|
||||||
|
for (let i = 0; i < attrList.length; i++) {
|
||||||
|
if (inputs[i + 1]) {
|
||||||
|
modKeys.push(`system.attributes.${attrList[i].toLowerCase()}.die.sides`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let i = 0; i < skillList.length; i++) {
|
||||||
|
if (inputs[i + 7]) {
|
||||||
|
modKeys.push(`@Skill{${skillList[i]}}[system.die.sides]`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.spawnMutation.embedded.ActiveEffect[effectDoc.name] = effectDoc
|
||||||
|
}
|
||||||
|
|
||||||
async applyResult () {
|
async applyResult () {
|
||||||
|
await this.prepAdditional()
|
||||||
await shim.warpgateSpawn(this.protoDoc, this.spawnMutation, {}, this.spawnOptions)
|
await shim.warpgateSpawn(this.protoDoc, this.spawnMutation, {}, this.spawnOptions)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user