buff机制修改

This commit is contained in:
xiekaidong 2023-07-21 11:37:29 +08:00
parent e85f2ba4f2
commit 026166478e
7 changed files with 34 additions and 7 deletions

View File

@ -395,7 +395,7 @@ local buff = {
["id"]=48,
["name"]="burn",
["buff_type"]=4,
["stack"]=1,
["stack"]=0,
["decr"]=2,
["formula"]=4,
["icon"]="burn",
@ -694,6 +694,7 @@ local buff = {
["name"]="invincible_shield",
["buff_type"]=7,
["decr"]=3,
["stack"]=3,
["icon"]="invincible_shield",
["fx_continued"]={
26

View File

@ -415,6 +415,7 @@ function GFunc.getPerStr(key, str)
key == GConst.BattleConst.BUFF_NAME.SHIELD_ICE_REBOUND_400 or
key == GConst.BattleConst.BUFF_NAME.BURN or
key == GConst.BattleConst.BUFF_NAME.SHIELD_ICE or
key == GConst.BattleConst.BUFF_NAME.SHIELD_ICE_02 or
key == GConst.BattleConst.BUFF_NAME.BLOCK or
key == GConst.BattleConst.BUFF_NAME.CRIT_ADD
then

View File

@ -124,7 +124,8 @@ BattleConst.BUFF_TYPE = {
BattleConst.BUFF_STACK_TYPE = {
CANT_ADD = 0,
ADD_ROUND = 1,
ADD = 2
ADD = 2,
REMOVE_LAST = 3,
}
BattleConst.BUFF_DECR_TYPE = {
@ -338,6 +339,7 @@ local BUFF_NAME = {
END_DMG_ADDITION_ALL_ADD = "end_dmg_addition_all_add",
END_DMG_DEC_ALL_ADD = "end_dmg_dec_all_add",
INVINCIBLE_SHIELD = "invincible_shield",
SHIELD_ICE_02 = "shield_ice_02",
}
BattleConst.BUFF_NAME = BUFF_NAME

View File

@ -1631,10 +1631,12 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
if num < 0 then -- 伤害
local delayTime = 0
if shieldHpDiff < 0 or shieldWorkOn then
if shieldHpDiff == 0 then
shieldHpDiff = damage
end
if shieldHpDiff == 0 then -- 护盾血量没有减少, 但是被抵消了
shieldHpDiff = -1
damage = 0
else
damage = damage - shieldHpDiff
end
delayTime = BattleConst.EFFECT_NUMBER_DELAY
if self.lastBlueNumberTime == time then
self.lastSameTimeBlueCount = self.lastSameTimeBlueCount + 1

View File

@ -229,6 +229,7 @@ function BattleTeam:handleShield(reduceShield, unit)
while currShieldBuff do
if reduceShield <= 0 and currShieldBuff.buff and currShieldBuff.buff:getName() == BattleConst.BUFF_NAME.INVINCIBLE_SHIELD then
reduceShield = currShieldBuff.result - 1
needReedRefreshBuff = true
else
reduceShield = reduceShield + currShieldBuff.result
end
@ -278,6 +279,13 @@ function BattleTeam:addBuff(buffEffect)
bEffect[fieldName] = buffEffect[fieldName]
end
end
if bEffect.buff:getEffectNum() < buffEffect.buff:getEffectNum() then
bEffect.buff:setEffectNum(buffEffect.buff:getEffectNum())
end
needRecycle = bEffect
break
elseif bEffect.buff:getEffectNum() < buffEffect.buff:getEffectNum() then
bEffect.buff:setEffectNum(buffEffect.buff:getEffectNum())
needRecycle = bEffect
break
else
@ -304,6 +312,10 @@ function BattleTeam:addBuff(buffEffect)
end
end
elseif stack == BattleConst.BUFF_STACK_TYPE.ADD then
elseif stack == BattleConst.BUFF_STACK_TYPE.REMOVE_LAST then
local buffName = buffEffect.buff:getName()
self:removeBuffByName(buffName)
end
if needRecycle then

View File

@ -427,7 +427,7 @@ function BattleBaseUI:refreshBuff(side, buffList)
local cell = self.tinyBuffCells[side][index]
if cell then
cell:getBaseObject():setVisible(true)
cell:refresh(buffObj.buff:getIcon(), buffObj.round)
cell:refresh(buffObj.buff:getIcon(), buffObj.round, buffObj.buff:getEffectNum(), buffObj.result)
end
index = index + 1
if index > buffCellCount then

View File

@ -1,6 +1,6 @@
local TinyBuffCell = class("TinyBuffCell", BaseCell)
function TinyBuffCell:refresh(buffName, round)
function TinyBuffCell:refresh(buffName, round, num, result)
if round <= 1 or round > 9 then
round = GConst.EMPTY_STRING
else
@ -10,6 +10,15 @@ function TinyBuffCell:refresh(buffName, round)
local uiMap = self:getUIMap()
uiMap["tiny_buff_cell.buff_icon"]:setSprite(GConst.ATLAS_PATH.ICON_BUFF, buffName)
uiMap["tiny_buff_cell.round_text"]:setText(round)
local buffNum = uiMap["tiny_buff_cell.buff_num"]
if buffName == GConst.BattleConst.BUFF_NAME.INVINCIBLE_SHIELD then
uiMap["tiny_buff_cell.round_text"]:setText(GConst.EMPTY_STRING)
result = result or num
buffNum:setText(result or GConst.EMPTY_STRING)
else
buffNum:setText(GConst.EMPTY_STRING)
end
end
return TinyBuffCell