Commit 07f319c0 authored by wyykak's avatar wyykak
parents fbcb8fde 71cf2514
Pipeline #8676 passed with stage
in 1 minute and 20 seconds
......@@ -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)
......@@ -219,7 +236,8 @@ function M.spop(e,tp,eg,ep,ev,re,r,rp)
local tg = sg:Select(tp, 1, 1, nil)
local tc = tg:GetFirst()
if sg1:IsContains(tc) and (sg3 == nil or not sg3:IsContains(tc) or not Duel.SelectYesNo(tp, ce:GetDescription())) then
if tc:IsRace(RACE_PLANT) and sg2:IsContains(tc) and Duel.SelectYesNo(tp, aux.Stringid(Mid, 3)) then
local noNeedAsk = not tc:CheckFusionMaterial(mg1)
if tc:IsRace(RACE_PLANT) and sg2:IsContains(tc) and (noNeedAsk or Duel.SelectYesNo(tp, aux.Stringid(Mid, 3))) then
local mat1 = Duel.SelectFusionMaterial(tp, tc, mg2, c, chkf)
tc:SetMaterial(mat1)
Duel.ConfirmCards(1-tp, mat1)
......
......@@ -9,6 +9,7 @@ function M.initial_effect(c)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(M.tg)
e1:SetOperation(M.op)
e1:SetCountLimit(1, Mid)
c:RegisterEffect(e1)
end
......
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