Fix self-targeting check in attack spell cast function

This commit is contained in:
PeaAshMeter 2025-11-04 07:00:46 +03:00
parent 3838037006
commit c1e5ba880d

View File

@ -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