name: Summon
card_text: Once per turn, during your Main Phase: You can Special Summon 1 Level 4 or lower "Cloudian" monster from your hand or either GY. You must control no monsters to activate and to resolve this effect. If you Special Summon a monster from the GY with this effect, destroy this card.
external_ids: local SETCARD_ID_0 = 0x18 --Cloudian
  
lua: local SETCARD_ID_0 = 0x18 --Cloudian
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetCountLimit(1)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCondition(s.condition)
  	e2:SetTarget(s.target)
  	e2:SetOperation(s.operation)
  	c:RegisterEffect(e2)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetFieldGroupCount(tp, LOCATION_MZONE, 0) == 0
  end
  function s.filter(c, e, tp)
  	return c:IsLevelBelow(4) and c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND + LOCATION_GRAVE)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	if Duel.GetFieldGroupCount(tp, LOCATION_MZONE, 0) > 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.filter), tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  	if g:GetCount() > 0 then
  		local grav = g:GetFirst():IsLocation(LOCATION_GRAVE)
  		Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP)
  		if grav then
  			Duel.Destroy(e:GetHandler(), REASON_EFFECT)
  		end
  	end
  end
  
  
source_text: Summon
  Once per turn, during your Main Phase: You can Special Summon 1 Level 4 or lower "Cloudian" monster from your hand or either GY. You must control no monsters to activate and to resolve this effect. If you Special Summon a monster from the GY with this effect, destroy this card.
target_text: -- Summon
  local SETCARD_ID_0 = 0x18 --Cloudian
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetCountLimit(1)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCondition(s.condition)
  	e2:SetTarget(s.target)
  	e2:SetOperation(s.operation)
  	c:RegisterEffect(e2)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetFieldGroupCount(tp, LOCATION_MZONE, 0) == 0
  end
  function s.filter(c, e, tp)
  	return c:IsLevelBelow(4) and c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND + LOCATION_GRAVE)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	if Duel.GetFieldGroupCount(tp, LOCATION_MZONE, 0) > 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.filter), tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  	if g:GetCount() > 0 then
  		local grav = g:GetFirst():IsLocation(LOCATION_GRAVE)
  		Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP)
  		if grav then
  			Duel.Destroy(e:GetHandler(), REASON_EFFECT)
  		end
  	end
  end
  
  