--Origin Dragon Flame Falls --created by Ace, coded by Lyris --Updated activation effect format by: XGlitchy30 local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:HOPT(true) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local b1=s.sptg(e,tp,eg,ep,ev,re,r,rp,0) local b2=s.tktg(e,tp,eg,ep,ev,re,r,rp,0) local b3=s.thtg(e,tp,eg,ep,ev,re,r,rp,0) if chk==0 then return b1 or b2 or b3 end local opt=aux.Option(tp,id,1,b1,b2,b3) if not opt then return end e:SetLabel(opt) if opt==0 then e:SetCategory(CATEGORY_SPECIAL_SUMMON) s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) elseif opt==1 then e:SetCategory(CATEGORIES_TOKEN) s.tktg(e,tp,eg,ep,ev,re,r,rp,chk) elseif opt==2 then e:SetCategory(CATEGORIES_SEARCH) s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local opt=e:GetLabel() if opt==0 then s.spop(e,tp,eg,ep,ev,re,r,rp) elseif opt==1 then s.tkop(e,tp,eg,ep,ev,re,r,rp) elseif opt==2 then s.thop(e,tp,eg,ep,ev,re,r,rp) end end function s.filter(c,e,tp) return c:IsSetCard(ARCHE_ORIGIN_DRAGON) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) end function s.spop(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,aux.NecroValleyFilter(s.filter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.tktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,TOKEN_DRAGON_EGG,0,TYPES_TOKEN_MONSTER,300,300,1,RACE_DRAGON,ATTRIBUTE_FIRE) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,tp,0) end function s.tkop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not Duel.IsPlayerCanSpecialSummonMonster(tp,TOKEN_DRAGON_EGG,0,TYPES_TOKEN_MONSTER,300,300,1,RACE_DRAGON,ATTRIBUTE_FIRE) then return end local c=e:GetHandler() local token=Duel.CreateToken(tp,TOKEN_DRAGON_EGG) if Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL) e1:SetValue(s.matlim) e1:SetReset(RESET_EVENT|RESETS_STANDARD) token:RegisterEffect(e1,true) local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL) token:RegisterEffect(e2,true) local e3=e1:Clone() e3:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL) token:RegisterEffect(e3,true) end Duel.SpecialSummonComplete() end function s.matlim(e,c) if not c then return false end return not c:IsSetCard(ARCHE_ORIGIN_DRAGON) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local ct=Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsCode,TOKEN_DRAGON_EGG),tp,LOCATION_ONFIELD,0,1,nil) return ct>0 and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>=ct and Duel.GetDecktopGroup(tp,ct):FilterCount(Card.IsAbleToHand,nil)>0 end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local ct=Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsCode,TOKEN_DRAGON_EGG),tp,LOCATION_ONFIELD,0,1,nil) if ct==0 then return end Duel.ConfirmDecktop(tp,ct) local g=Duel.GetDecktopGroup(tp,ct) if #g<1 then return end local sg=g:Filter(Card.IsSetCard,nil,ARCHE_ORIGIN_DRAGON) if not sg:IsExists(aux.NOT(Card.IsAbleToHand),1,nil) then Duel.SendtoHand(sg,nil,REASON_EFFECT|REASON_REVEAL) Duel.ConfirmCards(1-tp,sg) Duel.ShuffleHand(tp) if #g~=#sg then Duel.BreakEffect() end end Duel.ShuffleDeck(tp) end