add power effect descriptions, blind, blast

This commit is contained in:
Mike Bloy 2024-05-03 00:09:42 -05:00
parent 6100f425ed
commit 5dfce6cbcc
2 changed files with 173 additions and 2 deletions

View File

@ -239,9 +239,14 @@ export class PowerEffect {
return changes
}
getPrimaryEffectDescription () {
return ""
}
async createPrimaryEffect (maintId) {
const doc = this.createEffectDocument(this.icon, this.effectName,
this.getPrimaryEffectChanges())
doc.description += this.getPrimaryEffectDescription()
doc.flags[moduleName].maintId = maintId
doc.duration.seconds = 594
return doc
@ -254,7 +259,8 @@ export class PowerEffect {
}
const doc = this.createEffectDocument(icon, `Maintaining ${this.name}`, [])
doc.duration.rounds = this.duration
doc.flags.swade.expiration = CONFIG.SWADE.CONST.STATUS_EFFECT_EXPIRATION.StartOfTurnPrompt
doc.description += this.getPrimaryEffectDescription()
doc.flags.swade.expiration = CONFIG.SWADE.CONST.STATUS_EFFECT_EXPIRATION.EndOfTurnPrompt
doc.flags.swade.loseTurnOnHold = true
doc.flags[moduleName].maintainingId = maintId
doc.flags[moduleName].targetIds = this.targets.map(t => t.id)
@ -269,6 +275,8 @@ export class PowerEffect {
// eslint-disable-next-line no-unused-vars
async primaryDocForTarget(doc, target) {
const newDoc = deepClone(doc)
newDoc.flags[moduleName].maintainingId = doc.flags[moduleName].maintId
newDoc.flags[moduleName].targetIds = [target.id]
return newDoc
}

View File

@ -116,6 +116,166 @@ class BarrierEffect extends PowerEffect {
}
}
class BeastFriendEffect extends PowerEffect {
get name () { return 'Beast Friend' }
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 isTargeted () { return false }
get isDamaging () { return true }
get basePowerPoints () { return 2 }
get usePrimaryEffect () { return false }
get modifiers () {
const mods = super.modifiers
mods.push(
{ name: 'Bestiarium', value: 2, id: 'bestiarium', epic: true, effect: false },
{ name: 'Duration', value: 1, id: 'duration', epic: false, effect: false },
{ name: 'Mind Rider', value: 1, id: 'mindrider', epic: false, effect: false },
)
return mods
}
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 {
get name () { return 'Blast' }
get icon () { return 'icons/magic/fire/explosion-fireball-large-red-orange.webp' }
get duration () { return 0 }
get isTargeted () { return false }
get isDamaging () { return true }
get basePowerPoints () { return 3 }
get menuInputs () {
const inputs = super.menuInputs
inputs.push
inputs.push({ type: 'select', label: 'Area of Effect',
options: [
{html: 'Small Blast Template (0)', value: 's', selected: false},
{html: 'Medium Blast Template (0)', value: 'm', selected: true},
{html: 'Large Blast Template (+1)', value: 'l', selected: false},
]})
return inputs
}
get modifiers () {
const mods = super.modifiers
mods.push(
{ name: 'Damage', value: 2, id: 'damage', epic: false, effect: false },
{ name: 'Greater Blast', value: 1, id: 'greater', epic: true, effect: false },
)
return mods
}
get powerPoints () {
let total = super.powerPoints
total += (this.data.aoe === 'l' ? 1 : 0)
return total
}
async parseValues () {
await super.parseValues()
this.data.aoe = this.data.values.shift()
}
get chatMessageEffects () {
const list = []
switch (this.data.aoe) {
case 's': list.push('SBT'); break;
case 'm': list.push('MBT'); break;
case 'l': list.push('LBT'); break;
}
if (this.data.mods.has('greater')) {
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
}
}
class BlindEffect extends PowerEffect {
get name () { return 'Blind' }
get icon () { return 'icons/skills/wounds/injury-eyes-blood-red.webp' }
get duration () { return 0 }
get isTargeted () { return true }
get basePowerPoints () { return 2 }
getPrimaryEffectChanges () {
const changes = [
{ key: 'system.stats.globalMods.trait', value: -2,
priority: 0, mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD } ]
return changes
}
getPrimaryEffectDescription() {
return super.getPrimaryEffectDescription() +
`<p>${this.data.raise ? -4 : -2} penalty to all actions involving sight.</p>
<p>Shake off attempts at end of turns with a Vigor
${this.data.mods.has('strong') ? '-2 ' : ''}roll as a free action.
Success removes 2 points of penalties. A raise removes the effect.</p>`
}
async createSecondaryEffects (maintId) {
const docs = await super.createSecondaryEffects(maintId)
if (this.data.raise) {
const strong = this.data.mods.has('strong')
const doc = this.createEffectDocument(
this.icon, `Blinded (${strong ? 'Strong, ' : ''}Raise)`, [
{ key: 'system.stats.globalMods.trait', value: -2,
priority: 0, mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD }
])
doc.duration.seconds = 594
doc.flags[moduleName].maintId = maintId
docs.push(doc)
}
return docs
}
get modifiers () {
const mods = super.modifiers
mods.push(
{ name: 'Strong', value: 1, id: 'strong', epic: false, effect: false },
)
return mods
}
get menuInputs () {
const inputs = super.menuInputs
inputs.push
inputs.push({ type: 'select', label: 'Area of Effect',
options: [
{html: 'None', value: 0, selected: true},
{html: 'Medium Blast Template (+2)', value: 2, selected: false},
{html: 'Large Blast Template (+3)', value: 3, selected: false},
]})
return inputs
}
async parseValues () {
await super.parseValues()
this.data.aoe = this.data.values.shift()
}
get powerPoints () {
let total = super.powerPoints
total += this.data.aoe
return total
}
get effectName () {
const strong = this.data.mods.has('strong')
return `Blinded${strong ? ' (Strong)' : ''}`
}
get chatMessageEffects () {
const list = super.chatMessageEffects
switch (this.data.aoe) {
case 2: list.push('MBT'); break
case 3: list.push('LBT'); break
}
if (this.data.mods.has('strong')) {
list.push('Strong')
}
return list
}
}
class BurrowEffect extends PowerEffect {
get name () { return 'Burrow' }
get duration () { return 5 }
@ -145,7 +305,10 @@ const PowerClasses = {
"arcane-protection": ArcaneProtectionEffect,
banish: BanishEffect,
barrier: BarrierEffect,
burrow: BurrowEffect
"beast-friend": BeastFriendEffect,
blast: BlastEffect,
blind: BlindEffect,
burrow: BurrowEffect,
}
/* ---------------------------------------------------------------- */