From 1229c24d0b4d65e25f720083109f540c64d2ecd2 Mon Sep 17 00:00:00 2001 From: zhouhaihai Date: Thu, 5 Mar 2020 17:04:44 +0800 Subject: [PATCH] 新加选择条件 --- src/adv/Adv.lua | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/src/adv/Adv.lua b/src/adv/Adv.lua index 01372e1..c686c8c 100644 --- a/src/adv/Adv.lua +++ b/src/adv/Adv.lua @@ -852,15 +852,15 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) return true end, -- 拥有道具 - [1] = function() - if self:cost({[cond[2]] = cond[3]}, {}, true) then + [1] = function(_, itemId, count) + if self:cost({[itemId] = count}, {}, true) then return true end end, -- xx角色(todo 队长) - [2] = function() + [2] = function(_, leaderType) local hero = self.owner.heros[self.owner:getProperty("advTeam").leader] - if hero and hero:getProperty("type") == cond[2] then + if hero and hero:getProperty("type") == leaderType then return true end end, @@ -876,37 +876,43 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) return true end, --制定属性 - [4] = function() - if (self.battle.player[AttsEnumEx[cond[2]]] or 0) >= cond[3] then + [4] = function(_, attrType, value) + if (self.battle.player[AttsEnumEx[attrType]] or 0) >= value then return true end end, -- 提交一个物品 - [5] = function () - if self:cost({[cond[2]] = cond[3]}, {}) then - self:backCost({[cond[2]] = cond[3]}) + [5] = function (_, itemId, count) + if self:cost({[itemId] = count}, {}) then + self:backCost({[itemId] = count}) return true end end, -- sp 到达指定值 - [6] = function() - if self.battle.player.sp >= cond[2] then + [6] = function(_, value) + if self.battle.player.sp >= value then return true end end, - [7] = function() - local buff = self.battle.player:getBuffById(cond[2]) - if buff and buff:getLayer() >= cond[3] then + --7=拥有指定buff指定层数 + [7] = function(_, buffId, layer) + local buff = self.battle.player:getBuffById(buffId) + if buff and buff:getLayer() >= layer then return true end end, - [8] = function() - return self:isHaveArtifact(cond[2]) - end + --8=拥有x神器 + [8] = function(_, artifactId) + return self:isHaveArtifact(artifactId) + end, + -- 9 = 生命值大于x% + [9] = function (_, value) + return self.battle.player.hp / self.battle.player.hpMax * 100 > value + end, } assert(not cond[1] or checkCond[cond[1]], "error cond, event_" .. (tag or "choose") .. "Csv id :" .. block.event.id) - if cond[1] and not checkCond[cond[1]]() then return end + if cond[1] and not checkCond[cond[1]](table.unpack(cond)) then return end local clearBlock = chooseData.keep ~= 1 local effects = chooseData["button".. choose .."effect"]:toTableArray(true) for _, effect in ipairs(effects) do -- libgit2 0.21.2