add additional recipients to power structure
This commit is contained in:
parent
baa9d51c18
commit
c679304ae2
@ -69,6 +69,9 @@ class PowerEffect {
|
||||
get duration () { return 5 }
|
||||
get basePowerPoints () { return 0 }
|
||||
get usePrimaryEffect () { return true }
|
||||
get hasAdditionalRecipients () { return false }
|
||||
get additionalRecipientCost () { return 0 }
|
||||
get isTargeted () { return false }
|
||||
get modifiers () {
|
||||
return [
|
||||
{ name: 'Glow',
|
||||
@ -122,10 +125,15 @@ class PowerEffect {
|
||||
{ type: 'header', label: `${this.name} Effect` },
|
||||
{ type: 'info', label: `Apply ${this.name} Effect` },
|
||||
]
|
||||
if (this.targets.length > 0) {
|
||||
if (this.isTargeted) {
|
||||
let label = `<strong>Targets:</strong> ${this.targets.map(t => t.name).join(',')}`
|
||||
if (this.targets.length > 1 && this.hasAdditionalRecipients) {
|
||||
label += ` (${this.targets.length - 1} additional recipients ` +
|
||||
`+${this.additionalRecipientCost} ea.)`
|
||||
}
|
||||
data.push({
|
||||
type: 'info',
|
||||
label: `<strong>Targets:</strong> ${this.targets.map(t => t.name).join(',')}`
|
||||
label: label
|
||||
})
|
||||
}
|
||||
for (const mod of this.modifiers) {
|
||||
@ -174,7 +182,10 @@ class PowerEffect {
|
||||
async parseValues () {
|
||||
this.data.rawValues = deepClone(this.data.values)
|
||||
this.data.raise = this.data.button === 'raise'
|
||||
for (let i = 0; i < 3; i++) {
|
||||
for (let i = 0; i < 2; i++) {
|
||||
this.data.values.shift()
|
||||
}
|
||||
if (this.isTargeted) {
|
||||
this.data.values.shift()
|
||||
}
|
||||
this.data.mods = new Set()
|
||||
@ -272,6 +283,9 @@ class PowerEffect {
|
||||
total += mod.value
|
||||
}
|
||||
}
|
||||
if (this.targets.length > 1 && this.hasAdditionalRecipients) {
|
||||
total += (this.targets.length - 1) * this.additionalRecipientCost
|
||||
}
|
||||
return total
|
||||
}
|
||||
|
||||
@ -289,34 +303,16 @@ class PowerEffect {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class AdditionalRecipientsMixin extends PowerEffect {
|
||||
get additionalRecipientCost () { return 1 }
|
||||
get menuInputs () {
|
||||
const inputs = super.menuInputs
|
||||
if (this.targets.length > 1) {
|
||||
inputs[2].label += ` (${this.targets.length - 1} additional recipients ` +
|
||||
` +${this.additionalRecipientCost} ea.)`
|
||||
}
|
||||
return inputs
|
||||
}
|
||||
|
||||
get powerPoints () {
|
||||
let pp = super.powerPoints
|
||||
if (this.targets.length > 1) {
|
||||
pp += (this.targets.length - 1) * this.additionalRecipientCost
|
||||
}
|
||||
return pp
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class BurrowEffect extends PowerEffect, AdditionalRecipientsMixin {
|
||||
class BurrowEffect extends PowerEffect {
|
||||
get name () { return 'Burrow' }
|
||||
get duration () { return 5 }
|
||||
get icon () { return 'icons/magic/earth/projectile-stone-landslide.webp' }
|
||||
get hasAdditionalRecipients () { return true }
|
||||
get additionalRecipientCost () { return 1 }
|
||||
get basePowerPoints () { return 1 }
|
||||
get isTargeted () { return true }
|
||||
get effectName () {
|
||||
return `${this.name} (${this.data.raise ? 'half' : 'full'} pace)`
|
||||
return `${this.name} (${this.data.raise ? 'full' : 'half'} pace)`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user