buff叠加机制和然烧buff

This commit is contained in:
xiekaidong 2023-05-08 16:31:44 +08:00
parent 3cc17442b6
commit 518aabb829
8 changed files with 87 additions and 8 deletions

View File

@ -252,6 +252,11 @@ local buff = {
["fx_disappear"]={
14
}
},
[47]={
["name"]="burn",
["buff_type"]=4,
["formula"]=4
}
}
local keys = {
@ -301,12 +306,13 @@ local keys = {
["cured_add"]=buff[43],
["add_skill"]=buff[44],
["skill_fire_times"]=buff[45],
["shield_rebound_200"]=buff[46]
["shield_rebound_200"]=buff[46],
["burn"]=buff[47]
}
}
local config = {
data=buff,
keys=keys,
count=46
count=47
}
return config

View File

@ -96,6 +96,9 @@ local chapter = {
3
},
["seal_element"]={
1,
3,
4,
5
},
["not_involved_skill"]={

View File

@ -336,6 +336,12 @@ local skill = {
["num"]=40000,
["ratio"]=10000,
["round"]=0
},
{
["type"]="burn",
["num"]=10000,
["ratio"]=10000,
["round"]=2
}
},
["obj"]=2,

View File

@ -90,6 +90,12 @@ BattleConst.BUFF_TYPE = {
DIRECT_HURT = 3
}
BattleConst.BUFF_STACK_TYPE = {
CANT_ADD = 0,
ADD_ROUND = 1,
ADD = 2
}
BattleConst.SKILL_MOVE_TYPE = {
MOVE = 1, -- 移动到目标跟前使用
STAND = 2, -- 原地使用

View File

@ -1067,7 +1067,7 @@ function BattleUnitComp:addMaxHp(percent)
end
function BattleUnitComp:addBuff(buffEffect)
self.team:addBuff(buffEffect)
return self.team:addBuff(buffEffect)
end
function BattleUnitComp:updateBuffState(buff, num)
@ -1151,7 +1151,7 @@ function BattleUnitComp:takeEffect(buff, target)
buffEffect.round = round
buffEffect.target = target
buffEffect.sender = self
target:addBuff(buffEffect)
buffEffect = target:addBuff(buffEffect)
end
local func = BattleBuffHandle.takeBuffEffect[buff:getBuffType()]
if func then

View File

@ -39,6 +39,11 @@ BattleFormula.calculateFormula = {
[3] = function(unitComp, buff, targetUnit)
local result = unitComp.unitEntity:getAtk() * buff:getEffectNum() // DEFAULT_FACTOR * (unitComp.unitEntity:getCureAddition() + DEFAULT_FACTOR) // DEFAULT_FACTOR
return result, 0
end,
-- buff释放方攻击力*技能倍率
[4] = function(unitComp, buff, targetUnit)
local result = unitComp.unitEntity:getAtk() * buff:getEffectNum() // DEFAULT_FACTOR
return result, 0
end
}

View File

@ -228,11 +228,60 @@ function BattleTeam:handleShield(reduceShield, unit)
end
function BattleTeam:addBuff(buffEffect)
table.insert(self.buffList, buffEffect)
self:updateBuffState(buffEffect.buff, 1)
if buffEffect.buff:getIcon() then
self.battleController:refreshBuff(self.side, self.buffList)
local stack = buffEffect.buff:getStack()
local needRecycle
if not stack or stack == BattleConst.BUFF_STACK_TYPE.CANT_ADD then
local buffName = buffEffect.buff:getName()
local buffNum = self.sameBuffCount[buffName]
if buffNum and buffNum > 0 then
for _, bEffect in ipairs(self.buffList) do
if bEffect.buff:getName() == buffName then
if bEffect.round < buffEffect.round then
bEffect.round = buffEffect.round
for fieldName, v in pairs(bEffect) do
if fieldName ~= "buff" and fieldName ~= "round" then
bEffect[fieldName] = buffEffect[fieldName]
end
end
needRecycle = bEffect
break
end
end
end
end
elseif stack == BattleConst.BUFF_STACK_TYPE.ADD_ROUND then
local buffName = buffEffect.buff:getName()
local buffNum = self.sameBuffCount[buffName]
if buffNum and buffNum > 0 then
for _, bEffect in ipairs(self.buffList) do
if bEffect.buff:getName() == buffName then
bEffect.round = bEffect.round + buffEffect.round
for fieldName, v in pairs(bEffect) do
if fieldName ~= "buff" and fieldName ~= "round" then
bEffect[fieldName] = buffEffect[fieldName]
end
end
needRecycle = bEffect
break
end
end
end
elseif stack == BattleConst.BUFF_STACK_TYPE.ADD then
end
if needRecycle then
BattleHelper:recycleBuffEffect(buffEffect)
else
table.insert(self.buffList, buffEffect)
self:updateBuffState(buffEffect.buff, 1)
if buffEffect.buff:getIcon() then
self.battleController:refreshBuff(self.side, self.buffList)
end
needRecycle = buffEffect
end
return needRecycle
end
function BattleTeam:removeAllBuff()

View File

@ -81,6 +81,10 @@ function BattleBuffEntity:setTargetSide(side)
self.targetSide = side
end
function BattleBuffEntity:getStack()
return self.buffInfo.stack
end
function BattleBuffEntity:getIcon()
return self.buffInfo.icon
end