还有一个更坑的
@女王受·虫 @doublebit @Fsu0413
技能:你可以将一张手牌当作一张锦囊牌使用。
local objectNames_list = {}
for id = 0,(sgs.Sanguosha:getCardCount() - 1),1 do
local card = sgs.Sanguosha:getEngineCard(id)
if card:isKindOf("TrickCard") then
if not table.contains(objectNames_list,card:objectName()) then
table.insert(objectNames_list,card:objectName())
end
end
end
local getPos = function(table,value)
for i,va in ipairs (table) do
if va == value then return i end
end
return -1 --Just An Error Signal
end
local target_fixed_card_objectName_list = {}
local not_target_fixed_card_objectName_list = {}
for _,name in ipairs(objectNames_list) do
local card = sgs.Sanguosha:cloneCard(name)
card:deleteLater()
if card:targetFixed() then
table.insert(target_fixed_card_objectName_list,name)
else
table.insert(not_target_fixed_card_objectName_list,name)
end
end
table.insert(not_target_fixed_card_objectName_list,"cancel")
sgs.LuaTrick_Dummy_Case = {}
for i,_ in ipairs(not_target_fixed_card_objectName_list)do
sgs.LuaTrick_Dummy_Case[i] = false
end
LuaTrick_Dummy = sgs.CreateSkillCard{
name = "LuaTrick_Dummy",
target_fixed = false,
will_throw = true,
filter = function(self, targets, to_select)
local qtargets = sgs.PlayerList()
for _, p in ipairs(targets) do
qtargets:append(p)
end
local LuaTrick_Dummy_Case_Filter = {}
for _,name in ipairs(not_target_fixed_card_objectName_list) do
if name ~= "cancel" then
local card = sgs.Sanguosha:cloneCard(name)
card:deleteLater()
table.insert(LuaTrick_Dummy_Case_Filter,card:targetFilter(qtargets,to_select,sgs.Self))
end
end
return (getPos(LuaTrick_Dummy_Case_Filter,true) ~= -1) or #targets == 0
end,
feasible = function(self, targets)
for i,_ in ipairs(not_target_fixed_card_objectName_list)do
sgs.LuaTrick_Dummy_Case[i] = false
end
local qtargets = sgs.PlayerList()
for _, p in ipairs(targets) do
qtargets:append(p)
end
for _,name in ipairs(not_target_fixed_card_objectName_list) do
if name ~= "cancel" then
local card = sgs.Sanguosha:cloneCard(name)
card:deleteLater()
table.insert(sgs.LuaTrick_Dummy_Case,card:targetsFeasible(qtargets,sgs.Self))
end
end
return (getPos(sgs.LuaTrick_Dummy_Case,true) ~= -1) or #targets == 0
end,
on_validate = function(self,carduse)
if carduse.to:length() > 0 then
local source = carduse.from
local room = source:getRoom()
local choose_list = {}
local i = 1
for _,bool in ipairs(sgs.LuaTrick_Dummy_Case) do
if bool then
table.insert(choose_list,not_target_fixed_card_objectName_list[i])
end
i = i + 1
end
table.insert(choose_list,"cancel")
local choice = room:askForChoice(source,self:objectName(),table.concat(choose_list,"+"))
if choice ~= "cancel" then
local aCard = sgs.Sanguosha:cloneCard(choice)
aCard:setSkillName(self:objectName())
aCard:addSubcard(self)
return aCard
end
else
local source = carduse.from
local room = source:getRoom()
local choice = room:askForChoice(source,self:objectName(),table.concat(target_fixed_card_objectName_list,"+"))
if choice ~= "cancel" then
local aCard = sgs.Sanguosha:cloneCard(choice)
aCard:setSkillName(self:objectName())
aCard:addSubcard(self)
return aCard
end
end
return nil
end,
}
这个技能卡貌似有点问题啊,只选择一个目标不好使的说,而且退出之后还会卡一会。