feature/task #29
@ -22,7 +22,7 @@ function spell:update(caster, dt) end
|
||||
|
||||
function spell:draw() end
|
||||
|
||||
function spell:cast(caster, target) return true end
|
||||
function spell:cast(caster, target) return end
|
||||
|
||||
local walk = setmetatable({
|
||||
--- @type Deque
|
||||
@ -55,32 +55,9 @@ function walk:cast(caster, target)
|
||||
return
|
||||
end
|
||||
|
||||
local testChar = Tree.level.characters[1];
|
||||
|
||||
|
||||
return function(callback) -- <- вызовется после всех анимаций
|
||||
local counter = require 'lib.utils.counter' (callback)
|
||||
counter.push()
|
||||
return function(callback)
|
||||
return caster:has(Tree.behaviors.tiled):followPath(path)(
|
||||
function()
|
||||
do
|
||||
counter.push()
|
||||
local initialPos2 = caster:has(Tree.behaviors.positioned).position:floor()
|
||||
local path2 = require "lib.pathfinder" (initialPos2, Vec3 { 10, math.random(1, 10) })
|
||||
path:pop_front()
|
||||
caster:has(Tree.behaviors.tiled):followPath(path2)(counter.pop)
|
||||
end
|
||||
|
||||
do
|
||||
counter.push()
|
||||
local testInitialPos = testChar:has(Tree.behaviors.positioned).position:floor()
|
||||
local testPath = require "lib.pathfinder" (testInitialPos, Vec3 { 10, math.random(20, 5) })
|
||||
path:pop_front()
|
||||
testChar:has(Tree.behaviors.tiled):followPath(testPath)(counter.pop)
|
||||
end
|
||||
|
||||
counter.pop()
|
||||
end
|
||||
callback
|
||||
) -- <- callback вызовется после followPath
|
||||
end
|
||||
end
|
||||
@ -114,9 +91,10 @@ function regenerateMana:cast(caster, target)
|
||||
stats.mana = 10
|
||||
stats.initiative = stats.initiative + 10
|
||||
end)
|
||||
print(caster.id, "has regenerated mana and gained initiative")
|
||||
|
||||
local sprite = caster:has(Tree.behaviors.sprite)
|
||||
if not sprite then return nil end
|
||||
print(caster.id, "has regenerated mana and gained initiative")
|
||||
|
||||
local light = require "lib/character/character".spawn("Light Effect")
|
||||
light:addBehavior {
|
||||
@ -126,11 +104,12 @@ function regenerateMana:cast(caster, target)
|
||||
}
|
||||
|
||||
return function(callback)
|
||||
print(light:has(Tree.behaviors.light).animateColor)
|
||||
light:has(Tree.behaviors.light):animateColor(Vec3 {})(function()
|
||||
light:has(Tree.behaviors.light):animateColor(Vec3 {})(
|
||||
function()
|
||||
light:die()
|
||||
callback()
|
||||
end)
|
||||
end
|
||||
)
|
||||
sprite:animate("hurt")(callback)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user