--created & coded by Lyris, art by Ellysiumn of DeviantArt --機氷竜バリアー local s,id,o=GetID() function s.initial_effect(c) aux.AddCodeList(c,id-5) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_IMMUNE_EFFECT) e2:SetRange(LOCATION_FZONE) e2:SetValue(s.efilter) e2:SetLabelObject(c) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT) e3:SetRange(LOCATION_SZONE) e3:SetTargetRange(LOCATION_FZONE,0) e3:SetTarget(aux.TargetBoolFunction(Card.IsCode,id-5)) e3:SetLabelObject(e2) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetCode(EVENT_FREE_CHAIN) e4:SetRange(LOCATION_GRAVE) e4:SetCountLimit(1,id) e4:SetCondition(aux.exccon) e4:SetCost(aux.bfgcost) e4:SetTarget(s.target) e4:SetOperation(s.operation) c:RegisterEffect(e4) if not s.global_check then s.global_check=true s[0]={} s[1]={} local race=1 while race0 then local rc=1 while rc0 then return false end local tp=sump if targetp then tp=targetp end return s[tp][c:GetRace()] and s[tp][c:GetRace()]>1 end function s.filter(c,tp) return c:IsCode(id-5) and c:IsType(TYPE_FIELD) and c:GetActivateEffect():IsActivatable(tp,true,true) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,tp) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local sc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,tp):GetFirst() Duel.MoveToField(sc,tp,tp,LOCATION_FZONE,POS_FACEUP,true) local te=sc:GetActivateEffect() te:UseCountLimit(tp,1,true) local tep=sc:GetControler() local cost=te:GetCost() if cost then cost(te,tep,eg,ep,ev,re,r,rp,1) end Duel.RaiseEvent(sc,4179255,te,0,tp,tp,Duel.GetCurrentChain()) if Duel.GetFlagEffect(tp,id)==0 then local rc=1 while rc