Commit cddc1cde authored by POLYMER's avatar POLYMER

fix

parent 81d0643c
......@@ -98,6 +98,7 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e0:SetRange(LOCATION_MZONE)
e0:SetValue(0x442)
e0:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e0,true)
end
end
......
......@@ -97,6 +97,7 @@ function cm.ActivateCard(c,tp,oe)
end
end
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return ph~=PHASE_DAMAGE and ph~=PHASE_DAMAGE_CAL and e:GetHandler():IsReason(REASON_EFFECT)
......@@ -117,13 +118,43 @@ end
function cm.slfilter(c,sc,lv)
return c:GetSynchroLevel(sc)==lv
end
--function Auxiliary.SynMixCheckRecursive(c,tp,sg,mg,ct,minc,maxc,syncard,sg1,smat,gc,mgchk)
-- local eg=mg:Clone()
-- local tempg=mg-sg
-- for c in aux.Next(tempg) do
-- if eg:IsContains(c) then
-- sg:AddCard(c)
-- ct=ct+1
-- if Auxiliary.SynMixCheckGoal(tp,sg,minc,ct,syncard,sg1,smat,gc,mgchk) or (ct<maxc and Auxiliary.SynMixCheckRecursive(c,tp,sg,eg,ct,minc,maxc,syncard,sg1,smat,gc,mgchk)) then return true end
-- sg:RemoveCard(c)
-- ct=ct-1
--eg:RemoveCard(c)
-- eg:Sub(eg:Filter(cm.slfilter,nil,syncard,c:GetSynchroLevel(syncard)))
-- end
-- end
-- return false
--end
function Auxiliary.SynMixFilter4(c,f4,minc,maxc,syncard,mg1,smat,c1,c2,c3,gc,mgchk)
cm.fparams={f4,c1,c2,c3}
if f4 and not f4(c,syncard,c1,c2,c3) then return false end
local sg=Group.FromCards(c1,c)
sg:AddCard(c1)
if c2 then sg:AddCard(c2) end
if c3 then sg:AddCard(c3) end
local mg=mg1:Clone()
if f4 then
mg=mg:Filter(f4,sg,syncard,c1,c2,c3)
else
mg:Sub(sg)
end
return Auxiliary.SynMixCheck(mg,sg,minc-1,maxc-1,syncard,smat,gc,mgchk)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(cm.symfil,tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_MZONE,0,nil,e)
if chk==0 then
cm.SubGroupParams={nil,Card.GetLevel,nil,false,true}
--local res=Group.CheckSubGroup(g,cm.symgck,1,3,e,tp)
local res=cm.SelectSubGroup(g,tp,cm.symgck,false,1,3,e,tp)
local res=Group.SelectSubGroup(g,tp,cm.symgck,false,1,3,e,tp)
cm.SubGroupParams={}
return res
end
......@@ -132,7 +163,7 @@ end
function cm.espfil3(c,g,e,tp)
cm.SubGroupParams={nil,Card.GetLevel,nil,false,true}
--local res=Group.CheckSubGroup(g,cm.symgck,1,3,e,tp)
local res=cm.SelectSubGroup(g,tp,cm.espfilr,false,1,3,e,tp,c)
local res=Group.SelectSubGroup(g,tp,cm.espfilr,false,1,3,e,tp,c)
cm.SubGroupParams={}
return res
--return c:IsSynchroSummonable(nil,g)
......@@ -147,7 +178,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(cm.symfil,tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_MZONE,0,nil,e)
local tc=Duel.SelectMatchingCard(tp,cm.espfil3,tp,LOCATION_EXTRA,0,1,1,nil,g,e,tp):GetFirst()
cm.SubGroupParams={function(c,sc) return c:GetSynchroLevel(tc)==sc:GetSynchroLevel(tc) and (not cm.fparams or (cm.fparams[1](c,tc,table.unpack(cm.fparams,2))==cm.fparams[1](sc,tc,table.unpack(cm.fparams,2)))) end,Card.GetLevel,nil,false}
local mat1=cm.SelectSubGroup(g,tp,cm.espfil2,false,1,3,tc)
local mat1=g:SelectSubGroup(tp,cm.espfil2,false,1,3,tc)
cm.SubGroupParams={}
cm.fparams=nil
if mat1:IsExists(function(c) return c:IsLocation(LOCATION_MZONE) and c:IsFacedown() or c:IsLocation(LOCATION_HAND) end,1,nil) then
......@@ -173,37 +204,10 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
tc:CompleteProcedure()
end
function cm.thfilter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and (c:IsSetCard(0x181) or aux.IsCodeListed(c,56099748)) and c:IsFaceup() and c:IsSSetable()
end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingTarget(aux.NecroValleyFilter(cm.thfilter),tp,LOCATION_REMOVED+LOCATION_GRAVE,0,1,nil) end
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.SelectTarget(tp,aux.NecroValleyFilter(cm.thfilter),tp,LOCATION_REMOVED+LOCATION_GRAVE,0,1,1,nil)
local tc=g:GetFirst()
if tc and Duel.SSet(tp,tc)~=0 then
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,1))
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN)
e1:SetCondition(cm.setcon)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
end
end
function cm.fit1(c)
return c:IsType(TYPE_FUSION) and c:IsSetCard(0x181)
end
function cm.setcon(e,c)
local tp=e:GetHandlerPlayer()
return Duel.IsExistingMatchingCard(cm.fit1,tp,LOCATION_MZONE,0,1,nil)
end
--subgroup optimization
function cm.SelectSubGroup(g,tp,f,cancelable,min,max,...)
function Group.SelectSubGroup(g,tp,f,cancelable,min,max,...)
--classif: function to classify cards, e.g. function(c,tc) return c:GetLevel()==tc:GetLevel() end
--sortif: function of subgroup search order, high to low. e.g. Card.GetLevel
--passf: cards that do not require check, e.g. function(c) return c:IsLevel(1) end
......
......@@ -14,15 +14,16 @@ function s.initial_effect(c)
local e2=e1:Clone()
e2:SetCode(EVENT_SUMMON_SUCCESS)
c:RegisterEffect(e2)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,id+100)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCountLimit(1,id+100)
e3:SetCondition(s.con)
e3:SetTarget(s.target)
e3:SetOperation(s.activate)
c:RegisterEffect(e3)
end
s.fusion_effect=true
function s.exconfilter(c)
......@@ -131,6 +132,9 @@ end
function s.thfilter(c)
return ( c:IsSetCard(0x181)) and c:IsAbleToHand() and c:IsType(TYPE_SPELL+TYPE_TRAP)
end
function s.con(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_EFFECT)
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
......
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