name: Floowandereeze
card_text: If this face-up card would leave the field, banish it instead. You can only use each of the following effects of "Floowandereeze & Eglen" once per turn, and cannot Special Summon during the turn you activate either effect. If this card is Normal Summoned: You can add 1 Level 7 or higher Winged Beast monster from your Deck to your hand, then immediately after this effect resolves, you can Normal Summon 1 Winged Beast monster. If a Winged Beast monster is Normal Summoned to your field while this card is banished: You can add this card to your hand.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--to hand
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SEARCH + CATEGORY_TOHAND + CATEGORY_SUMMON)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--redirect
  	aux.AddBanishRedirect(c)
  	--to hand(self)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_TOHAND)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_SUMMON_SUCCESS)
  	e3:SetProperty(EFFECT_FLAG_DELAY)
  	e3:SetRange(LOCATION_REMOVED)
  	e3:SetCountLimit(1, id + 1)
  	e3:SetCondition(s.thcon2)
  	e3:SetCost(s.cost)
  	e3:SetTarget(s.thtg2)
  	e3:SetOperation(s.thop2)
  	c:RegisterEffect(e3)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetActivityCount(tp, ACTIVITY_SPSUMMON) == 0
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	e1:SetTargetRange(1, 0)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.thfilter(c)
  	return c:IsLevelAbove(7) and c:IsRace(RACE_WINDBEAST) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  	Duel.SetOperationInfo(0, CATEGORY_SUMMON, nil, 0, 0, 0)
  end
  function s.sumfilter(c)
  	return c:IsSummonable(true, nil) and c:IsRace(RACE_WINDBEAST)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  		if Duel.IsExistingMatchingCard(s.sumfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, nil) and Duel.SelectYesNo(tp, aux.Stringid(id, 2)) then
  			Duel.BreakEffect()
  			Duel.ShuffleHand(tp)
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SUMMON)
  			local sg = Duel.SelectMatchingCard(tp, s.sumfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, 1, nil)
  			if sg:GetCount() > 0 then
  				Duel.Summon(tp, sg:GetFirst(), true, nil)
  			end
  		end
  	end
  end
  function s.thcon2(e, tp, eg, ep, ev, re, r, rp)
  	local ec = eg:GetFirst()
  	return ec:IsControler(tp) and ec:IsRace(RACE_WINDBEAST)
  end
  function s.thtg2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToHand()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, e:GetHandler(), 1, 0, 0)
  end
  function s.thop2(e, tp, eg, ep, ev, re, r, rp)
  	if e:GetHandler():IsRelateToEffect(e) then
  		Duel.SendtoHand(e:GetHandler(), nil, REASON_EFFECT)
  	end
  end
  
  
source_text: Floowandereeze
  If this face-up card would leave the field, banish it instead. You can only use each of the following effects of "Floowandereeze & Eglen" once per turn, and cannot Special Summon during the turn you activate either effect. If this card is Normal Summoned: You can add 1 Level 7 or higher Winged Beast monster from your Deck to your hand, then immediately after this effect resolves, you can Normal Summon 1 Winged Beast monster. If a Winged Beast monster is Normal Summoned to your field while this card is banished: You can add this card to your hand.
target_text: -- Floowandereeze
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--to hand
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SEARCH + CATEGORY_TOHAND + CATEGORY_SUMMON)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--redirect
  	aux.AddBanishRedirect(c)
  	--to hand(self)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_TOHAND)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_SUMMON_SUCCESS)
  	e3:SetProperty(EFFECT_FLAG_DELAY)
  	e3:SetRange(LOCATION_REMOVED)
  	e3:SetCountLimit(1, id + 1)
  	e3:SetCondition(s.thcon2)
  	e3:SetCost(s.cost)
  	e3:SetTarget(s.thtg2)
  	e3:SetOperation(s.thop2)
  	c:RegisterEffect(e3)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetActivityCount(tp, ACTIVITY_SPSUMMON) == 0
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	e1:SetTargetRange(1, 0)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.thfilter(c)
  	return c:IsLevelAbove(7) and c:IsRace(RACE_WINDBEAST) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  	Duel.SetOperationInfo(0, CATEGORY_SUMMON, nil, 0, 0, 0)
  end
  function s.sumfilter(c)
  	return c:IsSummonable(true, nil) and c:IsRace(RACE_WINDBEAST)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  		if Duel.IsExistingMatchingCard(s.sumfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, nil) and Duel.SelectYesNo(tp, aux.Stringid(id, 2)) then
  			Duel.BreakEffect()
  			Duel.ShuffleHand(tp)
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SUMMON)
  			local sg = Duel.SelectMatchingCard(tp, s.sumfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, 1, nil)
  			if sg:GetCount() > 0 then
  				Duel.Summon(tp, sg:GetFirst(), true, nil)
  			end
  		end
  	end
  end
  function s.thcon2(e, tp, eg, ep, ev, re, r, rp)
  	local ec = eg:GetFirst()
  	return ec:IsControler(tp) and ec:IsRace(RACE_WINDBEAST)
  end
  function s.thtg2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToHand()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, e:GetHandler(), 1, 0, 0)
  end
  function s.thop2(e, tp, eg, ep, ev, re, r, rp)
  	if e:GetHandler():IsRelateToEffect(e) then
  		Duel.SendtoHand(e:GetHandler(), nil, REASON_EFFECT)
  	end
  end
  
  