Commit e9e384bf8df350973f3af105ca7548bdccd99bde
Merge branch 'develop' of 120.26.43.151:wasteland/server into develop
Showing
6 changed files
with
201 additions
and
63 deletions
Show diff stats
src/actions/AdvAction.lua
| ... | ... | @@ -746,7 +746,7 @@ function _M.endBattleRpc(agent, data) |
| 746 | 746 | end |
| 747 | 747 | end |
| 748 | 748 | adv:mylog({desc = "endBattle"}) |
| 749 | - local status = adv:clickBlock(roomId, blockId, {player = player, bySkill = bySkill}) | |
| 749 | + local status = adv:clickBlock(roomId, blockId, {player = player, enemy = msg.enemy, bySkill = bySkill}) | |
| 750 | 750 | |
| 751 | 751 | if not status then return end |
| 752 | 752 | SendPacket(actionCodes.Adv_endBattleRpc, MsgPack.pack({events = adv:popBackEvents()})) | ... | ... |
src/adv/Adv.lua
| ... | ... | @@ -1953,73 +1953,144 @@ function Adv:enemyDead(enemy, escape) |
| 1953 | 1953 | -- self:backDead(enemyId, changeV) |
| 1954 | 1954 | self:backDead(enemyId) |
| 1955 | 1955 | |
| 1956 | - local toClick = enemy:hadBuff(Buff.CHANGE_DROP_TO_CLICK) | |
| 1957 | - if toClick then | |
| 1958 | - toClick = toClick:effect() | |
| 1956 | + local isMine = false -- 是不是宝藏怪 | |
| 1957 | + for _, mid in ipairs(globalCsv.adv_egg_treasureMonster_id) do | |
| 1958 | + if mid == enemyId then | |
| 1959 | + isMine = true | |
| 1960 | + break | |
| 1961 | + end | |
| 1959 | 1962 | end |
| 1963 | + if isMine then | |
| 1964 | + local advMine = self.owner:getProperty("advMine") | |
| 1965 | + advMine[1] = advMine[1] or {} | |
| 1966 | + advMine[2] = advMine[2] or {} | |
| 1967 | + local mineCo = advMine[1].co or {} | |
| 1968 | + local mineCo2 = advMine[2].co or {} | |
| 1969 | + local mineCh = advMine[2].ch or globalCsv.adv_egg_treasureLayer_showup | |
| 1970 | + if monsterData.limit ~= 0 then | |
| 1971 | + mineCo[enemyId] = (mineCo[enemyId] or 0) + 1 | |
| 1972 | + end | |
| 1960 | 1973 | |
| 1961 | - local changItem = enemy:hadBuff(Buff.CHANGE_DROP) | |
| 1962 | - if changItem then | |
| 1963 | - changItem = table.pack(changItem:effect()) | |
| 1964 | - end | |
| 1974 | + local had = false | |
| 1975 | + if math.randomInt(1, 100) <= mineCh then -- 刷出来了 | |
| 1976 | + local mpool = {} | |
| 1977 | + for _, mid in ipairs(globalCsv.adv_egg_treasureLayer_id) do | |
| 1978 | + local layer = csvdb["event_buildingCsv"][mid] | |
| 1979 | + if (not mineCo2[mid] or layer.limit == 0 or mineCo2[mid] < layer.limit) and layer.showup > 0 then | |
| 1980 | + mpool[mid] = {layer.showup} | |
| 1981 | + end | |
| 1982 | + end | |
| 1983 | + if next(mpool) then | |
| 1984 | + local cId = math.randWeight(mpool, 1) | |
| 1985 | + block:updateEvent({ | |
| 1986 | + etype = AdvEventType.Build, | |
| 1987 | + id = cId | |
| 1988 | + }) | |
| 1989 | + if csvdb["event_buildingCsv"][cId].limit ~= 0 then | |
| 1990 | + mineCo2[cId] = (mineCo2[cId] or 0) + 1 | |
| 1991 | + end | |
| 1992 | + had = true | |
| 1993 | + end | |
| 1994 | + end | |
| 1995 | + if had then | |
| 1996 | + mineCh = math.min(mineCh + globalCsv.adv_egg_treasureLayer_showup_add, 100) | |
| 1997 | + else | |
| 1998 | + mineCh = nil | |
| 1999 | + end | |
| 1965 | 2000 | |
| 1966 | - local addMult = 0 | |
| 1967 | - local dropBuff = enemy:hadBuff(Buff.DROP_BUFF_BY_ENEMY) -- 根据敌人数量变化个数 | |
| 1968 | - if dropBuff then | |
| 1969 | - local team = enemy:getTeam(1, true) | |
| 1970 | - addMult = addMult + 0.2 * #team | |
| 1971 | - end | |
| 2001 | + local drops = {} | |
| 2002 | + for _, dropId in ipairs(monsterData.dropid:toArray(true, "=")) do | |
| 2003 | + local dropData = csvdb["event_dropCsv"][dropId] | |
| 2004 | + if dropData then | |
| 2005 | + local cur = dropData["range"]:randWeight(true) | |
| 2006 | + if cur and cur[1] ~= 0 then | |
| 2007 | + drops[#drops + 1] = cur | |
| 2008 | + end | |
| 2009 | + end | |
| 2010 | + end | |
| 2011 | + local blocks = self:getCurMap():getEmptyBlocks(roomId, blockId, #drops) | |
| 2012 | + for _i, cblock in ipairs(blocks) do | |
| 2013 | + cblock:updateEvent({ | |
| 2014 | + etype = AdvEventType.Drop, | |
| 2015 | + item = drops[_i] | |
| 2016 | + }) | |
| 2017 | + if cblock ~= block then | |
| 2018 | + self:backBlockChange(cblock.room.roomId, cblock.blockId) | |
| 2019 | + end | |
| 2020 | + end | |
| 2021 | + advMine[1].co = mineCo | |
| 2022 | + advMine[2].co = mineCo2 | |
| 2023 | + advMine[2].ch = mineCh | |
| 2024 | + self.owner:setProperty("advMine", advMine) | |
| 2025 | + else | |
| 2026 | + local toClick = enemy:hadBuff(Buff.CHANGE_DROP_TO_CLICK) | |
| 2027 | + if toClick then | |
| 2028 | + toClick = toClick:effect() | |
| 2029 | + end | |
| 1972 | 2030 | |
| 1973 | - local dropIds = monsterData.dropid:toArray(true, "=") | |
| 1974 | - local drops = {} | |
| 1975 | - local cCcount = 0 -- 需要改变为click 的个数 | |
| 1976 | - for _, dropId in ipairs(dropIds) do | |
| 1977 | - local dropData = csvdb["event_dropCsv"][dropId] | |
| 1978 | - if dropData then | |
| 1979 | - local cur = dropData["range"]:randWeight(true) | |
| 1980 | - if cur and cur[1] ~= 0 then | |
| 1981 | - if toClick then | |
| 1982 | - cCcount = cCcount + 1 | |
| 1983 | - else | |
| 1984 | - local item = changItem and changItem or cur | |
| 1985 | - item[2] = math.floor(item[2] * (1 + addMult)) | |
| 1986 | - drops[#drops + 1] = item | |
| 2031 | + local changItem = enemy:hadBuff(Buff.CHANGE_DROP) | |
| 2032 | + if changItem then | |
| 2033 | + changItem = table.pack(changItem:effect()) | |
| 2034 | + end | |
| 2035 | + | |
| 2036 | + local addMult = 0 | |
| 2037 | + local dropBuff = enemy:hadBuff(Buff.DROP_BUFF_BY_ENEMY) -- 根据敌人数量变化个数 | |
| 2038 | + if dropBuff then | |
| 2039 | + local team = enemy:getTeam(1, true) | |
| 2040 | + addMult = addMult + 0.2 * #team | |
| 2041 | + end | |
| 2042 | + | |
| 2043 | + local dropIds = monsterData.dropid:toArray(true, "=") | |
| 2044 | + local drops = {} | |
| 2045 | + local cCcount = 0 -- 需要改变为click 的个数 | |
| 2046 | + for _, dropId in ipairs(dropIds) do | |
| 2047 | + local dropData = csvdb["event_dropCsv"][dropId] | |
| 2048 | + if dropData then | |
| 2049 | + local cur = dropData["range"]:randWeight(true) | |
| 2050 | + if cur and cur[1] ~= 0 then | |
| 2051 | + if toClick then | |
| 2052 | + cCcount = cCcount + 1 | |
| 2053 | + else | |
| 2054 | + local item = changItem and changItem or cur | |
| 2055 | + item[2] = math.floor(item[2] * (1 + addMult)) | |
| 2056 | + drops[#drops + 1] = item | |
| 2057 | + end | |
| 1987 | 2058 | end |
| 1988 | 2059 | end |
| 1989 | 2060 | end |
| 1990 | - end | |
| 1991 | - -- 这些奖励可能会有被动加成 | |
| 1992 | - self.battle.player:triggerPassive(Passive.BATTLE_WIN, {drops = drops}) | |
| 2061 | + -- 这些奖励可能会有被动加成 | |
| 2062 | + self.battle.player:triggerPassive(Passive.BATTLE_WIN, {drops = drops}) | |
| 1993 | 2063 | |
| 1994 | - -- 自身带的掉落是不会被改变的 也不会被加成 | |
| 1995 | - if block.event.item and block.event.item[1] ~= 0 then | |
| 1996 | - table.insert(drops, 1, block.event.item) | |
| 1997 | - end | |
| 2064 | + -- 自身带的掉落是不会被改变的 也不会被加成 | |
| 2065 | + if block.event.item and block.event.item[1] ~= 0 then | |
| 2066 | + table.insert(drops, 1, block.event.item) | |
| 2067 | + end | |
| 1998 | 2068 | |
| 1999 | - -- 清空当前的格子 | |
| 2000 | - block:clear() | |
| 2069 | + -- 清空当前的格子 | |
| 2070 | + block:clear() | |
| 2001 | 2071 | |
| 2002 | - -- 掉落走一波 | |
| 2003 | - local blocks = self:getCurMap():getEmptyBlocks(roomId, blockId, #drops) | |
| 2004 | - for _i, cblock in ipairs(blocks) do | |
| 2005 | - cblock:updateEvent({ | |
| 2006 | - etype = AdvEventType.Drop, | |
| 2007 | - item = drops[_i] | |
| 2008 | - }) | |
| 2009 | - if cblock ~= block then | |
| 2010 | - self:backBlockChange(cblock.room.roomId, cblock.blockId) | |
| 2072 | + -- 掉落走一波 | |
| 2073 | + local blocks = self:getCurMap():getEmptyBlocks(roomId, blockId, #drops) | |
| 2074 | + for _i, cblock in ipairs(blocks) do | |
| 2075 | + cblock:updateEvent({ | |
| 2076 | + etype = AdvEventType.Drop, | |
| 2077 | + item = drops[_i] | |
| 2078 | + }) | |
| 2079 | + if cblock ~= block then | |
| 2080 | + self:backBlockChange(cblock.room.roomId, cblock.blockId) | |
| 2081 | + end | |
| 2011 | 2082 | end |
| 2012 | - end | |
| 2013 | 2083 | |
| 2014 | - -- 转换的click走一波 | |
| 2015 | - local blocks = self:getCurMap():getEmptyBlocks(roomId, blockId, cCcount) | |
| 2016 | - for _i, cblock in ipairs(blocks) do | |
| 2017 | - cblock:updateEvent({ | |
| 2018 | - etype = AdvEventType.Click, | |
| 2019 | - id = clickId | |
| 2020 | - }) | |
| 2021 | - if cblock ~= block then | |
| 2022 | - self:backBlockChange(cblock.room.roomId, cblock.blockId) | |
| 2084 | + -- 转换的click走一波 | |
| 2085 | + local blocks = self:getCurMap():getEmptyBlocks(roomId, blockId, cCcount) | |
| 2086 | + for _i, cblock in ipairs(blocks) do | |
| 2087 | + cblock:updateEvent({ | |
| 2088 | + etype = AdvEventType.Click, | |
| 2089 | + id = clickId | |
| 2090 | + }) | |
| 2091 | + if cblock ~= block then | |
| 2092 | + self:backBlockChange(cblock.room.roomId, cblock.blockId) | |
| 2093 | + end | |
| 2023 | 2094 | end |
| 2024 | 2095 | end |
| 2025 | 2096 | ... | ... |
src/adv/AdvBattle.lua
| ... | ... | @@ -366,18 +366,32 @@ function Battle:battleBegin(roomId, blockId, params) |
| 366 | 366 | if not enemy then return end |
| 367 | 367 | local player = params.player |
| 368 | 368 | if not player then return end |
| 369 | + local penemy = params.enemy or {hp = 0} | |
| 370 | + if player.hp ~= 0 then | |
| 371 | + if penemy.hp <= 0 then | |
| 372 | + enemy:kill() | |
| 373 | + self.adv.owner:checkTaskEnter("AdvBattleWin", {id = self.adv.chapterId}) | |
| 374 | + else | |
| 375 | + -- 处理一下怪物 | |
| 376 | + if penemy.hp > enemy.hp then | |
| 377 | + enemy:recover(penemy.hp - enemy.hp) | |
| 378 | + else | |
| 379 | + enemy:hurt(math.max(0, math.ceil(enemy.hp - penemy.hp)), self.player, {hurtType = 5}) --战斗血量只会变少 | |
| 380 | + end | |
| 381 | + if penemy.escape and penemy.escape == 0 then | |
| 382 | + enemy.isDead = 1 | |
| 383 | + end | |
| 384 | + end | |
| 385 | + end | |
| 369 | 386 | -- 玩家没死就是怪死了 |
| 370 | 387 | if player.hp > 0 then |
| 371 | - enemy:kill() | |
| 372 | 388 | self.player:effectBattleBuff() |
| 373 | - | |
| 374 | - self.adv.owner:checkTaskEnter("AdvBattleWin", {id = self.adv.chapterId}) | |
| 375 | 389 | if params.bySkill then |
| 376 | 390 | self.player:triggerPassive(Passive.SKILL_KILL) |
| 377 | 391 | end |
| 378 | 392 | end |
| 379 | 393 | if player.hp > self.player.hp then |
| 380 | - self.player:recover(player.hp - self.player.hp, player) | |
| 394 | + self.player:recover(player.hp - self.player.hp) | |
| 381 | 395 | else |
| 382 | 396 | self.player:hurt(math.max(0, math.ceil(self.player.hp - player.hp)), enemy, {hurtType = 5}) --战斗血量只会变少 |
| 383 | 397 | end | ... | ... |
src/adv/AdvMap.lua
| ... | ... | @@ -313,13 +313,13 @@ function Map:openBlocksIsMonsterByRoom(roomId, count, isPlayer, ignoreBack) |
| 313 | 313 | end |
| 314 | 314 | end |
| 315 | 315 | |
| 316 | - if not count or count == -1 or count >= len(allBlock) then | |
| 316 | + if not count or count == -1 or count >= #allBlock then | |
| 317 | 317 | for _, blockId in ipairs(allBlock) do |
| 318 | 318 | openBlock(blockId) |
| 319 | 319 | end |
| 320 | 320 | else |
| 321 | 321 | for i = 1, count do |
| 322 | - local idx = math.randomInt(1, len(allBlock)) | |
| 322 | + local idx = math.randomInt(1, #allBlock) | |
| 323 | 323 | openBlock(allBlock[idx]) |
| 324 | 324 | table.remove(allBlock, idx) |
| 325 | 325 | end |
| ... | ... | @@ -812,6 +812,47 @@ createMap = function(self, mapId, isEnter, isNewRelay) |
| 812 | 812 | end |
| 813 | 813 | end |
| 814 | 814 | |
| 815 | + -- 宝藏怪刷新 | |
| 816 | + for idx = #(stagePool["global"][AdvCodeRandomStage] or {}), 1, -1 do | |
| 817 | + local c = stagePool["global"][AdvCodeRandomStage][idx] -- {room = roomId, block = blockId} | |
| 818 | + if mapInfo.rooms[c["room"]]["event"][c["block"]] then -- 存在 | |
| 819 | + table.remove(stagePool["global"][AdvCodeRandomStage], idx) | |
| 820 | + end | |
| 821 | + end | |
| 822 | + local ln = #(stagePool["global"][AdvCodeRandomStage] or {}) | |
| 823 | + local advMine = self.adv.owner:getProperty("advMine") | |
| 824 | + advMine[1] = advMine[1] or {} | |
| 825 | + local mineCh = advMine[1].ch or globalCsv.adv_egg_treasureMonster_showup | |
| 826 | + local mineCo = advMine[1].co or {} | |
| 827 | + local had = false | |
| 828 | + if ln > 0 then | |
| 829 | + if math.randomInt(1, 100) <= mineCh then -- 刷出来了 | |
| 830 | + local mpool = {} | |
| 831 | + for _, mid in ipairs(globalCsv.adv_egg_treasureMonster_id) do | |
| 832 | + local monster = csvdb["event_monsterCsv"][mid] | |
| 833 | + if (not mineCo[mid] or monster.limit == 0 or mineCo[mid] < monster.limit) and monster.showup > 0 then | |
| 834 | + mpool[mid] = {monster.showup} | |
| 835 | + end | |
| 836 | + end | |
| 837 | + if next(mpool) then | |
| 838 | + local idx = math.randomInt(1, ln) | |
| 839 | + local cur = stagePool["global"][AdvCodeRandomStage][idx] | |
| 840 | + giveEvent(cur["room"], cur["block"], AdvEventType.Monster, math.randWeight(mpool, 1)) | |
| 841 | + table.remove(stagePool["global"][AdvCodeRandomStage], idx) | |
| 842 | + ln = ln - 1 | |
| 843 | + had = true | |
| 844 | + end | |
| 845 | + end | |
| 846 | + end | |
| 847 | + if not had then | |
| 848 | + mineCh = math.min(mineCh + globalCsv.adv_egg_treasureMonster_showup_add, 100) | |
| 849 | + else | |
| 850 | + mineCh = nil | |
| 851 | + end | |
| 852 | + advMine[1].ch = mineCh | |
| 853 | + self.adv.owner:setProperty("advMine", advMine) | |
| 854 | + | |
| 855 | + | |
| 815 | 856 | if mapCsvData.clearType == 1 and not haveBoss then |
| 816 | 857 | if not next(monsterEvents) then |
| 817 | 858 | error("这个地图没有钥匙!!! mapId : " .. mapId) | ... | ... |
src/models/Role.lua
| ... | ... | @@ -99,7 +99,8 @@ Role.schema = { |
| 99 | 99 | advLimit = {"table", {}}, -- 冒险事件每次的limit |
| 100 | 100 | advC = {"number", 0}, -- 冒险次数(消耗体力) |
| 101 | 101 | advCT = {"number", 0}, -- 冒险次数 上次恢复时间 |
| 102 | - | |
| 102 | + advMine = {"table", {}}, -- -- {1 = {ch = 0, co = {id = count}}, 2 = {ch = 0, co = {id = count}}} 宝藏怪刷出概率 1 宝藏怪 2 宝藏洞 ch 概率 co 不同id 次数记录 | |
| 103 | + | |
| 103 | 104 | --挂机相关 |
| 104 | 105 | hangPass = {"table", {}}, -- 挂机通过的最大关卡 |
| 105 | 106 | hangGift = {"table", {}}, -- 挂机奖励 {id = 1} | ... | ... |
src/models/RoleTimeReset.lua
| ... | ... | @@ -17,6 +17,11 @@ ResetFunc["CrossDay"] = function(self, notify, response, now) |
| 17 | 17 | self:advRandomSupportEffect(not notify) |
| 18 | 18 | |
| 19 | 19 | self:checkExpireItem(not notify) |
| 20 | + local advMine = self:getProperty("advMine") | |
| 21 | + if advMine[1] then | |
| 22 | + advMine[1].co = nil | |
| 23 | + end | |
| 24 | + self:setProperty("advMine", advMine) | |
| 20 | 25 | |
| 21 | 26 | response.dTask = {} |
| 22 | 27 | response.advSup = self:getProperty("advSup") |
| ... | ... | @@ -24,10 +29,16 @@ ResetFunc["CrossDay"] = function(self, notify, response, now) |
| 24 | 29 | end |
| 25 | 30 | |
| 26 | 31 | ResetFunc["CrossWeek"] = function(self, notify, response) |
| 32 | + local advMine = self:getProperty("advMine") | |
| 33 | + if advMine[2] then | |
| 34 | + advMine[2].co = nil | |
| 35 | + end | |
| 27 | 36 | self:setProperties({ |
| 28 | 37 | wTask = {}, |
| 29 | 38 | dinerS = {}, |
| 39 | + advMine = advMine, | |
| 30 | 40 | }) |
| 41 | + | |
| 31 | 42 | response.wTask = {} |
| 32 | 43 | response.dinerS = {} |
| 33 | 44 | end | ... | ... |