diff --git a/sonic-radiance.love/datas/cbs.lua b/sonic-radiance.love/datas/cbs.lua new file mode 100644 index 0000000..7d1028e --- /dev/null +++ b/sonic-radiance.love/datas/cbs.lua @@ -0,0 +1,6 @@ +local CONST = {} + +CONST.ACCURACY = 100 +CONST.ATKWRONGTYPE = 0.66 + +return CONST \ No newline at end of file diff --git a/sonic-radiance.love/datas/gamedata/ennemies/skills/tackle.lua b/sonic-radiance.love/datas/gamedata/ennemies/skills/tackle.lua index 0663022..d5550f3 100644 --- a/sonic-radiance.love/datas/gamedata/ennemies/skills/tackle.lua +++ b/sonic-radiance.love/datas/gamedata/ennemies/skills/tackle.lua @@ -14,7 +14,7 @@ return { choregraphy = { -- the main attack choregraphy {"goTo", "none", "target", -0.4, 0, 0.5, true}, - {"sendDamage", "none", 120, 100, false, false}, + {"sendDamage", "none", 120, "basic", "none", false}, {'addGFX', "sentDamage", 'hitGFX', "target", -0.4, 0, true, false}, {'playSFX', "sentDamage", 'hitconnect'}, {'jumpBack', "none", 0.3, true}, diff --git a/sonic-radiance.love/datas/gamedata/skills/attack.lua b/sonic-radiance.love/datas/gamedata/skills/attack.lua index 2599828..08e5121 100644 --- a/sonic-radiance.love/datas/gamedata/skills/attack.lua +++ b/sonic-radiance.love/datas/gamedata/skills/attack.lua @@ -18,7 +18,7 @@ return { {"addQTE", "none", {"simplePrompt", {{"A", 1}}, 0.2}, "target", false}, {'playSFX', "none", 'hit'}, {'setAnimation', "none", 'hit1start', true}, - {'sendDamage', "none", 33, 100, false, false}, + {'sendDamage', "none", 33, "basic", "none", false}, {'addGFX',"sentDamage", 'hitGFX', "actor", 0.75, 0, true, false}, {'playSFX', "sentDamage", 'hitconnect'}, {'setAnimation', "none", 'hit1end', true}, @@ -26,7 +26,7 @@ return { {"addQTE", "none", {"simplePrompt", {{"A", 1}}, 0.2}, "target", false}, {'playSFX', "none", 'hit'}, {'setAnimation', "none", 'hit2start', true}, - {'sendDamage', "none", 33, 100, false, false}, + {'sendDamage', "none", 33, "basic", "none", false}, {'addGFX',"sentDamage", 'hitGFX', "actor", 0.75, 0, true, false}, {'playSFX', "sentDamage", 'hitconnect'}, {'setAnimation', "none", 'hit2end', true}, @@ -34,7 +34,7 @@ return { {"addQTE", "none", {"simplePrompt", {{"A", 1}}, 0.2}, "target", false}, {'playSFX', "none", 'hit'}, {'setAnimation', "none", 'hit3start', true}, - {'sendDamage', "none", 33, 100, false, false}, + {'sendDamage', "none", 33, "basic", "none", false}, {'addGFX',"sentDamage", 'hitGFX', "actor", 0.75, 0, true, false}, {'playSFX', "sentDamage", 'hitconnect'}, {'setAnimation', "none", 'hit3end', true}, diff --git a/sonic-radiance.love/datas/gamedata/skills/spinattack.lua b/sonic-radiance.love/datas/gamedata/skills/spinattack.lua index 4368023..a37dd8a 100644 --- a/sonic-radiance.love/datas/gamedata/skills/spinattack.lua +++ b/sonic-radiance.love/datas/gamedata/skills/spinattack.lua @@ -19,7 +19,7 @@ return { {"setAnimation", "none", "spin", false}, {'playSFX', "none", 'spinrelease'}, {"waitActorFinished", "none", "goTo"}, - {"sendDamage", "none", 120, 100, false, false}, + {"sendDamage", "none", 120, "basic", "none", false}, {'addGFX', "sentDamage", 'hitGFX', "target", 0, 0, true, false}, {'playSFX', "sentDamage", 'hitconnect'}, {'jumpBack', "none", 0.3, true}, diff --git a/sonic-radiance.love/datas/gamedata/skills/spindash.lua b/sonic-radiance.love/datas/gamedata/skills/spindash.lua index eccf4fd..cc5fa24 100644 --- a/sonic-radiance.love/datas/gamedata/skills/spindash.lua +++ b/sonic-radiance.love/datas/gamedata/skills/spindash.lua @@ -14,7 +14,7 @@ return { {"setAnimation", "none", "spin", false}, {'playSFX', "none", 'spinrelease'}, {"goTo", "none", "target", 0, 0, 0.3, true}, - {"sendDamage", "none", 120, 100, false, false}, + {"sendDamage", "none", 120, "basic", "none", false}, {'addGFX', "sentDamage", 'hitGFX', "target", 0, 0, true, false}, {'playSFX', "sentDamage", 'hitconnect'}, {'jumpBack', "none", 0.3, true}, diff --git a/sonic-radiance.love/game/utils/choregraphy/arguments.lua b/sonic-radiance.love/game/utils/choregraphy/arguments.lua index 2b47e9d..e7355f8 100644 --- a/sonic-radiance.love/game/utils/choregraphy/arguments.lua +++ b/sonic-radiance.love/game/utils/choregraphy/arguments.lua @@ -2,7 +2,7 @@ return { ["wait"] = {"duration"}, ["addGFX"] = {'sprite', "origin", "x", "y", "affectedByDirection", 'blockProcess'}, ["playSFX"] = {"sfx"}, - ["sendDamage"] = {"power", "accuracy", "isSpecial", "isAerial"}, + ["sendDamage"] = {"power", "type", "element", "isSpecial"}, ["goTo"] = {"origin", "x", "y", "duration", "blockProcess"}, ["setAnimation"] = {"animation", "blockProcess"}, ["jump"] = {"power", "bounceNumber", "blockProcess"}, diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/parent.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/parent.lua index 64ada28..ea64b2d 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/parent.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/parent.lua @@ -1,8 +1,6 @@ local FighterParent = Object:extend() -local counter = 0 - -local AERIAL_ACCURACY_FACTOR = 0 +local CONST = require "datas.cbs" function FighterParent:new(owner, isHero, id) self.owner = owner @@ -76,7 +74,7 @@ function FighterParent:haveProtecType(type) return self.abstract:haveProtecType(type) end -function FighterParent:sendDamage(target, value, accuracy, isSpecial, isAerial) +function FighterParent:sendDamage(target, value, type, element, isSpecial) local stats = self:getStats() local value = value / 10 @@ -88,10 +86,11 @@ function FighterParent:sendDamage(target, value, accuracy, isSpecial, isAerial) core.debug:print("cbs/battler", "Sending " .. value .." damage at " .. target.name) - return target:receiveDamage(value, accuracy, isSpecial, isAerial, self) + return target:receiveDamage(value, type, element, isSpecial, self) end -function FighterParent:receiveDamage(value, accuracy, isSpecial, isAerial, fromWho) +function FighterParent:receiveDamage(value, type, element, isSpecial, fromWho) + local accuracy = 100 local stats = self:getStats() local isSuccess = true @@ -101,8 +100,8 @@ function FighterParent:receiveDamage(value, accuracy, isSpecial, isAerial, fromW value = value / stats.defense end - if (self:haveProtecType("aerial") and not isAerial) then - accuracy = accuracy * AERIAL_ACCURACY_FACTOR + if (self:haveProtecType("aerial") and type == "basic") then + value = value * CONST.ATKWRONGTYPE end isSuccess = (math.random(100) <= accuracy) @@ -143,7 +142,6 @@ function FighterParent:updateAssets(dt) end function FighterParent:setActive() - counter = 0 self.isActive = true if (self.isDefending) then self.actor:changeAnimation("idle") diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/init.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/init.lua index d74a383..51bb7fd 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/init.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/init.lua @@ -72,10 +72,10 @@ function ChoregraphySystem:endQte(success) self.qte.wasSuccess = success end -function ChoregraphySystem:sendDamage(power, accuracy, isSpecial, isAerial) +function ChoregraphySystem:sendDamage(power, type, element, isSpecial) if (self.target ~= nil) then if (self.fighter.isAlive) then - self.haveSentDamage = self.fighter:sendDamage(self.target, power, accuracy, isSpecial, isAerial) + self.haveSentDamage = self.fighter:sendDamage(self.target, power, type, element, isSpecial) else self.haveSentDamage = false end diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/step/sendDamage.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/step/sendDamage.lua index 67c5a39..bc39b93 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/step/sendDamage.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/step/sendDamage.lua @@ -9,13 +9,11 @@ end function SendDamage:start() local power = self.arguments.power - local accuracy = self.arguments.accuracy local isSpecial = self.arguments.isSpecial - local isAerial = self.arguments.isAerial + local type = self.arguments.type + local element = self.arguments.element - - - self.choregraphy:sendDamage(power, accuracy, isSpecial, isAerial) + self.choregraphy:sendDamage(power, type, element, isSpecial) self:finish() end