Improve target validation logic in spell casting function
This commit is contained in:
parent
a6578ec8dd
commit
ecec540251
@ -41,7 +41,10 @@ function spell.new(data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
function newSpell:cast(caster, target)
|
function newSpell:cast(caster, target)
|
||||||
if not self.targetQuery:intersect(Query(targetTest.distance(self.distance))).test(caster, target) then return end -- проверка корректности цели
|
local targetQuery = self.distance
|
||||||
|
and self.targetQuery:intersect(Query(targetTest.distance(self.distance)))
|
||||||
|
or self.targetQuery
|
||||||
|
if not targetQuery.test(caster, target) then return end -- проверка корректности цели
|
||||||
|
|
||||||
-- проверка на достаточное количество маны
|
-- проверка на достаточное количество маны
|
||||||
if caster:try(Tree.behaviors.stats, function(stats)
|
if caster:try(Tree.behaviors.stats, function(stats)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user