attack & annotation refactor

This commit is contained in:
neckrat 2025-10-16 09:51:46 +03:00
parent a0ddd5f7cd
commit c27089d23e
2 changed files with 5 additions and 1 deletions

View File

@ -90,11 +90,15 @@ function attack:cast(caster, target)
if caster:try(Tree.behaviors.map, function(map)
local dist = math.max(math.abs(map.position.x - target.x), math.abs(map.position.y - target.y))
print("dist:", dist)
return dist >= 2
return dist > 2
end) then
return false
end
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