Commit 1229c24d0b4d65e25f720083109f540c64d2ecd2
1 parent
59701355
新加选择条件
Showing
1 changed file
with
24 additions
and
18 deletions
Show diff stats
src/adv/Adv.lua
... | ... | @@ -852,15 +852,15 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) |
852 | 852 | return true |
853 | 853 | end, |
854 | 854 | -- 拥有道具 |
855 | - [1] = function() | |
856 | - if self:cost({[cond[2]] = cond[3]}, {}, true) then | |
855 | + [1] = function(_, itemId, count) | |
856 | + if self:cost({[itemId] = count}, {}, true) then | |
857 | 857 | return true |
858 | 858 | end |
859 | 859 | end, |
860 | 860 | -- xx角色(todo 队长) |
861 | - [2] = function() | |
861 | + [2] = function(_, leaderType) | |
862 | 862 | local hero = self.owner.heros[self.owner:getProperty("advTeam").leader] |
863 | - if hero and hero:getProperty("type") == cond[2] then | |
863 | + if hero and hero:getProperty("type") == leaderType then | |
864 | 864 | return true |
865 | 865 | end |
866 | 866 | end, |
... | ... | @@ -876,37 +876,43 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) |
876 | 876 | return true |
877 | 877 | end, |
878 | 878 | --制定属性 |
879 | - [4] = function() | |
880 | - if (self.battle.player[AttsEnumEx[cond[2]]] or 0) >= cond[3] then | |
879 | + [4] = function(_, attrType, value) | |
880 | + if (self.battle.player[AttsEnumEx[attrType]] or 0) >= value then | |
881 | 881 | return true |
882 | 882 | end |
883 | 883 | end, |
884 | 884 | -- 提交一个物品 |
885 | - [5] = function () | |
886 | - if self:cost({[cond[2]] = cond[3]}, {}) then | |
887 | - self:backCost({[cond[2]] = cond[3]}) | |
885 | + [5] = function (_, itemId, count) | |
886 | + if self:cost({[itemId] = count}, {}) then | |
887 | + self:backCost({[itemId] = count}) | |
888 | 888 | return true |
889 | 889 | end |
890 | 890 | end, |
891 | 891 | -- sp 到达指定值 |
892 | - [6] = function() | |
893 | - if self.battle.player.sp >= cond[2] then | |
892 | + [6] = function(_, value) | |
893 | + if self.battle.player.sp >= value then | |
894 | 894 | return true |
895 | 895 | end |
896 | 896 | end, |
897 | - [7] = function() | |
898 | - local buff = self.battle.player:getBuffById(cond[2]) | |
899 | - if buff and buff:getLayer() >= cond[3] then | |
897 | + --7=拥有指定buff指定层数 | |
898 | + [7] = function(_, buffId, layer) | |
899 | + local buff = self.battle.player:getBuffById(buffId) | |
900 | + if buff and buff:getLayer() >= layer then | |
900 | 901 | return true |
901 | 902 | end |
902 | 903 | end, |
903 | - [8] = function() | |
904 | - return self:isHaveArtifact(cond[2]) | |
905 | - end | |
904 | + --8=拥有x神器 | |
905 | + [8] = function(_, artifactId) | |
906 | + return self:isHaveArtifact(artifactId) | |
907 | + end, | |
908 | + -- 9 = 生命值大于x% | |
909 | + [9] = function (_, value) | |
910 | + return self.battle.player.hp / self.battle.player.hpMax * 100 > value | |
911 | + end, | |
906 | 912 | } |
907 | 913 | assert(not cond[1] or checkCond[cond[1]], "error cond, event_" .. (tag or "choose") .. "Csv id :" .. block.event.id) |
908 | 914 | |
909 | - if cond[1] and not checkCond[cond[1]]() then return end | |
915 | + if cond[1] and not checkCond[cond[1]](table.unpack(cond)) then return end | |
910 | 916 | local clearBlock = chooseData.keep ~= 1 |
911 | 917 | local effects = chooseData["button".. choose .."effect"]:toTableArray(true) |
912 | 918 | for _, effect in ipairs(effects) do | ... | ... |