--Origin Dragon Pathway --created by Ace, coded by Lyris local s,id=GetID() function s.initial_effect(c) c:SetUniqueOnField(1,0,id) --activate local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --damage local e2=Effect.CreateEffect(c) e2:Desc(1) e2:SetCategory(CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_TRIGGER_F) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetRange(LOCATION_SZONE) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCondition(s.damcon) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) --token local e3=Effect.CreateEffect(c) e3:Desc(2) e3:SetCategory(CATEGORY_TOKEN|CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1) e3:SetRelevantTimings() e3:SetTarget(s.tg) e3:SetOperation(s.op) c:RegisterEffect(e3) end function s.filter(c,tp) return c:IsSummonLocation(LOCATION_EXTRA) and c:IsSummonPlayer(1-tp) end function s.tkfilter(c) return c:IsFaceup() and c:IsCode(TOKEN_DRAGON_EGG) and c:HasAttack() end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.filter,1,nil,tp) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local atk=Duel.GetMatchingGroup(s.tkfilter,tp,LOCATION_ONFIELD,0,nil):GetSum(Card.GetAttack) Duel.SetTargetPlayer(1-tp) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,atk) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local atk=Duel.GetMatchingGroup(s.tkfilter,tp,LOCATION_ONFIELD,0,nil):GetSum(Card.GetAttack) Duel.Damage(p,atk,REASON_EFFECT) end function s.tg(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.op(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