--Hellstrain Gate function c212030.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetTarget(c212030.target) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EVENT_LEAVE_FIELD_P) e2:SetOperation(c212030.checkop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e3:SetCode(EVENT_LEAVE_FIELD) e3:SetOperation(c212030.desop) e3:SetLabelObject(e2) c:RegisterEffect(e3) --atkup local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetRange(LOCATION_SZONE) e4:SetTargetRange(LOCATION_MZONE,0) e4:SetCode(EFFECT_UPDATE_ATTACK) e4:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x22f)) e4:SetValue(200) c:RegisterEffect(e4) --to deck local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(212030,0)) e5:SetCategory(CATEGORY_TODECK) e5:SetType(EFFECT_TYPE_QUICK_O) e5:SetProperty(EFFECT_FLAG_CARD_TARGET) e5:SetRange(LOCATION_GRAVE) e5:SetCode(EVENT_FREE_CHAIN) e5:SetCost(aux.bfgcost) e5:SetTarget(c212030.tdtg) e5:SetOperation(c212030.tdop) c:RegisterEffect(e5) end function c212030.spfilter(c,e,tp) return c:IsSetCard(0x22f) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c212030.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c212030.spfilter(chkc,e,tp) end if chk==0 then return true end if Duel.IsExistingTarget(c212030.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.SelectYesNo(tp,aux.Stringid(212030,0)) then e:SetCategory(CATEGORY_SPECIAL_SUMMON) e:SetProperty(EFFECT_FLAG_CARD_TARGET) e:SetOperation(c212030.activate) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c212030.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) else e:SetCategory(0) e:SetProperty(0) e:SetOperation(nil) end end function c212030.activate(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 Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then c:SetCardTarget(tc) Duel.SpecialSummonComplete() end end function c212030.checkop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsDisabled() then e:SetLabel(1) else e:SetLabel(0) end end function c212030.desop(e,tp,eg,ep,ev,re,r,rp) if e:GetLabelObject():GetLabel()~=0 then return end local tc=e:GetHandler():GetFirstCardTarget() if tc and tc:IsLocation(LOCATION_MZONE) then Duel.Destroy(tc,REASON_EFFECT) end end function c212030.tdfilter(c) return c:IsFaceup() and c:IsSetCard(0x22f) and c:IsAbleToDeck() end function c212030.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c212030.tdfilter(chkc) and chkc~=e:GetHandler() end if chk==0 then return Duel.IsExistingTarget(c212030.tdfilter,tp,LOCATION_GRAVE,0,1,e:GetHandler()) and not e:GetHandler():IsStatus(STATUS_CHAINING) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,c212030.tdfilter,tp,LOCATION_GRAVE,0,1,3,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0) end function c212030.tdop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e) if g:GetCount()>0 then Duel.SendtoDeck(g,nil,2,REASON_EFFECT) end end