Commit bbf64622d27f654e6503de9b1111aea0bf4cb1dc
1 parent
f02087ed
冒险
Showing
7 changed files
with
70 additions
and
64 deletions
Show diff stats
src/GlobalVar.lua
@@ -165,9 +165,11 @@ AdvBackEventType = { | @@ -165,9 +165,11 @@ AdvBackEventType = { | ||
165 | AdvScoreType = { | 165 | AdvScoreType = { |
166 | Level = 1, | 166 | Level = 1, |
167 | Kill = 2, | 167 | Kill = 2, |
168 | - Item = 3, | ||
169 | - Hurt = 4, | ||
170 | - Block = 5, | 168 | + KillBoss = 3, |
169 | + ItemBack = 4, | ||
170 | + Event = 5, | ||
171 | + Story = 6, | ||
172 | + Task = 7, | ||
171 | } | 173 | } |
172 | 174 | ||
173 | DinerTask = { | 175 | DinerTask = { |
src/ProtocolCode.lua
@@ -153,6 +153,10 @@ actionCodes = { | @@ -153,6 +153,10 @@ actionCodes = { | ||
153 | Pvp_endBattleRpc = 505, | 153 | Pvp_endBattleRpc = 505, |
154 | Pvp_rankListRpc = 506, | 154 | Pvp_rankListRpc = 506, |
155 | Pvp_recordListRpc = 507, | 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 | Store_rechargeRpc = 550, | 162 | Store_rechargeRpc = 550, |
src/adv/Adv.lua
@@ -126,7 +126,6 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt | @@ -126,7 +126,6 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt | ||
126 | self:checkAdvUnlock(1, self.level) | 126 | self:checkAdvUnlock(1, self.level) |
127 | if isToNext then | 127 | if isToNext then |
128 | self.battle.player:afterLayer() -- 玩家的buff 清理一下 | 128 | self.battle.player:afterLayer() -- 玩家的buff 清理一下 |
129 | - self:scoreChange(AdvScoreType.Level) --增加层级加分 | ||
130 | end | 129 | end |
131 | if not notNotify then | 130 | if not notNotify then |
132 | self:saveDB(notNotify) | 131 | self:saveDB(notNotify) |
@@ -617,34 +616,47 @@ function Adv:isEndless() | @@ -617,34 +616,47 @@ function Adv:isEndless() | ||
617 | end | 616 | end |
618 | 617 | ||
619 | function Adv:getCurFloorData() | 618 | function Adv:getCurFloorData() |
620 | - if not self.chapterId then return end | ||
621 | local chapter = self.chapterId % 100 | 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 | end | 621 | end |
624 | 622 | ||
625 | --关卡结束 | 623 | --关卡结束 |
626 | -function Adv:over(success, rewardRatio) | 624 | +function Adv:over(success, rewardRatio, overType) |
627 | if success then | 625 | if success then |
628 | rewardRatio = rewardRatio or 100 | 626 | rewardRatio = rewardRatio or 100 |
627 | + overType = overType or 0 | ||
629 | else | 628 | else |
630 | rewardRatio = rewardRatio or globalCsv.adv_fail_reward_ratio | 629 | rewardRatio = rewardRatio or globalCsv.adv_fail_reward_ratio |
630 | + overType = overType or -1 | ||
631 | end | 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 | local reward = self.owner:getProperty("advItems"):toNumMap() | 634 | local reward = self.owner:getProperty("advItems"):toNumMap() |
635 | + local addScore = 0 | ||
639 | for itemId, count in pairs(reward) do | 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 | end | 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 | reward = self.owner:award(reward) | 652 | reward = self.owner:award(reward) |
643 | 653 | ||
654 | + self.battle.player:triggerPassive(Passive.ADV_OVER, {score = score, level = self.level}) | ||
655 | + | ||
644 | if success then | 656 | if success then |
645 | self.owner:checkTaskEnter("AdvPass", {id = self.chapterId, level = self.level, score = score}) | 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 | self.owner:checkTaskEnter("AdvAllPass", {id = self.chapterId}) | 660 | self.owner:checkTaskEnter("AdvAllPass", {id = self.chapterId}) |
649 | end | 661 | end |
650 | 662 | ||
@@ -675,7 +687,7 @@ function Adv:over(success, rewardRatio) | @@ -675,7 +687,7 @@ function Adv:over(success, rewardRatio) | ||
675 | advAFGet = {}, | 687 | advAFGet = {}, |
676 | advAFWear = {}, | 688 | advAFWear = {}, |
677 | }) | 689 | }) |
678 | - self:backEnd(success, score, scoreInfo, reward) | 690 | + self:backEnd(success, score, scoreInfo, reward, overType, scoreReward) |
679 | end | 691 | end |
680 | 692 | ||
681 | function Adv:exit() | 693 | function Adv:exit() |
@@ -740,7 +752,6 @@ function Adv:award(gift, params) | @@ -740,7 +752,6 @@ function Adv:award(gift, params) | ||
740 | if count > 0 then | 752 | if count > 0 then |
741 | local buffAdd = self.battle.player:getRewardChange(itemId) | 753 | local buffAdd = self.battle.player:getRewardChange(itemId) |
742 | count = math.floor(math.max(0, (count + buffAdd[0]) * (1 + buffAdd[1]))) --附加 buff 的影响 | 754 | count = math.floor(math.max(0, (count + buffAdd[0]) * (1 + buffAdd[1]))) --附加 buff 的影响 |
743 | - self:scoreChange(AdvScoreType.Item, {itemId, count}) | ||
744 | self:checkTask(Adv.TaskType.Item, count, itemId) | 755 | self:checkTask(Adv.TaskType.Item, count, itemId) |
745 | self:checkAchievement(Adv.AchievType.GetItem, count, itemId) | 756 | self:checkAchievement(Adv.AchievType.GetItem, count, itemId) |
746 | end | 757 | end |
@@ -820,11 +831,16 @@ local function clickOut(self, room, block, params) | @@ -820,11 +831,16 @@ local function clickOut(self, room, block, params) | ||
820 | self:checkAchievement(Adv.AchievType.OverWin, 1, self.level) | 831 | self:checkAchievement(Adv.AchievType.OverWin, 1, self.level) |
821 | self:checkAdvUnlock(2, self.level) | 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 | if not self:isEndless() and (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel or not self.owner:advChapterIsOpen(self.chapterId, self.level + 1)) then --关卡结束 | 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 | self:over(true) | 840 | self:over(true) |
825 | else | 841 | else |
826 | self.battle.player:triggerPassive(Passive.DOWN_LAYER) | 842 | self.battle.player:triggerPassive(Passive.DOWN_LAYER) |
827 | - local curFloorData = self:getCurFloorData() | 843 | + |
828 | if curFloorData then | 844 | if curFloorData then |
829 | self:backReward(self:award({[ItemId.AdvPoint] = curFloorData.exp})) | 845 | self:backReward(self:award({[ItemId.AdvPoint] = curFloorData.exp})) |
830 | end | 846 | end |
@@ -1011,6 +1027,8 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | @@ -1011,6 +1027,8 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | ||
1011 | assert(doEffect[effect[1]], "error effect, event_" .. (tag or "choose") .. "Csv id :" .. block.event.id) | 1027 | assert(doEffect[effect[1]], "error effect, event_" .. (tag or "choose") .. "Csv id :" .. block.event.id) |
1012 | doEffect[effect[1]]() | 1028 | doEffect[effect[1]]() |
1013 | end | 1029 | end |
1030 | + self:scoreChange(AdvScoreType.Event, chooseData.advScore) --增加加分 | ||
1031 | + | ||
1014 | return true, clearBlock | 1032 | return true, clearBlock |
1015 | end | 1033 | end |
1016 | 1034 | ||
@@ -1048,6 +1066,7 @@ local function clickLinkChoose(self, room, block, params) | @@ -1048,6 +1066,7 @@ local function clickLinkChoose(self, room, block, params) | ||
1048 | self.owner:setProperty("advStoryB", advStoryB) | 1066 | self.owner:setProperty("advStoryB", advStoryB) |
1049 | local storyData = csvdb["event_linkchoose_storyCsv"][chooseData.storyid] | 1067 | local storyData = csvdb["event_linkchoose_storyCsv"][chooseData.storyid] |
1050 | self:checkAchievement(Adv.AchievType.StorryDone, 1, storyData[1].chapter) -- 检查故事对应章节 | 1068 | self:checkAchievement(Adv.AchievType.StorryDone, 1, storyData[1].chapter) -- 检查故事对应章节 |
1069 | + self:scoreChange(AdvScoreType.Story, storyData.advScore) --增加加分 | ||
1051 | 1070 | ||
1052 | self:checkAdvUnlock(4, startId) | 1071 | self:checkAdvUnlock(4, startId) |
1053 | self.lchoose.cur = self.lchoose.cur or {} | 1072 | self.lchoose.cur = self.lchoose.cur or {} |
@@ -1433,7 +1452,7 @@ function Adv:doActive(activeId, target) | @@ -1433,7 +1452,7 @@ function Adv:doActive(activeId, target) | ||
1433 | 1452 | ||
1434 | --10: 立刻结算 按比例返还 | 1453 | --10: 立刻结算 按比例返还 |
1435 | doActiveEffect[10] = function(_, rewardRatio) | 1454 | doActiveEffect[10] = function(_, rewardRatio) |
1436 | - self:over(true, rewardRatio) | 1455 | + self:over(true, rewardRatio, 1) |
1437 | return true | 1456 | return true |
1438 | end | 1457 | end |
1439 | 1458 | ||
@@ -1507,7 +1526,11 @@ function Adv:enemyDead(enemy, escape) | @@ -1507,7 +1526,11 @@ function Adv:enemyDead(enemy, escape) | ||
1507 | else | 1526 | else |
1508 | local enemyId = block.event.id | 1527 | local enemyId = block.event.id |
1509 | local monsterData = csvdb["event_monsterCsv"][enemyId] | 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 | local changeV = self.battle.player:addExp(monsterData.exp) | 1534 | local changeV = self.battle.player:addExp(monsterData.exp) |
1512 | self:backDead(enemyId, changeV) | 1535 | self:backDead(enemyId, changeV) |
1513 | if enemy:hadBuff(Buff.CHANGE_DROP_TO_CLICK) then -- 掉落转为 click | 1536 | if enemy:hadBuff(Buff.CHANGE_DROP_TO_CLICK) then -- 掉落转为 click |
@@ -1604,8 +1627,8 @@ function Adv:backNext() | @@ -1604,8 +1627,8 @@ function Adv:backNext() | ||
1604 | self:pushBackEvent(AdvBackEventType.Next, {}) | 1627 | self:pushBackEvent(AdvBackEventType.Next, {}) |
1605 | end | 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 | end | 1632 | end |
1610 | 1633 | ||
1611 | function Adv:backBlockChange(roomId, blockId) | 1634 | function Adv:backBlockChange(roomId, blockId) |
@@ -1641,43 +1664,27 @@ function Adv:backUse(items) | @@ -1641,43 +1664,27 @@ function Adv:backUse(items) | ||
1641 | end | 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 | self.score[scoreType] = self.score[scoreType] or 0 | 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 | end | 1670 | end |
1671 | 1671 | ||
1672 | function Adv:getScore() | 1672 | function Adv:getScore() |
1673 | self.score[AdvScoreType.Level] = math.floor(self.score[AdvScoreType.Level] or 0) | 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 | self.score[AdvScoreType.Kill] = math.floor(self.score[AdvScoreType.Kill] or 0) | 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 | end | 1688 | end |
1682 | 1689 | ||
1683 | function Adv:popBackEvents() | 1690 | function Adv:popBackEvents() |
src/adv/AdvMap.lua
@@ -142,7 +142,6 @@ function Map:openBlock(roomId, blockId, isPlayer, ignoreBack) | @@ -142,7 +142,6 @@ function Map:openBlock(roomId, blockId, isPlayer, ignoreBack) | ||
142 | if status then | 142 | if status then |
143 | if isPlayer then | 143 | if isPlayer then |
144 | self.adv.battle.player:triggerPassive(Passive.OPEN_BLOCK) | 144 | self.adv.battle.player:triggerPassive(Passive.OPEN_BLOCK) |
145 | - self.adv:scoreChange(AdvScoreType.Block) | ||
146 | self.adv.owner:checkTaskEnter("AdvOpenBlock") | 145 | self.adv.owner:checkTaskEnter("AdvOpenBlock") |
147 | end | 146 | end |
148 | 147 |
src/adv/AdvPlayer.lua
@@ -402,10 +402,6 @@ function BaseObject:hurt(value, releaser, params) | @@ -402,10 +402,6 @@ function BaseObject:hurt(value, releaser, params) | ||
402 | end | 402 | end |
403 | self.hp = math.max(0, self.hp - value) | 403 | self.hp = math.max(0, self.hp - value) |
404 | 404 | ||
405 | - if self.cutHp then | ||
406 | - self:cutHp(value) | ||
407 | - end | ||
408 | - | ||
409 | if self.hp == 0 then | 405 | if self.hp == 0 then |
410 | self:triggerPassive(Passive.SELF_DEAD) | 406 | self:triggerPassive(Passive.SELF_DEAD) |
411 | for _, team in ipairs(self:getTeam(1, true)) do | 407 | for _, team in ipairs(self:getTeam(1, true)) do |
@@ -542,10 +538,6 @@ function Player:ctor(battle, data) | @@ -542,10 +538,6 @@ function Player:ctor(battle, data) | ||
542 | self:initData(data) | 538 | self:initData(data) |
543 | end | 539 | end |
544 | 540 | ||
545 | -function Player:cutHp(value) | ||
546 | - self.battle.adv:scoreChange(AdvScoreType.Hurt, value) | ||
547 | -end | ||
548 | - | ||
549 | function Player:initData(data) | 541 | function Player:initData(data) |
550 | Player.super.initData(self, data) | 542 | Player.super.initData(self, data) |
551 | self.level = data.level or 1 --level 每增加1级 属性增长 growth * baseAttr | 543 | self.level = data.level or 1 --level 每增加1级 属性增长 growth * baseAttr |
src/adv/AdvTask.lua
@@ -139,6 +139,8 @@ function AdvTask.bind(Adv) | @@ -139,6 +139,8 @@ function AdvTask.bind(Adv) | ||
139 | reward[item[1]] = (reward[item[1]] or 0) + item[2] | 139 | reward[item[1]] = (reward[item[1]] or 0) + item[2] |
140 | reward = self:award(reward) | 140 | reward = self:award(reward) |
141 | 141 | ||
142 | + self:scoreChange(AdvScoreType.Task, taskData.advScore) --增加加分 | ||
143 | + | ||
142 | self.advTask[taskId] = nil | 144 | self.advTask[taskId] = nil |
143 | ok = true | 145 | ok = true |
144 | advTaskChange.t = true | 146 | advTaskChange.t = true |
src/models/RolePlugin.lua
@@ -994,7 +994,7 @@ function RolePlugin.bind(Role) | @@ -994,7 +994,7 @@ function RolePlugin.bind(Role) | ||
994 | end | 994 | end |
995 | end | 995 | end |
996 | end | 996 | end |
997 | - return score * (1 + change / 100) | 997 | + return math.floor(score * (1 + change / 100)) |
998 | end | 998 | end |
999 | 999 | ||
1000 | function Role:getAdvLvAddAttrs() | 1000 | function Role:getAdvLvAddAttrs() |