improvement: use the new attack structure

Replace accuracy and isAerial by attacktype and element
This commit is contained in:
Kazhnuz 2021-05-15 15:01:02 +02:00
parent a22871dcbc
commit 1991b5005f
9 changed files with 25 additions and 23 deletions

View file

@ -0,0 +1,6 @@
local CONST = {}
CONST.ACCURACY = 100
CONST.ATKWRONGTYPE = 0.66
return CONST

View file

@ -14,7 +14,7 @@ return {
choregraphy = { -- the main attack choregraphy choregraphy = { -- the main attack choregraphy
{"goTo", "none", "target", -0.4, 0, 0.5, true}, {"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}, {'addGFX', "sentDamage", 'hitGFX', "target", -0.4, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'}, {'playSFX', "sentDamage", 'hitconnect'},
{'jumpBack', "none", 0.3, true}, {'jumpBack', "none", 0.3, true},

View file

@ -18,7 +18,7 @@ return {
{"addQTE", "none", {"simplePrompt", {{"A", 1}}, 0.2}, "target", false}, {"addQTE", "none", {"simplePrompt", {{"A", 1}}, 0.2}, "target", false},
{'playSFX', "none", 'hit'}, {'playSFX', "none", 'hit'},
{'setAnimation', "none", 'hit1start', true}, {'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}, {'addGFX',"sentDamage", 'hitGFX', "actor", 0.75, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'}, {'playSFX', "sentDamage", 'hitconnect'},
{'setAnimation', "none", 'hit1end', true}, {'setAnimation', "none", 'hit1end', true},
@ -26,7 +26,7 @@ return {
{"addQTE", "none", {"simplePrompt", {{"A", 1}}, 0.2}, "target", false}, {"addQTE", "none", {"simplePrompt", {{"A", 1}}, 0.2}, "target", false},
{'playSFX', "none", 'hit'}, {'playSFX', "none", 'hit'},
{'setAnimation', "none", 'hit2start', true}, {'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}, {'addGFX',"sentDamage", 'hitGFX', "actor", 0.75, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'}, {'playSFX', "sentDamage", 'hitconnect'},
{'setAnimation', "none", 'hit2end', true}, {'setAnimation', "none", 'hit2end', true},
@ -34,7 +34,7 @@ return {
{"addQTE", "none", {"simplePrompt", {{"A", 1}}, 0.2}, "target", false}, {"addQTE", "none", {"simplePrompt", {{"A", 1}}, 0.2}, "target", false},
{'playSFX', "none", 'hit'}, {'playSFX', "none", 'hit'},
{'setAnimation', "none", 'hit3start', true}, {'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}, {'addGFX',"sentDamage", 'hitGFX', "actor", 0.75, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'}, {'playSFX', "sentDamage", 'hitconnect'},
{'setAnimation', "none", 'hit3end', true}, {'setAnimation', "none", 'hit3end', true},

View file

@ -19,7 +19,7 @@ return {
{"setAnimation", "none", "spin", false}, {"setAnimation", "none", "spin", false},
{'playSFX', "none", 'spinrelease'}, {'playSFX', "none", 'spinrelease'},
{"waitActorFinished", "none", "goTo"}, {"waitActorFinished", "none", "goTo"},
{"sendDamage", "none", 120, 100, false, false}, {"sendDamage", "none", 120, "basic", "none", false},
{'addGFX', "sentDamage", 'hitGFX', "target", 0, 0, true, false}, {'addGFX', "sentDamage", 'hitGFX', "target", 0, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'}, {'playSFX', "sentDamage", 'hitconnect'},
{'jumpBack', "none", 0.3, true}, {'jumpBack', "none", 0.3, true},

View file

@ -14,7 +14,7 @@ return {
{"setAnimation", "none", "spin", false}, {"setAnimation", "none", "spin", false},
{'playSFX', "none", 'spinrelease'}, {'playSFX', "none", 'spinrelease'},
{"goTo", "none", "target", 0, 0, 0.3, true}, {"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}, {'addGFX', "sentDamage", 'hitGFX', "target", 0, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'}, {'playSFX', "sentDamage", 'hitconnect'},
{'jumpBack', "none", 0.3, true}, {'jumpBack', "none", 0.3, true},

View file

@ -2,7 +2,7 @@ return {
["wait"] = {"duration"}, ["wait"] = {"duration"},
["addGFX"] = {'sprite', "origin", "x", "y", "affectedByDirection", 'blockProcess'}, ["addGFX"] = {'sprite', "origin", "x", "y", "affectedByDirection", 'blockProcess'},
["playSFX"] = {"sfx"}, ["playSFX"] = {"sfx"},
["sendDamage"] = {"power", "accuracy", "isSpecial", "isAerial"}, ["sendDamage"] = {"power", "type", "element", "isSpecial"},
["goTo"] = {"origin", "x", "y", "duration", "blockProcess"}, ["goTo"] = {"origin", "x", "y", "duration", "blockProcess"},
["setAnimation"] = {"animation", "blockProcess"}, ["setAnimation"] = {"animation", "blockProcess"},
["jump"] = {"power", "bounceNumber", "blockProcess"}, ["jump"] = {"power", "bounceNumber", "blockProcess"},

View file

@ -1,8 +1,6 @@
local FighterParent = Object:extend() local FighterParent = Object:extend()
local counter = 0 local CONST = require "datas.cbs"
local AERIAL_ACCURACY_FACTOR = 0
function FighterParent:new(owner, isHero, id) function FighterParent:new(owner, isHero, id)
self.owner = owner self.owner = owner
@ -76,7 +74,7 @@ function FighterParent:haveProtecType(type)
return self.abstract:haveProtecType(type) return self.abstract:haveProtecType(type)
end end
function FighterParent:sendDamage(target, value, accuracy, isSpecial, isAerial) function FighterParent:sendDamage(target, value, type, element, isSpecial)
local stats = self:getStats() local stats = self:getStats()
local value = value / 10 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) 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 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 stats = self:getStats()
local isSuccess = true local isSuccess = true
@ -101,8 +100,8 @@ function FighterParent:receiveDamage(value, accuracy, isSpecial, isAerial, fromW
value = value / stats.defense value = value / stats.defense
end end
if (self:haveProtecType("aerial") and not isAerial) then if (self:haveProtecType("aerial") and type == "basic") then
accuracy = accuracy * AERIAL_ACCURACY_FACTOR value = value * CONST.ATKWRONGTYPE
end end
isSuccess = (math.random(100) <= accuracy) isSuccess = (math.random(100) <= accuracy)
@ -143,7 +142,6 @@ function FighterParent:updateAssets(dt)
end end
function FighterParent:setActive() function FighterParent:setActive()
counter = 0
self.isActive = true self.isActive = true
if (self.isDefending) then if (self.isDefending) then
self.actor:changeAnimation("idle") self.actor:changeAnimation("idle")

View file

@ -72,10 +72,10 @@ function ChoregraphySystem:endQte(success)
self.qte.wasSuccess = success self.qte.wasSuccess = success
end end
function ChoregraphySystem:sendDamage(power, accuracy, isSpecial, isAerial) function ChoregraphySystem:sendDamage(power, type, element, isSpecial)
if (self.target ~= nil) then if (self.target ~= nil) then
if (self.fighter.isAlive) 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 else
self.haveSentDamage = false self.haveSentDamage = false
end end

View file

@ -9,13 +9,11 @@ end
function SendDamage:start() function SendDamage:start()
local power = self.arguments.power local power = self.arguments.power
local accuracy = self.arguments.accuracy
local isSpecial = self.arguments.isSpecial local isSpecial = self.arguments.isSpecial
local isAerial = self.arguments.isAerial local type = self.arguments.type
local element = self.arguments.element
self.choregraphy:sendDamage(power, type, element, isSpecial)
self.choregraphy:sendDamage(power, accuracy, isSpecial, isAerial)
self:finish() self:finish()
end end