diff --git a/src/models/Diner.lua b/src/models/Diner.lua index 2ddbb34..418c71f 100644 --- a/src/models/Diner.lua +++ b/src/models/Diner.lua @@ -232,7 +232,7 @@ function Diner:calSellReward(sell, delta, dishData, isExpedite) upValue[-1] = (upValue[-1] or 0) + collectAdd -- 电波塔加成 - local goldCount = (self.owner:getBnousDiner(4,addReward[ItemId.Gold])) * delta + local goldCount = (self.owner:getBnousDiner(4,addReward[ItemId.Gold]/delta, true) + self.owner:getBnousByZero(4)) * delta for id, count in pairs(addReward) do addReward[id] = math.floor(count * (1 + (upValue[id] or 0) / 100)) diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index e3b95a9..57c4f0b 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -2873,15 +2873,32 @@ function RolePlugin.bind(Role) return self.towerBnousActive end + function Role:bonusMerged(bonus1, bonus2) + bonus1 = bonus1 or {} + bonus2 = bonus2 or {} + + local bonus = {} + bonus[0] = (bonus1[0] or 0) + (bonus2[0] or 0) + bonus[1] = (bonus1[1] or 0) + (bonus2[1] or 0) + return bonus + end + + --计算公式是 (原价+固有提升数)*(1+赞誉度增幅中的百分比+电波塔中的百分比) + --详细做法是 原价 + (原价+固有提升数) * (赞誉度增幅中的百分比+电波塔中的百分比) + 固有提升数 function Role:getDeltaValue(result, value) if not result then return 0 end local delta = 0 - if result[1] and value then - delta = math.floor(value * result[1] / 100) - end if result[0] then delta = delta + result[0] end + + if result[1] and value then + if delta == 0 then + delta = delta * result[1] / 100 + else + delta = (delta + value )* result[1] / 100 + end + end return delta end @@ -2894,32 +2911,49 @@ function RolePlugin.bind(Role) local towerBnous = self:getTowerBnousActive() local levelBnous = self:getLevelBnous() - local towerValue = self:getDeltaValue(towerBnous[SystemBnousType.CrusadeTask], value) - local levelValue = self:getDeltaValue(levelBnous[SystemBnousType.CrusadeTask], value) - return levelValue + towerValue + local bonus = self:bonusMerged(towerBnous[SystemBnousType.CrusadeTask], levelBnous[SystemBnousType.CrusadeTask]) + return self:getDeltaValue(bonus, value) end - function Role:getBnousDiner(type, value) + function Role:getBnousDiner(type, value, flag) local towerBnous = self:getTowerBnousActive() local levelBnous = self:getLevelBnous() type = type or 1 - local result, levelReault + local bonus if type == 1 then - result = towerBnous[SystemBnousType.DinerGet] - levelReault = levelBnous[SystemBnousType.DinerGet] + bonus = self:bonusMerged(towerBnous[SystemBnousType.DinerGet], levelBnous[SystemBnousType.DinerGet]) elseif type == 2 then - result = towerBnous[SystemBnousType.DinerLimit] - levelReault = levelBnous[SystemBnousType.DinerLimit] + bonus = self:bonusMerged(towerBnous[SystemBnousType.DinerLimit], levelBnous[SystemBnousType.DinerLimit]) elseif type == 3 then - result = towerBnous[SystemBnousType.DinerSell] - levelReault = levelBnous[SystemBnousType.DinerSell] + bonus = self:bonusMerged(towerBnous[SystemBnousType.DinerSell], levelBnous[SystemBnousType.DinerSell]) elseif type == 4 then - result = towerBnous[SystemBnousType.DinerPrice] - levelReault = levelBnous[SystemBnousType.DinerPrice] + bonus = self:bonusMerged(towerBnous[SystemBnousType.DinerPrice], levelBnous[SystemBnousType.DinerPrice]) + end + dump(bonus) + if not flag then + return self:getDeltaValue(bonus, value) + (bonus[0] or 0) + else + return self:getDeltaValue(bonus, value) end - return self:getDeltaValue(result, value) + self:getDeltaValue(levelReault, value) end + function Role:getBnousByZero(type) + local towerBnous = self:getTowerBnousActive() + local levelBnous = self:getLevelBnous() + type = type or 1 + local bonus + if type == 1 then + bonus = self:bonusMerged(towerBnous[SystemBnousType.DinerGet], levelBnous[SystemBnousType.DinerGet]) + elseif type == 2 then + bonus = self:bonusMerged(towerBnous[SystemBnousType.DinerLimit], levelBnous[SystemBnousType.DinerLimit]) + elseif type == 3 then + bonus = self:bonusMerged(towerBnous[SystemBnousType.DinerSell], levelBnous[SystemBnousType.DinerSell]) + elseif type == 4 then + bonus = self:bonusMerged(towerBnous[SystemBnousType.DinerPrice], levelBnous[SystemBnousType.DinerPrice]) + end + return (bonus[0] or 0) + end + local function appendAdvBnous(dstBnous, srcBnous) if not dstBnous and not srcBnous then return {} end local result = clone(dstBnous or {}) -- libgit2 0.21.2