name: Floowandereeze
card_text: If this card is Tribute Summoned: You can add 1 "Floowandereeze" Spell/Trap from your Deck to your hand, then immediately after this effect resolves, you can Normal Summon 1 monster. While this Tribute Summoned card is in the Monster Zone, your opponent cannot activate the effects of Special Summoned monsters they control in Attack Position. Once per battle, during damage calculation, if this card battles an opponent's monster (Quick Effect): You can banish 1 card from your hand; that opponent's monster's current ATK/DEF become halved until the end of this turn.
external_ids: local SETCARD_ID_0 = 0x16d --Floowandereeze
  
lua: local SETCARD_ID_0 = 0x16d --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:SetCondition(s.thcon)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--act limit
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(0, 1)
  	e2:SetCondition(s.thcon)
  	e2:SetValue(s.limval)
  	c:RegisterEffect(e2)
  	--atk/def
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_ATKCHANGE + CATEGORY_DEFCHANGE)
  	e3:SetType(EFFECT_TYPE_QUICK_O)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
  	e3:SetCondition(s.atkcon)
  	e3:SetCost(s.atkcost)
  	e3:SetOperation(s.atkop)
  	c:RegisterEffect(e3)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_ADVANCE)
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_SPELL + TYPE_TRAP) 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.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(Card.IsSummonable, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, nil, true, 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, Card.IsSummonable, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, 1, nil, true, nil)
  			if sg:GetCount() > 0 then
  				Duel.Summon(tp, sg:GetFirst(), true, nil)
  			end
  		end
  	end
  end
  function s.limval(e, re, rp)
  	local rc = re:GetHandler()
  	return rc:IsLocation(LOCATION_MZONE) and re:IsActiveType(TYPE_MONSTER) and rc:IsAttackPos() and rc:IsSummonType(SUMMON_TYPE_SPECIAL)
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	local bc = e:GetHandler():GetBattleTarget()
  	if not bc then
  		return false
  	end
  	e:SetLabelObject(bc)
  	return bc:IsControler(1 - tp) and bc:IsRelateToBattle()
  end
  function s.atkcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	local bc = e:GetLabelObject()
  	if chk == 0 then
  		return bc and Duel.IsExistingMatchingCard(Card.IsAbleToRemoveAsCost, tp, LOCATION_HAND, 0, 1, nil) and c:GetFlagEffect(id) == 0
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, Card.IsAbleToRemoveAsCost, tp, LOCATION_HAND, 0, 1, 1, nil)
  	Duel.Remove(g, POS_FACEUP, REASON_COST)
  	c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_DAMAGE_CAL, 0, 1)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local bc = e:GetLabelObject()
  	if bc:IsFaceup() and bc:IsRelateToBattle() and bc:IsControler(1 - tp) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e1:SetValue(math.ceil(bc:GetAttack() / 2))
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		bc:RegisterEffect(e1)
  		local e2 = Effect.CreateEffect(e:GetHandler())
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_SET_DEFENSE_FINAL)
  		e2:SetValue(math.ceil(bc:GetDefense() / 2))
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		bc:RegisterEffect(e2)
  	end
  end
  
  
source_text: Floowandereeze
  If this card is Tribute Summoned: You can add 1 "Floowandereeze" Spell/Trap from your Deck to your hand, then immediately after this effect resolves, you can Normal Summon 1 monster. While this Tribute Summoned card is in the Monster Zone, your opponent cannot activate the effects of Special Summoned monsters they control in Attack Position. Once per battle, during damage calculation, if this card battles an opponent's monster (Quick Effect): You can banish 1 card from your hand; that opponent's monster's current ATK/DEF become halved until the end of this turn.
target_text: -- Floowandereeze
  local SETCARD_ID_0 = 0x16d --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:SetCondition(s.thcon)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--act limit
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(0, 1)
  	e2:SetCondition(s.thcon)
  	e2:SetValue(s.limval)
  	c:RegisterEffect(e2)
  	--atk/def
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_ATKCHANGE + CATEGORY_DEFCHANGE)
  	e3:SetType(EFFECT_TYPE_QUICK_O)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
  	e3:SetCondition(s.atkcon)
  	e3:SetCost(s.atkcost)
  	e3:SetOperation(s.atkop)
  	c:RegisterEffect(e3)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_ADVANCE)
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_SPELL + TYPE_TRAP) 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.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(Card.IsSummonable, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, nil, true, 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, Card.IsSummonable, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, 1, nil, true, nil)
  			if sg:GetCount() > 0 then
  				Duel.Summon(tp, sg:GetFirst(), true, nil)
  			end
  		end
  	end
  end
  function s.limval(e, re, rp)
  	local rc = re:GetHandler()
  	return rc:IsLocation(LOCATION_MZONE) and re:IsActiveType(TYPE_MONSTER) and rc:IsAttackPos() and rc:IsSummonType(SUMMON_TYPE_SPECIAL)
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	local bc = e:GetHandler():GetBattleTarget()
  	if not bc then
  		return false
  	end
  	e:SetLabelObject(bc)
  	return bc:IsControler(1 - tp) and bc:IsRelateToBattle()
  end
  function s.atkcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	local bc = e:GetLabelObject()
  	if chk == 0 then
  		return bc and Duel.IsExistingMatchingCard(Card.IsAbleToRemoveAsCost, tp, LOCATION_HAND, 0, 1, nil) and c:GetFlagEffect(id) == 0
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, Card.IsAbleToRemoveAsCost, tp, LOCATION_HAND, 0, 1, 1, nil)
  	Duel.Remove(g, POS_FACEUP, REASON_COST)
  	c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_DAMAGE_CAL, 0, 1)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local bc = e:GetLabelObject()
  	if bc:IsFaceup() and bc:IsRelateToBattle() and bc:IsControler(1 - tp) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e1:SetValue(math.ceil(bc:GetAttack() / 2))
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		bc:RegisterEffect(e1)
  		local e2 = Effect.CreateEffect(e:GetHandler())
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_SET_DEFENSE_FINAL)
  		e2:SetValue(math.ceil(bc:GetDefense() / 2))
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		bc:RegisterEffect(e2)
  	end
  end
  
  