diff --git a/src/actions/PvpAction.lua b/src/actions/PvpAction.lua index 79a1045..ffda473 100644 --- a/src/actions/PvpAction.lua +++ b/src/actions/PvpAction.lua @@ -371,6 +371,18 @@ function _M.endBattleRpc(agent, data) if revenge then match = _pvpRecordInfoCacheC[msg.idx] _revengeRecord[match.id] = now + RevengeWaitTime -- 1分钟内不能再打 + + if isWin then + -- 次数扣一波 + local pvpFree = role.dailyData:getProperty("pvpFree") + if pvpFree >= globalCsv.pvp_battle_free_count then + local cost = {[ItemId.PvpKey] = 1} + if not role:checkItemEnough(cost) then return 5 end + role:costItems(cost, {log = {desc = "startPvp", int1 = 1}}) + else + role.dailyData:updateProperty({field = "pvpFree", delta = 1}) + end + end else local pvpMC = role:getProperty("pvpMC") match = pvpMC[msg.idx] @@ -630,6 +642,18 @@ function _M.endBattleHRpc(agent, data) if revenge then match = _pvpRecordInfoCacheH[msg.idx] _revengeRecord[match.id] = now + RevengeWaitTime -- 1分钟内不能再打 + + if isWin then + -- 次数扣一波 + local pvpFreeH = role.dailyData:getProperty("pvpFreeH") + if pvpFreeH >= globalCsv.pvp_battle_free_count_high then + local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost} + if not role:checkItemEnough(cost) then return 5 end + role:costItems(cost, {log = {desc = "startPvp", int1 = 2}}) + else + role.dailyData:updateProperty({field = "pvpFreeH", delta = 1}) + end + end else local pvpMH = role:getProperty("pvpMH") match = pvpMH[msg.idx] diff --git a/src/models/HeroPlugin.lua b/src/models/HeroPlugin.lua index c5163c9..3136d2b 100644 --- a/src/models/HeroPlugin.lua +++ b/src/models/HeroPlugin.lua @@ -185,26 +185,30 @@ function HeroPlugin.bind(Hero) for _, uid in pairs(self:getProperty("rune"):toNumMap()) do if uid > 0 then local rune = self.owner.runeBag[uid] - local csvData = csvdb["runeCsv"][rune:getProperty("type")][rune:getProperty("id")] - local runeRareData = csvdb["rune_rareCsv"][csvData.rarity] - local buildData = csvdb["rune_buildCsv"][rune:getProperty("level")] - for k, v in pairs(rune:getProperty("attrs"):toNumMap()) do - local attName = AttsEnumEx[k] - --零件的加成属性有特殊需求 填的是 10倍的值 - --rare的effect不影响 特殊属性 - - --铭文单件普通属性=attr*(1+[rune_build表effect]/100*[rune_rare表effect]/100) - --铭文单件特殊属性=attr+[rune_build表effect] - - local effect = buildData[attName] - if not PercentAttr[attName] then - effect = buildData[attName] * runeRareData.effect / 100 - end - attrs.value[attName] = attrs.value[attName] + (v / 100) + addAttr(v / 100, effect, 1, attName) - end - - if not suits[csvData.suit] then suits[csvData.suit] = {} end - table.insert(suits[csvData.suit],csvData) + if not rune then + skynet.error(string.format("rune not exist,uid:%s,hero:%s,roleId:%s", uid, self:getProperty("id"), self:getProperty("roleid"))) + else + local csvData = csvdb["runeCsv"][rune:getProperty("type")][rune:getProperty("id")] + local runeRareData = csvdb["rune_rareCsv"][csvData.rarity] + local buildData = csvdb["rune_buildCsv"][rune:getProperty("level")] + for k, v in pairs(rune:getProperty("attrs"):toNumMap()) do + local attName = AttsEnumEx[k] + --零件的加成属性有特殊需求 填的是 10倍的值 + --rare的effect不影响 特殊属性 + + --铭文单件普通属性=attr*(1+[rune_build表effect]/100*[rune_rare表effect]/100) + --铭文单件特殊属性=attr+[rune_build表effect] + + local effect = buildData[attName] + if not PercentAttr[attName] then + effect = buildData[attName] * runeRareData.effect / 100 + end + attrs.value[attName] = attrs.value[attName] + (v / 100) + addAttr(v / 100, effect, 1, attName) + end + + if not suits[csvData.suit] then suits[csvData.suit] = {} end + table.insert(suits[csvData.suit],csvData) + end end end -- 零件套装效果 -- libgit2 0.21.2