--Cielodorato Dianaceleste - Naviam la Guida Temporale --Scripted by: XGlitchy30 local cid,id=GetID() function cid.initial_effect(c) c:EnableReviveLimit() aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_WARRIOR),2,2,cid.lcheck) --retrieve local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_REMOVE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_HANDES) e1:SetTarget(cid.target) e1:SetOperation(cid.operation) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCondition(cid.thcon) c:RegisterEffect(e2) --fusion summon local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,id) e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) e3:SetCost(cid.rmcost) e3:SetTarget(cid.rmtg) e3:SetOperation(cid.rmop) c:RegisterEffect(e3) end function cid.lcheck(g,lc) return g:IsExists(Card.IsSetCard,1,nil,0x528) or g:IsExists(Card.IsSetCard,1,nil,0x223) or g:IsExists(Card.IsSetCard,1,nil,0x2a7) or g:IsExists(Card.IsSetCard,1,nil,0xd0a1) end function cid.mfilter2(c) return (c:IsSetCard(0x528) or c:IsSetCard(0x223)) and c:IsAbleToHand() end function cid.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingTarget(cid.mfilter2,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,aux.NecroValleyFilter(cid.mfilter2),tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1) end function cid.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then if Duel.SendtoHand(tc,nil,REASON_EFFECT)>0 then Duel.ConfirmCards(1-tp,Group.FromCards(tc)) Duel.DiscardHand(tp,aux.TRUE,1,1,REASON_EFFECT+REASON_DISCARD) end end end function cid.thcon(e,tp,eg,ep,ev,re,r,rp) return bit.band(e:GetHandler():GetSummonType(),SUMMON_TYPE_LINK)>0 end --fusion filters function cid.filter0(c,e) return not c:IsImmuneToEffect(e) end function cid.filter1(c,e) return c:IsCanBeFusionMaterial() and e:GetHandler():GetLinkedGroup():IsContains(c) end function cid.filter2(c,e,tp,m,f,chkf) return c:IsType(TYPE_FUSION) and c:IsRace(RACE_WARRIOR) and (not f or f(c)) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf) end function cid.fcheck(tp,sg,fc) return sg:FilterCount(Card.IsControler,nil,1-tp)<=1 end function cid.gcheck(tp) return function (sg) return sg:FilterCount(Card.IsControler,nil,1-tp)<=1 end end -------- function cid.rmfil(c) return c:IsSetCard(0x223) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost() end function cid.rmcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.rmfil,tp,LOCATION_EXTRA,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,cid.rmfil,tp,LOCATION_EXTRA,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function cid.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local chkf=tp local mg1=Duel.GetFusionMaterial(tp) local mg2=Duel.GetMatchingGroup(cid.filter1,tp,0,LOCATION_MZONE,nil,e) if mg2:GetCount()>0 then mg1:Merge(mg2) Auxiliary.FCheckAdditional=cid.fcheck Auxiliary.GCheckAdditional=cid.gcheck(tp) end local res=Duel.IsExistingMatchingCard(cid.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf) Auxiliary.FCheckAdditional=nil Auxiliary.GCheckAdditional=nil if not res then local ce=Duel.GetChainMaterial(tp) if ce~=nil then local fgroup=ce:GetTarget() local mg3=fgroup(ce,e,tp) local mf=ce:GetValue() res=Duel.IsExistingMatchingCard(cid.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg3,mf,chkf) end end return res end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function cid.rmop(e,tp,eg,ep,ev,re,r,rp) local chkf=tp local mg1=Duel.GetFusionMaterial(tp):Filter(cid.filter0,nil,e) local exmat=false local mg2=Duel.GetMatchingGroup(cid.filter1,tp,0,LOCATION_MZONE,nil,e):Filter(cid.filter0,nil,e) if mg2:GetCount()>0 then mg1:Merge(mg2) exmat=true end if exmat then Auxiliary.FCheckAdditional=cid.fcheck Auxiliary.GCheckAdditional=cid.gcheck(tp) end local sg1=Duel.GetMatchingGroup(cid.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf) Auxiliary.FCheckAdditional=nil Auxiliary.GCheckAdditional=nil local mg3=nil local sg2=nil local ce=Duel.GetChainMaterial(tp) if ce~=nil then local fgroup=ce:GetTarget() mg3=fgroup(ce,e,tp) local mf=ce:GetValue() sg2=Duel.GetMatchingGroup(cid.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg3,mf,chkf) end if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then local sg=sg1:Clone() if sg2 then sg:Merge(sg2) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tg=sg:Select(tp,1,1,nil) local tc=tg:GetFirst() mg1:RemoveCard(tc) if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then if exmat then Auxiliary.FCheckAdditional=cid.fcheck Auxiliary.GCheckAdditional=cid.gcheck(tp) end local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf) Auxiliary.FCheckAdditional=nil Auxiliary.GCheckAdditional=nil tc:SetMaterial(mat1) Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION) Duel.BreakEffect() Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP) else local mat2=Duel.SelectFusionMaterial(tp,tc,mg3,nil,chkf) local fop=ce:GetOperation() fop(ce,e,tp,tc,mat2) end tc:CompleteProcedure() end end