bug修复
This commit is contained in:
parent
eb588d4e33
commit
0441e09d12
@ -471,6 +471,12 @@ function BattleUnitComp:removeShield(buffEffect)
|
||||
end
|
||||
|
||||
function BattleUnitComp:changeState(state)
|
||||
if self.currState == UNIT_STATE.DEAD then -- 死亡后只能去死亡状态
|
||||
if state ~= UNIT_STATE.DEAD then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- 进入目标状态
|
||||
if state == UNIT_STATE.IDLE then -- idle为默认状态,其状态下判定特殊状态
|
||||
if self.unitEntity:getIsFrozen() then -- 有冰冻buff
|
||||
@ -483,11 +489,7 @@ function BattleUnitComp:changeState(state)
|
||||
if self.currState == state and not self:repeatCurrState() then
|
||||
return false
|
||||
end
|
||||
if self.currState == UNIT_STATE.DEAD then -- 死亡后只能去死亡状态
|
||||
if state ~= UNIT_STATE.DEAD then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- 离开当前状态
|
||||
if self.currState == UNIT_STATE.IDLE then
|
||||
self:exitIdleState()
|
||||
@ -741,7 +743,7 @@ function BattleUnitComp:playBlock()
|
||||
end
|
||||
|
||||
local direction = BattleConst.EFFECT_TYPE_MOVE_R
|
||||
local x, y = self.baseObject:fastGetLocalPosition()
|
||||
local x, y = self.team:getMainUnitLocalPosition(self)
|
||||
if self.side == BattleConst.SIDE_ATK then
|
||||
direction = BattleConst.EFFECT_TYPE_MOVE_L
|
||||
end
|
||||
@ -1561,7 +1563,7 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
|
||||
self.team:handleShield(shieldHpDiff, self)
|
||||
end
|
||||
local hp = self.unitEntity:getHp()
|
||||
local x, y = self.baseObject:fastGetLocalPosition()
|
||||
local x, y = self.team:getMainUnitLocalPosition(self)
|
||||
local damage = num
|
||||
if num < 0 then -- 伤害
|
||||
local delayTime = 0
|
||||
@ -1638,7 +1640,7 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
|
||||
self.battleController:refreshHp(self.side, hp, hpPercent)
|
||||
if not atker:getIsFinalBlock() or not self.battleController:getIsLastInstruction() then
|
||||
if damage < 0 then
|
||||
self:playHurt()
|
||||
self.team:playHurt()
|
||||
end
|
||||
else
|
||||
if self.unitEntity:getIsDead() then
|
||||
@ -1657,9 +1659,9 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
|
||||
|
||||
self.battleController:resetTimeSpeed(true)
|
||||
|
||||
self:changeState(UNIT_STATE.DEAD)
|
||||
self.team:changeDead() -- 因为buff生效对象有可能不是当前主英雄,会导致状态不对,所以使用主英雄来播放动画
|
||||
elseif damage < 0 then
|
||||
self:playHurt()
|
||||
self.team:playHurt()
|
||||
end
|
||||
end
|
||||
|
||||
@ -1671,7 +1673,11 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
|
||||
end
|
||||
|
||||
function BattleUnitComp:showEffectNumber(colorType, effectType, num, x, y, delayTime)
|
||||
local addY = BattleConst.MIN_NODE_HEIGHT[self.unitEntity:getBody()] or BattleConst.MIN_NODE_HEIGHT_DEFAULT
|
||||
local body = self.unitEntity:getBody()
|
||||
if self.team:getMainUnit() then
|
||||
body = self.team:getMainUnit().unitEntity:getBody()
|
||||
end
|
||||
local addY = BattleConst.MIN_NODE_HEIGHT[body] or BattleConst.MIN_NODE_HEIGHT_DEFAULT
|
||||
self.battleController:showEffectNumber(colorType, effectType, num, x, y + addY, delayTime)
|
||||
end
|
||||
|
||||
|
||||
@ -260,7 +260,7 @@ function BattleControllerDailyChallenge:postWaveOver(atkDead, isQuit)
|
||||
local duration = Time:getServerTime() - self.waveStartTime
|
||||
local totalTime = Time:getServerTime() - self.battleStartTime
|
||||
local startTimes = DataManager.DailyChallengeData:getTotalFightCount()
|
||||
local isFirstWin = false -- TODO
|
||||
local isFirstWin = false -- TODO 策划说不需要 因为系数在变
|
||||
|
||||
local isFianlStep = self.waveIndex >= self.maxWaveIndex
|
||||
|
||||
|
||||
@ -166,6 +166,27 @@ function BattleTeam:changeMainUnit(matchType)
|
||||
unit:playSwitchIn()
|
||||
end
|
||||
|
||||
function BattleTeam:changeDead()
|
||||
if not self.mainUnit then
|
||||
return
|
||||
end
|
||||
self.mainUnit:changeState(BattleConst.UNIT_STATE.DEAD)
|
||||
end
|
||||
|
||||
function BattleTeam:playHurt()
|
||||
if not self.mainUnit then
|
||||
return
|
||||
end
|
||||
self.mainUnit:playHurt()
|
||||
end
|
||||
|
||||
function BattleTeam:getMainUnitLocalPosition(backup)
|
||||
if not self.mainUnit then
|
||||
return backup.baseObject:fastGetLocalPosition()
|
||||
end
|
||||
return self.mainUnit.baseObject:fastGetLocalPosition()
|
||||
end
|
||||
|
||||
-- 回合结束的时候要结算buff和技能
|
||||
function BattleTeam:onRoundEnd()
|
||||
for k, v in ipairs(self.unitList) do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user