多段伤害的更改
This commit is contained in:
parent
9c87bbc5d7
commit
77a9039092
@ -202,11 +202,18 @@ function CharacterSpineObject:getAnimationDuration(animationName)
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function CharacterSpineObject:getAnimationKeyFrameTime(animationName)
|
function CharacterSpineObject:getAnimationKeyFrameTimes(animationName)
|
||||||
|
local times = {}
|
||||||
if self.characterSpineHelper then
|
if self.characterSpineHelper then
|
||||||
return self.characterSpineHelper:GetAnimationKeyFrameTime(animationName)
|
local timeList = self.characterSpineHelper:GetAnimationKeyFrameTime(animationName)
|
||||||
|
local count = timeList.Count
|
||||||
|
if count > 0 then
|
||||||
|
for i = 1, count do
|
||||||
|
table.insert(times, timeList[i - 1])
|
||||||
end
|
end
|
||||||
return 0
|
end
|
||||||
|
end
|
||||||
|
return times
|
||||||
end
|
end
|
||||||
|
|
||||||
function CharacterSpineObject:addAnimationCompleteCallback(callback)
|
function CharacterSpineObject:addAnimationCompleteCallback(callback)
|
||||||
|
|||||||
@ -258,39 +258,40 @@ function BattleUnitComp:getAnimationDuration(aniName)
|
|||||||
return duration or 0
|
return duration or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUnitComp:getAnimationKeyFrameTime(animationName)
|
function BattleUnitComp:getAnimationKeyFrameTime(animationName, index)
|
||||||
local time = self.attackKeyFrameTimeMap[animationName]
|
index = index or 1
|
||||||
if time == nil then
|
local timeList = self.attackKeyFrameTimeMap[animationName]
|
||||||
time = self.baseObject:getAnimationKeyFrameTime(animationName)
|
if timeList == nil then
|
||||||
if time <= 0 then -- 容错处理
|
timeList = self.baseObject:getAnimationKeyFrameTimes(animationName)
|
||||||
time = 0.3
|
if not timeList[1] then
|
||||||
|
table.insert(timeList, 0.3)
|
||||||
end
|
end
|
||||||
self.attackKeyFrameTimeMap[animationName] = time
|
self.attackKeyFrameTimeMap[animationName] = timeList
|
||||||
end
|
end
|
||||||
return time
|
return timeList[index] or 0.3
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUnitComp:getKeyFrameTime(skill, blockIndex, animationName)
|
function BattleUnitComp:getKeyFrameTime(skill, blockIndex, animationName)
|
||||||
self.validEffectIdx[1] = 1
|
|
||||||
self.validEffectIdx[2] = 1
|
|
||||||
if not skill then
|
if not skill then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
self.currAttackBlockIndex = blockIndex
|
self.currAttackBlockIndex = blockIndex
|
||||||
local time = skill:getEffectBlockTime()[blockIndex]
|
local time = 0
|
||||||
if not time then
|
|
||||||
if blockIndex == 1 then
|
|
||||||
time = self:getAnimationKeyFrameTime(animationName)
|
|
||||||
else
|
|
||||||
time = 0
|
|
||||||
end
|
|
||||||
else
|
|
||||||
local blockList = skill:getEffectBlock()
|
local blockList = skill:getEffectBlock()
|
||||||
|
if blockList[blockIndex] then
|
||||||
local beforeIndex = blockIndex - 1
|
local beforeIndex = blockIndex - 1
|
||||||
self.validEffectIdx[1] = blockList[beforeIndex] or 1
|
self.validEffectIdx[1] = blockList[beforeIndex] or 0
|
||||||
self.validEffectIdx[2] = blockList[blockIndex] or 1
|
self.validEffectIdx[2] = blockList[blockIndex] or 1
|
||||||
|
time = skill:getEffectBlockTime()[blockIndex]
|
||||||
|
if not time then
|
||||||
|
time = self:getAnimationKeyFrameTime(animationName, blockIndex)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
-- Logger.logHighlight(animationName .. " blockIndex " .. blockIndex)
|
||||||
|
-- Logger.printTable(blockList)
|
||||||
|
|
||||||
|
-- Logger.printTable(self.validEffectIdx)
|
||||||
return time
|
return time
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -298,12 +299,17 @@ function BattleUnitComp:getIsCentralizedAttack()
|
|||||||
return self.team:getCentralizedAttack()
|
return self.team:getCentralizedAttack()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUnitComp:getIsFinalBlock()
|
||||||
|
return self.team:getIsFinalBlock()
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUnitComp:getCurAttackActionState()
|
function BattleUnitComp:getCurAttackActionState()
|
||||||
return self.curAttackActionState
|
return self.curAttackActionState
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUnitComp:beforeAttack(actionState)
|
function BattleUnitComp:beforeAttack(actionState)
|
||||||
self.team:setCentralizedAttack(true)
|
self.team:setCentralizedAttack(true)
|
||||||
|
self.team:setIsFinalBlock(false)
|
||||||
self.battleController:setIsPauseHpProgress(true)
|
self.battleController:setIsPauseHpProgress(true)
|
||||||
self.curAttackActionState = actionState
|
self.curAttackActionState = actionState
|
||||||
if actionState == BattleConst.ATTACK_ACTION_STATE.NORMAL then
|
if actionState == BattleConst.ATTACK_ACTION_STATE.NORMAL then
|
||||||
@ -852,13 +858,16 @@ function BattleUnitComp:updateAssistingAttackState(dt)
|
|||||||
else
|
else
|
||||||
if self.currAttackKeyTime > 0 and self.attackTime >= self.currAttackKeyTime then -- 到达关键后使用
|
if self.currAttackKeyTime > 0 and self.attackTime >= self.currAttackKeyTime then -- 到达关键后使用
|
||||||
local skill = self.unitEntity:getAssistingSkill()
|
local skill = self.unitEntity:getAssistingSkill()
|
||||||
|
local isFinalBlock = skill and skill:isFinalBlock(self.currAttackBlockIndex)
|
||||||
|
self:onSkillTakeEffect(skill, isFinalBlock, self.validEffectIdx)
|
||||||
|
|
||||||
if skill then
|
if skill then
|
||||||
local attackName = skill:getSkillAttackName()
|
local attackName = skill:getSkillAttackName()
|
||||||
self.currAttackKeyTime = self:getKeyFrameTime(skill, self.currAttackBlockIndex + 1, attackName)
|
self.currAttackKeyTime = self:getKeyFrameTime(skill, self.currAttackBlockIndex + 1, attackName)
|
||||||
else
|
else
|
||||||
self.currAttackKeyTime = 0
|
self.currAttackKeyTime = 0
|
||||||
end
|
end
|
||||||
self:onSkillTakeEffect(skill, self.currAttackKeyTime <= 0, self.validEffectIdx)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -998,34 +1007,37 @@ function BattleUnitComp:updateSkillAttack(dt)
|
|||||||
if self.currAttackKeyTime > 0 and self.attackTime >= self.currAttackKeyTime then -- 到达关键后使用
|
if self.currAttackKeyTime > 0 and self.attackTime >= self.currAttackKeyTime then -- 到达关键后使用
|
||||||
if self.normalSkillCount > 0 then
|
if self.normalSkillCount > 0 then
|
||||||
local skill = self.unitEntity:getNormalSkill()
|
local skill = self.unitEntity:getNormalSkill()
|
||||||
|
local isFinalBlock = skill and skill:isFinalBlock(self.currAttackBlockIndex)
|
||||||
|
|
||||||
|
if self.normalSkillCount == 1 and self.currActiveSkill == nil and isFinalBlock then -- 最后一次攻击
|
||||||
|
self.team:setCentralizedAttack(false)
|
||||||
|
end
|
||||||
|
self:onSkillTakeEffect(skill, isFinalBlock, self.validEffectIdx)
|
||||||
|
if self.normalSkillCount == 1 and self.currActiveSkill == nil and isFinalBlock then -- 最后一次攻击
|
||||||
|
self.battleController:setIsPauseHpProgress(false)
|
||||||
|
end
|
||||||
|
|
||||||
if skill then
|
if skill then
|
||||||
local attackName = skill:getSkillAttackName()
|
local attackName = skill:getSkillAttackName()
|
||||||
self.currAttackKeyTime = self:getKeyFrameTime(skill, self.currAttackBlockIndex + 1, attackName)
|
self.currAttackKeyTime = self:getKeyFrameTime(skill, self.currAttackBlockIndex + 1, attackName)
|
||||||
else
|
else
|
||||||
self.currAttackKeyTime = 0
|
self.currAttackKeyTime = 0
|
||||||
end
|
end
|
||||||
local isFinalBlock = self.currAttackKeyTime <= 0
|
|
||||||
|
|
||||||
if self.normalSkillCount == 1 and self.currActiveSkill == nil and isFinalBlock then -- 最后一次攻击
|
|
||||||
self.team:setCentralizedAttack(false)
|
|
||||||
end
|
|
||||||
self:onSkillTakeEffect(skill, self.currAttackKeyTime <= 0, self.validEffectIdx)
|
|
||||||
if self.normalSkillCount == 1 and self.currActiveSkill == nil and isFinalBlock then -- 最后一次攻击
|
|
||||||
self.battleController:setIsPauseHpProgress(false)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
local attackName = self.currActiveSkill:getSkillAttackName()
|
local isFinalBlock = self.currActiveSkill:isFinalBlock(self.currAttackBlockIndex)
|
||||||
self.currAttackKeyTime = self:getKeyFrameTime(self.currActiveSkill, self.currAttackBlockIndex + 1, attackName)
|
|
||||||
local isFinalBlock = self.currAttackKeyTime <= 0
|
|
||||||
local isHaveNextAttack = self:getIsHaveNextAvailableActiveSkill()
|
local isHaveNextAttack = self:getIsHaveNextAvailableActiveSkill()
|
||||||
if not isHaveNextAttack and isFinalBlock then
|
if not isHaveNextAttack and isFinalBlock then
|
||||||
self.team:setCentralizedAttack(false)
|
self.team:setCentralizedAttack(false)
|
||||||
|
self.team:setIsFinalBlock(isFinalBlock)
|
||||||
end
|
end
|
||||||
|
|
||||||
self:onSkillTakeEffect(self.currActiveSkill, isFinalBlock, self.validEffectIdx)
|
self:onSkillTakeEffect(self.currActiveSkill, isFinalBlock, self.validEffectIdx)
|
||||||
if not isHaveNextAttack and isFinalBlock then
|
if not isHaveNextAttack and isFinalBlock then
|
||||||
self.battleController:setIsPauseHpProgress(false)
|
self.battleController:setIsPauseHpProgress(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local attackName = self.currActiveSkill:getSkillAttackName()
|
||||||
|
self.currAttackKeyTime = self:getKeyFrameTime(self.currActiveSkill, self.currAttackBlockIndex + 1, attackName)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1220,21 +1232,22 @@ function BattleUnitComp:updateNormalAttack(dt)
|
|||||||
else
|
else
|
||||||
if self.currAttackKeyTime > 0 and self.attackTime >= self.currAttackKeyTime then -- 到达关键后使用
|
if self.currAttackKeyTime > 0 and self.attackTime >= self.currAttackKeyTime then -- 到达关键后使用
|
||||||
local skill = self.unitEntity:getNormalSkill()
|
local skill = self.unitEntity:getNormalSkill()
|
||||||
|
local isFinalBlock = skill and skill:isFinalBlock(self.currAttackBlockIndex) or false
|
||||||
|
if self.normalSkillCount == 1 and isFinalBlock then -- 如果是最后一次攻击,那么敌人受到这次攻击可以开始嗝屁了
|
||||||
|
self.team:setCentralizedAttack(false)
|
||||||
|
self.team:setIsFinalBlock(isFinalBlock)
|
||||||
|
end
|
||||||
|
self:onSkillTakeEffect(skill, isFinalBlock, self.validEffectIdx)
|
||||||
|
if self.normalSkillCount == 1 and isFinalBlock then -- 如果是最后一次攻击,那么可以开始跑血条了
|
||||||
|
self.battleController:setIsPauseHpProgress(false)
|
||||||
|
end
|
||||||
|
|
||||||
if skill then
|
if skill then
|
||||||
local attackName = skill:getSkillAttackName()
|
local attackName = skill:getSkillAttackName()
|
||||||
self.currAttackKeyTime = self:getKeyFrameTime(skill, self.currAttackBlockIndex + 1, attackName)
|
self.currAttackKeyTime = self:getKeyFrameTime(skill, self.currAttackBlockIndex + 1, attackName)
|
||||||
else
|
else
|
||||||
self.currAttackKeyTime = 0
|
self.currAttackKeyTime = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
local isFinalBlock = self.currAttackKeyTime <= 0
|
|
||||||
if self.normalSkillCount == 1 and isFinalBlock then -- 如果是最后一次攻击,那么敌人受到这次攻击可以开始嗝屁了
|
|
||||||
self.team:setCentralizedAttack(false)
|
|
||||||
end
|
|
||||||
self:onSkillTakeEffect(skill, isFinalBlock, self.validEffectIdx)
|
|
||||||
if self.normalSkillCount == 1 and isFinalBlock then -- 如果是最后一次攻击,那么可以开始跑血条了
|
|
||||||
self.battleController:setIsPauseHpProgress(false)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1296,9 +1309,6 @@ function BattleUnitComp:onSkillTakeEffect(skill, isFinalBlock, validEffectIdx)
|
|||||||
if #effectList == 0 then
|
if #effectList == 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not validEffectIdx then
|
|
||||||
validEffectIdx = {1, 1}
|
|
||||||
end
|
|
||||||
local targetType = skill:getTargetType()
|
local targetType = skill:getTargetType()
|
||||||
local target
|
local target
|
||||||
if targetType == 1 then -- 自己
|
if targetType == 1 then -- 自己
|
||||||
@ -1317,15 +1327,25 @@ function BattleUnitComp:onSkillTakeEffect(skill, isFinalBlock, validEffectIdx)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local succ = false
|
local succ = false
|
||||||
for k, effect in ipairs(effectList) do
|
local effectStartIdx = 1
|
||||||
if k >= validEffectIdx[1] and k <= validEffectIdx[2] then
|
local effectEndIdx = 1
|
||||||
if self:judgeSkillEffectCondition(skill, k) then
|
if validEffectIdx then
|
||||||
|
effectStartIdx = validEffectIdx[1] + 1
|
||||||
|
effectEndIdx = validEffectIdx[2]
|
||||||
|
end
|
||||||
|
for i = effectStartIdx, effectEndIdx do
|
||||||
|
local effect = effectList[i]
|
||||||
|
if effect then
|
||||||
|
if self:judgeSkillEffectCondition(skill, i) then
|
||||||
if self:takeEffect(effect, target) then
|
if self:takeEffect(effect, target) then
|
||||||
succ = true
|
succ = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if succ then
|
if succ then
|
||||||
if skill:getIsHurtType() then
|
if skill:getIsHurtType() then
|
||||||
self.team:addCombo()
|
self.team:addCombo()
|
||||||
@ -1565,7 +1585,7 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
|
|||||||
end
|
end
|
||||||
local hpPercent = self.unitEntity:getHpPercent()
|
local hpPercent = self.unitEntity:getHpPercent()
|
||||||
self.battleController:refreshHp(self.side, hp, hpPercent)
|
self.battleController:refreshHp(self.side, hp, hpPercent)
|
||||||
if atker:getIsCentralizedAttack() then
|
if not atker:getIsFinalBlock() then
|
||||||
if damage < 0 then
|
if damage < 0 then
|
||||||
self:playHurt()
|
self:playHurt()
|
||||||
end
|
end
|
||||||
|
|||||||
@ -531,6 +531,18 @@ function BattleTeam:setCentralizedAttack(centralizedAttack)
|
|||||||
self.centralizedAttack = centralizedAttack
|
self.centralizedAttack = centralizedAttack
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleTeam:setIsFinalBlock(isFinalBlock)
|
||||||
|
Logger.logHighlight(isFinalBlock)
|
||||||
|
if not self.isFinalBlock and not isFinalBlock then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.isFinalBlock = isFinalBlock
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleTeam:getIsFinalBlock()
|
||||||
|
return self.isFinalBlock
|
||||||
|
end
|
||||||
|
|
||||||
function BattleTeam:addCombo()
|
function BattleTeam:addCombo()
|
||||||
if self.side ~= BattleConst.SIDE_ATK then
|
if self.side ~= BattleConst.SIDE_ATK then
|
||||||
return
|
return
|
||||||
|
|||||||
@ -275,19 +275,20 @@ function IdleUnitComp:getAnimationDuration(aniName)
|
|||||||
return duration or 0
|
return duration or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function IdleUnitComp:getAnimationKeyFrameTime(animationName)
|
function IdleUnitComp:getAnimationKeyFrameTime(animationName, index)
|
||||||
|
index = index or 1
|
||||||
if self.attackKeyFrameTimeMap == nil then
|
if self.attackKeyFrameTimeMap == nil then
|
||||||
self.attackKeyFrameTimeMap = {}
|
self.attackKeyFrameTimeMap = {}
|
||||||
end
|
end
|
||||||
local time = self.attackKeyFrameTimeMap[animationName]
|
local timeList = self.attackKeyFrameTimeMap[animationName]
|
||||||
if time == nil then
|
if timeList == nil then
|
||||||
time = self.baseObject:getAnimationKeyFrameTime(animationName)
|
local timeList = self.baseObject:getAnimationKeyFrameTimes(animationName)
|
||||||
if time <= 0 then -- 容错处理
|
if not timeList[1] then
|
||||||
time = 0.3
|
table.insert(timeList, 0.3)
|
||||||
end
|
end
|
||||||
self.attackKeyFrameTimeMap[animationName] = time
|
self.attackKeyFrameTimeMap[animationName] = timeList
|
||||||
end
|
end
|
||||||
return time
|
return timeList[index] or 0.3
|
||||||
end
|
end
|
||||||
|
|
||||||
function IdleUnitComp:getNormalSkill(reRandom)
|
function IdleUnitComp:getNormalSkill(reRandom)
|
||||||
|
|||||||
@ -195,6 +195,10 @@ function BattleSkillEntity:getEffectBlock()
|
|||||||
return self.effectBlock
|
return self.effectBlock
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleSkillEntity:isFinalBlock(index)
|
||||||
|
return self.effectBlock[index + 1] == nil
|
||||||
|
end
|
||||||
|
|
||||||
function BattleSkillEntity:getEffectBlockTime()
|
function BattleSkillEntity:getEffectBlockTime()
|
||||||
return self.blockTime
|
return self.blockTime
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user