--Varia-Force Fire Protector function c249000768.initial_effect(c) c:EnableReviveLimit() --special summon procedure 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(c249000768.spcon) e1:SetOperation(c249000768.spop) c:RegisterEffect(e1) --Attribute Light local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetCode(EFFECT_ADD_ATTRIBUTE) e2:SetRange(LOCATION_MZONE) e2:SetValue(ATTRIBUTE_LIGHT) c:RegisterEffect(e2) --to hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(38495396,0)) e3:SetCategory(CATEGORY_TOHAND) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,2490007681) e3:SetCost(c249000768.thcost) e3:SetTarget(c249000768.thtg) e3:SetOperation(c249000768.thop) c:RegisterEffect(e3) --spsummon local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_LEAVE_FIELD) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e4:SetCountLimit(1,2490007682) e4:SetCondition(c249000768.spcon2) e4:SetTarget(c249000768.sptg2) e4:SetOperation(c249000768.spop2) c:RegisterEffect(e4) end function c249000768.spfilter(c) return c:IsSetCard(0x1B6) and c:IsAbleToDeckAsCost() and c:IsType(TYPE_MONSTER) end function c249000768.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c249000768.spfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,2,nil) end function c249000768.spop(e,tp,eg,ep,ev,re,r,rp,c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,c249000768.spfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,2,2,nil) Duel.SendtoDeck(g,nil,2,REASON_COST) end function c249000768.costfilter(c) return c:IsSetCard(0x1B6) and c:IsAbleToRemoveAsCost() end function c249000768.costfilter2(c,e) return c:IsSetCard(0x1B6) and not c:IsPublic() end function c249000768.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return (Duel.IsExistingMatchingCard(c249000768.costfilter,tp,LOCATION_GRAVE,0,1,nil) or Duel.IsExistingMatchingCard(c249000768.costfilter2,tp,LOCATION_HAND,0,1,nil)) end local option if Duel.IsExistingMatchingCard(c249000768.costfilter2,tp,LOCATION_HAND,0,1,nil) then option=0 end if Duel.IsExistingMatchingCard(c249000768.costfilter,tp,LOCATION_GRAVE,0,1,nil) then option=1 end if Duel.IsExistingMatchingCard(c249000768.costfilter,tp,LOCATION_GRAVE,0,1,nil) and Duel.IsExistingMatchingCard(c249000768.costfilter2,tp,LOCATION_HAND,0,1,nil) then option=Duel.SelectOption(tp,526,1102) end if option==0 then g=Duel.SelectMatchingCard(tp,c249000768.costfilter2,tp,LOCATION_HAND,0,1,1,nil,e) Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) end if option==1 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,c249000768.costfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end end function c249000768.thfilter(c) return c:IsType(TYPE_MONSTER) and c:IsAbleToHand() end function c249000768.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE+LOCATION_GRAVE) and c249000768.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(c249000768.thfilter,tp,LOCATION_MZONE+LOCATION_GRAVE,LOCATION_MZONE+LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,c249000768.thfilter,tp,LOCATION_MZONE+LOCATION_GRAVE,LOCATION_MZONE+LOCATION_GRAVE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) if Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,0,nil) < Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD,nil) and Duel.IsExistingTarget(c249000768.thfilter,tp,0,LOCATION_ONFIELD,1,g:GetFirst()) and Duel.SelectYesNo(tp,aux.Stringid(1347977,0)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g2=Duel.SelectTarget(tp,c249000768.thfilter,tp,0,LOCATION_ONFIELD,1,1,g:GetFirst()) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g2,1,0,0) end end function c249000768.thop(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.SendtoHand(g,nil,REASON_EFFECT) end end function c249000768.spcon2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousPosition(POS_FACEUP) and not c:IsLocation(LOCATION_DECK) end function c249000768.spfilter2(c,e,tp) return c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c249000768.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c249000768.spfilter2,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function c249000768.spop2(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,c249000768.spfilter2,tp,LOCATION_HAND,0,1,1,nil,e,tp) local tc=g:GetFirst() if tc then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end