diff --git a/sonic-radiance.love/datas/gamedata/skills/attack.lua b/sonic-radiance.love/datas/gamedata/skills/attack.lua index 0ffcbff..9503c77 100644 --- a/sonic-radiance.love/datas/gamedata/skills/attack.lua +++ b/sonic-radiance.love/datas/gamedata/skills/attack.lua @@ -17,17 +17,17 @@ return { -- if not nil : {ox, oy, shape, size, affectedByDirection} choregraphy = { -- the main attack choregraphy - {'setAnimation', 'hit1', true}, - {'addGFX', 'hitGFX', 0.75, 0, true, false}, - {'sendDamage', 33, 100, false, false}, - {'setAnimation', 'hit2', true}, - {'addGFX', 'hitGFX', 0.75, 0, true, false}, - {'sendDamage', 33, 100, false, false}, - {'setAnimation', 'hit3', true}, - {'addGFX', 'hitGFX', 0.75, 0, true, false}, - {'sendDamage', 33, 100, false, false}, - {'setAnimation', 'idle', false}, - {'wait', 0.5} + {'setAnimation', "none", 'hit1', true}, + {'sendDamage', "none", 33, 100, false, false}, + {'addGFX',"sentDamage", 'hitGFX', 0.75, 0, true, false}, + {'setAnimation', "none", 'hit2', true}, + {'sendDamage', "none", 33, 100, false, false}, + {'addGFX',"sentDamage", 'hitGFX', 0.75, 0, true, false}, + {'setAnimation', "none", 'hit3', true}, + {'sendDamage', "none", 33, 100, false, false}, + {'addGFX',"sentDamage", 'hitGFX', 0.75, 0, true, false}, + {'setAnimation', "none", 'idle', false}, + {'wait', "none", 0.5} }, onContact = { -- if the attack move and touch multiple ennemies, you can add @@ -38,16 +38,23 @@ return { --[[ CHOREGRAPHY POSSIBLE EFFECTS -- "wait" :: Simply wait before doing the next command --- :: {"wait", duration} +-- :: {"wait", condition, duration} -- "setAnimation" :: Change the animation of the battler --- {"setAnimation", animation, blockProcess} +-- {"setAnimation", condition, animation, blockProcess} -- "addGFX" :: Show a GFX relatively to the target position -- :: (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", damageEffect, accuracy, isSpecial, isAerial} +-- :: {"sendDamage", condition, damageEffect, accuracy, isSpecial, isAerial} + + CONDITION TYPES +-- +-- "sentDamage" :: an ennemy have received damage +-- +-- + ]] diff --git a/sonic-radiance.love/datas/gamedata/skills/spinattack.lua b/sonic-radiance.love/datas/gamedata/skills/spinattack.lua new file mode 100644 index 0000000..d657f65 --- /dev/null +++ b/sonic-radiance.love/datas/gamedata/skills/spinattack.lua @@ -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}, + } +} diff --git a/sonic-radiance.love/scenes/battlesystem/actors/battler.lua b/sonic-radiance.love/scenes/battlesystem/actors/battler.lua index b80f03e..d98eb2a 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/battler.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/battler.lua @@ -54,6 +54,9 @@ function Battler:sendDamage(x, y, value, accuracy, isSpecial, isAerial) if (other ~= nil) then core.debug:print("battler", "sending damage to actor at position <" .. x .. ";" .. y .. ">") other:receiveDamage(value, accuracy, isSpecial, isAerial, fromWho) + return true + else + return false end end diff --git a/sonic-radiance.love/scenes/battlesystem/actors/hero.lua b/sonic-radiance.love/scenes/battlesystem/actors/hero.lua index acfdee1..17e49d9 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/hero.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/hero.lua @@ -156,6 +156,8 @@ function Hero:receiveSignal(action_type, id) elseif (action_type == "attack") then --self:changeAnimation("hit1") self:startChoregraphy("attack") + elseif (action_type == "skill") then + self:startChoregraphy(id) else self:switchActiveBattler( ) end @@ -219,6 +221,8 @@ function Hero:startChoregraphy(skill, dx, dy) self.choregraphy.dx = dx or self.x self.choregraphy.dy = dy or self.y + self.choregraphy.haveSentDamage = false + self.isChoregraphyActive = true end @@ -235,7 +239,14 @@ function Hero:switchAction() self.isChoregraphyActive = false self:switchActiveBattler() 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 @@ -244,11 +255,11 @@ function Hero:doChoregraphyAction(choregraphyAction) self.choregraphy.changeAction = true if type == "wait" then - local duration = choregraphyAction[2] or 1 + local duration = choregraphyAction[3] or 1 self:wait(duration) elseif type == "setAnimation" then - local animation = choregraphyAction[2] - local blockProcess = choregraphyAction[3] + local animation = choregraphyAction[3] + local blockProcess = choregraphyAction[4] self:changeAnimation(animation) if (blockProcess) then self.choregraphy.blockedBy = animation @@ -257,20 +268,20 @@ function Hero:doChoregraphyAction(choregraphyAction) elseif type == "sendDamage" then local xx = self.x + self.direction local yy = self.y - local power = choregraphyAction[2] - local accuracy = choregraphyAction[3] - local isSpecial = choregraphyAction[4] - local isAerial = choregraphyAction[5] - self:sendDamage(xx, yy, power, accuracy, isSpecial, isAerial) + local power = choregraphyAction[3] + local accuracy = choregraphyAction[4] + local isSpecial = choregraphyAction[5] + local isAerial = choregraphyAction[6] + self.choregraphy.haveSentDamage = self:sendDamage(xx, yy, power, accuracy, isSpecial, isAerial) elseif type == "addGFX" then - local sprite = choregraphyAction[2] - local dx = choregraphyAction[3] - local dy = choregraphyAction[4] - local affectedByDirection = choregraphyAction[5] + local sprite = choregraphyAction[3] + local dx = choregraphyAction[4] + local dy = choregraphyAction[5] + local affectedByDirection = choregraphyAction[6] if (affectedByDirection) then dx = dx * self.direction end - local blockProcess = choregraphyAction[6] + local blockProcess = choregraphyAction[7] local x = self.x local y = self.y