Commit f789318d authored by 未闻皂名's avatar 未闻皂名

2024/5/16 调整魔人扫描器为可以取消

parent d9920d2f
Pipeline #27161 passed with stages
in 7 minutes and 23 seconds
...@@ -134,26 +134,48 @@ end ...@@ -134,26 +134,48 @@ end
-- 让玩家选择卡片组的 min ~ max 张卡,可以取消 -- 让玩家选择卡片组的 min ~ max 张卡,可以取消
function RushDuel.SelectGroup(player, group, min, max) function RushDuel.SelectGroup(player, group, min, max)
local sg = Group.CreateGroup() local sg = Group.CreateGroup()
local finish = (#sg >= min and #sg <= max) local finish = (#sg >= min and #sg <= max)
while #sg < max do while #sg < max do
local cg = group:Clone() local cg = group:Clone()
cg:Sub(sg) cg:Sub(sg)
finish = (#sg >= min and #sg <= max) finish = (#sg >= min and #sg <= max)
if #cg == 0 then break end if #cg == 0 then
local cancel = not finish break
local tc = cg:SelectUnselect(sg, player, finish, cancel, min, max) end
if not tc then break end local cancel = not finish
local tc = cg:SelectUnselect(sg, player, finish, cancel, min, max)
if not tc then
break
end
if not sg:IsContains(tc) then if not sg:IsContains(tc) then
sg:AddCard(tc) sg:AddCard(tc)
if #sg == max then finish = true end if #sg == max then
finish = true
end
else else
sg:RemoveCard(tc) sg:RemoveCard(tc)
end end
end end
if finish then if finish then
return sg return sg
else else
return nil return nil
end end
end
-- 让玩家可以选择卡片组的 min ~ max 张卡
function RushDuel.CanSelectGroup(player, desc, hint, group, min, max)
::cancel::
if Duel.SelectYesNo(player, desc) then
Duel.Hint(HINT_SELECTMSG, player, hint)
local sg = RushDuel.SelectGroup(player, group, min, max)
if sg == nil then
goto cancel
else
return sg
end
else
return nil
end
end end
...@@ -33,14 +33,15 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -33,14 +33,15 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.ConfirmDecktop(1-tp,4) Duel.ConfirmDecktop(1-tp,4)
local mg=g3:Filter(cm.filter,nil) local mg=g3:Filter(cm.filter,nil)
local draw=false local draw=false
if mg:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(m,1)) then if mg:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local sg=RD.CanSelectGroup(tp,aux.Stringid(m,1),HINTMSG_TOGRAVE,mg,1,2)
local sg=mg:Select(tp,1,2,nil) if sg then
Duel.DisableShuffleCheck() Duel.DisableShuffleCheck()
if Duel.SendtoGrave(sg,REASON_EFFECT)~=0 then if Duel.SendtoGrave(sg,REASON_EFFECT)~=0 then
if RD.IsOperatedGroupExists(cm.exfilter,1,nil) then draw=true end draw=RD.IsOperatedGroupExists(cm.exfilter,1,nil)
g1:Sub(sg) g1:Sub(sg)
g2:Sub(sg) g2:Sub(sg)
end
end end
end end
Duel.SortDecktop(tp,tp,g1:GetCount()) Duel.SortDecktop(tp,tp,g1:GetCount())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment