From 75ed02a710619fea5b5cabfb1871ae90be4013f9 Mon Sep 17 00:00:00 2001 From: Jack Holloway Date: Tue, 7 Jan 2025 22:20:27 +0000 Subject: [PATCH] Flame Blade --- CHANGELOG.md | 1 + macros/spells/flameBlade.js | 61 ------------------ src/effects/specialSpells.js | 5 -- src/effects/spells/flameBlade.js | 32 ---------- src/parser/enrichers/DDBSpellEnricher.mjs | 1 + src/parser/enrichers/spell/FlameBlade.mjs | 77 +++++++++++++++++++++++ src/parser/enrichers/spell/_module.mjs | 1 + 7 files changed, 80 insertions(+), 98 deletions(-) delete mode 100644 macros/spells/flameBlade.js delete mode 100644 src/effects/spells/flameBlade.js create mode 100644 src/parser/enrichers/spell/FlameBlade.mjs diff --git a/CHANGELOG.md b/CHANGELOG.md index c01c673b7..9a6bfefb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Next Up - Hex, Ice Knife, Fire Shield, Flesh to Stone and Heroism Midi automations for v4. +- Various spell fixes. # 6.0.62 diff --git a/macros/spells/flameBlade.js b/macros/spells/flameBlade.js deleted file mode 100644 index 899167ef7..000000000 --- a/macros/spells/flameBlade.js +++ /dev/null @@ -1,61 +0,0 @@ -if (args[0].tag === "OnUse" && ["preTargeting"].includes(args[0].macroPass)) { - args[0].workflow.item.system['target']['type'] = "self"; - args[0].workflow.item.system.range = { value: null, units: "self", long: null }; - return; -} - -// DAE Item Macro, pass spell level -const lastArg = args[args.length - 1]; -const tokenOrActor = await fromUuid(lastArg.actorUuid); -const target = tokenOrActor.actor ? tokenOrActor.actor : tokenOrActor; -const castItemName = "Summoned Flame Blade"; - -/** - * Create Flame Blade item in inventory - */ -if (args[0] === "on") { - const castItem = target.items.find((i) => i.name === castItemName && i.type === "weapon"); - if (!castItem) { - const DAEItem = lastArg.efData.flags.dae.itemData; - const weaponDamage = 2 + Math.floor(args[1] / 2); - const weaponData = { - name: castItemName, - type: "weapon", - system: { - quantity: 1, - activation: { type: "action", cost: 1, condition: "", }, - target: { value: 1, type: "creature", }, - range: { value: 5, long: null, units: "", }, - ability: DAEItem.system.ability, - actionType: "msak", - attack: { - bonus: DAEItem.system.attack.bonus, - }, - chatFlavor: "", - critical: null, - damage: { parts: [[`${weaponDamage}d6`, "fire"]], versatile: "" }, - type: { - value: "simpleM", - }, - properties: ["mgc"], - proficient: true, - equipped: true, - description: DAEItem.system.description, - }, - flags: { FlameBlade: target.id, ddbimporter: { ignoreItemUpdate: true } }, - img: DAEItem.img, - }; - - await target.createEmbeddedDocuments("Item", [weaponData]); - ui.notifications.notify("Flame Blade created in your inventory"); - } -} - -// Delete Flame Blade -if (args[0] === "off") { - const blades = target.items.filter((i) => i.flags?.FlameBlade === target.id); - if (blades.length > 0) { - await target.deleteEmbeddedDocuments("Item", blades.map((s) => s.id)); - ui.notifications.notify("Flame Blade removed from your inventory"); - } -} diff --git a/src/effects/specialSpells.js b/src/effects/specialSpells.js index 61c181a65..1aba8e9ad 100644 --- a/src/effects/specialSpells.js +++ b/src/effects/specialSpells.js @@ -22,7 +22,6 @@ import { divineWordEffect } from "./spells/divineWord.js"; import { enhanceAbilityEffect } from "./spells/enhanceAbility.js"; import { ensnaringStrikeEffect } from "./spells/ensnaringStrike.js"; import { eyebiteEffect } from "./spells/eyebite.js"; -import { flameBladeEffect } from "./spells/flameBlade.js"; import { greaseEffect } from "./spells/grease.js"; import { hailOfThornsEffect } from "./spells/hailOfThorns.js"; import { heroesFeastEffect } from "./spells/heroesFeast.js"; @@ -136,10 +135,6 @@ async function midiEffectAdjustment(document) { document = await eyebiteEffect(document); break; } - case "Flame Blade": { - document = await flameBladeEffect(document); - break; - } case "Grease": { document = await greaseEffect(document); break; diff --git a/src/effects/spells/flameBlade.js b/src/effects/spells/flameBlade.js deleted file mode 100644 index 195ad6fff..000000000 --- a/src/effects/spells/flameBlade.js +++ /dev/null @@ -1,32 +0,0 @@ -import { baseSpellEffect } from "../specialSpells.js"; -import { DDBMacros } from "../../lib/_module.mjs"; - -export async function flameBladeEffect(document) { - let effect = baseSpellEffect(document, document.name); - effect.changes.push( - DDBMacros.generateMacroChange({ macroValues: "@spellLevel", macroType: "spell", macroName: "flameBlade.js" }), - ); - - effect.changes.push( - { - key: "ATL.light.dim", - mode: CONST.ACTIVE_EFFECT_MODES.UPGRADE, - value: "20", - priority: 20, - }, - { - key: "ATL.light.bright", - mode: CONST.ACTIVE_EFFECT_MODES.UPGRADE, - value: "10", - priority: 20, - }, - ); - foundry.utils.setProperty(effect, "flags.dae.selfTarget", true); - foundry.utils.setProperty(effect, "flags.dae.selfTargetAlways", true); - document.system.actionType = "other"; - document.effects.push(effect); - document.system.damage = { parts: [], versatile: "", value: "" }; - DDBMacros.setMidiOnUseMacroFlag(document, "spell", "flameBlade.js", ["preTargeting"]); - await DDBMacros.setItemMacroFlag(document, "spell", "flameBlade.js"); - return document; -} diff --git a/src/parser/enrichers/DDBSpellEnricher.mjs b/src/parser/enrichers/DDBSpellEnricher.mjs index b6c2062c6..2d1f64445 100644 --- a/src/parser/enrichers/DDBSpellEnricher.mjs +++ b/src/parser/enrichers/DDBSpellEnricher.mjs @@ -159,6 +159,7 @@ export default class DDBSpellEnricher extends DDBEnricherFactoryMixin { "Banishment": SpellEnrichers.Banishment, "Ice Knife": SpellEnrichers.IceKnife, "Flesh to Stone": SpellEnrichers.FleshToStone, + "Flame Blade": SpellEnrichers.FlameBlade, // Needs work // "Web": SpellEnrichers.Web, }; diff --git a/src/parser/enrichers/spell/FlameBlade.mjs b/src/parser/enrichers/spell/FlameBlade.mjs new file mode 100644 index 000000000..3859ae67f --- /dev/null +++ b/src/parser/enrichers/spell/FlameBlade.mjs @@ -0,0 +1,77 @@ +/* eslint-disable class-methods-use-this */ +import DDBEnricherData from "../data/DDBEnricherData.mjs"; + +export default class FlameBlade extends DDBEnricherData { + + get type() { + return "utility"; + } + + get activity() { + return { + name: "Summon Blade", + }; + } + + get effects() { + return [ + { + name: "Flame Blade", + activityMatch: "Summon Blade", + atlChanges: [ + DDBEnricherData.ChangeHelper.upgradeChange("20", 20, "ATL.light.dim"), + DDBEnricherData.ChangeHelper.upgradeChange("10", 20, "ATL.light.bright"), + ], + data: { + flags: { + dae: { + selfTarget: true, + selfTargetAlways: true, + }, + }, + }, + }, + ]; + } + + get additionalActivities() { + return [ + { + constructor: { + name: "Attack", + type: "attack", + }, + build: { + generateAttack: true, + generateDamage: true, + geneateActivation: true, + noSpellslot: true, + generateRange: true, + generateTarget: true, + }, + overrides: { + activationType: "action", + targetType: "creature", + data: { + range: { + value: 5, + units: "ft", + }, + damage: { + parts: [ + DDBEnricherData.basicDamagePart({ + number: 3, + denomination: 6, + bonus: "@mod", + scalingMode: "whole", + scalingNumber: 1, + }), + ], + }, + }, + }, + }, + ]; + } + +} diff --git a/src/parser/enrichers/spell/_module.mjs b/src/parser/enrichers/spell/_module.mjs index ad9d420b0..16d4e4c37 100644 --- a/src/parser/enrichers/spell/_module.mjs +++ b/src/parser/enrichers/spell/_module.mjs @@ -46,6 +46,7 @@ export { default as FalseLife } from "./FalseLife.mjs"; export { default as FeatherFall } from "./FeatherFall.mjs"; export { default as Feeblemind } from "./Feeblemind.mjs"; export { default as FireShield } from "./FireShield.mjs"; +export { default as FlameBlade } from "./FlameBlade.mjs"; export { default as FlamingSphere } from "./FlamingSphere.mjs"; export { default as FleshToStone } from "./FleshToStone.mjs"; export { default as Fly } from "./Fly.mjs";