name: Flower
card_text: If you control a Level 2 or lower "Flower Cardian" monster: You can Special Summon this card from your hand, also you cannot Normal or Special Summon monsters for the rest of this turn, except "Flower Cardian" monsters. Once per turn: You can Tribute 1 "Flower Cardian" monster; draw 1 card, and if you do, show it, then, if it is a "Flower Cardian" monster, you can take 1 "Flower Cardian" monster from your Deck, except "Flower Cardian Cherry Blossom", and either add it to your hand or Special Summon it. Otherwise, send the card you drew to the GY.
external_ids: local SETCARD_ID_0 = 0xe6 --Flower
  
lua: local SETCARD_ID_0 = 0xe6 --Flower
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--draw
  	local e2 = Effect.CreateEffect(c)
  	e2:SetCategory(CATEGORY_DRAW + CATEGORY_SPECIAL_SUMMON + CATEGORY_SEARCH + CATEGORY_DECKDES)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCost(s.drawcost)
  	e2:SetTarget(s.drawtg)
  	e2:SetOperation(s.drawop)
  	c:RegisterEffect(e2)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsLevelBelow(2)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  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)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  	end
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_CANNOT_SUMMON)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.splimit(e, c)
  	return not c:IsSetCard(SETCARD_ID_0)
  end
  function s.drawcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, Card.IsSetCard, 1, nil, 0xe6)
  	end
  	local g = Duel.SelectReleaseGroup(tp, Card.IsSetCard, 1, 1, nil, 0xe6)
  	Duel.Release(g, REASON_COST)
  end
  function s.drawtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDraw(tp, 1)
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(1)
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 1)
  end
  function s.sfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0)
  		and c:IsType(TYPE_MONSTER)
  		and not c:IsCode(id)
  		and (c:IsAbleToHand() or (Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)))
  end
  function s.drawop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	if Duel.Draw(p, d, REASON_EFFECT) ~= 0 then
  		local tc = Duel.GetOperatedGroup():GetFirst()
  		Duel.ConfirmCards(1 - p, tc)
  		if tc:IsType(TYPE_MONSTER) and tc:IsSetCard(SETCARD_ID_0) then
  			local sel = 1
  			Duel.Hint(HINT_SELECTMSG, tp, aux.Stringid(id, 0))
  			if Duel.IsExistingMatchingCard(s.sfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp) then
  				sel = Duel.SelectOption(tp, 1213, 1214)
  			else
  				sel = Duel.SelectOption(tp, 1214) + 1
  			end
  			if sel == 0 then
  				Duel.BreakEffect()
  				Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPERATECARD)
  				local sc = Duel.SelectMatchingCard(tp, s.sfilter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp):GetFirst()
  				if Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and sc:IsCanBeSpecialSummoned(e, 0, tp, false, false) and (not sc:IsAbleToHand() or Duel.SelectOption(tp, 1190, 1152) == 1) then
  					Duel.SpecialSummon(sc, 0, tp, tp, false, false, POS_FACEUP)
  				else
  					Duel.SendtoHand(sc, nil, REASON_EFFECT)
  					Duel.ConfirmCards(1 - tp, sc)
  				end
  			end
  		else
  			Duel.SendtoGrave(tc, REASON_EFFECT)
  		end
  		Duel.ShuffleHand(tp)
  	end
  end
  
  
source_text: Flower
  If you control a Level 2 or lower "Flower Cardian" monster: You can Special Summon this card from your hand, also you cannot Normal or Special Summon monsters for the rest of this turn, except "Flower Cardian" monsters. Once per turn: You can Tribute 1 "Flower Cardian" monster; draw 1 card, and if you do, show it, then, if it is a "Flower Cardian" monster, you can take 1 "Flower Cardian" monster from your Deck, except "Flower Cardian Cherry Blossom", and either add it to your hand or Special Summon it. Otherwise, send the card you drew to the GY.
target_text: -- Flower
  local SETCARD_ID_0 = 0xe6 --Flower
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--draw
  	local e2 = Effect.CreateEffect(c)
  	e2:SetCategory(CATEGORY_DRAW + CATEGORY_SPECIAL_SUMMON + CATEGORY_SEARCH + CATEGORY_DECKDES)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCost(s.drawcost)
  	e2:SetTarget(s.drawtg)
  	e2:SetOperation(s.drawop)
  	c:RegisterEffect(e2)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsLevelBelow(2)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  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)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  	end
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_CANNOT_SUMMON)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.splimit(e, c)
  	return not c:IsSetCard(SETCARD_ID_0)
  end
  function s.drawcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, Card.IsSetCard, 1, nil, 0xe6)
  	end
  	local g = Duel.SelectReleaseGroup(tp, Card.IsSetCard, 1, 1, nil, 0xe6)
  	Duel.Release(g, REASON_COST)
  end
  function s.drawtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDraw(tp, 1)
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(1)
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 1)
  end
  function s.sfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0)
  		and c:IsType(TYPE_MONSTER)
  		and not c:IsCode(id)
  		and (c:IsAbleToHand() or (Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)))
  end
  function s.drawop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	if Duel.Draw(p, d, REASON_EFFECT) ~= 0 then
  		local tc = Duel.GetOperatedGroup():GetFirst()
  		Duel.ConfirmCards(1 - p, tc)
  		if tc:IsType(TYPE_MONSTER) and tc:IsSetCard(SETCARD_ID_0) then
  			local sel = 1
  			Duel.Hint(HINT_SELECTMSG, tp, aux.Stringid(id, 0))
  			if Duel.IsExistingMatchingCard(s.sfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp) then
  				sel = Duel.SelectOption(tp, 1213, 1214)
  			else
  				sel = Duel.SelectOption(tp, 1214) + 1
  			end
  			if sel == 0 then
  				Duel.BreakEffect()
  				Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPERATECARD)
  				local sc = Duel.SelectMatchingCard(tp, s.sfilter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp):GetFirst()
  				if Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and sc:IsCanBeSpecialSummoned(e, 0, tp, false, false) and (not sc:IsAbleToHand() or Duel.SelectOption(tp, 1190, 1152) == 1) then
  					Duel.SpecialSummon(sc, 0, tp, tp, false, false, POS_FACEUP)
  				else
  					Duel.SendtoHand(sc, nil, REASON_EFFECT)
  					Duel.ConfirmCards(1 - tp, sc)
  				end
  			end
  		else
  			Duel.SendtoGrave(tc, REASON_EFFECT)
  		end
  		Duel.ShuffleHand(tp)
  	end
  end
  
  