Commit bbf64622d27f654e6503de9b1111aea0bf4cb1dc
1 parent
f02087ed
冒险
Showing
7 changed files
with
70 additions
and
64 deletions
Show diff stats
src/GlobalVar.lua
src/ProtocolCode.lua
| ... | ... | @@ -153,6 +153,10 @@ actionCodes = { |
| 153 | 153 | Pvp_endBattleRpc = 505, |
| 154 | 154 | Pvp_rankListRpc = 506, |
| 155 | 155 | Pvp_recordListRpc = 507, |
| 156 | + Pvp_formatHighRpc = 508, | |
| 157 | + Pvp_refreshMatchHRpc = 509, | |
| 158 | + Pvp_startBattleHRpc = 510, | |
| 159 | + Pvp_endBattleHRpc = 511, | |
| 156 | 160 | |
| 157 | 161 | |
| 158 | 162 | Store_rechargeRpc = 550, | ... | ... |
src/adv/Adv.lua
| ... | ... | @@ -126,7 +126,6 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt |
| 126 | 126 | self:checkAdvUnlock(1, self.level) |
| 127 | 127 | if isToNext then |
| 128 | 128 | self.battle.player:afterLayer() -- 玩家的buff 清理一下 |
| 129 | - self:scoreChange(AdvScoreType.Level) --增加层级加分 | |
| 130 | 129 | end |
| 131 | 130 | if not notNotify then |
| 132 | 131 | self:saveDB(notNotify) |
| ... | ... | @@ -617,34 +616,47 @@ function Adv:isEndless() |
| 617 | 616 | end |
| 618 | 617 | |
| 619 | 618 | function Adv:getCurFloorData() |
| 620 | - if not self.chapterId then return end | |
| 621 | 619 | local chapter = self.chapterId % 100 |
| 622 | - return (csvdb["adv_chapter_floorCsv"][chapter] or {})[self.level] | |
| 620 | + return (csvdb["adv_chapter_floorCsv"][self.chapterId] or {})[self.level] | |
| 623 | 621 | end |
| 624 | 622 | |
| 625 | 623 | --关卡结束 |
| 626 | -function Adv:over(success, rewardRatio) | |
| 624 | +function Adv:over(success, rewardRatio, overType) | |
| 627 | 625 | if success then |
| 628 | 626 | rewardRatio = rewardRatio or 100 |
| 627 | + overType = overType or 0 | |
| 629 | 628 | else |
| 630 | 629 | rewardRatio = rewardRatio or globalCsv.adv_fail_reward_ratio |
| 630 | + overType = overType or -1 | |
| 631 | 631 | end |
| 632 | - local score = self:getScore() | |
| 633 | - local scoreInfo = self.score | |
| 634 | - | |
| 635 | - self.battle.player:triggerPassive(Passive.ADV_OVER, {score = score, level = self.level}) | |
| 636 | - | |
| 637 | - | |
| 632 | + local chapterData = csvdb["adv_chapterCsv"][self.chapterId] | |
| 633 | + -- 扣除的东西给积分 | |
| 638 | 634 | local reward = self.owner:getProperty("advItems"):toNumMap() |
| 635 | + local addScore = 0 | |
| 639 | 636 | for itemId, count in pairs(reward) do |
| 640 | - reward[itemId] = math.ceil(count * rewardRatio / 100) | |
| 637 | + local itemCsv = csvdb["itemCsv"][itemId] | |
| 638 | + if itemCsv.type == ItemType.AdvItem then | |
| 639 | + addScore = addScore + count * itemCsv.advScore | |
| 640 | + else | |
| 641 | + reward[itemId] = math.ceil(count * rewardRatio / 100) | |
| 642 | + end | |
| 641 | 643 | end |
| 644 | + self:scoreChange(AdvScoreType.ItemBack, addScore) | |
| 645 | + | |
| 646 | + local score = self.owner:fixAdvScoreChange(self:getScore()) | |
| 647 | + local scoreInfo = self.score | |
| 648 | + | |
| 649 | + local scoreReward = math.floor(score / chapterData.scoreAward) | |
| 650 | + self.owner:award({[ItemId.OldCoin] = scoreReward}) | |
| 651 | + | |
| 642 | 652 | reward = self.owner:award(reward) |
| 643 | 653 | |
| 654 | + self.battle.player:triggerPassive(Passive.ADV_OVER, {score = score, level = self.level}) | |
| 655 | + | |
| 644 | 656 | if success then |
| 645 | 657 | self.owner:checkTaskEnter("AdvPass", {id = self.chapterId, level = self.level, score = score}) |
| 646 | - local chapterData = csvdb["adv_chapterCsv"][self.chapterId].limitlevel | |
| 647 | - if not self:isEndless() and self.level >= chapterData then | |
| 658 | + | |
| 659 | + if not self:isEndless() and self.level >= chapterData.limitlevel then | |
| 648 | 660 | self.owner:checkTaskEnter("AdvAllPass", {id = self.chapterId}) |
| 649 | 661 | end |
| 650 | 662 | |
| ... | ... | @@ -675,7 +687,7 @@ function Adv:over(success, rewardRatio) |
| 675 | 687 | advAFGet = {}, |
| 676 | 688 | advAFWear = {}, |
| 677 | 689 | }) |
| 678 | - self:backEnd(success, score, scoreInfo, reward) | |
| 690 | + self:backEnd(success, score, scoreInfo, reward, overType, scoreReward) | |
| 679 | 691 | end |
| 680 | 692 | |
| 681 | 693 | function Adv:exit() |
| ... | ... | @@ -740,7 +752,6 @@ function Adv:award(gift, params) |
| 740 | 752 | if count > 0 then |
| 741 | 753 | local buffAdd = self.battle.player:getRewardChange(itemId) |
| 742 | 754 | count = math.floor(math.max(0, (count + buffAdd[0]) * (1 + buffAdd[1]))) --附加 buff 的影响 |
| 743 | - self:scoreChange(AdvScoreType.Item, {itemId, count}) | |
| 744 | 755 | self:checkTask(Adv.TaskType.Item, count, itemId) |
| 745 | 756 | self:checkAchievement(Adv.AchievType.GetItem, count, itemId) |
| 746 | 757 | end |
| ... | ... | @@ -820,11 +831,16 @@ local function clickOut(self, room, block, params) |
| 820 | 831 | self:checkAchievement(Adv.AchievType.OverWin, 1, self.level) |
| 821 | 832 | self:checkAdvUnlock(2, self.level) |
| 822 | 833 | |
| 834 | + local curFloorData = self:getCurFloorData() | |
| 835 | + if not self.isRelay then | |
| 836 | + self:scoreChange(AdvScoreType.Level, curFloorData.advScore) --增加层级加分 | |
| 837 | + end | |
| 838 | + | |
| 823 | 839 | if not self:isEndless() and (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel or not self.owner:advChapterIsOpen(self.chapterId, self.level + 1)) then --关卡结束 |
| 824 | 840 | self:over(true) |
| 825 | 841 | else |
| 826 | 842 | self.battle.player:triggerPassive(Passive.DOWN_LAYER) |
| 827 | - local curFloorData = self:getCurFloorData() | |
| 843 | + | |
| 828 | 844 | if curFloorData then |
| 829 | 845 | self:backReward(self:award({[ItemId.AdvPoint] = curFloorData.exp})) |
| 830 | 846 | end |
| ... | ... | @@ -1011,6 +1027,8 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) |
| 1011 | 1027 | assert(doEffect[effect[1]], "error effect, event_" .. (tag or "choose") .. "Csv id :" .. block.event.id) |
| 1012 | 1028 | doEffect[effect[1]]() |
| 1013 | 1029 | end |
| 1030 | + self:scoreChange(AdvScoreType.Event, chooseData.advScore) --增加加分 | |
| 1031 | + | |
| 1014 | 1032 | return true, clearBlock |
| 1015 | 1033 | end |
| 1016 | 1034 | |
| ... | ... | @@ -1048,6 +1066,7 @@ local function clickLinkChoose(self, room, block, params) |
| 1048 | 1066 | self.owner:setProperty("advStoryB", advStoryB) |
| 1049 | 1067 | local storyData = csvdb["event_linkchoose_storyCsv"][chooseData.storyid] |
| 1050 | 1068 | self:checkAchievement(Adv.AchievType.StorryDone, 1, storyData[1].chapter) -- 检查故事对应章节 |
| 1069 | + self:scoreChange(AdvScoreType.Story, storyData.advScore) --增加加分 | |
| 1051 | 1070 | |
| 1052 | 1071 | self:checkAdvUnlock(4, startId) |
| 1053 | 1072 | self.lchoose.cur = self.lchoose.cur or {} |
| ... | ... | @@ -1433,7 +1452,7 @@ function Adv:doActive(activeId, target) |
| 1433 | 1452 | |
| 1434 | 1453 | --10: 立刻结算 按比例返还 |
| 1435 | 1454 | doActiveEffect[10] = function(_, rewardRatio) |
| 1436 | - self:over(true, rewardRatio) | |
| 1455 | + self:over(true, rewardRatio, 1) | |
| 1437 | 1456 | return true |
| 1438 | 1457 | end |
| 1439 | 1458 | |
| ... | ... | @@ -1507,7 +1526,11 @@ function Adv:enemyDead(enemy, escape) |
| 1507 | 1526 | else |
| 1508 | 1527 | local enemyId = block.event.id |
| 1509 | 1528 | local monsterData = csvdb["event_monsterCsv"][enemyId] |
| 1510 | - self:scoreChange(AdvScoreType.Kill, monsterData.type) | |
| 1529 | + if block:isBoss() then | |
| 1530 | + self:scoreChange(AdvScoreType.KillBoss, monsterData.advScore) | |
| 1531 | + else | |
| 1532 | + self:scoreChange(AdvScoreType.Kill, monsterData.advScore) | |
| 1533 | + end | |
| 1511 | 1534 | local changeV = self.battle.player:addExp(monsterData.exp) |
| 1512 | 1535 | self:backDead(enemyId, changeV) |
| 1513 | 1536 | if enemy:hadBuff(Buff.CHANGE_DROP_TO_CLICK) then -- 掉落转为 click |
| ... | ... | @@ -1604,8 +1627,8 @@ function Adv:backNext() |
| 1604 | 1627 | self:pushBackEvent(AdvBackEventType.Next, {}) |
| 1605 | 1628 | end |
| 1606 | 1629 | |
| 1607 | -function Adv:backEnd(success, score, scoreInfo, reward) | |
| 1608 | - self:pushBackEvent(AdvBackEventType.End, {success = success, score = score, scoreInfo = scoreInfo, reward = reward}) | |
| 1630 | +function Adv:backEnd(success, score, scoreInfo, reward, overType, scoreAward) | |
| 1631 | + self:pushBackEvent(AdvBackEventType.End, {success = success, score = score, scoreInfo = scoreInfo, reward = reward, type = overType, scoreAward = scoreAward}) | |
| 1609 | 1632 | end |
| 1610 | 1633 | |
| 1611 | 1634 | function Adv:backBlockChange(roomId, blockId) |
| ... | ... | @@ -1641,43 +1664,27 @@ function Adv:backUse(items) |
| 1641 | 1664 | end |
| 1642 | 1665 | |
| 1643 | 1666 | |
| 1644 | -function Adv:scoreChange(scoreType, pms) | |
| 1645 | - local cutTypes = {} | |
| 1646 | - local score = 0 | |
| 1647 | - cutTypes[AdvScoreType.Level] = function() | |
| 1648 | - score = globalCsv.adv_score_floor | |
| 1649 | - end | |
| 1650 | - cutTypes[AdvScoreType.Kill] = function() | |
| 1651 | - local chapterData = csvdb["adv_chapterCsv"][self.chapterId] | |
| 1652 | - score = globalCsv.adv_score_monster[pms] * chapterData["reward"] | |
| 1653 | - end | |
| 1654 | - cutTypes[AdvScoreType.Item] = function() | |
| 1655 | - score = csvdb["itemCsv"][pms[1]].adv_score_item * pms[2] | |
| 1656 | - end | |
| 1657 | - cutTypes[AdvScoreType.Hurt] = function() | |
| 1658 | - score = globalCsv.adv_score_hurt * pms | |
| 1659 | - end | |
| 1660 | - cutTypes[AdvScoreType.Block] = function() | |
| 1661 | - score = globalCsv.adv_score_block | |
| 1662 | - end | |
| 1663 | - if cutTypes[scoreType] then | |
| 1664 | - cutTypes[scoreType]() | |
| 1665 | - else | |
| 1666 | - return | |
| 1667 | - end | |
| 1667 | +function Adv:scoreChange(scoreType, score) | |
| 1668 | 1668 | self.score[scoreType] = self.score[scoreType] or 0 |
| 1669 | - self.score[scoreType] = self.score[scoreType] + self.owner:fixAdvScoreChange(score) | |
| 1669 | + self.score[scoreType] = self.score[scoreType] + score | |
| 1670 | 1670 | end |
| 1671 | 1671 | |
| 1672 | 1672 | function Adv:getScore() |
| 1673 | 1673 | self.score[AdvScoreType.Level] = math.floor(self.score[AdvScoreType.Level] or 0) |
| 1674 | - self.score[AdvScoreType.Block] = math.floor(self.score[AdvScoreType.Block] or 0) | |
| 1675 | - self.score[AdvScoreType.Hurt] = math.max(math.floor(self.score[AdvScoreType.Hurt] or 0), - (self.score[AdvScoreType.Level] + self.score[AdvScoreType.Block])) | |
| 1674 | + self.score[AdvScoreType.Task] = math.floor(self.score[AdvScoreType.Task] or 0) | |
| 1676 | 1675 | self.score[AdvScoreType.Kill] = math.floor(self.score[AdvScoreType.Kill] or 0) |
| 1677 | - self.score[AdvScoreType.Item] = math.floor(self.score[AdvScoreType.Item] or 0) | |
| 1678 | - | |
| 1679 | - return self.score[AdvScoreType.Level] + self.score[AdvScoreType.Block] + self.score[AdvScoreType.Hurt] | |
| 1680 | - + self.score[AdvScoreType.Kill] + self.score[AdvScoreType.Item] | |
| 1676 | + self.score[AdvScoreType.KillBoss] = math.floor(self.score[AdvScoreType.KillBoss] or 0) | |
| 1677 | + self.score[AdvScoreType.ItemBack] = math.floor(self.score[AdvScoreType.ItemBack] or 0) | |
| 1678 | + self.score[AdvScoreType.Event] = math.floor(self.score[AdvScoreType.Event] or 0) | |
| 1679 | + self.score[AdvScoreType.Story] = math.floor(self.score[AdvScoreType.Story] or 0) | |
| 1680 | + | |
| 1681 | + return self.score[AdvScoreType.Level] | |
| 1682 | + + self.score[AdvScoreType.Task] | |
| 1683 | + + self.score[AdvScoreType.Kill] | |
| 1684 | + + self.score[AdvScoreType.KillBoss] | |
| 1685 | + + self.score[AdvScoreType.ItemBack] | |
| 1686 | + + self.score[AdvScoreType.Event] | |
| 1687 | + + self.score[AdvScoreType.Story] | |
| 1681 | 1688 | end |
| 1682 | 1689 | |
| 1683 | 1690 | function Adv:popBackEvents() | ... | ... |
src/adv/AdvMap.lua
| ... | ... | @@ -142,7 +142,6 @@ function Map:openBlock(roomId, blockId, isPlayer, ignoreBack) |
| 142 | 142 | if status then |
| 143 | 143 | if isPlayer then |
| 144 | 144 | self.adv.battle.player:triggerPassive(Passive.OPEN_BLOCK) |
| 145 | - self.adv:scoreChange(AdvScoreType.Block) | |
| 146 | 145 | self.adv.owner:checkTaskEnter("AdvOpenBlock") |
| 147 | 146 | end |
| 148 | 147 | ... | ... |
src/adv/AdvPlayer.lua
| ... | ... | @@ -402,10 +402,6 @@ function BaseObject:hurt(value, releaser, params) |
| 402 | 402 | end |
| 403 | 403 | self.hp = math.max(0, self.hp - value) |
| 404 | 404 | |
| 405 | - if self.cutHp then | |
| 406 | - self:cutHp(value) | |
| 407 | - end | |
| 408 | - | |
| 409 | 405 | if self.hp == 0 then |
| 410 | 406 | self:triggerPassive(Passive.SELF_DEAD) |
| 411 | 407 | for _, team in ipairs(self:getTeam(1, true)) do |
| ... | ... | @@ -542,10 +538,6 @@ function Player:ctor(battle, data) |
| 542 | 538 | self:initData(data) |
| 543 | 539 | end |
| 544 | 540 | |
| 545 | -function Player:cutHp(value) | |
| 546 | - self.battle.adv:scoreChange(AdvScoreType.Hurt, value) | |
| 547 | -end | |
| 548 | - | |
| 549 | 541 | function Player:initData(data) |
| 550 | 542 | Player.super.initData(self, data) |
| 551 | 543 | self.level = data.level or 1 --level 每增加1级 属性增长 growth * baseAttr | ... | ... |
src/adv/AdvTask.lua
| ... | ... | @@ -139,6 +139,8 @@ function AdvTask.bind(Adv) |
| 139 | 139 | reward[item[1]] = (reward[item[1]] or 0) + item[2] |
| 140 | 140 | reward = self:award(reward) |
| 141 | 141 | |
| 142 | + self:scoreChange(AdvScoreType.Task, taskData.advScore) --增加加分 | |
| 143 | + | |
| 142 | 144 | self.advTask[taskId] = nil |
| 143 | 145 | ok = true |
| 144 | 146 | advTaskChange.t = true | ... | ... |
src/models/RolePlugin.lua