refactoring the refactoring
This commit is contained in:
parent
ca7acd7e9d
commit
dd4735d50a
@ -73,6 +73,8 @@ export class PowerEffect {
|
|||||||
get isDamaging () { return false }
|
get isDamaging () { return false }
|
||||||
get additionalRecipientCost () { return 0 }
|
get additionalRecipientCost () { return 0 }
|
||||||
get isTargeted () { return false }
|
get isTargeted () { return false }
|
||||||
|
get isRaisable () { return true }
|
||||||
|
get hasAoe () { return false }
|
||||||
get modifiers () {
|
get modifiers () {
|
||||||
const mods = []
|
const mods = []
|
||||||
mods.push({ name: 'Adaptable Caster', id: 'adaptable',
|
mods.push({ name: 'Adaptable Caster', id: 'adaptable',
|
||||||
@ -106,7 +108,9 @@ export class PowerEffect {
|
|||||||
mods.push({ name: 'Lingering Damage', id: 'lingeringdamage', value: 2,
|
mods.push({ name: 'Lingering Damage', id: 'lingeringdamage', value: 2,
|
||||||
epic: false, effect: false})
|
epic: false, effect: false})
|
||||||
}
|
}
|
||||||
|
if (this.hasAoe) {
|
||||||
mods.push({ name: 'Selective', id: 'selective', value: 1, epic: false, effect: false })
|
mods.push({ name: 'Selective', id: 'selective', value: 1, epic: false, effect: false })
|
||||||
|
}
|
||||||
return mods
|
return mods
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,9 +166,12 @@ export class PowerEffect {
|
|||||||
get menuButtons () {
|
get menuButtons () {
|
||||||
const data = [
|
const data = [
|
||||||
{ label: 'Apply', value: 'apply' },
|
{ label: 'Apply', value: 'apply' },
|
||||||
{ label: 'Apply with Raise', value: 'raise' },
|
|
||||||
{ label: 'Cancel', value: 'cancel' }
|
|
||||||
]
|
]
|
||||||
|
if (this.isRaisable) {
|
||||||
|
data.push({ label: 'Apply with Raise', value: 'raise' })
|
||||||
|
}
|
||||||
|
data.push({ label: 'Cancel', value: 'cancel' })
|
||||||
|
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,14 +246,14 @@ export class PowerEffect {
|
|||||||
return changes
|
return changes
|
||||||
}
|
}
|
||||||
|
|
||||||
getPrimaryEffectDescription () {
|
get description () {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
async createPrimaryEffect (maintId) {
|
async createPrimaryEffect (maintId) {
|
||||||
const doc = this.createEffectDocument(this.icon, this.effectName,
|
const doc = this.createEffectDocument(this.icon, this.effectName,
|
||||||
this.getPrimaryEffectChanges())
|
this.getPrimaryEffectChanges())
|
||||||
doc.description += this.getPrimaryEffectDescription()
|
doc.description += this.description
|
||||||
doc.flags[moduleName].maintId = maintId
|
doc.flags[moduleName].maintId = maintId
|
||||||
doc.duration.seconds = 594
|
doc.duration.seconds = 594
|
||||||
return doc
|
return doc
|
||||||
@ -259,7 +266,7 @@ export class PowerEffect {
|
|||||||
}
|
}
|
||||||
const doc = this.createEffectDocument(icon, `Maintaining ${this.name}`, [])
|
const doc = this.createEffectDocument(icon, `Maintaining ${this.name}`, [])
|
||||||
doc.duration.rounds = this.duration
|
doc.duration.rounds = this.duration
|
||||||
doc.description += this.getPrimaryEffectDescription()
|
doc.description += this.description
|
||||||
doc.flags.swade.expiration = CONFIG.SWADE.CONST.STATUS_EFFECT_EXPIRATION.EndOfTurnPrompt
|
doc.flags.swade.expiration = CONFIG.SWADE.CONST.STATUS_EFFECT_EXPIRATION.EndOfTurnPrompt
|
||||||
doc.flags.swade.loseTurnOnHold = true
|
doc.flags.swade.loseTurnOnHold = true
|
||||||
doc.flags[moduleName].maintainingId = maintId
|
doc.flags[moduleName].maintainingId = maintId
|
||||||
@ -371,6 +378,10 @@ export class PowerEffect {
|
|||||||
text += ` on ${this.targets.map(t => t.name).join(', ')}`
|
text += ` on ${this.targets.map(t => t.name).join(', ')}`
|
||||||
}
|
}
|
||||||
text += '</p>'
|
text += '</p>'
|
||||||
|
const desc = this.description
|
||||||
|
if (desc) {
|
||||||
|
text += `<details><summary>Description</summary>${desc}</details>`
|
||||||
|
}
|
||||||
const effects = this.chatMessageEffects
|
const effects = this.chatMessageEffects
|
||||||
if (effects.length > 0) {
|
if (effects.length > 0) {
|
||||||
text += '<details><summary>Other Effects:</summary><ul><li>' +
|
text += '<details><summary>Other Effects:</summary><ul><li>' +
|
||||||
|
|||||||
@ -22,10 +22,10 @@ class ArcaneProtectionEffect extends PowerEffect {
|
|||||||
get _penaltyAmount () {
|
get _penaltyAmount () {
|
||||||
return (this.data.raise ? -4 : -2) + (this.data.mods.has('greater') ? -2 : 0)
|
return (this.data.raise ? -4 : -2) + (this.data.mods.has('greater') ? -2 : 0)
|
||||||
}
|
}
|
||||||
getPrimaryEffectDescription () {
|
get description () {
|
||||||
let text = super.getPrimaryEffectDescription()
|
let text = super.description
|
||||||
text += `<p>Hostile powers are at ${this._penaltyAmount}
|
text += `<p>Hostile powers are at ${this._penaltyAmount} when
|
||||||
targeting or damaging this character.</p>`
|
targeting or damaging the affected character.</p>`
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
get effectName () {
|
get effectName () {
|
||||||
@ -42,6 +42,8 @@ class BanishEffect extends PowerEffect {
|
|||||||
get basePowerPoints () { return 3 }
|
get basePowerPoints () { return 3 }
|
||||||
get usePrimaryEffect () { return false }
|
get usePrimaryEffect () { return false }
|
||||||
get isTargeted () { return true }
|
get isTargeted () { return true }
|
||||||
|
get isRaisable () { return false }
|
||||||
|
get hasAoe () { return true }
|
||||||
get menuInputs () {
|
get menuInputs () {
|
||||||
const inputs = super.menuInputs
|
const inputs = super.menuInputs
|
||||||
inputs.push
|
inputs.push
|
||||||
@ -59,8 +61,15 @@ class BanishEffect extends PowerEffect {
|
|||||||
total += this.data.aoe
|
total += this.data.aoe
|
||||||
return total
|
return total
|
||||||
}
|
}
|
||||||
|
get description () {
|
||||||
|
return super.description + `
|
||||||
|
<p>An opposed roll of the caster's skill vs the target's Spirit.
|
||||||
|
<strong>Success:</strong> Shaken, <strong>each Raise:</strong> 1 Wound
|
||||||
|
Incapacitation results in banishment to home plane.</p>
|
||||||
|
`
|
||||||
|
}
|
||||||
get chatMessageEffects () {
|
get chatMessageEffects () {
|
||||||
const list = []
|
const list = super.chatMessageEffects
|
||||||
switch (this.data.aoe) {
|
switch (this.data.aoe) {
|
||||||
case 0: break
|
case 0: break
|
||||||
case 1:
|
case 1:
|
||||||
@ -73,9 +82,6 @@ class BanishEffect extends PowerEffect {
|
|||||||
list.push('LBT')
|
list.push('LBT')
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
list.push("Opposed Roll: caster's arcane skill vs target's Spirit.")
|
|
||||||
list.push("<strong>Success:</strong> Shaken, <strong>Each Raise:</strong> 1 Wound")
|
|
||||||
list.push("If target incapacitated by this, banishment to home plane")
|
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
async parseValues () {
|
async parseValues () {
|
||||||
@ -96,7 +102,6 @@ class BarrierEffect extends PowerEffect {
|
|||||||
const mods = super.modifiers
|
const mods = super.modifiers
|
||||||
mods.push({ name: 'Damage', id: 'damage', value: 1, epic: false, effect: false })
|
mods.push({ name: 'Damage', id: 'damage', value: 1, epic: false, effect: false })
|
||||||
mods.push({ name: 'Damage (immaterial trapping)', id: 'damage', value: 0, epic: false, effect: false })
|
mods.push({ name: 'Damage (immaterial trapping)', id: 'damage', value: 0, epic: false, effect: false })
|
||||||
|
|
||||||
mods.push({ name: 'Deadly', id: 'deadly', value: 2, epic: true, effect: false })
|
mods.push({ name: 'Deadly', id: 'deadly', value: 2, epic: true, effect: false })
|
||||||
mods.push({ name: 'Hardened', id: 'hardened', value: 1, epic: false, effect: false })
|
mods.push({ name: 'Hardened', id: 'hardened', value: 1, epic: false, effect: false })
|
||||||
mods.push({ name: 'Shaped', id: 'shaped', value: 1, epic: false, effect: false })
|
mods.push({ name: 'Shaped', id: 'shaped', value: 1, epic: false, effect: false })
|
||||||
@ -115,48 +120,28 @@ class BarrierEffect extends PowerEffect {
|
|||||||
get _hardness () {
|
get _hardness () {
|
||||||
return (this.data.raise ? 12 : 10) + (this.data.mods.has('hardened') ? 2 : 0)
|
return (this.data.raise ? 12 : 10) + (this.data.mods.has('hardened') ? 2 : 0)
|
||||||
}
|
}
|
||||||
getPrimaryEffectDescription () {
|
get description () {
|
||||||
let text = super.getPrimaryEffectDescription()
|
let text = super.description
|
||||||
text += `<p>A barrier ${this._height} tall and ${this._length} long, of hardness ${this._hardness}.`
|
text += `<p>A barrier ${this._height} tall and ${this._length} long, of hardness ${this._hardness}. `
|
||||||
if (this.data.mods.has('deadly')) {
|
if (this.data.mods.has('deadly')) {
|
||||||
text += 'It does 2d6 damage to anyone who contacts it.'
|
text += 'It does 2d6 damage to anyone who contacts it. '
|
||||||
} else if (this.data.mods.has('damage')) {
|
} else if (this.data.mods.has('damage')) {
|
||||||
text += 'It does 2d4 damage to anyone who contacts it.'
|
text += 'It does 2d4 damage to anyone who contacts it. '
|
||||||
}
|
}
|
||||||
if (this.data.mods.has('shaped')) {
|
if (this.data.mods.has('shaped')) {
|
||||||
text += 'It was shaped into a circle, square, or rectangle.'
|
text += 'It was shaped into a circle, square, or rectangle. '
|
||||||
}
|
}
|
||||||
text += '</p>'
|
text += '</p>'
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
get chatMessageEffects () {
|
|
||||||
const list = []
|
|
||||||
list.push(
|
|
||||||
`The Barrier is ${this._height} tall and ${this._length} long, of hardness ${this._hardness}.`
|
|
||||||
)
|
|
||||||
if (this.data.mods.has('deadly')) {
|
|
||||||
list.push('Deadly: 2d6 to anyone who contacts')
|
|
||||||
} else if (this.data.mods.has('damage')) {
|
|
||||||
list.push('Damage: 2d4 to anyone who contacts')
|
|
||||||
}
|
|
||||||
if (this.data.mods.has('shaped')) {
|
|
||||||
list.push('Shaped (circle, square, or rectangle)')
|
|
||||||
}
|
|
||||||
if (this.data.mods.has('size')) {
|
|
||||||
list.push('Size - length and height doubled')
|
|
||||||
}
|
|
||||||
return list
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class BeastFriendEffect extends PowerEffect {
|
class BeastFriendEffect extends PowerEffect {
|
||||||
get name () { return 'Beast Friend' }
|
get name () { return 'Beast Friend' }
|
||||||
get duration () { return (this.data.mods.has('duration') ? 30 : 10) * 6 * 60 }
|
get duration () { return (this.data.mods.has('duration') ? 30 : 10) * 6 * 60 }
|
||||||
get icon () { return 'icons/magic/nature/wolf-paw-glow-large-green.webp' }
|
get icon () { return 'icons/magic/nature/wolf-paw-glow-large-green.webp' }
|
||||||
get isTargeted () { return false }
|
get isTargeted () { return true }
|
||||||
get isDamaging () { return true }
|
get usePrimaryEffect () { return true }
|
||||||
get basePowerPoints () { return 2 }
|
|
||||||
get usePrimaryEffect () { return false }
|
|
||||||
get modifiers () {
|
get modifiers () {
|
||||||
const mods = super.modifiers
|
const mods = super.modifiers
|
||||||
mods.push(
|
mods.push(
|
||||||
@ -166,28 +151,33 @@ class BeastFriendEffect extends PowerEffect {
|
|||||||
)
|
)
|
||||||
return mods
|
return mods
|
||||||
}
|
}
|
||||||
getPrimaryEffectDescription () {
|
get menuInputs () {
|
||||||
let text = super.getPrimaryEffectDescription()
|
const inputs = super.menuInputs
|
||||||
|
const pp = Math.max(
|
||||||
|
this.targets.
|
||||||
|
map(t => Math.max(t.actor.system.stats.size, 1)).
|
||||||
|
reduce((a,b) => a+b, 0),
|
||||||
|
1)
|
||||||
|
inputs.push({ type: 'number', label: 'Base power points', options: pp})
|
||||||
|
return inputs
|
||||||
|
}
|
||||||
|
async parseValues () {
|
||||||
|
await super.parseValues()
|
||||||
|
this.data.basePP = this.data.values.shift()
|
||||||
|
}
|
||||||
|
get basePowerPoints () { return this?.data?.basePP || 2 }
|
||||||
|
get description () {
|
||||||
|
let text = super.description
|
||||||
if (this.data.raise) {
|
if (this.data.raise) {
|
||||||
text += '<p>Creatures will overcome instincts to follow orders.'
|
text += '<p>Creatures will overcome instincts to follow orders.'
|
||||||
} else {
|
} else {
|
||||||
text += '<p>Creatures obey simple commands, subject to their insticts.'
|
text += '<p>Creatures obey simple commands, subject to their insticts.'
|
||||||
}
|
}
|
||||||
if (this.data.mods('bestiarium')) {
|
if (this.data.mods.has('bestiarium')) {
|
||||||
text += ' The caster may even effect magical beasts.'
|
text += ' The caster may even effect magical beasts.'
|
||||||
}
|
}
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
get chatMessageEffects () {
|
|
||||||
const list = []
|
|
||||||
if (this.data.mods.has('bestiarium')) {
|
|
||||||
list.push('Bestiarium, affect magical beasts with animal intelligence')
|
|
||||||
}
|
|
||||||
if (this.data.mods.has('mindrider')) {
|
|
||||||
list.push('Mind rider. Can communicate and sense through any befrended beasts')
|
|
||||||
}
|
|
||||||
return list
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class BlastEffect extends PowerEffect {
|
class BlastEffect extends PowerEffect {
|
||||||
@ -225,21 +215,14 @@ class BlastEffect extends PowerEffect {
|
|||||||
await super.parseValues()
|
await super.parseValues()
|
||||||
this.data.aoe = this.data.values.shift()
|
this.data.aoe = this.data.values.shift()
|
||||||
}
|
}
|
||||||
get chatMessageEffects () {
|
get description () {
|
||||||
const list = []
|
const dmgDie = (
|
||||||
switch (this.data.aoe) {
|
this.data.mods.has('greater') ? 4 :
|
||||||
case 's': list.push('SBT'); break;
|
(this.data.mods.has('damage') ? 3 : 2)) + (this.data.raise ? 1 : 0)
|
||||||
case 'm': list.push('MBT'); break;
|
const size = (
|
||||||
case 'l': list.push('LBT'); break;
|
this.data.aoe === 'l' ? 'LBT' : (this.data.aoe === 's' ? 'SBT' : 'MBT'))
|
||||||
}
|
return super.description + `
|
||||||
if (this.data.mods.has('greater')) {
|
<p>The blast covers a ${size} and does ${dmgDie}d6 damage</p>`
|
||||||
list.push('Greater Blast: 4d6 damage')
|
|
||||||
} else if (this.data.mods.has('damage')) {
|
|
||||||
list.push('Damaging: 3d6 damage')
|
|
||||||
} else {
|
|
||||||
list.push('2d6 damage')
|
|
||||||
}
|
|
||||||
return list
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,8 +238,8 @@ class BlindEffect extends PowerEffect {
|
|||||||
priority: 0, mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD } ]
|
priority: 0, mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD } ]
|
||||||
return changes
|
return changes
|
||||||
}
|
}
|
||||||
getPrimaryEffectDescription() {
|
get description () {
|
||||||
return super.getPrimaryEffectDescription() +
|
return super.description +
|
||||||
`<p>${this.data.raise ? -4 : -2} penalty to all actions involving sight.</p>
|
`<p>${this.data.raise ? -4 : -2} penalty to all actions involving sight.</p>
|
||||||
<p>Shake off attempts at end of turns with a Vigor
|
<p>Shake off attempts at end of turns with a Vigor
|
||||||
${this.data.mods.has('strong') ? '-2 ' : ''}roll as a free action.
|
${this.data.mods.has('strong') ? '-2 ' : ''}roll as a free action.
|
||||||
@ -272,6 +255,8 @@ class BlindEffect extends PowerEffect {
|
|||||||
priority: 0, mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD }
|
priority: 0, mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD }
|
||||||
])
|
])
|
||||||
doc.duration.seconds = 594
|
doc.duration.seconds = 594
|
||||||
|
doc.description = this.description +
|
||||||
|
"<p>This is the raise effect which can be shaken off separately.</p>"
|
||||||
doc.flags[moduleName].maintId = maintId
|
doc.flags[moduleName].maintId = maintId
|
||||||
docs.push(doc)
|
docs.push(doc)
|
||||||
}
|
}
|
||||||
@ -314,13 +299,52 @@ class BlindEffect extends PowerEffect {
|
|||||||
case 2: list.push('MBT'); break
|
case 2: list.push('MBT'); break
|
||||||
case 3: list.push('LBT'); break
|
case 3: list.push('LBT'); break
|
||||||
}
|
}
|
||||||
if (this.data.mods.has('strong')) {
|
|
||||||
list.push('Strong')
|
|
||||||
}
|
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class BoltEffect extends PowerEffect {
|
||||||
|
get name () { return 'Bolt' }
|
||||||
|
get icon () { return 'icons/magic/fire/explosion-fireball-large-red-orange.webp' }
|
||||||
|
get duration () { return 0 }
|
||||||
|
get isTargeted () { return true }
|
||||||
|
get isDamaging () { return true }
|
||||||
|
get basePowerPoints () { return 3 }
|
||||||
|
get modifiers () {
|
||||||
|
const mods = super.modifiers
|
||||||
|
mods.push(
|
||||||
|
{ name: 'Damage', value: 2, id: 'damage', epic: false, effect: false },
|
||||||
|
{ name: 'Disintegrate', value: 1, id: 'disintigrate', epic: true, effect: false },
|
||||||
|
{ name: 'Greater Blast', value: 1, id: 'greater', epic: true, effect: false },
|
||||||
|
{ name: 'Rate of Fire', value: 2, id: 'rof', epic: true, effect: false },
|
||||||
|
)
|
||||||
|
return mods
|
||||||
|
}
|
||||||
|
get powerPoints () {
|
||||||
|
let total = super.powerPoints
|
||||||
|
total += (this.data.aoe === 'l' ? 1 : 0)
|
||||||
|
return total
|
||||||
|
}
|
||||||
|
get description () {
|
||||||
|
const dmgDie = (
|
||||||
|
this.data.mods.has('greater') ? 4 :
|
||||||
|
(this.data.mods.has('damage') ? 3 : 2)) + (this.data.raise ? 1 : 0)
|
||||||
|
let desc = super.description + '<p>'
|
||||||
|
if (this.data.mods.has('rof')) {
|
||||||
|
desc += `Up to two bolts (RoF 2) do ${dmgDie}d6 damage each.`
|
||||||
|
} else {
|
||||||
|
desc += `The bolt does ${dmgDie}d6 damage.`
|
||||||
|
}
|
||||||
|
if (this.data.mods.has('disintegrate')) {
|
||||||
|
desc += 'The bolt is <em>disintegrating</em>. If being used to break' +
|
||||||
|
' something, the damage dice can Ace. A creature Incapacitated by a ' +
|
||||||
|
'disintegrating bolt must make a Vigor roll or its body turns to dust'
|
||||||
|
}
|
||||||
|
desc += '</p>'
|
||||||
|
return desc
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class BurrowEffect extends PowerEffect {
|
class BurrowEffect extends PowerEffect {
|
||||||
get name () { return 'Burrow' }
|
get name () { return 'Burrow' }
|
||||||
get duration () { return 5 }
|
get duration () { return 5 }
|
||||||
@ -344,21 +368,14 @@ class BurrowEffect extends PowerEffect {
|
|||||||
return `${this.name} ${this.data.mods.has('power') ? '[Power] ' : ''}` +
|
return `${this.name} ${this.data.mods.has('power') ? '[Power] ' : ''}` +
|
||||||
`(${this.data.raise ? 'full' : 'half'} pace)`
|
`(${this.data.raise ? 'full' : 'half'} pace)`
|
||||||
}
|
}
|
||||||
getPrimaryEffectDescription() {
|
get description() {
|
||||||
let text = super.getPrimaryEffectDescription() +
|
let text = super.description +
|
||||||
`<p>Meld into the ground. Move at ${this.data.raise ? 'full' : 'half'} pace. May not run.</p>`
|
`<p>Meld into the ground. Move at ${this.data.raise ? 'full' : 'half'} pace. May not run.</p>`
|
||||||
if (this.data.mods.has('power')) {
|
if (this.data.mods.has('power')) {
|
||||||
text += `<p>Can <em>burrow</em> through solid stone, concrete, etc</p>`
|
text += `<p>Can <em>burrow</em> through solid stone, concrete, etc</p>`
|
||||||
}
|
}
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
get chatMessageEffects () {
|
|
||||||
const list = super.chatMessageEffects
|
|
||||||
if (this.data.mods.has('Power')) {
|
|
||||||
list.push('Power: Burrow through solid stone, concrete')
|
|
||||||
}
|
|
||||||
return list
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const PowerClasses = {
|
const PowerClasses = {
|
||||||
@ -368,6 +385,7 @@ const PowerClasses = {
|
|||||||
"beast-friend": BeastFriendEffect,
|
"beast-friend": BeastFriendEffect,
|
||||||
blast: BlastEffect,
|
blast: BlastEffect,
|
||||||
blind: BlindEffect,
|
blind: BlindEffect,
|
||||||
|
bolt: BoltEffect,
|
||||||
burrow: BurrowEffect,
|
burrow: BurrowEffect,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user