--Xyz-Gemini Maiden function c249000370.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(c249000370.spcon) c:RegisterEffect(e1) --material local e2=Effect.CreateEffect(c) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCost(aux.bfgcost) e2:SetTarget(c249000370.target) e2:SetOperation(c249000370.operation) c:RegisterEffect(e2) --to hand local e2=Effect.CreateEffect(c) e2:SetDescription(506) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCountLimit(1,249000370) e2:SetCondition(c249000370.condition) e2:SetTarget(c249000370.target2) e2:SetOperation(c249000370.operation2) c:RegisterEffect(e2) end function c249000370.spfilter(c) return c:IsFaceup() and c:IsSetCard(0x6073) and c:GetCode()~=249000370 end function c249000370.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c249000370.spfilter,c:GetControler(),LOCATION_MZONE,0,1,nil) end function c249000370.filter1(c) return c:IsFaceup() and c:IsType(TYPE_XYZ) end function c249000370.filter2(c) return c:IsSetCard(0x6073) end function c249000370.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(c249000370.filter1,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingTarget(c249000370.filter2,tp,LOCATION_GRAVE,0,1,e:GetHandler()) end local g1=Duel.SelectTarget(tp,c249000370.filter1,tp,LOCATION_MZONE,0,1,1,nil) e:SetLabelObject(g1:GetFirst()) local g2=Duel.SelectTarget(tp,c249000370.filter2,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g2,1,0,0) end function c249000370.operation(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:IsImmuneToEffect(e) then return end local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,tc,e) if g:GetCount()>0 then Duel.Overlay(tc,g) end end function c249000370.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD) > Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,0) end function c249000370.filter(c) return c:IsSetCard(0x73) and c:IsAbleToHand() end function c249000370.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:GetControler()==tp and chkc:GetLocation()==LOCATION_GRAVE and c249000370.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c249000370.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,c249000370.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function c249000370.operation2(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end