下面这个教程里的LUA好像和真正的看破差距挺大,似乎不能无懈对自己的顺,拆,铁索,更不能无懈对别人的锦囊,有什么解决办法吗?
askedtmp={}
kanpoex=sgs.CreateViewAsSkill{
name="kanpoex",
n=1,
view_filter=function(self, selected,
to_select)
return to_select:isRed()
end,
view_as=function(self, cards)
if #cards==1 then
local
acard=sgs.Sanguosha:cloneCard(askedtmp[1],cards[1]:getSuit(),cards[1]:getNumber())
acard:addSubcard(cards[1])
acard:setSkillName(self:objectName())
return acard
end
end,
enabled_at_play=function()
return false
end,
enabled_at_response=function(self,player,pattern)
if #askedtmp==1 then table.remove(askedtmp) end
table.insert(askedtmp,pattern)
return not player:isKongcheng() and( pattern=="slash" or pattern=="jink" or pattern=="peach")
end}
askedtmp={}
kanpoex=sgs.CreateViewAsSkill{
name="kanpoex",
n=1,
view_filter=function(self, selected,
to_select)
return to_select:isRed()
end,
view_as=function(self, cards)
if #cards==1 then
local
acard=sgs.Sanguosha:cloneCard(askedtmp[1],cards[1]:getSuit(),cards[1]:getNumber())
acard:addSubcard(cards[1])
acard:setSkillName(self:objectName())
return acard
end
end,
enabled_at_play=function()
return false
end,
enabled_at_response=function(self,player,pattern)
if #askedtmp==1 then table.remove(askedtmp) end
table.insert(askedtmp,pattern)
return not player:isKongcheng() and( pattern=="slash" or pattern=="jink" or pattern=="peach")
end}