name: Radiant
card_text: If you have "Mystical Space Typhoon" in your GY, or your opponent controls no Spells/Traps, you can Special Summon this card (from your hand). You can only Special Summon "Radiant Typhoon Megala" once per turn this way. If a "Radiant Typhoon" Quick-Play Spell Card or "Mystical Space Typhoon" is activated: You can Special Summon 1 "Radiant Typhoon" monster from your Deck with a different name from the monsters you control, also you cannot Special Summon for the rest of this turn, except WIND monsters. You can only use this effect of "Radiant Typhoon Megala" once per turn.
external_ids: local CARD_ID_0 = 5318639 --Mystical Space Typhoon
  local SETCARD_ID_0 = 0x1d1 --Radiant
  
lua: local CARD_ID_0 = 5318639 --Mystical Space Typhoon
  local SETCARD_ID_0 = 0x1d1 --Radiant
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.spcon)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCode(EVENT_CHAINING)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id + o)
  	e2:SetCondition(s.spcon2)
  	e2:SetTarget(s.sptg2)
  	e2:SetOperation(s.spop2)
  	c:RegisterEffect(e2)
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	return Duel.GetLocationCount(c:GetControler(), LOCATION_MZONE) > 0
  		and (
  			not Duel.IsExistingMatchingCard(Card.IsType, c:GetControler(), 0, LOCATION_ONFIELD, 1, nil, TYPE_SPELL + TYPE_TRAP)
  			or Duel.IsExistingMatchingCard(Card.IsCode, c:GetControler(), LOCATION_GRAVE, 0, 1, nil, CARD_ID_0)
  		)
  end
  function s.spcon2(e, tp, eg, ep, ev, re, r, rp)
  	return re:IsHasType(EFFECT_TYPE_ACTIVATE) and (re:GetHandler():IsCode(CARD_ID_0) or re:GetHandler():IsSetCard(SETCARD_ID_0) and re:IsActiveType(TYPE_QUICKPLAY))
  end
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0)
  		and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  		and not Duel.IsExistingMatchingCard(aux.AND(Card.IsFaceup, Card.IsCode), tp, LOCATION_MZONE, 0, 1, nil, c:GetCode())
  end
  function s.sptg2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
  end
  function s.spop2(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local g = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp)
  		if g:GetCount() > 0 then
  			Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP)
  		end
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c, tp, sumtp, sumpos)
  	return not c:IsAttribute(ATTRIBUTE_WIND)
  end
  
  
source_text: Radiant
  If you have "Mystical Space Typhoon" in your GY, or your opponent controls no Spells/Traps, you can Special Summon this card (from your hand). You can only Special Summon "Radiant Typhoon Megala" once per turn this way. If a "Radiant Typhoon" Quick-Play Spell Card or "Mystical Space Typhoon" is activated: You can Special Summon 1 "Radiant Typhoon" monster from your Deck with a different name from the monsters you control, also you cannot Special Summon for the rest of this turn, except WIND monsters. You can only use this effect of "Radiant Typhoon Megala" once per turn.
target_text: -- Radiant
  local CARD_ID_0 = 5318639 --Mystical Space Typhoon
  local SETCARD_ID_0 = 0x1d1 --Radiant
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.spcon)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCode(EVENT_CHAINING)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id + o)
  	e2:SetCondition(s.spcon2)
  	e2:SetTarget(s.sptg2)
  	e2:SetOperation(s.spop2)
  	c:RegisterEffect(e2)
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	return Duel.GetLocationCount(c:GetControler(), LOCATION_MZONE) > 0
  		and (
  			not Duel.IsExistingMatchingCard(Card.IsType, c:GetControler(), 0, LOCATION_ONFIELD, 1, nil, TYPE_SPELL + TYPE_TRAP)
  			or Duel.IsExistingMatchingCard(Card.IsCode, c:GetControler(), LOCATION_GRAVE, 0, 1, nil, CARD_ID_0)
  		)
  end
  function s.spcon2(e, tp, eg, ep, ev, re, r, rp)
  	return re:IsHasType(EFFECT_TYPE_ACTIVATE) and (re:GetHandler():IsCode(CARD_ID_0) or re:GetHandler():IsSetCard(SETCARD_ID_0) and re:IsActiveType(TYPE_QUICKPLAY))
  end
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0)
  		and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  		and not Duel.IsExistingMatchingCard(aux.AND(Card.IsFaceup, Card.IsCode), tp, LOCATION_MZONE, 0, 1, nil, c:GetCode())
  end
  function s.sptg2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
  end
  function s.spop2(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local g = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp)
  		if g:GetCount() > 0 then
  			Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP)
  		end
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c, tp, sumtp, sumpos)
  	return not c:IsAttribute(ATTRIBUTE_WIND)
  end
  
  