From c1e5ba880deda56728697ef38045338a954b6d3f Mon Sep 17 00:00:00 2001 From: PeaAshMeter Date: Tue, 4 Nov 2025 07:00:46 +0300 Subject: [PATCH] Fix self-targeting check in attack spell cast function --- lib/spellbook.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/spellbook.lua b/lib/spellbook.lua index 7fca275..e117065 100644 --- a/lib/spellbook.lua +++ b/lib/spellbook.lua @@ -102,13 +102,13 @@ function attack:cast(caster, target) return false end - caster:try(Tree.behaviors.stats, function (stats) + caster:try(Tree.behaviors.stats, function(stats) stats.mana = stats.mana - 2 end) --- @type Character local targetCharacterId = Tree.level.characterGrid:get(target) - if not targetCharacterId then return false end + if not targetCharacterId or targetCharacterId == caster.id then return false end local targetCharacter = Tree.level.characters[targetCharacterId] targetCharacter:try(Tree.behaviors.stats, function(stats) stats.hp = stats.hp - 4