name: Wishes
card_text: Discard 1 card; add 1 Level 1 LIGHT Tuner, and 1 Spell/Trap that mentions "Blue-Eyes White Dragon", from your Deck to your hand, except "Wishes for Eyes of Blue". You can banish this card from your GY, then target 1 "Blue-Eyes White Dragon" you control; equip 1 "Blue-Eyes" monster from your Extra Deck to it as an Equip Spell that gives it 400 ATK. You can only use each effect of "Wishes for Eyes of Blue" once per turn.
external_ids: local CARD_ID_0 = 89631139 --Blue-Eyes White Dragon
  local SETCARD_ID_0 = 0xdd --Blue-Eyes
  
lua: local CARD_ID_0 = 89631139 --Blue-Eyes White Dragon
  local SETCARD_ID_0 = 0xdd --Blue-Eyes
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--equip
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_EQUIP)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id + o)
  	e2:SetCost(aux.bfgcost)
  	e2:SetTarget(s.eqtg)
  	e2:SetOperation(s.eqop)
  	c:RegisterEffect(e2)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(Card.IsDiscardable, tp, LOCATION_HAND, 0, 1, c)
  	end
  	Duel.DiscardHand(tp, Card.IsDiscardable, 1, 1, REASON_COST + REASON_DISCARD, nil)
  end
  function s.thfilter1(c, tp)
  	return not c:IsCode(id) and aux.IsCodeListed(c, CARD_ID_0) and c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsAbleToHand() and Duel.IsExistingMatchingCard(s.thfilter2, tp, LOCATION_DECK, 0, 1, c)
  end
  function s.thfilter2(c)
  	return c:IsLevel(1) and c:IsType(TYPE_TUNER) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToHand()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter1, tp, LOCATION_DECK, 0, 1, nil, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 2, tp, LOCATION_DECK)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local tc = Duel.SelectMatchingCard(tp, s.thfilter1, tp, LOCATION_DECK, 0, 1, 1, nil, tp):GetFirst()
  	if tc and Duel.IsExistingMatchingCard(s.thfilter2, tp, LOCATION_DECK, 0, 1, tc) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  		local g = Duel.SelectMatchingCard(tp, s.thfilter2, tp, LOCATION_DECK, 0, 1, 1, tc)
  		g:AddCard(tc)
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  function s.tgfilter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.eqfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER)
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.tgfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0
  			and Duel.IsExistingTarget(s.tgfilter, tp, LOCATION_MZONE, 0, 1, nil)
  			and Duel.IsExistingMatchingCard(s.eqfilter, tp, LOCATION_EXTRA, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	Duel.SelectTarget(tp, s.tgfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, nil, 1, tp, LOCATION_EXTRA)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and tc:IsFaceup() and Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  		local g = Duel.SelectMatchingCard(tp, s.eqfilter, tp, LOCATION_EXTRA, 0, 1, 1, nil)
  		local ec = g:GetFirst()
  		if ec then
  			if not Duel.Equip(tp, ec, tc) then
  				return
  			end
  			--equip limit
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_EQUIP_LIMIT)
  			e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  			e1:SetLabelObject(tc)
  			e1:SetValue(s.eqlimit)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			ec:RegisterEffect(e1)
  			local e2 = Effect.CreateEffect(e:GetHandler())
  			e2:SetType(EFFECT_TYPE_EQUIP)
  			e2:SetCode(EFFECT_UPDATE_ATTACK)
  			e2:SetValue(400)
  			e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  			ec:RegisterEffect(e2)
  		end
  	end
  end
  function s.eqlimit(e, c)
  	return c == e:GetLabelObject()
  end
  
  
source_text: Wishes
  Discard 1 card; add 1 Level 1 LIGHT Tuner, and 1 Spell/Trap that mentions "Blue-Eyes White Dragon", from your Deck to your hand, except "Wishes for Eyes of Blue". You can banish this card from your GY, then target 1 "Blue-Eyes White Dragon" you control; equip 1 "Blue-Eyes" monster from your Extra Deck to it as an Equip Spell that gives it 400 ATK. You can only use each effect of "Wishes for Eyes of Blue" once per turn.
target_text: -- Wishes
  local CARD_ID_0 = 89631139 --Blue-Eyes White Dragon
  local SETCARD_ID_0 = 0xdd --Blue-Eyes
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--equip
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_EQUIP)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id + o)
  	e2:SetCost(aux.bfgcost)
  	e2:SetTarget(s.eqtg)
  	e2:SetOperation(s.eqop)
  	c:RegisterEffect(e2)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(Card.IsDiscardable, tp, LOCATION_HAND, 0, 1, c)
  	end
  	Duel.DiscardHand(tp, Card.IsDiscardable, 1, 1, REASON_COST + REASON_DISCARD, nil)
  end
  function s.thfilter1(c, tp)
  	return not c:IsCode(id) and aux.IsCodeListed(c, CARD_ID_0) and c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsAbleToHand() and Duel.IsExistingMatchingCard(s.thfilter2, tp, LOCATION_DECK, 0, 1, c)
  end
  function s.thfilter2(c)
  	return c:IsLevel(1) and c:IsType(TYPE_TUNER) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToHand()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter1, tp, LOCATION_DECK, 0, 1, nil, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 2, tp, LOCATION_DECK)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local tc = Duel.SelectMatchingCard(tp, s.thfilter1, tp, LOCATION_DECK, 0, 1, 1, nil, tp):GetFirst()
  	if tc and Duel.IsExistingMatchingCard(s.thfilter2, tp, LOCATION_DECK, 0, 1, tc) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  		local g = Duel.SelectMatchingCard(tp, s.thfilter2, tp, LOCATION_DECK, 0, 1, 1, tc)
  		g:AddCard(tc)
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  function s.tgfilter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.eqfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER)
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.tgfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0
  			and Duel.IsExistingTarget(s.tgfilter, tp, LOCATION_MZONE, 0, 1, nil)
  			and Duel.IsExistingMatchingCard(s.eqfilter, tp, LOCATION_EXTRA, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	Duel.SelectTarget(tp, s.tgfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, nil, 1, tp, LOCATION_EXTRA)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and tc:IsFaceup() and Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  		local g = Duel.SelectMatchingCard(tp, s.eqfilter, tp, LOCATION_EXTRA, 0, 1, 1, nil)
  		local ec = g:GetFirst()
  		if ec then
  			if not Duel.Equip(tp, ec, tc) then
  				return
  			end
  			--equip limit
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_EQUIP_LIMIT)
  			e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  			e1:SetLabelObject(tc)
  			e1:SetValue(s.eqlimit)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			ec:RegisterEffect(e1)
  			local e2 = Effect.CreateEffect(e:GetHandler())
  			e2:SetType(EFFECT_TYPE_EQUIP)
  			e2:SetCode(EFFECT_UPDATE_ATTACK)
  			e2:SetValue(400)
  			e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  			ec:RegisterEffect(e2)
  		end
  	end
  end
  function s.eqlimit(e, c)
  	return c == e:GetLabelObject()
  end
  
  