name: Blue-Eyes
card_text: Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand) by Tributing 2 monsters, while you control "Toon World". Cannot attack the turn it is Special Summoned. You must pay 500 LP to declare an attack with this monster. If "Toon World" on the field is destroyed, destroy this card. Can attack your opponent directly, unless they control a Toon monster, in which case this card must target a Toon monster for its attacks.
external_ids: local CARD_ID_0 = 15259703 --Toon World
  
lua: local CARD_ID_0 = 15259703 --Toon World
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	c:EnableReviveLimit()
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_SPSUMMON_PROC)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetRange(LOCATION_HAND)
  	e2:SetCondition(s.spcon)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  	--destroy
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCode(EVENT_LEAVE_FIELD)
  	e3:SetCondition(s.sdescon)
  	e3:SetOperation(s.sdesop)
  	c:RegisterEffect(e3)
  	--direct attack
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_SINGLE)
  	e4:SetCode(EFFECT_DIRECT_ATTACK)
  	e4:SetCondition(s.dircon)
  	c:RegisterEffect(e4)
  	local e5 = Effect.CreateEffect(c)
  	e5:SetType(EFFECT_TYPE_SINGLE)
  	e5:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
  	e5:SetCondition(s.atcon)
  	e5:SetValue(s.atlimit)
  	c:RegisterEffect(e5)
  	local e6 = Effect.CreateEffect(c)
  	e6:SetType(EFFECT_TYPE_SINGLE)
  	e6:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
  	e6:SetCondition(s.atcon)
  	c:RegisterEffect(e6)
  	--cannot attack
  	local e7 = Effect.CreateEffect(c)
  	e7:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e7:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e7:SetOperation(s.atklimit)
  	c:RegisterEffect(e7)
  	--attack cost
  	local e8 = Effect.CreateEffect(c)
  	e8:SetType(EFFECT_TYPE_SINGLE)
  	e8:SetCode(EFFECT_ATTACK_COST)
  	e8:SetCost(s.atcost)
  	e8:SetOperation(s.atop)
  	c:RegisterEffect(e8)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	local rg = Duel.GetReleaseGroup(tp, false, REASON_SPSUMMON)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_ONFIELD, 0, 1, nil) and rg:CheckSubGroup(aux.mzctcheckrel, 2, 2, tp, REASON_SPSUMMON)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local rg = Duel.GetReleaseGroup(tp, false, REASON_SPSUMMON)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local sg = rg:SelectSubGroup(tp, aux.mzctcheckrel, true, 2, 2, tp, REASON_SPSUMMON)
  	if sg then
  		sg:KeepAlive()
  		e:SetLabelObject(sg)
  		return true
  	else
  		return false
  	end
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
  	local g = e:GetLabelObject()
  	Duel.Release(g, REASON_SPSUMMON)
  	g:DeleteGroup()
  end
  function s.sfilter(c)
  	return c:IsReason(REASON_DESTROY) and c:IsPreviousPosition(POS_FACEUP) and c:GetPreviousCodeOnField() == CARD_ID_0 and c:IsPreviousLocation(LOCATION_ONFIELD)
  end
  function s.sdescon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.sfilter, 1, nil)
  end
  function s.sdesop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Destroy(e:GetHandler(), REASON_EFFECT)
  end
  function s.atkfilter(c)
  	return c:IsFaceup() and c:IsType(TYPE_TOON)
  end
  function s.dircon(e)
  	return not Duel.IsExistingMatchingCard(s.atkfilter, e:GetHandlerPlayer(), 0, LOCATION_MZONE, 1, nil)
  end
  function s.atcon(e)
  	return Duel.IsExistingMatchingCard(s.atkfilter, e:GetHandlerPlayer(), 0, LOCATION_MZONE, 1, nil)
  end
  function s.atlimit(e, c)
  	return not c:IsType(TYPE_TOON) or c:IsFacedown()
  end
  function s.atklimit(e, tp, eg, ep, ev, re, r, rp)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_CANNOT_ATTACK)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  	e:GetHandler():RegisterEffect(e1)
  end
  function s.atcost(e, c, tp)
  	return Duel.CheckLPCost(tp, 500)
  end
  function s.atop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.PayLPCost(tp, 500)
  end
  
  
source_text: Blue-Eyes
  Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand) by Tributing 2 monsters, while you control "Toon World". Cannot attack the turn it is Special Summoned. You must pay 500 LP to declare an attack with this monster. If "Toon World" on the field is destroyed, destroy this card. Can attack your opponent directly, unless they control a Toon monster, in which case this card must target a Toon monster for its attacks.
target_text: -- Blue-Eyes
  local CARD_ID_0 = 15259703 --Toon World
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	c:EnableReviveLimit()
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_SPSUMMON_PROC)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetRange(LOCATION_HAND)
  	e2:SetCondition(s.spcon)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  	--destroy
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCode(EVENT_LEAVE_FIELD)
  	e3:SetCondition(s.sdescon)
  	e3:SetOperation(s.sdesop)
  	c:RegisterEffect(e3)
  	--direct attack
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_SINGLE)
  	e4:SetCode(EFFECT_DIRECT_ATTACK)
  	e4:SetCondition(s.dircon)
  	c:RegisterEffect(e4)
  	local e5 = Effect.CreateEffect(c)
  	e5:SetType(EFFECT_TYPE_SINGLE)
  	e5:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
  	e5:SetCondition(s.atcon)
  	e5:SetValue(s.atlimit)
  	c:RegisterEffect(e5)
  	local e6 = Effect.CreateEffect(c)
  	e6:SetType(EFFECT_TYPE_SINGLE)
  	e6:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
  	e6:SetCondition(s.atcon)
  	c:RegisterEffect(e6)
  	--cannot attack
  	local e7 = Effect.CreateEffect(c)
  	e7:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e7:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e7:SetOperation(s.atklimit)
  	c:RegisterEffect(e7)
  	--attack cost
  	local e8 = Effect.CreateEffect(c)
  	e8:SetType(EFFECT_TYPE_SINGLE)
  	e8:SetCode(EFFECT_ATTACK_COST)
  	e8:SetCost(s.atcost)
  	e8:SetOperation(s.atop)
  	c:RegisterEffect(e8)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	local rg = Duel.GetReleaseGroup(tp, false, REASON_SPSUMMON)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_ONFIELD, 0, 1, nil) and rg:CheckSubGroup(aux.mzctcheckrel, 2, 2, tp, REASON_SPSUMMON)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local rg = Duel.GetReleaseGroup(tp, false, REASON_SPSUMMON)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local sg = rg:SelectSubGroup(tp, aux.mzctcheckrel, true, 2, 2, tp, REASON_SPSUMMON)
  	if sg then
  		sg:KeepAlive()
  		e:SetLabelObject(sg)
  		return true
  	else
  		return false
  	end
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
  	local g = e:GetLabelObject()
  	Duel.Release(g, REASON_SPSUMMON)
  	g:DeleteGroup()
  end
  function s.sfilter(c)
  	return c:IsReason(REASON_DESTROY) and c:IsPreviousPosition(POS_FACEUP) and c:GetPreviousCodeOnField() == CARD_ID_0 and c:IsPreviousLocation(LOCATION_ONFIELD)
  end
  function s.sdescon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.sfilter, 1, nil)
  end
  function s.sdesop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Destroy(e:GetHandler(), REASON_EFFECT)
  end
  function s.atkfilter(c)
  	return c:IsFaceup() and c:IsType(TYPE_TOON)
  end
  function s.dircon(e)
  	return not Duel.IsExistingMatchingCard(s.atkfilter, e:GetHandlerPlayer(), 0, LOCATION_MZONE, 1, nil)
  end
  function s.atcon(e)
  	return Duel.IsExistingMatchingCard(s.atkfilter, e:GetHandlerPlayer(), 0, LOCATION_MZONE, 1, nil)
  end
  function s.atlimit(e, c)
  	return not c:IsType(TYPE_TOON) or c:IsFacedown()
  end
  function s.atklimit(e, tp, eg, ep, ev, re, r, rp)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_CANNOT_ATTACK)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  	e:GetHandler():RegisterEffect(e1)
  end
  function s.atcost(e, c, tp)
  	return Duel.CheckLPCost(tp, 500)
  end
  function s.atop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.PayLPCost(tp, 500)
  end
  
  