add several more powers
Invisiblity, Intangability, Protection, Smite
This commit is contained in:
parent
c577a8ec0f
commit
d7c30e3990
@ -279,7 +279,7 @@ class ConfusionEffect extends TargetedPowerEffect {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
prepMenu () {
|
async prepMenu () {
|
||||||
this.menuData.inputs.push(
|
this.menuData.inputs.push(
|
||||||
{ type: 'checkbox', label: 'Greater (adds Shaken)', options: false })
|
{ type: 'checkbox', label: 'Greater (adds Shaken)', options: false })
|
||||||
this.menuData.buttons = [
|
this.menuData.buttons = [
|
||||||
@ -290,7 +290,7 @@ class ConfusionEffect extends TargetedPowerEffect {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
prepResult () {
|
async prepResult () {
|
||||||
const greater = !!this.inputs[this.inputIndex]
|
const greater = !!this.inputs[this.inputIndex]
|
||||||
if (this.buttons === 'distracted' || this.buttons === 'raise') {
|
if (this.buttons === 'distracted' || this.buttons === 'raise') {
|
||||||
this.effectDocs.push(shim.getStatus('SWADE.Distr', 'Distracted'))
|
this.effectDocs.push(shim.getStatus('SWADE.Distr', 'Distracted'))
|
||||||
@ -313,7 +313,7 @@ class DeflectionEffect extends TargetedPowerEffect {
|
|||||||
return 5
|
return 5
|
||||||
}
|
}
|
||||||
|
|
||||||
prepMenu () {
|
async prepMenu () {
|
||||||
this.menuData.buttons = [
|
this.menuData.buttons = [
|
||||||
{ label: 'Melee', value: 'melee' },
|
{ label: 'Melee', value: 'melee' },
|
||||||
{ label: 'Ranged', value: 'ranged' },
|
{ label: 'Ranged', value: 'ranged' },
|
||||||
@ -322,7 +322,7 @@ class DeflectionEffect extends TargetedPowerEffect {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
prepResult () {
|
async prepResult () {
|
||||||
const effectName = `Deflection (${this.buttons === 'raise' ? 'all' : this.buttons})`
|
const effectName = `Deflection (${this.buttons === 'raise' ? 'all' : this.buttons})`
|
||||||
const icon = 'icons/magic/defensive/shield-barrier-deflect-teal.webp'
|
const icon = 'icons/magic/defensive/shield-barrier-deflect-teal.webp'
|
||||||
this.effectDocs.push(shim.createEffectDocument(icon, effectName, this.durationRounds))
|
this.effectDocs.push(shim.createEffectDocument(icon, effectName, this.durationRounds))
|
||||||
@ -338,7 +338,7 @@ class EntangleEffect extends TargetedPowerEffect {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
prepMenu () {
|
async prepMenu () {
|
||||||
this.menuData.inputs = this.menuData.inputs.concat([
|
this.menuData.inputs = this.menuData.inputs.concat([
|
||||||
{ type: 'radio', label: 'Not Damaging', options: ['dmg', true] },
|
{ type: 'radio', label: 'Not Damaging', options: ['dmg', true] },
|
||||||
{ type: 'radio', label: 'Damaging', options: ['dmg', false] },
|
{ type: 'radio', label: 'Damaging', options: ['dmg', false] },
|
||||||
@ -352,7 +352,7 @@ class EntangleEffect extends TargetedPowerEffect {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
prepResult () {
|
async prepResult () {
|
||||||
const damage = (this.inputs[this.inputIndex + 1]
|
const damage = (this.inputs[this.inputIndex + 1]
|
||||||
? '2d4'
|
? '2d4'
|
||||||
: (this.inputs[this.inputIndex + 2] ? '2d6' : null))
|
: (this.inputs[this.inputIndex + 2] ? '2d6' : null))
|
||||||
@ -391,7 +391,7 @@ class IntangibilityEffect extends TargetedPowerEffect {
|
|||||||
return 5 // no duration
|
return 5 // no duration
|
||||||
}
|
}
|
||||||
|
|
||||||
prepMenu () {
|
async prepMenu () {
|
||||||
this.menuData.inputs.push({ type: 'checkbox', label: 'Duration', options: false })
|
this.menuData.inputs.push({ type: 'checkbox', label: 'Duration', options: false })
|
||||||
this.menuData.buttons = [
|
this.menuData.buttons = [
|
||||||
{ label: 'Apply', value: 'apply' },
|
{ label: 'Apply', value: 'apply' },
|
||||||
@ -399,13 +399,125 @@ class IntangibilityEffect extends TargetedPowerEffect {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
prepResult () {
|
async prepResult () {
|
||||||
const icon = 'icons/magic/control/debuff-energy-hold-levitate-blue-yellow.webp'
|
const icon = 'icons/magic/control/debuff-energy-hold-levitate-blue-yellow.webp'
|
||||||
const effect = shim.createEffectDocument(icon, this.name, this.durationRounds, [])
|
const effect = shim.createEffectDocument(icon, this.name, this.durationRounds, [])
|
||||||
this.effectDocs.push(effect)
|
this.effectDocs.push(effect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class InvisibilityEffect extends TargetedPowerEffect {
|
||||||
|
get name () {
|
||||||
|
return 'Invisiblity'
|
||||||
|
}
|
||||||
|
|
||||||
|
get durationRounds () {
|
||||||
|
if (!this.inputs) {
|
||||||
|
return 5
|
||||||
|
}
|
||||||
|
if (this.inputs[this.inputs.length - 1]) { // Duration
|
||||||
|
return 50
|
||||||
|
}
|
||||||
|
return 5 // no duration
|
||||||
|
}
|
||||||
|
|
||||||
|
async prepMenu () {
|
||||||
|
this.menuData.inputs.push({ type: 'checkbox', label: 'Duration', options: false })
|
||||||
|
}
|
||||||
|
|
||||||
|
async prepResult () {
|
||||||
|
const effect = shim.getStatus('EFFECT.StatusInvisible', 'Invisible')
|
||||||
|
effect.duration = { rounds: this.durationRounds }
|
||||||
|
this.effectDocs.push(effect)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ProtectionEffect extends TargetedPowerEffect {
|
||||||
|
get name () {
|
||||||
|
return 'Protection'
|
||||||
|
}
|
||||||
|
|
||||||
|
get durationRounds () {
|
||||||
|
return 5
|
||||||
|
}
|
||||||
|
|
||||||
|
async prepMenu () {
|
||||||
|
this.menuData.buttons = [
|
||||||
|
{ label: 'Apply (+2 armor)', value: 'apply' },
|
||||||
|
{ label: 'Apply with raise (+2 toughness)', value: 'raise' },
|
||||||
|
{ label: 'Cancel', value: 'cancel' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
async prepResult () {
|
||||||
|
const effect = shim.getStatus('SWADE.Protection', 'Protection')
|
||||||
|
effect.duration = { rounds: this.durationRounds }
|
||||||
|
const mode = CONST.FOUNDRY.ACTIVE_EFFECT_MODES.ADD
|
||||||
|
effect.changes = [
|
||||||
|
{ key: 'system.stats.toughness.armor', mode, value: 2, priority: 0 }
|
||||||
|
]
|
||||||
|
if (this.buttons === 'raise') {
|
||||||
|
effect.changes[0].key = 'system.stats.toughness.value'
|
||||||
|
}
|
||||||
|
this.effectDocs.push(effect)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SmiteEffect extends TargetedPowerEffect {
|
||||||
|
get name () {
|
||||||
|
return 'Smite'
|
||||||
|
}
|
||||||
|
|
||||||
|
get durationRounds () {
|
||||||
|
return 5
|
||||||
|
}
|
||||||
|
|
||||||
|
async prepMenu () {
|
||||||
|
this.menuData.inputs.push({
|
||||||
|
type: 'checkbox', label: 'Greater', options: false
|
||||||
|
})
|
||||||
|
const tokenWeapons = {}
|
||||||
|
let index = this.menuData.inputs.length - 1
|
||||||
|
for (const token of this.targets) {
|
||||||
|
index += 2
|
||||||
|
tokenWeapons[token.id] = index
|
||||||
|
this.menuData.inputs.push({ type: 'info', label: `<h2>${token.name}</h2>` })
|
||||||
|
const weapons = token.actor.items.filter(i => i.type === 'weapon').map(
|
||||||
|
i => { return { value: i.name, html: i.name } })
|
||||||
|
weapons.unshift({ value: '', html: '<i>None</i>' })
|
||||||
|
this.menuData.inputs.push({ type: 'select', label: token.name, options: weapons })
|
||||||
|
}
|
||||||
|
this.tokenWeapons = tokenWeapons
|
||||||
|
}
|
||||||
|
|
||||||
|
async prepResult () {
|
||||||
|
this.baseEffect = shim.getStatus('SWADE.Smite', 'Smite')
|
||||||
|
}
|
||||||
|
|
||||||
|
async applyResult () {
|
||||||
|
const mode = CONST.FOUNDRY.ACTIVE_EFFECT_MODES.ADD
|
||||||
|
const raise = (this.buttons === 'raise')
|
||||||
|
const greater = !!this.inputs[this.inputIndex]
|
||||||
|
const changeValue = (greater ? (raise ? '+6' : '+4') : (raise ? '+4' : '+2'))
|
||||||
|
for (const token of this.targets) {
|
||||||
|
const weaponName = this.inputs[this.tokenWeapons[token.id]]
|
||||||
|
const weaponId = token.actor.items.getName(weaponName)?.id
|
||||||
|
const changeKey = `@Weapon{${weaponName}}[system.actions.dmgMod]`
|
||||||
|
if (!weaponId) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
const effectName = `${this.buttons === 'raise' ? 'major' : 'minor'} Smite${greater ? ' (greater)' : ''} (${weaponName})`
|
||||||
|
const changes = [
|
||||||
|
{ key: changeKey, mode, value: changeValue, priority: 0 }
|
||||||
|
]
|
||||||
|
this.baseEffect.changes = changes
|
||||||
|
this.baseEffect.name = effectName
|
||||||
|
console.log(token, weaponName, weaponId, effectName, changeKey)
|
||||||
|
await shim.applyActiveEffects(token, [this.baseEffect].concat(this.effectDocs))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const PowerClasses = {
|
const PowerClasses = {
|
||||||
blind: BlindEffect,
|
blind: BlindEffect,
|
||||||
'boost/lower trait': BoostLowerTraitEffect,
|
'boost/lower trait': BoostLowerTraitEffect,
|
||||||
@ -413,8 +525,11 @@ const PowerClasses = {
|
|||||||
confusion: ConfusionEffect,
|
confusion: ConfusionEffect,
|
||||||
deflection: DeflectionEffect,
|
deflection: DeflectionEffect,
|
||||||
entangle: EntangleEffect,
|
entangle: EntangleEffect,
|
||||||
inangibility: IntangibilityEffect,
|
intangibility: IntangibilityEffect,
|
||||||
'lower trait': BoostLowerTraitEffect
|
invisibility: InvisibilityEffect,
|
||||||
|
'lower trait': BoostLowerTraitEffect,
|
||||||
|
protection: ProtectionEffect,
|
||||||
|
smite: SmiteEffect
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function powerEffects (options = {}) {
|
export async function powerEffects (options = {}) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user