Commit fbf0f1a5 authored by oilloillo's avatar oilloillo

优化选择顺序,先选融合卡1/2对应的素材都可以

parent 53a54248
......@@ -54,6 +54,13 @@ function M.fmatcheck2(c, fc, mg)
and mg:IsExists(M.gridcheck, 1, nil, fc, c)
end
function M.fmatcheck3(c, fc1, fc2, mg)
if not mg or mg:GetCount() == 0 then return false end
return c:IsAbleToGrave() and
((M.CheckMaterialSingle(c, fc1) and mg:IsExists(M.gridcheck, 1, nil, fc1, c)) or
(M.CheckMaterialSingle(c, fc2) and mg:IsExists(M.gridcheck, 1, nil, fc2, c)))
end
function M.gridcheck(c, fc, c2)
local tp = fc:GetControler()
return Duel.GetLocationCountFromEx(tp, tp, Group.FromCards(c, c2), fc) > 0
......@@ -108,24 +115,34 @@ function M.lkop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.ConfirmCards(1-tp, Group.FromCards(fc1, fc2))
--
-- 排除原先matg1中的不可用素材
matg1 = Duel.GetMatchingGroup(M.fmatcheck2, tp, LOCATION_HAND+LOCATION_MZONE, 0, nil, fc1, matg2)
-- 首次选择
-- 排除原先matg1/matg2中的不可用素材
local sMatg1 = Duel.GetMatchingGroup(M.fmatcheck2, tp, LOCATION_HAND+LOCATION_MZONE, 0, nil, fc1, matg2)
local sMatg2 = Duel.GetMatchingGroup(M.fmatcheck2, tp, LOCATION_HAND+LOCATION_MZONE, 0, nil, fc2, matg1)
-- 对两组素材中共有的卡进行处理
local same = matg1:Filter(M.samefilter, nil, matg2)
if same:GetCount() == 1 then
same = same:GetFirst()
if matg2:GetCount() == 1 then
matg1:RemoveCard(same)
elseif matg1:GetCount() == 1 then
matg2:RemoveCard(same)
end
end
local same = sMatg1:Filter(M.samefilter, nil, sMatg2)
local all = sMatg1:Clone()
all:Merge(sMatg2)
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_LMATERIAL)
local dis1 = matg1:Select(tp, 1, 1, nil)
local dis2 = matg2:FilterSelect(tp, M.fmatcheck2, 1, 1, dis1:GetFirst(), fc2, dis1)
local dis1 = all:Select(tp, 1, 1, nil)
-- 第二次选择
local mat1 = dis1:GetFirst()
local dis2
if same:IsContains(mat1) then
all = matg1:Clone()
all:Merge(matg2)
dis2 = all:FilterSelect(tp, M.fmatcheck3, 1, 1, mat1, fc1, fc2, dis1)
else
if sMatg1:IsContains(mat1) then
dis2 = matg2:FilterSelect(tp, M.fmatcheck2, 1, 1, mat1, fc2, dis1)
else
dis2 = matg1:FilterSelect(tp, M.fmatcheck2, 1, 1, mat1, fc1, dis1)
end
end
--
dis1:Merge(dis2)
c:SetMaterial(dis1)
......
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