feat: add back step conditions
This commit is contained in:
parent
30cdda0970
commit
b9d324fa57
2 changed files with 15 additions and 5 deletions
|
@ -12,6 +12,8 @@ function ChoregraphySystem:new(action, choregraphy)
|
||||||
self.world = self.actor.world
|
self.world = self.actor.world
|
||||||
self.target = action.target
|
self.target = action.target
|
||||||
|
|
||||||
|
self.haveSentDamage = false
|
||||||
|
|
||||||
self.currentStepId = 0
|
self.currentStepId = 0
|
||||||
self.currentStep = nil
|
self.currentStep = nil
|
||||||
self.stepList = choregraphy
|
self.stepList = choregraphy
|
||||||
|
@ -38,7 +40,7 @@ function ChoregraphySystem:switchStep()
|
||||||
self.currentStepId = self.currentStepId + 1
|
self.currentStepId = self.currentStepId + 1
|
||||||
local stepData = choregraphyUtils.getStepDatas(self.stepList[self.currentStepId])
|
local stepData = choregraphyUtils.getStepDatas(self.stepList[self.currentStepId])
|
||||||
core.debug:print("cbs/choregraphy", "Starting step " .. stepData.name)
|
core.debug:print("cbs/choregraphy", "Starting step " .. stepData.name)
|
||||||
if (stepObjectList[stepData.name] ~= nil) then
|
if (stepObjectList[stepData.name] ~= nil and self:checkCondition(stepData.condition)) then
|
||||||
self.currentStep = stepObjectList[stepData.name](self, stepData.arguments)
|
self.currentStep = stepObjectList[stepData.name](self, stepData.arguments)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -46,6 +48,15 @@ function ChoregraphySystem:switchStep()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ChoregraphySystem:checkCondition(condition)
|
||||||
|
local conditionArgs = utils.string.split(condition, ":")
|
||||||
|
local success = true
|
||||||
|
if (conditionArgs[1] == "sentDamage" and (not self.haveSentDamage)) then
|
||||||
|
success = false
|
||||||
|
end
|
||||||
|
return success
|
||||||
|
end
|
||||||
|
|
||||||
function ChoregraphySystem:addQTE(action, origin, qteBaseData, blockProcess)
|
function ChoregraphySystem:addQTE(action, origin, qteBaseData, blockProcess)
|
||||||
local qteData = choregraphyUtils.getQteDatas(qteBaseData)
|
local qteData = choregraphyUtils.getQteDatas(qteBaseData)
|
||||||
if (qteObjectList[qteData.name] ~= nil) then
|
if (qteObjectList[qteData.name] ~= nil) then
|
||||||
|
@ -64,10 +75,9 @@ end
|
||||||
function ChoregraphySystem:sendDamage(power, accuracy, isSpecial, isAerial)
|
function ChoregraphySystem:sendDamage(power, accuracy, isSpecial, isAerial)
|
||||||
if (self.target ~= nil) then
|
if (self.target ~= nil) then
|
||||||
if (self.fighter.isAlive) then
|
if (self.fighter.isAlive) then
|
||||||
self.fighter:sendDamage(self.target, power, accuracy, isSpecial, isAerial)
|
self.haveSentDamage = self.fighter:sendDamage(self.target, power, accuracy, isSpecial, isAerial)
|
||||||
return true
|
|
||||||
else
|
else
|
||||||
return false
|
self.haveSentDamage = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@ function SendDamage:start()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.choregraphy.haveSentDamage = self.choregraphy:sendDamage(power, accuracy, isSpecial, isAerial)
|
self.choregraphy:sendDamage(power, accuracy, isSpecial, isAerial)
|
||||||
self:finish()
|
self:finish()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue