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.target = action.target
|
||||
|
||||
self.haveSentDamage = false
|
||||
|
||||
self.currentStepId = 0
|
||||
self.currentStep = nil
|
||||
self.stepList = choregraphy
|
||||
|
@ -38,7 +40,7 @@ function ChoregraphySystem:switchStep()
|
|||
self.currentStepId = self.currentStepId + 1
|
||||
local stepData = choregraphyUtils.getStepDatas(self.stepList[self.currentStepId])
|
||||
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)
|
||||
end
|
||||
else
|
||||
|
@ -46,6 +48,15 @@ function ChoregraphySystem:switchStep()
|
|||
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)
|
||||
local qteData = choregraphyUtils.getQteDatas(qteBaseData)
|
||||
if (qteObjectList[qteData.name] ~= nil) then
|
||||
|
@ -64,10 +75,9 @@ end
|
|||
function ChoregraphySystem:sendDamage(power, accuracy, isSpecial, isAerial)
|
||||
if (self.target ~= nil) then
|
||||
if (self.fighter.isAlive) then
|
||||
self.fighter:sendDamage(self.target, power, accuracy, isSpecial, isAerial)
|
||||
return true
|
||||
self.haveSentDamage = self.fighter:sendDamage(self.target, power, accuracy, isSpecial, isAerial)
|
||||
else
|
||||
return false
|
||||
self.haveSentDamage = false
|
||||
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()
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue