name: Destiny
card_text: Cannot be Special Summoned. This card can attack twice during each Battle Phase. During your Standby Phase, if this card was destroyed since your last Standby Phase: You can Special Summon 2 "Double Dude Tokens" (Warrior-Type/DARK/Level 4/ATK 1000/DEF 1000). This card must be in your Graveyard to activate and to resolve this effect.
external_ids: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 28355719 --Double Dude Token
  
lua: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 28355719 --Double Dude Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--cannot special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	c:RegisterEffect(e1)
  	--multiattack
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_EXTRA_ATTACK)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	--token
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e3:SetCode(EVENT_TO_GRAVE)
  	e3:SetOperation(s.regop)
  	c:RegisterEffect(e3)
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsReason(REASON_DESTROY) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetDescription(aux.Stringid(id, 0))
  		e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  		e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  		e1:SetRange(LOCATION_GRAVE)
  		e1:SetCountLimit(1)
  		e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
  		e1:SetCondition(s.spcon)
  		e1:SetTarget(s.sptg)
  		e1:SetOperation(s.spop)
  		if Duel.GetTurnPlayer() == tp then
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END + RESET_SELF_TURN, 2)
  		else
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END + RESET_SELF_TURN, 1)
  		end
  		c:RegisterEffect(e1)
  	end
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			and Duel.GetLocationCount(tp, LOCATION_MZONE) > 1
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 1000, 1000, 4, RACE_WARRIOR, ATTRIBUTE_DARK)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 2, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 2, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		return
  	end
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) < 2 then
  		return
  	end
  	if not Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 1000, 1000, 4, RACE_WARRIOR, ATTRIBUTE_DARK) then
  		return
  	end
  	for i = 1, 2 do
  		local token = Duel.CreateToken(tp, id + 1)
  		Duel.SpecialSummonStep(token, 0, tp, tp, false, false, POS_FACEUP)
  	end
  	Duel.SpecialSummonComplete()
  end
  
  
source_text: Destiny
  Cannot be Special Summoned. This card can attack twice during each Battle Phase. During your Standby Phase, if this card was destroyed since your last Standby Phase: You can Special Summon 2 "Double Dude Tokens" (Warrior-Type/DARK/Level 4/ATK 1000/DEF 1000). This card must be in your Graveyard to activate and to resolve this effect.
target_text: -- Destiny
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 28355719 --Double Dude Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--cannot special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	c:RegisterEffect(e1)
  	--multiattack
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_EXTRA_ATTACK)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	--token
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e3:SetCode(EVENT_TO_GRAVE)
  	e3:SetOperation(s.regop)
  	c:RegisterEffect(e3)
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsReason(REASON_DESTROY) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetDescription(aux.Stringid(id, 0))
  		e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  		e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  		e1:SetRange(LOCATION_GRAVE)
  		e1:SetCountLimit(1)
  		e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
  		e1:SetCondition(s.spcon)
  		e1:SetTarget(s.sptg)
  		e1:SetOperation(s.spop)
  		if Duel.GetTurnPlayer() == tp then
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END + RESET_SELF_TURN, 2)
  		else
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END + RESET_SELF_TURN, 1)
  		end
  		c:RegisterEffect(e1)
  	end
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			and Duel.GetLocationCount(tp, LOCATION_MZONE) > 1
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 1000, 1000, 4, RACE_WARRIOR, ATTRIBUTE_DARK)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 2, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 2, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		return
  	end
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) < 2 then
  		return
  	end
  	if not Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 1000, 1000, 4, RACE_WARRIOR, ATTRIBUTE_DARK) then
  		return
  	end
  	for i = 1, 2 do
  		local token = Duel.CreateToken(tp, id + 1)
  		Duel.SpecialSummonStep(token, 0, tp, tp, false, false, POS_FACEUP)
  	end
  	Duel.SpecialSummonComplete()
  end
  
  