attack & annotation refactor
This commit is contained in:
parent
a0ddd5f7cd
commit
c27089d23e
@ -90,11 +90,15 @@ function attack:cast(caster, target)
|
|||||||
if caster:try(Tree.behaviors.map, function(map)
|
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))
|
local dist = math.max(math.abs(map.position.x - target.x), math.abs(map.position.y - target.y))
|
||||||
print("dist:", dist)
|
print("dist:", dist)
|
||||||
return dist >= 2
|
return dist > 2
|
||||||
end) then
|
end) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
caster:try(Tree.behaviors.stats, function (stats)
|
||||||
|
stats.mana = stats.mana - 2
|
||||||
|
end)
|
||||||
|
|
||||||
--- @type Character
|
--- @type Character
|
||||||
local targetCharacterId = Tree.level.characterGrid:get(target)
|
local targetCharacterId = Tree.level.characterGrid:get(target)
|
||||||
if not targetCharacterId then return false end
|
if not targetCharacterId then return false end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user