he's (ai) doing some stuff and i think its cool
This commit is contained in:
parent
4629cde5d4
commit
885fabe24e
@ -86,6 +86,7 @@ local function circleVectors(center, radius)
|
||||
return vecs
|
||||
end
|
||||
|
||||
--- ищет пути к ближайшему персу в определённом радиусе
|
||||
--- @param owner Character
|
||||
--- @param radius integer здесь мы должны сами определять, сколько должны не доходить до персонажа (1 <= n)
|
||||
--- @return Vec3|nil
|
||||
@ -112,18 +113,22 @@ local aiNature = {
|
||||
["dev_warrior"] = function(self)
|
||||
return function(callback) -- почему так, описано в Task
|
||||
self.owner:try(Tree.behaviors.spellcaster, function(spellB)
|
||||
self.target = pathToClosestCharacter(self.owner, 2)
|
||||
self.target = pathToClosestCharacter(self.owner, 1)
|
||||
local attackTarget = closestCharacter(self.owner):has(Tree.behaviors.positioned)
|
||||
if not attackTarget then return end
|
||||
local task1 = spellB.spellbook[1]:cast(self.owner, self.target)
|
||||
if task1 then
|
||||
task1(
|
||||
function()
|
||||
-- здесь мы оказываемся после того, как сходили в первый раз
|
||||
local newTarget = Vec3 { 1, 1 }
|
||||
local task2 = spellB.spellbook[1]:cast(self.owner, newTarget)
|
||||
print('[AI]: я походил')
|
||||
local task2 = spellB.spellbook[3]:cast(self.owner, attackTarget.position)
|
||||
if task2 then
|
||||
-- дергаем функцию после завершения хода
|
||||
print('[AI]: и ударил')
|
||||
task2(callback)
|
||||
else
|
||||
print('[AI]: чёт не бьётся')
|
||||
callback()
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user