Commit 22b2987b4ed5c0dafd4064a2f9a4b04bb43a02be
merge code
Showing
12 changed files
with
491 additions
and
179 deletions
Show diff stats
src/GlobalVar.lua
| @@ -126,6 +126,7 @@ ItemId = { | @@ -126,6 +126,7 @@ ItemId = { | ||
| 126 | HeroFC = {700, 701, 702, 703}, --通用角色碎片 | 126 | HeroFC = {700, 701, 702, 703}, --通用角色碎片 |
| 127 | AdvKey = 80, -- 冒险钥匙 | 127 | AdvKey = 80, -- 冒险钥匙 |
| 128 | BoxKey = 60, -- 拆解工具 | 128 | BoxKey = 60, -- 拆解工具 |
| 129 | + AdvPower = 4701, -- 拾荒体力 | ||
| 129 | } | 130 | } |
| 130 | 131 | ||
| 131 | TimeReset = { | 132 | TimeReset = { |
src/actions/AdvAction.lua
| @@ -527,25 +527,8 @@ function _M.useItemRpc(agent, data) | @@ -527,25 +527,8 @@ function _M.useItemRpc(agent, data) | ||
| 527 | adv:cost({[itemId] = count}, {log = {desc = "useItem", int1 = itemId, int2 = count}}) | 527 | adv:cost({[itemId] = count}, {log = {desc = "useItem", int1 = itemId, int2 = count}}) |
| 528 | adv:backUse({[itemId] = count}) | 528 | adv:backUse({[itemId] = count}) |
| 529 | end | 529 | end |
| 530 | - | ||
| 531 | - if itemId == 5020 then | ||
| 532 | - role:finishGuide(53) | ||
| 533 | - end | ||
| 534 | - adv:checkAchievement(adv.AchievType.UseItem, count, itemId) | ||
| 535 | - adv:mylog({desc = "useItem", int1 = itemId, int2 = count}) | ||
| 536 | - | ||
| 537 | - role:log("mission_pick_use", { | ||
| 538 | - mission_threadid = adv.chapterId, -- 大地图ID | ||
| 539 | - mission_threadname = (csvdb["adv_chapterCsv"][adv.chapterId] or {})["chapter"] or "auto", -- 大地图名称 | ||
| 540 | - mission_id = adv.level, -- 关卡ID | ||
| 541 | - item_id = itemId, -- 道具ID | ||
| 542 | - mission_pick_use_num = count, -- 道具使用量 | ||
| 543 | - mission_sequenceid = adv.logid, -- 本次拾荒ID,用于关联一次拾荒产生多条不同类型的日志 | ||
| 544 | - }) | ||
| 545 | - | ||
| 546 | - for i = 1, count do | ||
| 547 | - adv:doActive(itemData.effect, target) -- target | ||
| 548 | - end | 530 | + |
| 531 | + adv:useItem(itemId, count, target) | ||
| 549 | 532 | ||
| 550 | adv:afterRound() | 533 | adv:afterRound() |
| 551 | adv:saveDB() | 534 | adv:saveDB() |
src/actions/GmAction.lua
| @@ -402,20 +402,20 @@ function _M.advl(role, pms) | @@ -402,20 +402,20 @@ function _M.advl(role, pms) | ||
| 402 | return "成功" | 402 | return "成功" |
| 403 | end | 403 | end |
| 404 | 404 | ||
| 405 | -table.insert(helpDes, {"冒险内等级增加", "advcl", "经验值"}) | ||
| 406 | -function _M.advcl(role, pms) | ||
| 407 | - local exp = tonum(pms.pm1) | ||
| 408 | - local advData = role:getAdvData() | 405 | +-- table.insert(helpDes, {"冒险内等级增加", "advcl", "经验值"}) |
| 406 | +-- function _M.advcl(role, pms) | ||
| 407 | +-- local exp = tonum(pms.pm1) | ||
| 408 | +-- local advData = role:getAdvData() | ||
| 409 | 409 | ||
| 410 | - if not advData.chapterId then | ||
| 411 | - return "先随便开启一关" | ||
| 412 | - end | ||
| 413 | - advData.battle.player:addExp(exp) | ||
| 414 | - advData:saveDB() | ||
| 415 | - role:mylog("gm_action", {desc = "advcl", int1 = exp, key1 = pms.sender}) | 410 | +-- if not advData.chapterId then |
| 411 | +-- return "先随便开启一关" | ||
| 412 | +-- end | ||
| 413 | +-- advData.battle.player:addExp(exp) | ||
| 414 | +-- advData:saveDB() | ||
| 415 | +-- role:mylog("gm_action", {desc = "advcl", int1 = exp, key1 = pms.sender}) | ||
| 416 | 416 | ||
| 417 | - return "成功" | ||
| 418 | -end | 417 | +-- return "成功" |
| 418 | +-- end | ||
| 419 | 419 | ||
| 420 | table.insert(helpDes, {"挂机清除" , "idlec"}) | 420 | table.insert(helpDes, {"挂机清除" , "idlec"}) |
| 421 | function _M.idlec(role, pms) | 421 | function _M.idlec(role, pms) |
src/adv/Adv.lua
| @@ -936,7 +936,7 @@ end | @@ -936,7 +936,7 @@ end | ||
| 936 | 936 | ||
| 937 | -- log long1 字段被征用!!! | 937 | -- log long1 字段被征用!!! |
| 938 | -- 在冒险中获得的物品都发放在冒险背包内 | 938 | -- 在冒险中获得的物品都发放在冒险背包内 |
| 939 | -function Adv:award(gift, params) | 939 | +function Adv:award(gift, params, backRewardParams) |
| 940 | params = params or {} | 940 | params = params or {} |
| 941 | local tgift = {} | 941 | local tgift = {} |
| 942 | if type(gift) == "string" then | 942 | if type(gift) == "string" then |
| @@ -948,6 +948,8 @@ function Adv:award(gift, params) | @@ -948,6 +948,8 @@ function Adv:award(gift, params) | ||
| 948 | end | 948 | end |
| 949 | local items = self.owner:getProperty("advItems") | 949 | local items = self.owner:getProperty("advItems") |
| 950 | local oldItems = items | 950 | local oldItems = items |
| 951 | + | ||
| 952 | + local autoUse = {} | ||
| 951 | for itemId, count in pairs(tgift) do | 953 | for itemId, count in pairs(tgift) do |
| 952 | if count > 0 then | 954 | if count > 0 then |
| 953 | local buffAdd = self.battle.player:getRewardChange(itemId) | 955 | local buffAdd = self.battle.player:getRewardChange(itemId) |
| @@ -956,41 +958,45 @@ function Adv:award(gift, params) | @@ -956,41 +958,45 @@ function Adv:award(gift, params) | ||
| 956 | self:checkAchievement(Adv.AchievType.GetItem, count, itemId) | 958 | self:checkAchievement(Adv.AchievType.GetItem, count, itemId) |
| 957 | end | 959 | end |
| 958 | tgift[itemId] = count | 960 | tgift[itemId] = count |
| 959 | - local origin = items:getv(itemId, 0) | ||
| 960 | - local nums = origin + count | ||
| 961 | - | ||
| 962 | - if csvdb["adv_artifactCsv"][itemId] then -- 获得神器 | ||
| 963 | - self:awardArtifact(itemId, params) | ||
| 964 | - if not self.owner:checkOverGuide(55) then | ||
| 965 | - self.owner:saveGuide(55,1,true) | ||
| 966 | - end | 961 | + if globalCsv.adv_auto_useItem[itemId] and count > 0 then |
| 962 | + autoUse[itemId] = count | ||
| 967 | else | 963 | else |
| 968 | - if nums <= 0 then | ||
| 969 | - items = items:delk(itemId) | ||
| 970 | - nums = 0 | 964 | + local origin = items:getv(itemId, 0) |
| 965 | + local nums = origin + count | ||
| 966 | + | ||
| 967 | + if csvdb["adv_artifactCsv"][itemId] then -- 获得神器 | ||
| 968 | + self:awardArtifact(itemId, params) | ||
| 969 | + if not self.owner:checkOverGuide(55) then | ||
| 970 | + self.owner:saveGuide(55,1,true) | ||
| 971 | + end | ||
| 971 | else | 972 | else |
| 972 | - items = items:setv(itemId, nums) | ||
| 973 | - end | 973 | + if nums <= 0 then |
| 974 | + items = items:delk(itemId) | ||
| 975 | + nums = 0 | ||
| 976 | + else | ||
| 977 | + items = items:setv(itemId, nums) | ||
| 978 | + end | ||
| 974 | 979 | ||
| 975 | - if itemId == 16 and not self.owner:checkOverGuide(51,4) then | ||
| 976 | - self.owner:saveGuide(51,4) | ||
| 977 | - end | ||
| 978 | - if params.log then | ||
| 979 | - local log = clone(params.log) | ||
| 980 | - if log["cint1"] or log["cint2"] or log["cint3"] or log["long1"] then | ||
| 981 | - print("addAdvItem error log have cint1 or cint2 or cint3 ", debug.traceback()) | 980 | + if itemId == 16 and not self.owner:checkOverGuide(51,4) then |
| 981 | + self.owner:saveGuide(51,4) | ||
| 982 | end | 982 | end |
| 983 | - log["cint1"] = itemId | ||
| 984 | - log["cint2"] = math.abs(count) | ||
| 985 | - log["cint3"] = self.chapterId | ||
| 986 | - log["long1"] = self.level | ||
| 987 | - if count >= 0 then | ||
| 988 | - self.owner:mylog("in_adv", log) | 983 | + if params.log then |
| 984 | + local log = clone(params.log) | ||
| 985 | + if log["cint1"] or log["cint2"] or log["cint3"] or log["long1"] then | ||
| 986 | + print("addAdvItem error log have cint1 or cint2 or cint3 ", debug.traceback()) | ||
| 987 | + end | ||
| 988 | + log["cint1"] = itemId | ||
| 989 | + log["cint2"] = math.abs(count) | ||
| 990 | + log["cint3"] = self.chapterId | ||
| 991 | + log["long1"] = self.level | ||
| 992 | + if count >= 0 then | ||
| 993 | + self.owner:mylog("in_adv", log) | ||
| 994 | + else | ||
| 995 | + self.owner:mylog("out_adv", log) | ||
| 996 | + end | ||
| 989 | else | 997 | else |
| 990 | - self.owner:mylog("out_adv", log) | 998 | + print("addAdvItem no log ", debug.traceback()) |
| 991 | end | 999 | end |
| 992 | - else | ||
| 993 | - print("addAdvItem no log ", debug.traceback()) | ||
| 994 | end | 1000 | end |
| 995 | end | 1001 | end |
| 996 | end | 1002 | end |
| @@ -1001,10 +1007,48 @@ function Adv:award(gift, params) | @@ -1001,10 +1007,48 @@ function Adv:award(gift, params) | ||
| 1001 | if tgift[ItemId.OldCoin] then | 1007 | if tgift[ItemId.OldCoin] then |
| 1002 | self.battle.player:attrChangeCondBuffCheck(0) | 1008 | self.battle.player:attrChangeCondBuffCheck(0) |
| 1003 | end | 1009 | end |
| 1010 | + | ||
| 1011 | + if backRewardParams then | ||
| 1012 | + self:backReward(tgift, backRewardParams) | ||
| 1013 | + end | ||
| 1014 | + | ||
| 1015 | + if next(autoUse) then | ||
| 1016 | + for itemId, count in pairs(autoUse) do | ||
| 1017 | + self:useItem(itemId, count) | ||
| 1018 | + end | ||
| 1019 | + self:backUse(autoUse, 1) | ||
| 1020 | + end | ||
| 1004 | return tgift | 1021 | return tgift |
| 1005 | end | 1022 | end |
| 1006 | 1023 | ||
| 1007 | 1024 | ||
| 1025 | +function Adv:useItem(itemId, count, target) | ||
| 1026 | + local itemData = csvdb["adv_itemCsv"][itemId] | ||
| 1027 | + if not itemData then return end | ||
| 1028 | + | ||
| 1029 | + if itemData["function"] == 0 or itemData["function"] == 2 then count = 1 end | ||
| 1030 | + | ||
| 1031 | + if itemId == 5020 then | ||
| 1032 | + role:finishGuide(53) | ||
| 1033 | + end | ||
| 1034 | + | ||
| 1035 | + self:checkAchievement(self.AchievType.UseItem, count, itemId) | ||
| 1036 | + self:mylog({desc = "useItem", int1 = itemId, int2 = count}) | ||
| 1037 | + | ||
| 1038 | + self.owner:log("mission_pick_use", { | ||
| 1039 | + mission_threadid = self.chapterId, -- 大地图ID | ||
| 1040 | + mission_threadname = (csvdb["adv_chapterCsv"][self.chapterId] or {})["chapter"] or "auto", -- 大地图名称 | ||
| 1041 | + mission_id = self.level, -- 关卡ID | ||
| 1042 | + item_id = itemId, -- 道具ID | ||
| 1043 | + mission_pick_use_num = count, -- 道具使用量 | ||
| 1044 | + mission_sequenceid = self.logid, -- 本次拾荒ID,用于关联一次拾荒产生多条不同类型的日志 | ||
| 1045 | + }) | ||
| 1046 | + | ||
| 1047 | + for i = 1, count do | ||
| 1048 | + self:doActive(itemData.effect, target) -- target | ||
| 1049 | + end | ||
| 1050 | +end | ||
| 1051 | + | ||
| 1008 | -- 消耗物品 优先冒险背包 --check 只是检查够不够 | 1052 | -- 消耗物品 优先冒险背包 --check 只是检查够不够 |
| 1009 | function Adv:cost(item, params, check) | 1053 | function Adv:cost(item, params, check) |
| 1010 | local items = self.owner:getProperty("advItems") | 1054 | local items = self.owner:getProperty("advItems") |
| @@ -1071,7 +1115,7 @@ local function clickOut(self, room, block, params, isExit) | @@ -1071,7 +1115,7 @@ local function clickOut(self, room, block, params, isExit) | ||
| 1071 | self.battle.player:triggerPassive(Passive.DOWN_LAYER) | 1115 | self.battle.player:triggerPassive(Passive.DOWN_LAYER) |
| 1072 | 1116 | ||
| 1073 | if curFloorData then | 1117 | if curFloorData then |
| 1074 | - self:backReward(self:award({[ItemId.AdvPoint] = curFloorData.exp}, {log = {desc = "passReward", int1 = self.chapterId, int2 = self.level}})) | 1118 | + self:award({[ItemId.AdvPoint] = curFloorData.exp}, {log = {desc = "passReward", int1 = self.chapterId, int2 = self.level}}, {}) |
| 1075 | end | 1119 | end |
| 1076 | local isHaveRelay = self:isHaveRelay(self.level) | 1120 | local isHaveRelay = self:isHaveRelay(self.level) |
| 1077 | 1121 | ||
| @@ -1255,7 +1299,7 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | @@ -1255,7 +1299,7 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | ||
| 1255 | skynet.error(string.format("[ERROR]: event_dropCsv no id %s in %s id: %s", effect[2], tag, chooseData.id)) | 1299 | skynet.error(string.format("[ERROR]: event_dropCsv no id %s in %s id: %s", effect[2], tag, chooseData.id)) |
| 1256 | end | 1300 | end |
| 1257 | end | 1301 | end |
| 1258 | - self:backReward(self:award(reward, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}), {roomId = room.roomId, blockId = block.blockId}) | 1302 | + self:award(reward, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}, {roomId = room.roomId, blockId = block.blockId}) |
| 1259 | end, | 1303 | end, |
| 1260 | [2] = function() --获得冒险buff | 1304 | [2] = function() --获得冒险buff |
| 1261 | local layer = effect[3] or 1 | 1305 | local layer = effect[3] or 1 |
| @@ -1419,14 +1463,12 @@ local function clickDrop(self, room, block, params) | @@ -1419,14 +1463,12 @@ local function clickDrop(self, room, block, params) | ||
| 1419 | if not self.battle or not self.battle.player then return end | 1463 | if not self.battle or not self.battle.player then return end |
| 1420 | self.battle.player:triggerPassive(Passive.CLICK_DROP) | 1464 | self.battle.player:triggerPassive(Passive.CLICK_DROP) |
| 1421 | 1465 | ||
| 1422 | - local reward = self:award({[block.event.item[1]] = block.event.item[2]}, {log = {desc = "clickDrop"}}) | ||
| 1423 | - -- local reward = self:award({[5801] = 1}) | ||
| 1424 | - -- 获取绷带的引导 | 1466 | + local reward = self:award({[block.event.item[1]] = block.event.item[2]}, {log = {desc = "clickDrop"}}, {roomId = room.roomId, blockId = block.blockId}) |
| 1467 | + | ||
| 1425 | if block.event.item[1] == 5020 and not self.owner:checkOverGuide(53,2) then | 1468 | if block.event.item[1] == 5020 and not self.owner:checkOverGuide(53,2) then |
| 1426 | self.owner:saveGuide(53,2) | 1469 | self.owner:saveGuide(53,2) |
| 1427 | end | 1470 | end |
| 1428 | block:clear() | 1471 | block:clear() |
| 1429 | - self:backReward(reward, {roomId = room.roomId, blockId = block.blockId}) | ||
| 1430 | return true | 1472 | return true |
| 1431 | end | 1473 | end |
| 1432 | 1474 | ||
| @@ -1447,7 +1489,7 @@ local function clickTrader(self, room, block, params) | @@ -1447,7 +1489,7 @@ local function clickTrader(self, room, block, params) | ||
| 1447 | local costCount = math.ceil(goodsData.price * (block.event.shop[buyId][2] or 100) / 100) | 1489 | local costCount = math.ceil(goodsData.price * (block.event.shop[buyId][2] or 100) / 100) |
| 1448 | if not self:cost({[goodsData.currency] = costCount}, {log = {desc = "clickTrader", int1 = block.event.id}}) then return false, 6 end --不够 | 1490 | if not self:cost({[goodsData.currency] = costCount}, {log = {desc = "clickTrader", int1 = block.event.id}}) then return false, 6 end --不够 |
| 1449 | self:backCost({[goodsData.currency] = costCount}) | 1491 | self:backCost({[goodsData.currency] = costCount}) |
| 1450 | - local reward = self:award({[goodsData.item] = goodsData.num}, {log = {desc = "clickTrader", int1 = block.event.id}}) | 1492 | + self:award({[goodsData.item] = goodsData.num}, {log = {desc = "clickTrader", int1 = block.event.id}}, {}) |
| 1451 | if goodsData.restrict == 1 then | 1493 | if goodsData.restrict == 1 then |
| 1452 | self.shopStatus[goodsData.goods] = (self.shopStatus[goodsData.goods] or 0) + 1 | 1494 | self.shopStatus[goodsData.goods] = (self.shopStatus[goodsData.goods] or 0) + 1 |
| 1453 | elseif goodsData.restrict == 2 then | 1495 | elseif goodsData.restrict == 2 then |
| @@ -1459,7 +1501,6 @@ local function clickTrader(self, room, block, params) | @@ -1459,7 +1501,6 @@ local function clickTrader(self, room, block, params) | ||
| 1459 | buyCount = buyCount + 1 | 1501 | buyCount = buyCount + 1 |
| 1460 | self:checkTask(Adv.TaskType.Shop, 1, block.event.id) | 1502 | self:checkTask(Adv.TaskType.Shop, 1, block.event.id) |
| 1461 | self:checkAchievement(Adv.AchievType.Shop, 1, block.event.id) | 1503 | self:checkAchievement(Adv.AchievType.Shop, 1, block.event.id) |
| 1462 | - self:backReward(reward) | ||
| 1463 | 1504 | ||
| 1464 | if (traderData.purchasetime ~= 0 and traderData.purchasetime <= buyCount) or #block.event.shop <= buyCount then | 1505 | if (traderData.purchasetime ~= 0 and traderData.purchasetime <= buyCount) or #block.event.shop <= buyCount then |
| 1465 | block:clear() | 1506 | block:clear() |
| @@ -1501,7 +1542,7 @@ local function clickClick(self, room, block, params) | @@ -1501,7 +1542,7 @@ local function clickClick(self, room, block, params) | ||
| 1501 | local item = csvdb["event_dropCsv"][dropId]["range"]:randWeight(true) | 1542 | local item = csvdb["event_dropCsv"][dropId]["range"]:randWeight(true) |
| 1502 | reward[item[1]] = (reward[item[1]] or 0) + item[2] | 1543 | reward[item[1]] = (reward[item[1]] or 0) + item[2] |
| 1503 | end | 1544 | end |
| 1504 | - self:backReward(self:award(reward, {log = {desc = "clickClick", int1 = block.event.id}}), {roomId = room.roomId, blockId = block.blockId}) | 1545 | + self:award(reward, {log = {desc = "clickClick", int1 = block.event.id}}, {roomId = room.roomId, blockId = block.blockId}) |
| 1505 | end, | 1546 | end, |
| 1506 | [3] = function() | 1547 | [3] = function() |
| 1507 | for _, buffId in ipairs(clickData.effect:toArray(true, "=")) do | 1548 | for _, buffId in ipairs(clickData.effect:toArray(true, "=")) do |
| @@ -1842,23 +1883,31 @@ end | @@ -1842,23 +1883,31 @@ end | ||
| 1842 | 1883 | ||
| 1843 | -- 地图上物品变化 | 1884 | -- 地图上物品变化 |
| 1844 | function Adv:mapItemChange(ctype) | 1885 | function Adv:mapItemChange(ctype) |
| 1886 | + local blocks = {} | ||
| 1887 | + for roomId, room in pairs(self:getCurMap().rooms) do | ||
| 1888 | + for blockId, block in pairs(room.blocks) do | ||
| 1889 | + table.insert(blocks, block) | ||
| 1890 | + end | ||
| 1891 | + end | ||
| 1892 | + self:blockDropChange(ctype, blocks) | ||
| 1893 | +end | ||
| 1894 | + | ||
| 1895 | +function Adv:blockDropChange(ctype, blocks) | ||
| 1845 | local clist = csvdb["transform_itemCsv"][ctype] | 1896 | local clist = csvdb["transform_itemCsv"][ctype] |
| 1846 | if clist then | 1897 | if clist then |
| 1847 | - for roomId, room in pairs(self:getCurMap().rooms) do | ||
| 1848 | - for blockId, block in pairs(room.blocks) do | ||
| 1849 | - if block:getEventType() == AdvEventType.Drop and block.event.item then | ||
| 1850 | - local id = block.event.item[1] | ||
| 1851 | - local count = block.event.item[2] | ||
| 1852 | - local changeTo = nil | ||
| 1853 | - if clist[id] then | ||
| 1854 | - changeTo = {clist[id].toId, math.ceil(count * clist[id].num)} | ||
| 1855 | - elseif clist[-1] then | ||
| 1856 | - changeTo = {clist[-1].toId, math.ceil(count * clist[-1].num)} | ||
| 1857 | - end | ||
| 1858 | - if changeTo and changeTo[1] ~= 0 and changeTo[2] ~= 0 then | ||
| 1859 | - block.event.item = changeTo | ||
| 1860 | - self:backBlockChange(roomId, blockId, ctype) | ||
| 1861 | - end | 1898 | + for _, block in ipairs(blocks) do |
| 1899 | + if block:getEventType() == AdvEventType.Drop and block.event.item then | ||
| 1900 | + local id = block.event.item[1] | ||
| 1901 | + local count = block.event.item[2] | ||
| 1902 | + local changeTo = nil | ||
| 1903 | + if clist[id] then | ||
| 1904 | + changeTo = {clist[id].toId, math.ceil(count * clist[id].num)} | ||
| 1905 | + elseif clist[-1] then | ||
| 1906 | + changeTo = {clist[-1].toId, math.ceil(count * clist[-1].num)} | ||
| 1907 | + end | ||
| 1908 | + if changeTo and changeTo[1] ~= 0 and changeTo[2] ~= 0 then | ||
| 1909 | + block.event.item = changeTo | ||
| 1910 | + self:backBlockChange(block.room.roomId, block.blockId, ctype) | ||
| 1862 | end | 1911 | end |
| 1863 | end | 1912 | end |
| 1864 | end | 1913 | end |
| @@ -1887,8 +1936,9 @@ function Adv:enemyDead(enemy, escape) | @@ -1887,8 +1936,9 @@ function Adv:enemyDead(enemy, escape) | ||
| 1887 | else | 1936 | else |
| 1888 | self:scoreChange(AdvScoreType.Kill, monsterData.advScore) | 1937 | self:scoreChange(AdvScoreType.Kill, monsterData.advScore) |
| 1889 | end | 1938 | end |
| 1890 | - local changeV = self.battle.player:addExp(monsterData.exp) | ||
| 1891 | - self:backDead(enemyId, changeV) | 1939 | + -- local changeV = self.battle.player:addExp(monsterData.exp) |
| 1940 | + -- self:backDead(enemyId, changeV) | ||
| 1941 | + self:backDead(enemyId) | ||
| 1892 | 1942 | ||
| 1893 | local toClick = enemy:hadBuff(Buff.CHANGE_DROP_TO_CLICK) | 1943 | local toClick = enemy:hadBuff(Buff.CHANGE_DROP_TO_CLICK) |
| 1894 | if toClick then | 1944 | if toClick then |
| @@ -1989,10 +2039,13 @@ end | @@ -1989,10 +2039,13 @@ end | ||
| 1989 | function Adv:pushBackEvent(btype, params) | 2039 | function Adv:pushBackEvent(btype, params) |
| 1990 | table.insert(self.backEvents, {btype = btype, params = params}) | 2040 | table.insert(self.backEvents, {btype = btype, params = params}) |
| 1991 | end | 2041 | end |
| 1992 | - | 2042 | +--[=[ |
| 2043 | +tag | ||
| 2044 | +1 自动拾取 | ||
| 2045 | +--]=] | ||
| 1993 | function Adv:backReward(items, params) | 2046 | function Adv:backReward(items, params) |
| 1994 | params = params or {} | 2047 | params = params or {} |
| 1995 | - self:pushBackEvent(AdvBackEventType.Reward, {items = items, roomId = params.roomId, blockId = params.blockId}) | 2048 | + self:pushBackEvent(AdvBackEventType.Reward, {items = items, roomId = params.roomId, blockId = params.blockId, tag = params.tag}) |
| 1996 | end | 2049 | end |
| 1997 | 2050 | ||
| 1998 | -- if is player enemyId is nil | 2051 | -- if is player enemyId is nil |
| @@ -2009,8 +2062,8 @@ function Adv:backBlockChange(roomId, blockId, itemChangeType) | @@ -2009,8 +2062,8 @@ function Adv:backBlockChange(roomId, blockId, itemChangeType) | ||
| 2009 | self:pushBackEvent(AdvBackEventType.BlockChange, {roomId = roomId, blockId = blockId, itemChangeType = itemChangeType}) | 2062 | self:pushBackEvent(AdvBackEventType.BlockChange, {roomId = roomId, blockId = blockId, itemChangeType = itemChangeType}) |
| 2010 | end | 2063 | end |
| 2011 | 2064 | ||
| 2012 | -function Adv:backDead(enemyId, exp) | ||
| 2013 | - self:pushBackEvent(AdvBackEventType.Dead, {enemyId = enemyId, exp = exp}) | 2065 | +function Adv:backDead(enemyId) |
| 2066 | + self:pushBackEvent(AdvBackEventType.Dead, {enemyId = enemyId}) | ||
| 2014 | end | 2067 | end |
| 2015 | 2068 | ||
| 2016 | function Adv:backTrap() | 2069 | function Adv:backTrap() |
| @@ -2033,8 +2086,12 @@ function Adv:backCost(items) | @@ -2033,8 +2086,12 @@ function Adv:backCost(items) | ||
| 2033 | self:pushBackEvent(AdvBackEventType.Cost, {items = items}) | 2086 | self:pushBackEvent(AdvBackEventType.Cost, {items = items}) |
| 2034 | end | 2087 | end |
| 2035 | 2088 | ||
| 2036 | -function Adv:backUse(items) | ||
| 2037 | - self:pushBackEvent(AdvBackEventType.Use, {items = items}) | 2089 | +--[=[ |
| 2090 | +tag | ||
| 2091 | +1 自动使用 | ||
| 2092 | +--]=] | ||
| 2093 | +function Adv:backUse(items, tag) | ||
| 2094 | + self:pushBackEvent(AdvBackEventType.Use, {items = items, tag = tag}) | ||
| 2038 | end | 2095 | end |
| 2039 | 2096 | ||
| 2040 | 2097 |
src/adv/AdvBattle.lua
| @@ -67,17 +67,17 @@ function Battle:initPlayer() | @@ -67,17 +67,17 @@ function Battle:initPlayer() | ||
| 67 | local advAddAttrs = self.adv.owner:getAdvLvAddAttrs() | 67 | local advAddAttrs = self.adv.owner:getAdvLvAddAttrs() |
| 68 | 68 | ||
| 69 | player = {} | 69 | player = {} |
| 70 | - player.level = 1 | ||
| 71 | - if self.adv.level ~= 1 then | ||
| 72 | - local relayData = self.adv:isHaveRelay() | ||
| 73 | - if relayData then | ||
| 74 | - player.level = relayData.level | ||
| 75 | - end | ||
| 76 | - end | ||
| 77 | - player.exp = 0 | 70 | + -- player.level = 1 |
| 71 | + -- if self.adv.level ~= 1 then | ||
| 72 | + -- local relayData = self.adv:isHaveRelay() | ||
| 73 | + -- if relayData then | ||
| 74 | + -- player.level = relayData.level | ||
| 75 | + -- end | ||
| 76 | + -- end | ||
| 77 | + -- player.exp = 0 | ||
| 78 | player.sp = getAdvLvAttrUp(advAddAttrs, "sp", 100) | 78 | player.sp = getAdvLvAttrUp(advAddAttrs, "sp", 100) |
| 79 | player.spMax = player.sp | 79 | player.spMax = player.sp |
| 80 | - player.growth = {} | 80 | + -- player.growth = {} |
| 81 | player.passives = {} | 81 | player.passives = {} |
| 82 | 82 | ||
| 83 | for slot, heroId in pairs(advTeam.heros) do | 83 | for slot, heroId in pairs(advTeam.heros) do |
| @@ -100,8 +100,8 @@ function Battle:initPlayer() | @@ -100,8 +100,8 @@ function Battle:initPlayer() | ||
| 100 | player[attrName] = (player[attrName] or 0) + hero[attrName] | 100 | player[attrName] = (player[attrName] or 0) + hero[attrName] |
| 101 | end | 101 | end |
| 102 | player[attrName] = getAdvLvAttrUp(advAddAttrs, attrName, player[attrName]) * (globalCsv.adv_battle_attr_ratio[attrName] or 1) | 102 | player[attrName] = getAdvLvAttrUp(advAddAttrs, attrName, player[attrName]) * (globalCsv.adv_battle_attr_ratio[attrName] or 1) |
| 103 | - player.growth[attrName] = player[attrName] * (globalCsv.adv_battle_attr_growth_ratio[attrName] or 1) | ||
| 104 | - player[attrName] = player[attrName] + player.growth[attrName] * (player.level - 1) | 103 | + -- player.growth[attrName] = player[attrName] * (globalCsv.adv_battle_attr_growth_ratio[attrName] or 1) |
| 104 | + -- player[attrName] = player[attrName] + player.growth[attrName] * (player.level - 1) | ||
| 105 | end | 105 | end |
| 106 | 106 | ||
| 107 | player.hpMax = player.hp or 0 | 107 | player.hpMax = player.hp or 0 |
src/adv/AdvBlock.lua
| @@ -48,6 +48,8 @@ function Block:updateEvent(event, isInit) | @@ -48,6 +48,8 @@ function Block:updateEvent(event, isInit) | ||
| 48 | end | 48 | end |
| 49 | end | 49 | end |
| 50 | end | 50 | end |
| 51 | + local oldet = self:getEventType() | ||
| 52 | + | ||
| 51 | self.event = event | 53 | self.event = event |
| 52 | if not isInit and self.event then | 54 | if not isInit and self.event then |
| 53 | -- 判断下类型是不是错的 | 55 | -- 判断下类型是不是错的 |
| @@ -58,18 +60,49 @@ function Block:updateEvent(event, isInit) | @@ -58,18 +60,49 @@ function Block:updateEvent(event, isInit) | ||
| 58 | end | 60 | end |
| 59 | self:randomEvent() | 61 | self:randomEvent() |
| 60 | end | 62 | end |
| 63 | + self:quickDrop() | ||
| 64 | + | ||
| 65 | + if not isInit and self.isOpen then | ||
| 66 | + local newet = self:getEventType() | ||
| 67 | + if oldet ~= newet then | ||
| 68 | + local em = {} | ||
| 69 | + if oldet then | ||
| 70 | + em[oldet] =1 | ||
| 71 | + end | ||
| 72 | + if newet then | ||
| 73 | + em[oldet] =1 | ||
| 74 | + end | ||
| 75 | + | ||
| 76 | + local player = self.room.map.adv.battle.player | ||
| 77 | + player:attrChangeCondBuffCheck(4, em) | ||
| 78 | + for _, monster in pairs(player:getTeam(2)) do | ||
| 79 | + monster:attrChangeCondBuffCheck(4, em) | ||
| 80 | + end | ||
| 81 | + end | ||
| 82 | + end | ||
| 61 | end | 83 | end |
| 62 | 84 | ||
| 63 | function Block:clear() | 85 | function Block:clear() |
| 64 | - if self:getEventType() == AdvEventType.Trap then | 86 | + local et = self:getEventType() |
| 87 | + if et == AdvEventType.Trap then | ||
| 65 | self.trapId = self.event.id | 88 | self.trapId = self.event.id |
| 66 | - elseif self:getEventType() == AdvEventType.Build then | 89 | + elseif et == AdvEventType.Build then |
| 67 | local build = self.room.map.adv.battle:getBuild(self.room.roomId, self.blockId, self.room.map.mapIdx) | 90 | local build = self.room.map.adv.battle:getBuild(self.room.roomId, self.blockId, self.room.map.mapIdx) |
| 68 | if build then | 91 | if build then |
| 69 | build.isDead = true | 92 | build.isDead = true |
| 70 | end | 93 | end |
| 71 | end | 94 | end |
| 72 | self.event = nil | 95 | self.event = nil |
| 96 | + | ||
| 97 | + | ||
| 98 | + if et then | ||
| 99 | + local em = {[et] = 1} | ||
| 100 | + local player = self.room.map.adv.battle.player | ||
| 101 | + player:attrChangeCondBuffCheck(4, em) | ||
| 102 | + for _, monster in pairs(player:getTeam(2)) do | ||
| 103 | + monster:attrChangeCondBuffCheck(4, em) | ||
| 104 | + end | ||
| 105 | + end | ||
| 73 | end | 106 | end |
| 74 | 107 | ||
| 75 | 108 | ||
| @@ -90,8 +123,10 @@ function Block:randomEvent() | @@ -90,8 +123,10 @@ function Block:randomEvent() | ||
| 90 | enemy:triggerPassive(Passive.BORN_ONCE) | 123 | enemy:triggerPassive(Passive.BORN_ONCE) |
| 91 | 124 | ||
| 92 | adv.battle.player:triggerPassive(Passive.OPEN_MONSTER, {trigger = enemy}) | 125 | adv.battle.player:triggerPassive(Passive.OPEN_MONSTER, {trigger = enemy}) |
| 126 | + adv.battle.player:attrChangeCondBuffCheck(3, enemy:getClassify()) | ||
| 93 | for _, monster in pairs(adv.battle.player:getTeam(2)) do | 127 | for _, monster in pairs(adv.battle.player:getTeam(2)) do |
| 94 | - adv.battle.player:triggerPassive(Passive.OPEN_MONSTER, {trigger = enemy}) | 128 | + monster:triggerPassive(Passive.OPEN_MONSTER, {trigger = enemy}) |
| 129 | + monster:attrChangeCondBuffCheck(3, enemy:getClassify()) | ||
| 95 | end | 130 | end |
| 96 | end | 131 | end |
| 97 | randomFunc[AdvEventType.BOSS] = randomFunc[AdvEventType.Monster] | 132 | randomFunc[AdvEventType.BOSS] = randomFunc[AdvEventType.Monster] |
| @@ -208,6 +243,13 @@ function Block:randomEvent() | @@ -208,6 +243,13 @@ function Block:randomEvent() | ||
| 208 | e:addBuff(buffId) | 243 | e:addBuff(buffId) |
| 209 | end | 244 | end |
| 210 | end | 245 | end |
| 246 | + elseif data.target == 4 then | ||
| 247 | + local enemys = self.room.map.adv:getCurMap():openBlocksIsMonsterByRoom(self.room.roomId) | ||
| 248 | + for _, e in ipairs(enemys) do | ||
| 249 | + for _, buffId in ipairs(buffs) do | ||
| 250 | + e:addBuff(buffId) | ||
| 251 | + end | ||
| 252 | + end | ||
| 211 | end | 253 | end |
| 212 | 254 | ||
| 213 | if data.specialEff ~= "" then | 255 | if data.specialEff ~= "" then |
| @@ -263,10 +305,35 @@ function Block:open() | @@ -263,10 +305,35 @@ function Block:open() | ||
| 263 | local adv = map.adv | 305 | local adv = map.adv |
| 264 | self.isOpen = true | 306 | self.isOpen = true |
| 265 | self:randomEvent() | 307 | self:randomEvent() |
| 308 | + self:quickDrop() | ||
| 309 | + | ||
| 310 | + local et = self:getEventType() | ||
| 311 | + if et then | ||
| 312 | + local em = {[et] = 1} | ||
| 313 | + local player = self.room.map.adv.battle.player | ||
| 314 | + player:attrChangeCondBuffCheck(4, em) | ||
| 315 | + for _, monster in pairs(player:getTeam(2)) do | ||
| 316 | + monster:attrChangeCondBuffCheck(4, em) | ||
| 317 | + end | ||
| 318 | + end | ||
| 266 | return true | 319 | return true |
| 267 | end | 320 | end |
| 268 | 321 | ||
| 322 | +function Block:quickDrop() | ||
| 323 | + if self:getEventType() == AdvEventType.Drop and self.event.item then | ||
| 324 | + local itemId, count = table.unpack(self.event.item) | ||
| 325 | + if globalCsv.adv_auto_collect[itemId] then | ||
| 326 | + self.room.map.adv:award({[itemId] = count}, {log = {desc = "clickDrop"}}, {roomId = self.room.roomId, blockId = self.blockId, tag = 1}) | ||
| 327 | + self:clear() | ||
| 328 | + end | ||
| 329 | + end | ||
| 330 | +end | ||
| 331 | + | ||
| 269 | function Block:getObstacle() | 332 | function Block:getObstacle() |
| 333 | + if self:isMonster() then | ||
| 334 | + local enemy = self.room.map.adv.battle:getEnemy(self.room.roomId, self.blockId) | ||
| 335 | + return enemy:getObstacle() | ||
| 336 | + end | ||
| 270 | local data = self:getEventData() | 337 | local data = self:getEventData() |
| 271 | if not data then return 0 end | 338 | if not data then return 0 end |
| 272 | return data.obstacle or 0 | 339 | return data.obstacle or 0 |
src/adv/AdvBuff.lua
| @@ -20,7 +20,7 @@ Buff.HP_CHANGE_NOW = 16 -- 生命变化(每回合生效,立刻生效) | @@ -20,7 +20,7 @@ Buff.HP_CHANGE_NOW = 16 -- 生命变化(每回合生效,立刻生效) | ||
| 20 | Buff.BATTLE_BUFF = 17 -- 切换为战斗中的buff | 20 | Buff.BATTLE_BUFF = 17 -- 切换为战斗中的buff |
| 21 | Buff.CHANGE_DROP = 18 -- 转换掉落 | 21 | Buff.CHANGE_DROP = 18 -- 转换掉落 |
| 22 | Buff.BATTLE_PASSIVE = 19 -- 切换为战斗中的被动技 | 22 | Buff.BATTLE_PASSIVE = 19 -- 切换为战斗中的被动技 |
| 23 | -Buff.EXP_ADD = 20 -- 增加exp(每回合) | 23 | +-- Buff.EXP_ADD = 20 -- 增加exp(每回合) |
| 24 | Buff.DONT_DEFEND = 21 -- 不看守地板 -- 怪周围点半可点击 | 24 | Buff.DONT_DEFEND = 21 -- 不看守地板 -- 怪周围点半可点击 |
| 25 | Buff.SHOW_DANGER = 22 -- 扫雷 展示地上怪物和陷阱数量的标记 | 25 | Buff.SHOW_DANGER = 22 -- 扫雷 展示地上怪物和陷阱数量的标记 |
| 26 | Buff.SHOW_MONSTER_POS = 23 -- 蓝臂章训练场 感知 | 26 | Buff.SHOW_MONSTER_POS = 23 -- 蓝臂章训练场 感知 |
| @@ -34,6 +34,8 @@ Buff.Buff_EFFECT_CHANGE = 30 -- 改变 buff 效果 | @@ -34,6 +34,8 @@ Buff.Buff_EFFECT_CHANGE = 30 -- 改变 buff 效果 | ||
| 34 | Buff.Buff_NO_PASSIVE_MONSTER = 31 -- 地图被动刷新不出来怪物 | 34 | Buff.Buff_NO_PASSIVE_MONSTER = 31 -- 地图被动刷新不出来怪物 |
| 35 | Buff.SNEAK = 32 --潜行 | 35 | Buff.SNEAK = 32 --潜行 |
| 36 | Buff.DROP_BUFF_BY_ENEMY = 33 -- 怪物掉落加成 -- 怪物使用 | 36 | Buff.DROP_BUFF_BY_ENEMY = 33 -- 怪物掉落加成 -- 怪物使用 |
| 37 | +Buff.GET_PASSIVE = 34 -- 获得 passive -- 结束失效 | ||
| 38 | +Buff.OBSTACLE_CHANGE = 35 -- 看守类型改变 -- 怪物使用 0 - 1 | ||
| 37 | 39 | ||
| 38 | 40 | ||
| 39 | --角色一些属性的变化 | 41 | --角色一些属性的变化 |
| @@ -87,13 +89,24 @@ local function commonAttCond(_Buff, attrName) | @@ -87,13 +89,24 @@ local function commonAttCond(_Buff, attrName) | ||
| 87 | if buff then | 89 | if buff then |
| 88 | effectCount = buff.layer | 90 | effectCount = buff.layer |
| 89 | end | 91 | end |
| 92 | + elseif self.buffData.effectValue4 == 3 then | ||
| 93 | + local classify = tonumber(self.buffData.effectValue5) -- 怪标签 | ||
| 94 | + local enemy = self.owner.battle.player:getTeam(2) | ||
| 95 | + for _, one in pairs(enemy) do | ||
| 96 | + if one.isClassify and one:isClassify(classify) then | ||
| 97 | + effectCount = effectCount + 1 | ||
| 98 | + end | ||
| 99 | + end | ||
| 100 | + elseif self.buffData.effectValue4 == 4 then | ||
| 101 | + local eventType = tonumber(self.buffData.effectValue5) -- event 类型 | ||
| 102 | + effectCount = #self.owner.battle.adv:getCurMap():getEventTypeAllMap(eventType) | ||
| 90 | end | 103 | end |
| 91 | return self.buffData.effectValue2 * effectCount | 104 | return self.buffData.effectValue2 * effectCount |
| 92 | end | 105 | end |
| 93 | 106 | ||
| 94 | _Buff.getEffectBy = function(self) | 107 | _Buff.getEffectBy = function(self) |
| 95 | local cond = nil | 108 | local cond = nil |
| 96 | - if self.buffData.effectValue4 == 2 then | 109 | + if self.buffData.effectValue4 == 2 or self.buffData.effectValue4 == 3 or self.buffData.effectValue4 == 4 then |
| 97 | cond = tonumber(self.buffData.effectValue5) | 110 | cond = tonumber(self.buffData.effectValue5) |
| 98 | end | 111 | end |
| 99 | return self.buffData.effectValue4, attrName, cond | 112 | return self.buffData.effectValue4, attrName, cond |
| @@ -302,16 +315,16 @@ local BuffFactory = { | @@ -302,16 +315,16 @@ local BuffFactory = { | ||
| 302 | end | 315 | end |
| 303 | end, | 316 | end, |
| 304 | 317 | ||
| 305 | - [Buff.EXP_ADD] = function(_Buff) | ||
| 306 | - _Buff._afterRound = function(self) | ||
| 307 | - local value = self:effect() | ||
| 308 | - self.owner.battle.player:addExp(value) | ||
| 309 | - end | ||
| 310 | - _Buff._effectValue = function(self) | ||
| 311 | - -- 经验值 | ||
| 312 | - return self.buffData.effectValue1 * self.layer | ||
| 313 | - end | ||
| 314 | - end, | 318 | + -- [Buff.EXP_ADD] = function(_Buff) |
| 319 | + -- _Buff._afterRound = function(self) | ||
| 320 | + -- local value = self:effect() | ||
| 321 | + -- self.owner.battle.player:addExp(value) | ||
| 322 | + -- end | ||
| 323 | + -- _Buff._effectValue = function(self) | ||
| 324 | + -- -- 经验值 | ||
| 325 | + -- return self.buffData.effectValue1 * self.layer | ||
| 326 | + -- end | ||
| 327 | + -- end, | ||
| 315 | 328 | ||
| 316 | [Buff.DISABLE_BUFF] = function(_Buff) | 329 | [Buff.DISABLE_BUFF] = function(_Buff) |
| 317 | _Buff._effectValue = function(self) | 330 | _Buff._effectValue = function(self) |
| @@ -378,6 +391,14 @@ local BuffFactory = { | @@ -378,6 +391,14 @@ local BuffFactory = { | ||
| 378 | self.layer = self.buffData.effectValue1 | 391 | self.layer = self.buffData.effectValue1 |
| 379 | end | 392 | end |
| 380 | end, | 393 | end, |
| 394 | + [Buff.GET_PASSIVE] = function( _Buff ) | ||
| 395 | + _Buff._init = function(self) | ||
| 396 | + self.owner:addPassive({id = self.buffData.effectValue1}) | ||
| 397 | + end | ||
| 398 | + _Buff._endBuff = function(self) | ||
| 399 | + self.owner:delPassiveById(self.buffData.effectValue1) | ||
| 400 | + end | ||
| 401 | + end | ||
| 381 | } | 402 | } |
| 382 | 403 | ||
| 383 | -- 同样的返回 effectValue1, effectValue2 * self.layer 类型的buff | 404 | -- 同样的返回 effectValue1, effectValue2 * self.layer 类型的buff |
src/adv/AdvMap.lua
| @@ -256,7 +256,7 @@ function Map:openBlock(roomId, blockId, isPlayer, ignoreBack) | @@ -256,7 +256,7 @@ function Map:openBlock(roomId, blockId, isPlayer, ignoreBack) | ||
| 256 | 256 | ||
| 257 | if status then | 257 | if status then |
| 258 | if isPlayer then | 258 | if isPlayer then |
| 259 | - self.adv.battle:triggerPassive(Passive.OPEN_BLOCK) | 259 | + self.adv.battle:triggerPassive(Passive.OPEN_BLOCK, {roomId = roomId, blockId = blockId}) |
| 260 | self.adv.owner:checkTaskEnter("AdvOpenBlock") | 260 | self.adv.owner:checkTaskEnter("AdvOpenBlock") |
| 261 | 261 | ||
| 262 | -- 潜行检查 | 262 | -- 潜行检查 |
| @@ -272,8 +272,8 @@ function Map:openBlock(roomId, blockId, isPlayer, ignoreBack) | @@ -272,8 +272,8 @@ function Map:openBlock(roomId, blockId, isPlayer, ignoreBack) | ||
| 272 | if not ignoreBack then | 272 | if not ignoreBack then |
| 273 | self.adv:backBlockChange(roomId, blockId) | 273 | self.adv:backBlockChange(roomId, blockId) |
| 274 | end | 274 | end |
| 275 | - | ||
| 276 | end | 275 | end |
| 276 | + return status | ||
| 277 | end | 277 | end |
| 278 | 278 | ||
| 279 | function Map:openBlocksBySize(roomId, blockId, size, isPlayer, ignoreBack) | 279 | function Map:openBlocksBySize(roomId, blockId, size, isPlayer, ignoreBack) |
| @@ -292,6 +292,41 @@ function Map:openBlocksByRoom(roomId, isPlayer, ignoreBack) | @@ -292,6 +292,41 @@ function Map:openBlocksByRoom(roomId, isPlayer, ignoreBack) | ||
| 292 | end | 292 | end |
| 293 | end | 293 | end |
| 294 | 294 | ||
| 295 | +function Map:openBlocksIsMonsterByRoom(roomId, count, isPlayer, ignoreBack) | ||
| 296 | + local room = self.rooms[roomId] | ||
| 297 | + if not room then return end | ||
| 298 | + | ||
| 299 | + local allBlock = {} | ||
| 300 | + for blockId, block in pairs(room.blocks) do | ||
| 301 | + if block:isMonster() and not block.isOpen then | ||
| 302 | + table.insert(allBlock, blockId) | ||
| 303 | + end | ||
| 304 | + end | ||
| 305 | + | ||
| 306 | + local enemys = {} | ||
| 307 | + local openBlock = function(blockId) | ||
| 308 | + if self:openBlock(roomId, blockId, isPlayer, ignoreBack) then | ||
| 309 | + local e = self.adv.battle:getEnemy(roomId, blockId) | ||
| 310 | + if e then | ||
| 311 | + table.insert(enemys, e) | ||
| 312 | + end | ||
| 313 | + end | ||
| 314 | + end | ||
| 315 | + | ||
| 316 | + if not count or count == -1 or count >= len(allBlock) then | ||
| 317 | + for _, blockId in ipairs(allBlock) do | ||
| 318 | + openBlock(blockId) | ||
| 319 | + end | ||
| 320 | + else | ||
| 321 | + for i = 1, count do | ||
| 322 | + local idx = math.randomInt(1, len(allBlock)) | ||
| 323 | + openBlock(allBlock[idx]) | ||
| 324 | + table.remove(allBlock, idx) | ||
| 325 | + end | ||
| 326 | + end | ||
| 327 | + return enemys | ||
| 328 | +end | ||
| 329 | + | ||
| 295 | function Map:openAllBlocks(isPlayer, ignoreBack) | 330 | function Map:openAllBlocks(isPlayer, ignoreBack) |
| 296 | for roomId, room in pairs(self.rooms) do | 331 | for roomId, room in pairs(self.rooms) do |
| 297 | self:openBlocksByRoom(room.roomId, isPlayer, ignoreBack) | 332 | self:openBlocksByRoom(room.roomId, isPlayer, ignoreBack) |
| @@ -309,6 +344,22 @@ function Map:getRBByPos(c, r) | @@ -309,6 +344,22 @@ function Map:getRBByPos(c, r) | ||
| 309 | end | 344 | end |
| 310 | end | 345 | end |
| 311 | 346 | ||
| 347 | +function Map:getDistance(froomId, fblockId, troomId, tblockId) | ||
| 348 | + local distance = -1 | ||
| 349 | + local room1 = self.rooms[froomId] | ||
| 350 | + local room2 = self.rooms[troomId] | ||
| 351 | + if room1 and room2 then | ||
| 352 | + local block1 = room1[fblockId] | ||
| 353 | + local block2 = room2[tblockId] | ||
| 354 | + if block1 and block2 then | ||
| 355 | + local c1, r1 = room1:tranLtoG(block1.col, block1.row) | ||
| 356 | + local c2, r2 = room2:tranLtoG(block2.col, block2.row) | ||
| 357 | + distance = math.max(math.abs(c1 - c2), math.abs(r1 - r2)) | ||
| 358 | + end | ||
| 359 | + end | ||
| 360 | + return distance | ||
| 361 | +end | ||
| 362 | + | ||
| 312 | function Map:getAroundBlocks(room, block) | 363 | function Map:getAroundBlocks(room, block) |
| 313 | local blocks = {} | 364 | local blocks = {} |
| 314 | local range = {1, -1} | 365 | local range = {1, -1} |
| @@ -412,6 +463,18 @@ function Map:getEnemysBySize(roomId, blockId, size) | @@ -412,6 +463,18 @@ function Map:getEnemysBySize(roomId, blockId, size) | ||
| 412 | return enemys | 463 | return enemys |
| 413 | end | 464 | end |
| 414 | 465 | ||
| 466 | +function Map:getEventTypeAllMap(eventType) | ||
| 467 | + local blocks = {} | ||
| 468 | + if not eventType then return blocks end | ||
| 469 | + for roomId, room in pairs(self.rooms) do | ||
| 470 | + for blockId, block in pairs(room.blocks) do | ||
| 471 | + if block.isOpen and block:getEventType() == eventType then | ||
| 472 | + table.insert(blocks, block) | ||
| 473 | + end | ||
| 474 | + end | ||
| 475 | + end | ||
| 476 | + return blocks | ||
| 477 | +end | ||
| 415 | -----------------------------随机地图----------------------------- | 478 | -----------------------------随机地图----------------------------- |
| 416 | 479 | ||
| 417 | -- isEnter isNewRelay 区分中继层的类型 --是否是开始进入 是否是第一次进入 | 480 | -- isEnter isNewRelay 区分中继层的类型 --是否是开始进入 是否是第一次进入 |
src/adv/AdvPassive.lua
| @@ -7,6 +7,8 @@ Filter.HP_LOW = 4 -- 血量<value% | @@ -7,6 +7,8 @@ Filter.HP_LOW = 4 -- 血量<value% | ||
| 7 | Filter.BUFF_BY_TYPE = 5 -- 指定类型buff | 7 | Filter.BUFF_BY_TYPE = 5 -- 指定类型buff |
| 8 | Filter.BUFF_BY_ID = 6 -- 指定id的buff | 8 | Filter.BUFF_BY_ID = 6 -- 指定id的buff |
| 9 | Filter.CAMP = 7 -- 玩家是指定阵营 | 9 | Filter.CAMP = 7 -- 玩家是指定阵营 |
| 10 | +Filter.RANGE = 8 -- 筛选范围 (触发是地块) | ||
| 11 | +Filter.CLASSIFY = 9 -- 标签 | ||
| 10 | 12 | ||
| 11 | local FilterFactory = {} | 13 | local FilterFactory = {} |
| 12 | FilterFactory[Filter.HP_UP_WITH_EQUAL] = function (_Filter) | 14 | FilterFactory[Filter.HP_UP_WITH_EQUAL] = function (_Filter) |
| @@ -46,6 +48,21 @@ FilterFactory[Filter.CAMP] = function (_Filter) | @@ -46,6 +48,21 @@ FilterFactory[Filter.CAMP] = function (_Filter) | ||
| 46 | end | 48 | end |
| 47 | end | 49 | end |
| 48 | 50 | ||
| 51 | +FilterFactory[Filter.RANGE] = function (_Filter) | ||
| 52 | + _Filter._execute = function (self, target, params) | ||
| 53 | + if self.owner.blockId and self.owner.roomId and params.blockId and params.roomId then | ||
| 54 | + local distance = self.owner.battle.adv:getCurMap():getDistance(self.owner.roomId, self.owner.blockId, params.roomId, params.blockId) | ||
| 55 | + return distance ~= -1 and distance <= self.value | ||
| 56 | + end | ||
| 57 | + return false | ||
| 58 | + end | ||
| 59 | +end | ||
| 60 | + | ||
| 61 | +FilterFactory[Filter.CLASSIFY] = function (_Filter) | ||
| 62 | + _Filter._execute = function (self, target) | ||
| 63 | + return target.isClassify and target:isClassify(self.value) | ||
| 64 | + end | ||
| 65 | +end | ||
| 49 | 66 | ||
| 50 | function Filter:ctor(params) | 67 | function Filter:ctor(params) |
| 51 | self.owner = params.owner | 68 | self.owner = params.owner |
| @@ -79,7 +96,7 @@ function Filter:execute(params) | @@ -79,7 +96,7 @@ function Filter:execute(params) | ||
| 79 | return | 96 | return |
| 80 | end | 97 | end |
| 81 | if self:_execute(target) then | 98 | if self:_execute(target) then |
| 82 | - return self:_execute(target) | 99 | + return self:_execute(target, params) |
| 83 | end | 100 | end |
| 84 | end | 101 | end |
| 85 | 102 | ||
| @@ -120,6 +137,7 @@ Passive.GET_BUFF = 28 --获得指定buff | @@ -120,6 +137,7 @@ Passive.GET_BUFF = 28 --获得指定buff | ||
| 120 | Passive.OPEN_BLOCK = 29 --翻开格子 | 137 | Passive.OPEN_BLOCK = 29 --翻开格子 |
| 121 | Passive.OPEN_MONSTER = 30 --翻开怪物 | 138 | Passive.OPEN_MONSTER = 30 --翻开怪物 |
| 122 | Passive.PLAYER_BUFF = 31 --玩家获得buff | 139 | Passive.PLAYER_BUFF = 31 --玩家获得buff |
| 140 | + | ||
| 123 | Passive.PLAYER_BUFF_CLASSIFY = 35 -- 获得指定标签的buff | 141 | Passive.PLAYER_BUFF_CLASSIFY = 35 -- 获得指定标签的buff |
| 124 | 142 | ||
| 125 | -- 不同的开启条件 | 143 | -- 不同的开启条件 |
| @@ -442,6 +460,7 @@ end | @@ -442,6 +460,7 @@ end | ||
| 442 | 460 | ||
| 443 | --3=翻开自己所在格子 | 461 | --3=翻开自己所在格子 |
| 444 | function Passive:effect3(value) | 462 | function Passive:effect3(value) |
| 463 | + if not self.owner.roomId or not self.owner.blockId then return end | ||
| 445 | if value == 0 then | 464 | if value == 0 then |
| 446 | self.owner.battle.adv:getCurMap():openBlock(self.owner.roomId, self.owner.blockId) | 465 | self.owner.battle.adv:getCurMap():openBlock(self.owner.roomId, self.owner.blockId) |
| 447 | elseif value > 0 then | 466 | elseif value > 0 then |
| @@ -494,7 +513,7 @@ function Passive:effect8(dropId) | @@ -494,7 +513,7 @@ function Passive:effect8(dropId) | ||
| 494 | skynet.error(string.format("CSVDATA Error adv_map_passive %s effect 8 not id %s in event_drop", self.id, dropId)) | 513 | skynet.error(string.format("CSVDATA Error adv_map_passive %s effect 8 not id %s in event_drop", self.id, dropId)) |
| 495 | end | 514 | end |
| 496 | local item = dropData["range"]:randWeight(true) | 515 | local item = dropData["range"]:randWeight(true) |
| 497 | - self.owner.battle.adv:backReward(self.owner.battle.adv:award({[item[1]] = item[2]}, {log = {desc = "passive", int1 = self.id}}), {roomId = self.owner.roomId, blockId = self.owner.blockId}) | 516 | + self.owner.battle.adv:award({[item[1]] = item[2]}, {log = {desc = "passive", int1 = self.id}}, {roomId = self.owner.roomId, blockId = self.owner.blockId}) |
| 498 | 517 | ||
| 499 | end | 518 | end |
| 500 | 519 | ||
| @@ -509,7 +528,7 @@ function Passive:effect9(itemId, triggerPms, ratio, max) | @@ -509,7 +528,7 @@ function Passive:effect9(itemId, triggerPms, ratio, max) | ||
| 509 | return | 528 | return |
| 510 | end | 529 | end |
| 511 | if not cond then return end | 530 | if not cond then return end |
| 512 | - self.owner.battle.adv:backReward(self.owner.battle.adv:award({[itemId] = math.floor(math.max(0, math.min(max, cond / ratio)))}, {log = {desc = "passive", int1 = self.id}}), {roomId = self.owner.roomId, blockId = self.owner.blockId}) | 531 | + self.owner.battle.adv:award({[itemId] = math.floor(math.max(0, math.min(max, cond / ratio)))}, {log = {desc = "passive", int1 = self.id}}, {roomId = self.owner.roomId, blockId = self.owner.blockId}) |
| 513 | end | 532 | end |
| 514 | 533 | ||
| 515 | --10=战斗额外掉落次数 | 534 | --10=战斗额外掉落次数 |
| @@ -561,5 +580,22 @@ function Passive:effect14(value, triggerPms, enemyId) | @@ -561,5 +580,22 @@ function Passive:effect14(value, triggerPms, enemyId) | ||
| 561 | end | 580 | end |
| 562 | end | 581 | end |
| 563 | 582 | ||
| 583 | +--15=翻开房间内的count 个怪 并且增加一个buff | ||
| 584 | +function Passive:effect15(count, triggerPms, buffId) | ||
| 585 | + local roomId = self.owner.roomId | ||
| 586 | + if not roomId then return end | ||
| 587 | + local enemys = self.owner.battle.adv:getCurMap():openBlocksIsMonsterByRoom(roomId, count) | ||
| 588 | + for _, e in ipairs(enemys) do | ||
| 589 | + e:addBuff(buffId) | ||
| 590 | + end | ||
| 591 | +end | ||
| 592 | + | ||
| 593 | +--16=转变 value 范围内的掉落物 为 id count | ||
| 594 | +function Passive:effect16(value, triggerPms, changeType) | ||
| 595 | + if not self.owner.roomId or not self.owner.blockId then return end | ||
| 596 | + local blocks = self.owner.battle.adv:getCurMap():getBlocksBySize(self.owner.roomId, self.owner.blockId, value) | ||
| 597 | + self.owner.battle.adv:blockDropChange(changeType, blocks) | ||
| 598 | +end | ||
| 599 | + | ||
| 564 | 600 | ||
| 565 | return Passive | 601 | return Passive |
| 566 | \ No newline at end of file | 602 | \ No newline at end of file |
src/adv/AdvPlayer.lua
| @@ -90,6 +90,12 @@ end | @@ -90,6 +90,12 @@ end | ||
| 90 | function BaseObject:clear() | 90 | function BaseObject:clear() |
| 91 | self.buffs = {} | 91 | self.buffs = {} |
| 92 | self.passives = {} | 92 | self.passives = {} |
| 93 | + if self:is("Enemy") then | ||
| 94 | + self.battle.player:attrChangeCondBuffCheck(3, self:getClassify()) | ||
| 95 | + for _, monster in pairs(self.battle.player:getTeam(2)) do | ||
| 96 | + monster:attrChangeCondBuffCheck(3, self:getClassify()) | ||
| 97 | + end | ||
| 98 | + end | ||
| 93 | end | 99 | end |
| 94 | 100 | ||
| 95 | function BaseObject:addPassive(params) | 101 | function BaseObject:addPassive(params) |
| @@ -165,6 +171,7 @@ function BaseObject:addBuff(buffId, releaser) | @@ -165,6 +171,7 @@ function BaseObject:addBuff(buffId, releaser) | ||
| 165 | end | 171 | end |
| 166 | self:triggerPassive(Passive.GET_BUFF, {trigger = releaser, buffId = buffId}) | 172 | self:triggerPassive(Passive.GET_BUFF, {trigger = releaser, buffId = buffId}) |
| 167 | self:triggerPassive(Passive.PLAYER_BUFF_CLASSIFY, {trigger = releaser, classify = buffData.classify}) | 173 | self:triggerPassive(Passive.PLAYER_BUFF_CLASSIFY, {trigger = releaser, classify = buffData.classify}) |
| 174 | + self:attrChangeCondBuffCheck(2, buffId) | ||
| 168 | return true | 175 | return true |
| 169 | end | 176 | end |
| 170 | 177 | ||
| @@ -417,7 +424,7 @@ function BaseObject:hurt(value, releaser, params) | @@ -417,7 +424,7 @@ function BaseObject:hurt(value, releaser, params) | ||
| 417 | if self.hp == 0 then | 424 | if self.hp == 0 then |
| 418 | self:triggerPassive(Passive.SELF_DEAD) | 425 | self:triggerPassive(Passive.SELF_DEAD) |
| 419 | for _, team in ipairs(self:getTeam(1, true)) do | 426 | for _, team in ipairs(self:getTeam(1, true)) do |
| 420 | - team:triggerPassive(Passive.TEAM_DEAD) | 427 | + team:triggerPassive(Passive.TEAM_DEAD, {trigger = self}) |
| 421 | end | 428 | end |
| 422 | 429 | ||
| 423 | if (params.hurtType == 6 or params.hurtType == 2) and self ~= self.battle.player then | 430 | if (params.hurtType == 6 or params.hurtType == 2) and self ~= self.battle.player then |
| @@ -505,6 +512,50 @@ function BaseObject:getTeam(nType, noSelf, mapIdx, includeLock) | @@ -505,6 +512,50 @@ function BaseObject:getTeam(nType, noSelf, mapIdx, includeLock) | ||
| 505 | return team | 512 | return team |
| 506 | end | 513 | end |
| 507 | 514 | ||
| 515 | +function BaseObject:attrChangeCondBuffCheck(etype, cond) | ||
| 516 | + local effect = {} | ||
| 517 | + if etype == 3 then | ||
| 518 | + if type(cond) ~= "string" then | ||
| 519 | + return | ||
| 520 | + end | ||
| 521 | + local temp = cond:toArray(true, " ") | ||
| 522 | + cond = {} | ||
| 523 | + for _, one in pairs(temp) do | ||
| 524 | + cond[one] = 1 | ||
| 525 | + end | ||
| 526 | + elseif etype == 4 then | ||
| 527 | + if not cond then | ||
| 528 | + cond = {} | ||
| 529 | + end | ||
| 530 | + if type(cond) == "number" then | ||
| 531 | + cond = {[cond] = 1} | ||
| 532 | + end | ||
| 533 | + end | ||
| 534 | + for _, buff in ipairs(self.buffs) do | ||
| 535 | + if not buff:isHide() and (buff:getType() == Buff.ATTR_CHANGE_COND) then | ||
| 536 | + local _et, _attr, _co = buff:getEffectBy() | ||
| 537 | + if etype == _et then | ||
| 538 | + if etype == 3 or etype == 4 then | ||
| 539 | + if cond[_co] then | ||
| 540 | + effect[_attr] = 1 | ||
| 541 | + end | ||
| 542 | + else | ||
| 543 | + if (not _co or _co == cond) then | ||
| 544 | + effect[_attr] = 1 | ||
| 545 | + end | ||
| 546 | + end | ||
| 547 | + end | ||
| 548 | + end | ||
| 549 | + end | ||
| 550 | + for attrName, _ in pairs(effect) do | ||
| 551 | + if attrName == "hp" then | ||
| 552 | + self:reSetHpMax() | ||
| 553 | + else | ||
| 554 | + self:reSetAttr(attrName) | ||
| 555 | + end | ||
| 556 | + end | ||
| 557 | +end | ||
| 558 | + | ||
| 508 | function BaseObject:getDB() | 559 | function BaseObject:getDB() |
| 509 | local db = {} | 560 | local db = {} |
| 510 | db.hp = self.hp | 561 | db.hp = self.hp |
| @@ -557,6 +608,24 @@ function Enemy:isEnemy() | @@ -557,6 +608,24 @@ function Enemy:isEnemy() | ||
| 557 | return true | 608 | return true |
| 558 | end | 609 | end |
| 559 | 610 | ||
| 611 | +function Enemy:getObstacle() | ||
| 612 | + local obstacle = csvdb["event_monsterCsv"][self.monsterId].obstacle | ||
| 613 | + if obstacle == 0 and self:hadBuff(Buff.OBSTACLE_CHANGE) then | ||
| 614 | + obstacle = 1 | ||
| 615 | + end | ||
| 616 | + return obstacle | ||
| 617 | +end | ||
| 618 | + | ||
| 619 | +function Enemy:isClassify(check) | ||
| 620 | + local classify = self:getClassify() | ||
| 621 | + return classify and classify:sismember(check, " ") | ||
| 622 | +end | ||
| 623 | + | ||
| 624 | +function Enemy:getClassify() | ||
| 625 | + return csvdb["event_monsterCsv"][self.monsterId].classify | ||
| 626 | +end | ||
| 627 | + | ||
| 628 | + | ||
| 560 | function Enemy:kill() | 629 | function Enemy:kill() |
| 561 | self:hurt(self.hp, self.battle.player, {hurtType = 5}) | 630 | self:hurt(self.hp, self.battle.player, {hurtType = 5}) |
| 562 | end | 631 | end |
| @@ -569,44 +638,44 @@ end | @@ -569,44 +638,44 @@ end | ||
| 569 | 638 | ||
| 570 | function Player:initData(data) | 639 | function Player:initData(data) |
| 571 | Player.super.initData(self, data) | 640 | Player.super.initData(self, data) |
| 572 | - self.level = data.level or 1 --level 每增加1级 属性增长 growth * baseAttr | 641 | + -- self.level = data.level or 1 --level 每增加1级 属性增长 growth * baseAttr |
| 573 | self.growth = data.growth | 642 | self.growth = data.growth |
| 574 | - self.exp = data.exp or 0 | 643 | + -- self.exp = data.exp or 0 |
| 575 | self.sp = data.sp or 100 | 644 | self.sp = data.sp or 100 |
| 576 | self.spMax = data.spMax or 100 | 645 | self.spMax = data.spMax or 100 |
| 577 | self._spMax = data._spMax or 100 | 646 | self._spMax = data._spMax or 100 |
| 578 | end | 647 | end |
| 579 | 648 | ||
| 580 | -function Player:addExp(value) | ||
| 581 | - -- buff 经验加成 | ||
| 582 | - local up = self:getCommonBuffEffect(Buff.EXP_UP) | ||
| 583 | - value = math.ceil((value + up[0]) * (1 + up[1])) | ||
| 584 | - | ||
| 585 | - if value <= 0 then return end | ||
| 586 | - local newExp = self.exp + value | ||
| 587 | - local level = self.level | ||
| 588 | - if level >= #csvdb["adv_levelCsv"] then return end | ||
| 589 | - while true do | ||
| 590 | - local curData = csvdb["adv_levelCsv"][level] | ||
| 591 | - if newExp < curData.exp then break end | ||
| 592 | - level = level + 1 | ||
| 593 | - newExp = newExp - curData.exp | ||
| 594 | - if level >= #csvdb["adv_levelCsv"] then break end | ||
| 595 | - end | ||
| 596 | - local delta = level - self.level | ||
| 597 | - | ||
| 598 | - self.battle.adv:pushBackEvent(AdvBackEventType.Exp, {delta = value}) | ||
| 599 | - | ||
| 600 | - if delta > 0 then | ||
| 601 | - for attr, _ in pairs(AdvAttsEnum) do | ||
| 602 | - self:addBaseAttr(attr, self.growth[attr] * delta, 0, true) | ||
| 603 | - end | ||
| 604 | - self.battle.adv:pushBackEvent(AdvBackEventType.Level, {level = level, delta = delta}) | ||
| 605 | - end | ||
| 606 | - self.level = level | ||
| 607 | - self.exp = newExp | ||
| 608 | - return value | ||
| 609 | -end | 649 | +-- function Player:addExp(value) |
| 650 | +-- -- buff 经验加成 | ||
| 651 | +-- local up = self:getCommonBuffEffect(Buff.EXP_UP) | ||
| 652 | +-- value = math.ceil((value + up[0]) * (1 + up[1])) | ||
| 653 | + | ||
| 654 | +-- if value <= 0 then return end | ||
| 655 | +-- local newExp = self.exp + value | ||
| 656 | +-- local level = self.level | ||
| 657 | +-- if level >= #csvdb["adv_levelCsv"] then return end | ||
| 658 | +-- while true do | ||
| 659 | +-- local curData = csvdb["adv_levelCsv"][level] | ||
| 660 | +-- if newExp < curData.exp then break end | ||
| 661 | +-- level = level + 1 | ||
| 662 | +-- newExp = newExp - curData.exp | ||
| 663 | +-- if level >= #csvdb["adv_levelCsv"] then break end | ||
| 664 | +-- end | ||
| 665 | +-- local delta = level - self.level | ||
| 666 | + | ||
| 667 | +-- self.battle.adv:pushBackEvent(AdvBackEventType.Exp, {delta = value}) | ||
| 668 | + | ||
| 669 | +-- if delta > 0 then | ||
| 670 | +-- for attr, _ in pairs(AdvAttsEnum) do | ||
| 671 | +-- self:addBaseAttr(attr, self.growth[attr] * delta, 0, true) | ||
| 672 | +-- end | ||
| 673 | +-- self.battle.adv:pushBackEvent(AdvBackEventType.Level, {level = level, delta = delta}) | ||
| 674 | +-- end | ||
| 675 | +-- self.level = level | ||
| 676 | +-- self.exp = newExp | ||
| 677 | +-- return value | ||
| 678 | +-- end | ||
| 610 | --vtype 0/1 值/% | 679 | --vtype 0/1 值/% |
| 611 | function Player:addBaseAttr(attr, value, vtype, ignoreBack) | 680 | function Player:addBaseAttr(attr, value, vtype, ignoreBack) |
| 612 | local attrName = attr | 681 | local attrName = attr |
| @@ -696,7 +765,6 @@ end | @@ -696,7 +765,6 @@ end | ||
| 696 | function Player:addBuff(buffId, releaser) | 765 | function Player:addBuff(buffId, releaser) |
| 697 | local status = Player.super.addBuff(self, buffId, releaser) | 766 | local status = Player.super.addBuff(self, buffId, releaser) |
| 698 | if status then | 767 | if status then |
| 699 | - self.battle.player:attrChangeCondBuffCheck(2, buffId) | ||
| 700 | self.battle.adv:checkAchievement(self.battle.adv.AchievType.GetBuff, 1, buffId) | 768 | self.battle.adv:checkAchievement(self.battle.adv.AchievType.GetBuff, 1, buffId) |
| 701 | self.battle.adv:pushBackEvent(AdvBackEventType.Buff, {buffId = buffId}) | 769 | self.battle.adv:pushBackEvent(AdvBackEventType.Buff, {buffId = buffId}) |
| 702 | self.battle:triggerPassive(Passive.PLAYER_BUFF, {buffId = buffId}) | 770 | self.battle:triggerPassive(Passive.PLAYER_BUFF, {buffId = buffId}) |
| @@ -708,33 +776,14 @@ function Player:addBuff(buffId, releaser) | @@ -708,33 +776,14 @@ function Player:addBuff(buffId, releaser) | ||
| 708 | return status | 776 | return status |
| 709 | end | 777 | end |
| 710 | 778 | ||
| 711 | -function Player:attrChangeCondBuffCheck(etype, cond) | ||
| 712 | - local effect = {} | ||
| 713 | - for _, buff in ipairs(self.buffs) do | ||
| 714 | - if not buff:isHide() and (buff:getType() == Buff.ATTR_CHANGE_COND) then | ||
| 715 | - local _et, _attr, _co = buff:getEffectBy() | ||
| 716 | - if etype == _et and (not _co or _co == cond) then | ||
| 717 | - effect[_attr] = 1 | ||
| 718 | - end | ||
| 719 | - | ||
| 720 | - end | ||
| 721 | - end | ||
| 722 | - for attrName, _ in pairs(effect) do | ||
| 723 | - if attrName == "hp" then | ||
| 724 | - self:reSetHpMax() | ||
| 725 | - else | ||
| 726 | - self:reSetAttr(attrName) | ||
| 727 | - end | ||
| 728 | - end | ||
| 729 | -end | ||
| 730 | - | ||
| 731 | function Player:isPlayer() | 779 | function Player:isPlayer() |
| 732 | return true | 780 | return true |
| 733 | end | 781 | end |
| 734 | 782 | ||
| 735 | function Player:getDB() | 783 | function Player:getDB() |
| 736 | local db = Player.super.getDB(self) | 784 | local db = Player.super.getDB(self) |
| 737 | - for _ , field in pairs({"level", "exp", "growth", "sp", "spMax"}) do | 785 | + -- for _ , field in pairs({"level", "exp", "growth", "sp", "spMax"}) do |
| 786 | + for _ , field in pairs({"level", "growth", "sp", "spMax"}) do | ||
| 738 | db[field] = self[field] | 787 | db[field] = self[field] |
| 739 | end | 788 | end |
| 740 | db["_spMax"] = self._spMax | 789 | db["_spMax"] = self._spMax |
src/models/HeroPlugin.lua
| @@ -247,6 +247,37 @@ function HeroPlugin.bind(Hero) | @@ -247,6 +247,37 @@ function HeroPlugin.bind(Hero) | ||
| 247 | return level | 247 | return level |
| 248 | end | 248 | end |
| 249 | 249 | ||
| 250 | + -- 天赋获得的技能 | ||
| 251 | + function Hero:getTalentSkill() | ||
| 252 | + local TalentEnum = { | ||
| 253 | + [1] = 1, -- 血量 | ||
| 254 | + [2] = 2, -- 攻击 | ||
| 255 | + [3] = 3, -- 物理防御 | ||
| 256 | + [4] = 4, -- 命中 | ||
| 257 | + [5] = 5, -- 闪避 | ||
| 258 | + } | ||
| 259 | + local talentCsv = csvdb["unit_talent_" .. self:getProperty("type") .. "Csv"] | ||
| 260 | + local curLv = self:getProperty("talent"):getv(1,1) - 1 | ||
| 261 | + local curRan = self:getProperty("talent"):getv(0,1) | ||
| 262 | + local skills = {} | ||
| 263 | + for ran, data in ipairs(talentCsv) do | ||
| 264 | + if ran <= curRan then | ||
| 265 | + for lv, value in ipairs(data) do | ||
| 266 | + if ran < curRan or lv <= curLv then | ||
| 267 | + if not TalentEnum[value.effect] then | ||
| 268 | + skills[value.strength] = true | ||
| 269 | + end | ||
| 270 | + else | ||
| 271 | + break | ||
| 272 | + end | ||
| 273 | + end | ||
| 274 | + else | ||
| 275 | + break | ||
| 276 | + end | ||
| 277 | + end | ||
| 278 | + return skills | ||
| 279 | + end | ||
| 280 | + | ||
| 250 | function Hero:getSkillData(idx) | 281 | function Hero:getSkillData(idx) |
| 251 | local unitData = csvdb["unitCsv"][self:getProperty("type")] | 282 | local unitData = csvdb["unitCsv"][self:getProperty("type")] |
| 252 | if idx == 1 then | 283 | if idx == 1 then |
src/models/RolePlugin.lua
| @@ -64,6 +64,9 @@ function RolePlugin.bind(Role) | @@ -64,6 +64,9 @@ function RolePlugin.bind(Role) | ||
| 64 | [ItemId.PlayerExp] = function() | 64 | [ItemId.PlayerExp] = function() |
| 65 | self:addPlayExp(count, pms) | 65 | self:addPlayExp(count, pms) |
| 66 | end, | 66 | end, |
| 67 | + [ItemId.AdvPower] = function() | ||
| 68 | + self:changeAdvCount(-count) | ||
| 69 | + end, | ||
| 67 | } | 70 | } |
| 68 | 71 | ||
| 69 | local itemTypeAward = { | 72 | local itemTypeAward = { |
| @@ -1280,6 +1283,7 @@ function RolePlugin.bind(Role) | @@ -1280,6 +1283,7 @@ function RolePlugin.bind(Role) | ||
| 1280 | info.specialLevel = hero:getSkillLevel(1) | 1283 | info.specialLevel = hero:getSkillLevel(1) |
| 1281 | info.passiveLevel = hero:getSkillLevel(3) | 1284 | info.passiveLevel = hero:getSkillLevel(3) |
| 1282 | info.runeSkill = hero:getRuneSkill(102) | 1285 | info.runeSkill = hero:getRuneSkill(102) |
| 1286 | + info.talentSkills = hero:getTalentSkill() | ||
| 1283 | teamInfo.heros[slot] = info | 1287 | teamInfo.heros[slot] = info |
| 1284 | end | 1288 | end |
| 1285 | for slot, id in pairs(team.supports or {}) do | 1289 | for slot, id in pairs(team.supports or {}) do |