name: White
card_text: 1 Tuner Synchro Monster + 1+ non-Tuner monsters
  During your turn, when this card is Synchro Summoned: You can Special Summon 1 "Divine Dragon Token" (Fish/WATER/Level 10/ATK 3300/DEF 3000) in Defense Position. Once per opponent's turn, while you control no Tokens (Quick Effect): You can Special Summon 1 "Divine Dragon Token". If this card you control is destroyed by an opponent's card effect and sent to your GY, while you control a "Divine Dragon Token": You can Special Summon this card in Defense Position.
external_ids: local CARD_ID_0 = 89907228 --Divine Dragon Token
  
lua: local CARD_ID_0 = 89907228 --Divine Dragon Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--synchro summon
  	aux.AddSynchroProcedure(c, aux.FilterBoolFunction(Card.IsType, TYPE_SYNCHRO), aux.NonTuner(nil), 1)
  	c:EnableReviveLimit()
  	--token
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetCondition(s.tkcon)
  	e1:SetTarget(s.tktg)
  	e1:SetOperation(s.tkop)
  	c:RegisterEffect(e1)
  	--token
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetCountLimit(1)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetHintTiming(0, TIMING_BATTLE_START + TIMING_END_PHASE)
  	e2:SetCondition(s.tkcon2)
  	e2:SetTarget(s.tktg)
  	e2:SetOperation(s.tkop2)
  	c:RegisterEffect(e2)
  	--special summon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 2))
  	e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_ACTIVATE_CONDITION)
  	e3:SetCode(EVENT_TO_GRAVE)
  	e3:SetCondition(s.spcon)
  	e3:SetTarget(s.sptg)
  	e3:SetOperation(s.spop)
  	c:RegisterEffect(e3)
  end
  s.material_type = TYPE_SYNCHRO
  function s.tkcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp and e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO)
  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,
  			id + 1,
  			0,
  			TYPES_TOKEN_MONSTER,
  			3300,
  			3000,
  			10,
  			RACE_FISH,
  			ATTRIBUTE_WATER,
  			POS_FACEUP_DEFENSE
  		)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, 0, 0)
  end
  function s.tkop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	if Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 3300, 3000, 10, RACE_FISH, ATTRIBUTE_WATER, POS_FACEUP_DEFENSE) then
  		local token = Duel.CreateToken(tp, id + 1)
  		Duel.SpecialSummon(token, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
  	end
  end
  function s.tkcon2(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsTurnPlayer(1 - tp) and not aux.tkfcon(e, tp)
  end
  function s.tkop2(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	if Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 3300, 3000, 10, RACE_FISH, ATTRIBUTE_WATER) then
  		local token = Duel.CreateToken(tp, id + 1)
  		Duel.SpecialSummon(token, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsReason(REASON_DESTROY)
  		and rp == 1 - tp
  		and c:IsReason(REASON_EFFECT)
  		and c:IsPreviousLocation(LOCATION_MZONE)
  		and c:IsPreviousControler(tp)
  		and Duel.IsExistingMatchingCard(Card.IsCode, tp, LOCATION_ONFIELD, 0, 1, nil, id + 1)
  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 e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	if e:GetHandler():IsRelateToEffect(e) then
  		Duel.SpecialSummon(e:GetHandler(), 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
  	end
  end
  
  
source_text: White
  1 Tuner Synchro Monster + 1+ non-Tuner monsters
  During your turn, when this card is Synchro Summoned: You can Special Summon 1 "Divine Dragon Token" (Fish/WATER/Level 10/ATK 3300/DEF 3000) in Defense Position. Once per opponent's turn, while you control no Tokens (Quick Effect): You can Special Summon 1 "Divine Dragon Token". If this card you control is destroyed by an opponent's card effect and sent to your GY, while you control a "Divine Dragon Token": You can Special Summon this card in Defense Position.
target_text: -- White
  local CARD_ID_0 = 89907228 --Divine Dragon Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--synchro summon
  	aux.AddSynchroProcedure(c, aux.FilterBoolFunction(Card.IsType, TYPE_SYNCHRO), aux.NonTuner(nil), 1)
  	c:EnableReviveLimit()
  	--token
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetCondition(s.tkcon)
  	e1:SetTarget(s.tktg)
  	e1:SetOperation(s.tkop)
  	c:RegisterEffect(e1)
  	--token
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetCountLimit(1)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetHintTiming(0, TIMING_BATTLE_START + TIMING_END_PHASE)
  	e2:SetCondition(s.tkcon2)
  	e2:SetTarget(s.tktg)
  	e2:SetOperation(s.tkop2)
  	c:RegisterEffect(e2)
  	--special summon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 2))
  	e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_ACTIVATE_CONDITION)
  	e3:SetCode(EVENT_TO_GRAVE)
  	e3:SetCondition(s.spcon)
  	e3:SetTarget(s.sptg)
  	e3:SetOperation(s.spop)
  	c:RegisterEffect(e3)
  end
  s.material_type = TYPE_SYNCHRO
  function s.tkcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp and e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO)
  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,
  			id + 1,
  			0,
  			TYPES_TOKEN_MONSTER,
  			3300,
  			3000,
  			10,
  			RACE_FISH,
  			ATTRIBUTE_WATER,
  			POS_FACEUP_DEFENSE
  		)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, 0, 0)
  end
  function s.tkop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	if Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 3300, 3000, 10, RACE_FISH, ATTRIBUTE_WATER, POS_FACEUP_DEFENSE) then
  		local token = Duel.CreateToken(tp, id + 1)
  		Duel.SpecialSummon(token, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
  	end
  end
  function s.tkcon2(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsTurnPlayer(1 - tp) and not aux.tkfcon(e, tp)
  end
  function s.tkop2(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	if Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 3300, 3000, 10, RACE_FISH, ATTRIBUTE_WATER) then
  		local token = Duel.CreateToken(tp, id + 1)
  		Duel.SpecialSummon(token, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsReason(REASON_DESTROY)
  		and rp == 1 - tp
  		and c:IsReason(REASON_EFFECT)
  		and c:IsPreviousLocation(LOCATION_MZONE)
  		and c:IsPreviousControler(tp)
  		and Duel.IsExistingMatchingCard(Card.IsCode, tp, LOCATION_ONFIELD, 0, 1, nil, id + 1)
  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 e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	if e:GetHandler():IsRelateToEffect(e) then
  		Duel.SpecialSummon(e:GetHandler(), 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
  	end
  end
  
  