feat(cbs): add condition to choregraphy system
This commit is contained in:
parent
56e9af6ac3
commit
a60f6ade6c
4 changed files with 66 additions and 29 deletions
|
@ -17,17 +17,17 @@ return {
|
||||||
-- if not nil : {ox, oy, shape, size, affectedByDirection}
|
-- if not nil : {ox, oy, shape, size, affectedByDirection}
|
||||||
|
|
||||||
choregraphy = { -- the main attack choregraphy
|
choregraphy = { -- the main attack choregraphy
|
||||||
{'setAnimation', 'hit1', true},
|
{'setAnimation', "none", 'hit1', true},
|
||||||
{'addGFX', 'hitGFX', 0.75, 0, true, false},
|
{'sendDamage', "none", 33, 100, false, false},
|
||||||
{'sendDamage', 33, 100, false, false},
|
{'addGFX',"sentDamage", 'hitGFX', 0.75, 0, true, false},
|
||||||
{'setAnimation', 'hit2', true},
|
{'setAnimation', "none", 'hit2', true},
|
||||||
{'addGFX', 'hitGFX', 0.75, 0, true, false},
|
{'sendDamage', "none", 33, 100, false, false},
|
||||||
{'sendDamage', 33, 100, false, false},
|
{'addGFX',"sentDamage", 'hitGFX', 0.75, 0, true, false},
|
||||||
{'setAnimation', 'hit3', true},
|
{'setAnimation', "none", 'hit3', true},
|
||||||
{'addGFX', 'hitGFX', 0.75, 0, true, false},
|
{'sendDamage', "none", 33, 100, false, false},
|
||||||
{'sendDamage', 33, 100, false, false},
|
{'addGFX',"sentDamage", 'hitGFX', 0.75, 0, true, false},
|
||||||
{'setAnimation', 'idle', false},
|
{'setAnimation', "none", 'idle', false},
|
||||||
{'wait', 0.5}
|
{'wait', "none", 0.5}
|
||||||
},
|
},
|
||||||
|
|
||||||
onContact = { -- if the attack move and touch multiple ennemies, you can add
|
onContact = { -- if the attack move and touch multiple ennemies, you can add
|
||||||
|
@ -38,16 +38,23 @@ return {
|
||||||
--[[
|
--[[
|
||||||
CHOREGRAPHY POSSIBLE EFFECTS
|
CHOREGRAPHY POSSIBLE EFFECTS
|
||||||
-- "wait" :: Simply wait before doing the next command
|
-- "wait" :: Simply wait before doing the next command
|
||||||
-- :: {"wait", duration}
|
-- :: {"wait", condition, duration}
|
||||||
|
|
||||||
-- "setAnimation" :: Change the animation of the battler
|
-- "setAnimation" :: Change the animation of the battler
|
||||||
-- {"setAnimation", animation, blockProcess}
|
-- {"setAnimation", condition, animation, blockProcess}
|
||||||
|
|
||||||
-- "addGFX" :: Show a GFX relatively to the target position
|
-- "addGFX" :: Show a GFX relatively to the target position
|
||||||
-- :: (player if target is nil)
|
-- :: (player if target is nil)
|
||||||
-- :: {"addGFX", "gfxname", x, y, affectedByDirection, blockProcess}
|
-- :: {"addGFX", condition, "gfxname", x, y, affectedByDirection, blockProcess}
|
||||||
|
|
||||||
-- "sendDamage" :: Send Damage on the whole target Area
|
-- "sendDamage" :: Send Damage on the whole target Area
|
||||||
-- ::
|
-- ::
|
||||||
-- :: {"sendDamage", damageEffect, accuracy, isSpecial, isAerial}
|
-- :: {"sendDamage", condition, damageEffect, accuracy, isSpecial, isAerial}
|
||||||
|
|
||||||
|
CONDITION TYPES
|
||||||
|
--
|
||||||
|
-- "sentDamage" :: an ennemy have received damage
|
||||||
|
--
|
||||||
|
--
|
||||||
|
|
||||||
]]
|
]]
|
||||||
|
|
16
sonic-radiance.love/datas/gamedata/skills/spinattack.lua
Normal file
16
sonic-radiance.love/datas/gamedata/skills/spinattack.lua
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
return {
|
||||||
|
name = "Spin Dash",
|
||||||
|
cost = "05",
|
||||||
|
target = nil, -- No targeting capacity
|
||||||
|
effectArea = {1, 0, "line", 5, true}, -- which area is affected by the attack
|
||||||
|
choregraphy = {
|
||||||
|
{"setAnimation", "none", "spindash", false},
|
||||||
|
{"wait", "none", 0.5},
|
||||||
|
{"setAnimation", "none", "spin", false},
|
||||||
|
{"dashForward", "none", 12, true},
|
||||||
|
{'sendDamage', 120, 100, false, false},
|
||||||
|
{'addGFX', "sentDamage", 'hitGFX', 0.75, 0, true, false},
|
||||||
|
{'jumpBack', "none", true},
|
||||||
|
{'setAnimation', "none", 'idle', false},
|
||||||
|
}
|
||||||
|
}
|
|
@ -54,6 +54,9 @@ function Battler:sendDamage(x, y, value, accuracy, isSpecial, isAerial)
|
||||||
if (other ~= nil) then
|
if (other ~= nil) then
|
||||||
core.debug:print("battler", "sending damage to actor at position <" .. x .. ";" .. y .. ">")
|
core.debug:print("battler", "sending damage to actor at position <" .. x .. ";" .. y .. ">")
|
||||||
other:receiveDamage(value, accuracy, isSpecial, isAerial, fromWho)
|
other:receiveDamage(value, accuracy, isSpecial, isAerial, fromWho)
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -156,6 +156,8 @@ function Hero:receiveSignal(action_type, id)
|
||||||
elseif (action_type == "attack") then
|
elseif (action_type == "attack") then
|
||||||
--self:changeAnimation("hit1")
|
--self:changeAnimation("hit1")
|
||||||
self:startChoregraphy("attack")
|
self:startChoregraphy("attack")
|
||||||
|
elseif (action_type == "skill") then
|
||||||
|
self:startChoregraphy(id)
|
||||||
else
|
else
|
||||||
self:switchActiveBattler( )
|
self:switchActiveBattler( )
|
||||||
end
|
end
|
||||||
|
@ -219,6 +221,8 @@ function Hero:startChoregraphy(skill, dx, dy)
|
||||||
self.choregraphy.dx = dx or self.x
|
self.choregraphy.dx = dx or self.x
|
||||||
self.choregraphy.dy = dy or self.y
|
self.choregraphy.dy = dy or self.y
|
||||||
|
|
||||||
|
self.choregraphy.haveSentDamage = false
|
||||||
|
|
||||||
self.isChoregraphyActive = true
|
self.isChoregraphyActive = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -235,7 +239,14 @@ function Hero:switchAction()
|
||||||
self.isChoregraphyActive = false
|
self.isChoregraphyActive = false
|
||||||
self:switchActiveBattler()
|
self:switchActiveBattler()
|
||||||
else
|
else
|
||||||
self:doChoregraphyAction(nextAction)
|
local condition = nextAction[2]
|
||||||
|
if (condition == "sentDamage") and (not self.choregraphy.haveSentDamage) then
|
||||||
|
core.debug:print("cbs/hero", "you didn't do damage, skipping " .. nextAction[1])
|
||||||
|
self:switchAction()
|
||||||
|
else
|
||||||
|
self:doChoregraphyAction(nextAction)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -244,11 +255,11 @@ function Hero:doChoregraphyAction(choregraphyAction)
|
||||||
self.choregraphy.changeAction = true
|
self.choregraphy.changeAction = true
|
||||||
|
|
||||||
if type == "wait" then
|
if type == "wait" then
|
||||||
local duration = choregraphyAction[2] or 1
|
local duration = choregraphyAction[3] or 1
|
||||||
self:wait(duration)
|
self:wait(duration)
|
||||||
elseif type == "setAnimation" then
|
elseif type == "setAnimation" then
|
||||||
local animation = choregraphyAction[2]
|
local animation = choregraphyAction[3]
|
||||||
local blockProcess = choregraphyAction[3]
|
local blockProcess = choregraphyAction[4]
|
||||||
self:changeAnimation(animation)
|
self:changeAnimation(animation)
|
||||||
if (blockProcess) then
|
if (blockProcess) then
|
||||||
self.choregraphy.blockedBy = animation
|
self.choregraphy.blockedBy = animation
|
||||||
|
@ -257,20 +268,20 @@ function Hero:doChoregraphyAction(choregraphyAction)
|
||||||
elseif type == "sendDamage" then
|
elseif type == "sendDamage" then
|
||||||
local xx = self.x + self.direction
|
local xx = self.x + self.direction
|
||||||
local yy = self.y
|
local yy = self.y
|
||||||
local power = choregraphyAction[2]
|
local power = choregraphyAction[3]
|
||||||
local accuracy = choregraphyAction[3]
|
local accuracy = choregraphyAction[4]
|
||||||
local isSpecial = choregraphyAction[4]
|
local isSpecial = choregraphyAction[5]
|
||||||
local isAerial = choregraphyAction[5]
|
local isAerial = choregraphyAction[6]
|
||||||
self:sendDamage(xx, yy, power, accuracy, isSpecial, isAerial)
|
self.choregraphy.haveSentDamage = self:sendDamage(xx, yy, power, accuracy, isSpecial, isAerial)
|
||||||
elseif type == "addGFX" then
|
elseif type == "addGFX" then
|
||||||
local sprite = choregraphyAction[2]
|
local sprite = choregraphyAction[3]
|
||||||
local dx = choregraphyAction[3]
|
local dx = choregraphyAction[4]
|
||||||
local dy = choregraphyAction[4]
|
local dy = choregraphyAction[5]
|
||||||
local affectedByDirection = choregraphyAction[5]
|
local affectedByDirection = choregraphyAction[6]
|
||||||
if (affectedByDirection) then
|
if (affectedByDirection) then
|
||||||
dx = dx * self.direction
|
dx = dx * self.direction
|
||||||
end
|
end
|
||||||
local blockProcess = choregraphyAction[6]
|
local blockProcess = choregraphyAction[7]
|
||||||
|
|
||||||
local x = self.x
|
local x = self.x
|
||||||
local y = self.y
|
local y = self.y
|
||||||
|
|
Loading…
Reference in a new issue