Commit da555218dd5b9fa08000bdd5a25219ec35a2558b
Merge remote-tracking branch 'origin/cn/develop' into cn/develop
Showing
2 changed files
with
48 additions
and
20 deletions
Show diff stats
src/actions/PvpAction.lua
| @@ -371,6 +371,18 @@ function _M.endBattleRpc(agent, data) | @@ -371,6 +371,18 @@ function _M.endBattleRpc(agent, data) | ||
| 371 | if revenge then | 371 | if revenge then |
| 372 | match = _pvpRecordInfoCacheC[msg.idx] | 372 | match = _pvpRecordInfoCacheC[msg.idx] |
| 373 | _revengeRecord[match.id] = now + RevengeWaitTime -- 1分钟内不能再打 | 373 | _revengeRecord[match.id] = now + RevengeWaitTime -- 1分钟内不能再打 |
| 374 | + | ||
| 375 | + if isWin then | ||
| 376 | + -- 次数扣一波 | ||
| 377 | + local pvpFree = role.dailyData:getProperty("pvpFree") | ||
| 378 | + if pvpFree >= globalCsv.pvp_battle_free_count then | ||
| 379 | + local cost = {[ItemId.PvpKey] = 1} | ||
| 380 | + if not role:checkItemEnough(cost) then return 5 end | ||
| 381 | + role:costItems(cost, {log = {desc = "startPvp", int1 = 1}}) | ||
| 382 | + else | ||
| 383 | + role.dailyData:updateProperty({field = "pvpFree", delta = 1}) | ||
| 384 | + end | ||
| 385 | + end | ||
| 374 | else | 386 | else |
| 375 | local pvpMC = role:getProperty("pvpMC") | 387 | local pvpMC = role:getProperty("pvpMC") |
| 376 | match = pvpMC[msg.idx] | 388 | match = pvpMC[msg.idx] |
| @@ -630,6 +642,18 @@ function _M.endBattleHRpc(agent, data) | @@ -630,6 +642,18 @@ function _M.endBattleHRpc(agent, data) | ||
| 630 | if revenge then | 642 | if revenge then |
| 631 | match = _pvpRecordInfoCacheH[msg.idx] | 643 | match = _pvpRecordInfoCacheH[msg.idx] |
| 632 | _revengeRecord[match.id] = now + RevengeWaitTime -- 1分钟内不能再打 | 644 | _revengeRecord[match.id] = now + RevengeWaitTime -- 1分钟内不能再打 |
| 645 | + | ||
| 646 | + if isWin then | ||
| 647 | + -- 次数扣一波 | ||
| 648 | + local pvpFreeH = role.dailyData:getProperty("pvpFreeH") | ||
| 649 | + if pvpFreeH >= globalCsv.pvp_battle_free_count_high then | ||
| 650 | + local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost} | ||
| 651 | + if not role:checkItemEnough(cost) then return 5 end | ||
| 652 | + role:costItems(cost, {log = {desc = "startPvp", int1 = 2}}) | ||
| 653 | + else | ||
| 654 | + role.dailyData:updateProperty({field = "pvpFreeH", delta = 1}) | ||
| 655 | + end | ||
| 656 | + end | ||
| 633 | else | 657 | else |
| 634 | local pvpMH = role:getProperty("pvpMH") | 658 | local pvpMH = role:getProperty("pvpMH") |
| 635 | match = pvpMH[msg.idx] | 659 | match = pvpMH[msg.idx] |
src/models/HeroPlugin.lua
| @@ -185,26 +185,30 @@ function HeroPlugin.bind(Hero) | @@ -185,26 +185,30 @@ function HeroPlugin.bind(Hero) | ||
| 185 | for _, uid in pairs(self:getProperty("rune"):toNumMap()) do | 185 | for _, uid in pairs(self:getProperty("rune"):toNumMap()) do |
| 186 | if uid > 0 then | 186 | if uid > 0 then |
| 187 | local rune = self.owner.runeBag[uid] | 187 | local rune = self.owner.runeBag[uid] |
| 188 | - local csvData = csvdb["runeCsv"][rune:getProperty("type")][rune:getProperty("id")] | ||
| 189 | - local runeRareData = csvdb["rune_rareCsv"][csvData.rarity] | ||
| 190 | - local buildData = csvdb["rune_buildCsv"][rune:getProperty("level")] | ||
| 191 | - for k, v in pairs(rune:getProperty("attrs"):toNumMap()) do | ||
| 192 | - local attName = AttsEnumEx[k] | ||
| 193 | - --零件的加成属性有特殊需求 填的是 10倍的值 | ||
| 194 | - --rare的effect不影响 特殊属性 | ||
| 195 | - | ||
| 196 | - --铭文单件普通属性=attr*(1+[rune_build表effect]/100*[rune_rare表effect]/100) | ||
| 197 | - --铭文单件特殊属性=attr+[rune_build表effect] | ||
| 198 | - | ||
| 199 | - local effect = buildData[attName] | ||
| 200 | - if not PercentAttr[attName] then | ||
| 201 | - effect = buildData[attName] * runeRareData.effect / 100 | ||
| 202 | - end | ||
| 203 | - attrs.value[attName] = attrs.value[attName] + (v / 100) + addAttr(v / 100, effect, 1, attName) | ||
| 204 | - end | ||
| 205 | - | ||
| 206 | - if not suits[csvData.suit] then suits[csvData.suit] = {} end | ||
| 207 | - table.insert(suits[csvData.suit],csvData) | 188 | + if not rune then |
| 189 | + skynet.error(string.format("rune not exist,uid:%s,hero:%s,roleId:%s", uid, self:getProperty("id"), self:getProperty("roleid"))) | ||
| 190 | + else | ||
| 191 | + local csvData = csvdb["runeCsv"][rune:getProperty("type")][rune:getProperty("id")] | ||
| 192 | + local runeRareData = csvdb["rune_rareCsv"][csvData.rarity] | ||
| 193 | + local buildData = csvdb["rune_buildCsv"][rune:getProperty("level")] | ||
| 194 | + for k, v in pairs(rune:getProperty("attrs"):toNumMap()) do | ||
| 195 | + local attName = AttsEnumEx[k] | ||
| 196 | + --零件的加成属性有特殊需求 填的是 10倍的值 | ||
| 197 | + --rare的effect不影响 特殊属性 | ||
| 198 | + | ||
| 199 | + --铭文单件普通属性=attr*(1+[rune_build表effect]/100*[rune_rare表effect]/100) | ||
| 200 | + --铭文单件特殊属性=attr+[rune_build表effect] | ||
| 201 | + | ||
| 202 | + local effect = buildData[attName] | ||
| 203 | + if not PercentAttr[attName] then | ||
| 204 | + effect = buildData[attName] * runeRareData.effect / 100 | ||
| 205 | + end | ||
| 206 | + attrs.value[attName] = attrs.value[attName] + (v / 100) + addAttr(v / 100, effect, 1, attName) | ||
| 207 | + end | ||
| 208 | + | ||
| 209 | + if not suits[csvData.suit] then suits[csvData.suit] = {} end | ||
| 210 | + table.insert(suits[csvData.suit],csvData) | ||
| 211 | + end | ||
| 208 | end | 212 | end |
| 209 | end | 213 | end |
| 210 | -- 零件套装效果 | 214 | -- 零件套装效果 |