--Aircaster Observation --created by Alastar Rainford, coded by Lyris local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetCategory(CATEGORY_SPECIAL_SUMMON|CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRelevantTimings() e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c,e,tp) return c:IsAbleToDeck() and (not e or Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,c,e,tp)) end function s.spfilter(c,e,tp) return c:IsSetCard(ARCHE_AIRCASTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local c=e:GetHandler() local exc if e:IsHasType(EFFECT_TYPE_ACTIVATE) and c:IsLocation(LOCATION_HAND) then exc=c end return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,1,exc,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.ForcedSelect(HINTMSG_TODECK,false,tp,s.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 and Duel.SendtoDeck(g,nil,SEQ_DECKTOP,REASON_EFFECT)>0 and g:GetFirst():IsLocation(LOCATION_DECK) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,e,tp) if #tg>0 and Duel.SpecialSummon(tg,0,tp,tp,false,false,POS_FACEUP)~=0 then local tc=tg:GetFirst() local fid=e:GetFieldID() tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,fid,aux.Stringid(id,1)) local e2=Effect.CreateEffect(e:GetHandler()) e2:Desc(2) e2:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_CONTINUOUS) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetCode(EVENT_PHASE|PHASE_END) e2:SetCountLimit(1) e2:SetLabel(fid) e2:SetLabelObject(tc) e2:SetCondition(s.retcon) e2:SetOperation(s.retop) Duel.RegisterEffect(e2,tp) end end end function s.retcon(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if not tc or not tc:HasFlagEffectLabel(id,e:GetLabel()) then e:Reset() return false end return true end function s.retop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() Duel.SendtoDeck(tc,nil,SEQ_DECKTOP,REASON_EFFECT) end