--Mecha Blade Blood Queen local m=88880111 local cm=_G["c"..m] function cm.initial_effect(c) c:SetUniqueOnField(1,0,m) --xyz summon aux.AddXyzProcedure(c,cm.mfilter,4,2,cm.ovfilter,aux.Stringid(m,0),2,cm.xyzop) c:EnableReviveLimit() --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(m,0)) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(cm.atccon) e1:SetTarget(cm.target) e1:SetOperation(cm.operation) c:RegisterEffect(e1) if not cm.global_check then cm.global_check=true local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_SUMMON_SUCCESS) ge1:SetOperation(cm.checkop) Duel.RegisterEffect(ge1,0) local ge2=ge1:Clone() ge2:SetCode(EVENT_SPSUMMON_SUCCESS) Duel.RegisterEffect(ge2,0) end --spsummon local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(m,1)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e4:SetCode(EVENT_TO_GRAVE) e4:SetCondition(cm.spcon) e4:SetTarget(cm.sptg) e4:SetOperation(cm.spop) c:RegisterEffect(e4) end function cm.checkop(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() while tc do Duel.RegisterFlagEffect(tc:GetSummonPlayer(),m,RESET_PHASE+PHASE_END,0,1) tc=eg:GetNext() end end function cm.atccon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFlagEffect(1-tp,m)>=5 and (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) end function cm.mfilter(c) return c:IsSetCard(0xffd) end function cm.ovfilter(c) return c:IsFaceup() and ((c:IsType(TYPE_XYZ) and c:GetOverlayGroup():IsExists(Card.IsCode,1,nil,88880005)) or (c:IsCode(88880006) and c:GetOverlayGroup():GetCount()>0)) end function cm.xyzop(e,tp,chk,mc) if chk==0 then return mc:CheckRemoveOverlayCard(tp,1,REASON_COST) end mc:RemoveOverlayCard(tp,1,1,REASON_COST) end function cm.filter(c) return c:IsCanOverlay() end function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and cm.filter(chkc) and chkc~=e:GetHandler() end if chk==0 then return e:GetHandler():IsType(TYPE_XYZ) and Duel.IsExistingTarget(cm.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) Duel.SelectTarget(tp,cm.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,e:GetHandler()) end function cm.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then local og=tc:GetOverlayGroup() if og:GetCount()>0 then Duel.SendtoGrave(og,REASON_RULE) end Duel.Overlay(c,Group.FromCards(tc)) end end function cm.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetOverlayCount()>0 end function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function cm.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,1,tp,tp,false,false,POS_FACEUP) end end