name: Twin
card_text: 2 Level 4 or lower Dragon monsters, except Tokens
  When this card is Link Summoned: You can pay 500 LP, then target 1 Level 5 or higher monster in your GY; Special Summon it to your zone this card points to, but it cannot attack this turn, also it has its effects negated.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	aux.AddLinkProcedure(c, s.mfilter, 2)
  	c:EnableReviveLimit()
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCondition(s.spcon)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  end
  function s.mfilter(c)
  	return c:IsLevelBelow(4) and c:IsLinkRace(RACE_DRAGON) and not c:IsLinkType(TYPE_TOKEN)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 500)
  	end
  	Duel.PayLPCost(tp, 500)
  end
  function s.filter(c, e, tp, zone)
  	return c:IsLevelAbove(5) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP, tp, zone)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local zone = e:GetHandler():GetLinkedZone(tp)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc, e, tp, zone)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, LOCATION_GRAVE, 0, 1, nil, e, tp, zone)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectTarget(tp, s.filter, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp, zone)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local zone = c:GetLinkedZone(tp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and zone & 0x1f ~= 0 and Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP, zone) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e1, true)
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_DISABLE_EFFECT)
  		e2:SetValue(RESET_TURN_SET)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e2, true)
  		local e3 = Effect.CreateEffect(c)
  		e3:SetType(EFFECT_TYPE_SINGLE)
  		e3:SetCode(EFFECT_CANNOT_ATTACK)
  		e3:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e3, true)
  	end
  	Duel.SpecialSummonComplete()
  end
  
  
source_text: Twin
  2 Level 4 or lower Dragon monsters, except Tokens
  When this card is Link Summoned: You can pay 500 LP, then target 1 Level 5 or higher monster in your GY; Special Summon it to your zone this card points to, but it cannot attack this turn, also it has its effects negated.
target_text: -- Twin
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	aux.AddLinkProcedure(c, s.mfilter, 2)
  	c:EnableReviveLimit()
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCondition(s.spcon)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  end
  function s.mfilter(c)
  	return c:IsLevelBelow(4) and c:IsLinkRace(RACE_DRAGON) and not c:IsLinkType(TYPE_TOKEN)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 500)
  	end
  	Duel.PayLPCost(tp, 500)
  end
  function s.filter(c, e, tp, zone)
  	return c:IsLevelAbove(5) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP, tp, zone)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local zone = e:GetHandler():GetLinkedZone(tp)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc, e, tp, zone)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, LOCATION_GRAVE, 0, 1, nil, e, tp, zone)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectTarget(tp, s.filter, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp, zone)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local zone = c:GetLinkedZone(tp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and zone & 0x1f ~= 0 and Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP, zone) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e1, true)
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_DISABLE_EFFECT)
  		e2:SetValue(RESET_TURN_SET)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e2, true)
  		local e3 = Effect.CreateEffect(c)
  		e3:SetType(EFFECT_TYPE_SINGLE)
  		e3:SetCode(EFFECT_CANNOT_ATTACK)
  		e3:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e3, true)
  	end
  	Duel.SpecialSummonComplete()
  end
  
  