name: White
card_text: If this card is in your hand: You can target 1 Level 4 or lower Fish monster in your GY with the same name as a card you control; Special Summon this card, and if you do, Special Summon that monster. You can only use this effect of "White Sunfish" once per turn. If this card is Special Summoned from the GY: You can treat it as a Tuner this turn.
external_ids: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  
lua: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--Tuner
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCondition(s.tncon)
  	e2:SetOperation(s.tnop)
  	c:RegisterEffect(e2)
  end
  s.treat_itself_tuner = true
  function s.filter(c, e, tp)
  	return c:IsLevelBelow(4) and c:IsRace(RACE_FISH) and Duel.IsExistingMatchingCard(Card.IsCode, tp, LOCATION_ONFIELD, 0, 1, nil, c:GetCode()) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc, e, tp)
  	end
  	local c = e:GetHandler()
  	if chk == 0 then
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			and Duel.GetLocationCount(tp, LOCATION_MZONE) > 1
  			and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  			and Duel.IsExistingTarget(s.filter, tp, LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectTarget(tp, s.filter, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp) + c
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 2, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if not c:IsRelateToEffect(e) then
  		return
  	end
  	if
  		Duel.SpecialSummonStep(c, 0, tp, tp, false, false, POS_FACEUP)
  		and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  		and tc:IsRelateToEffect(e)
  		and not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  	then
  		Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP)
  	end
  	Duel.SpecialSummonComplete()
  end
  function s.tncon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsPreviousLocation(LOCATION_GRAVE)
  end
  function s.tnop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetCode(EFFECT_ADD_TYPE)
  		e1:SetValue(TYPE_TUNER)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  	end
  end
  
  
source_text: White
  If this card is in your hand: You can target 1 Level 4 or lower Fish monster in your GY with the same name as a card you control; Special Summon this card, and if you do, Special Summon that monster. You can only use this effect of "White Sunfish" once per turn. If this card is Special Summoned from the GY: You can treat it as a Tuner this turn.
target_text: -- White
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--Tuner
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCondition(s.tncon)
  	e2:SetOperation(s.tnop)
  	c:RegisterEffect(e2)
  end
  s.treat_itself_tuner = true
  function s.filter(c, e, tp)
  	return c:IsLevelBelow(4) and c:IsRace(RACE_FISH) and Duel.IsExistingMatchingCard(Card.IsCode, tp, LOCATION_ONFIELD, 0, 1, nil, c:GetCode()) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc, e, tp)
  	end
  	local c = e:GetHandler()
  	if chk == 0 then
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			and Duel.GetLocationCount(tp, LOCATION_MZONE) > 1
  			and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  			and Duel.IsExistingTarget(s.filter, tp, LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectTarget(tp, s.filter, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp) + c
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 2, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if not c:IsRelateToEffect(e) then
  		return
  	end
  	if
  		Duel.SpecialSummonStep(c, 0, tp, tp, false, false, POS_FACEUP)
  		and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  		and tc:IsRelateToEffect(e)
  		and not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  	then
  		Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP)
  	end
  	Duel.SpecialSummonComplete()
  end
  function s.tncon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsPreviousLocation(LOCATION_GRAVE)
  end
  function s.tnop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetCode(EFFECT_ADD_TYPE)
  		e1:SetValue(TYPE_TUNER)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  	end
  end
  
  