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,15 +852,15 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | ||
| 852 | return true | 852 | return true |
| 853 | end, | 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 | return true | 857 | return true |
| 858 | end | 858 | end |
| 859 | end, | 859 | end, |
| 860 | -- xx角色(todo 队长) | 860 | -- xx角色(todo 队长) |
| 861 | - [2] = function() | 861 | + [2] = function(_, leaderType) |
| 862 | local hero = self.owner.heros[self.owner:getProperty("advTeam").leader] | 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 | return true | 864 | return true |
| 865 | end | 865 | end |
| 866 | end, | 866 | end, |
| @@ -876,37 +876,43 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | @@ -876,37 +876,43 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | ||
| 876 | return true | 876 | return true |
| 877 | end, | 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 | return true | 881 | return true |
| 882 | end | 882 | end |
| 883 | end, | 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 | return true | 888 | return true |
| 889 | end | 889 | end |
| 890 | end, | 890 | end, |
| 891 | -- sp 到达指定值 | 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 | return true | 894 | return true |
| 895 | end | 895 | end |
| 896 | end, | 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 | return true | 901 | return true |
| 901 | end | 902 | end |
| 902 | end, | 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 | assert(not cond[1] or checkCond[cond[1]], "error cond, event_" .. (tag or "choose") .. "Csv id :" .. block.event.id) | 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 | local clearBlock = chooseData.keep ~= 1 | 916 | local clearBlock = chooseData.keep ~= 1 |
| 911 | local effects = chooseData["button".. choose .."effect"]:toTableArray(true) | 917 | local effects = chooseData["button".. choose .."effect"]:toTableArray(true) |
| 912 | for _, effect in ipairs(effects) do | 918 | for _, effect in ipairs(effects) do |