本屌爪机党无电脑,求好心人测试纠正!
--[[
技能名:突袭
相关武将:1v1·张辽1v1
描述:摸牌阶段,若你的手牌数小于对手的手牌数,你可以少摸一张牌并你获得对手的一张手牌。
]]--
LuaKOFTuxi = sgs.CreateDrawCardsSkill
name = "LuaKOFTuxi",
draw_num_func = function(self,player,n)
local room = player:getRoom()
local can_invoke = false
local targets = sgs.SPlayerList()
for _,p in sgs.qlist(room:getOtherPlayers(player)) do
if p:getHandcardNum() > player:getHandcardNum() then
targets:append(p)
end
end
if not targets:isEmpty() then
can_invoke = true
end
if can_invoke then
local target = room:askForPlayerChosen(player, targets, self:objectName(), "koftuxi-invoke", true, true)
if (target) then
target:setFlags("LuaKOFTuxiTarget")
player:setFlags("Luakoftuxi")
return n - 1
else
return n
end
else
return n
end
end
}
LuaKOFTuxiAct = sgs.CreateTriggerSkill{
name = "#Luakoftuxi",
events = {sgs.AfterDrawNCards},
on_trigger = function(self, event, player, data)
if not player:hasFlag("Luakoftuxi") then
return false
end
player:setFlags("-Luakoftuxi")
local target = nil
for _,p in sgs.qlist(room:getOtherPlayers(player)) do
if p:hasFlag("LuaKOFTuxiTarget") then
p:setFlags("-LuaKOFTuxiTarget")
target = p
break
end
end
if not target then return false end
local card_id = room:askForCardChosen(player, target, "h", "koftuxi")
local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_EXTRACTION, self:objectName())
room:obtainCard(player, sgs.Sanguosha:getCard(card_id), reason, false)
end,
can_trigger = function(self, target)
return target ~= nil
end
}
--[[
技能名:突袭
相关武将:1v1·张辽1v1
描述:摸牌阶段,若你的手牌数小于对手的手牌数,你可以少摸一张牌并你获得对手的一张手牌。
]]--
LuaKOFTuxi = sgs.CreateDrawCardsSkill
name = "LuaKOFTuxi",
draw_num_func = function(self,player,n)
local room = player:getRoom()
local can_invoke = false
local targets = sgs.SPlayerList()
for _,p in sgs.qlist(room:getOtherPlayers(player)) do
if p:getHandcardNum() > player:getHandcardNum() then
targets:append(p)
end
end
if not targets:isEmpty() then
can_invoke = true
end
if can_invoke then
local target = room:askForPlayerChosen(player, targets, self:objectName(), "koftuxi-invoke", true, true)
if (target) then
target:setFlags("LuaKOFTuxiTarget")
player:setFlags("Luakoftuxi")
return n - 1
else
return n
end
else
return n
end
end
}
LuaKOFTuxiAct = sgs.CreateTriggerSkill{
name = "#Luakoftuxi",
events = {sgs.AfterDrawNCards},
on_trigger = function(self, event, player, data)
if not player:hasFlag("Luakoftuxi") then
return false
end
player:setFlags("-Luakoftuxi")
local target = nil
for _,p in sgs.qlist(room:getOtherPlayers(player)) do
if p:hasFlag("LuaKOFTuxiTarget") then
p:setFlags("-LuaKOFTuxiTarget")
target = p
break
end
end
if not target then return false end
local card_id = room:askForCardChosen(player, target, "h", "koftuxi")
local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_EXTRACTION, self:objectName())
room:obtainCard(player, sgs.Sanguosha:getCard(card_id), reason, false)
end,
can_trigger = function(self, target)
return target ~= nil
end
}