name: Wattsychic
card_text: Special Summon up to 2 Level 3 or lower LIGHT monsters from your hand. If you Summoned 2 monsters with the same original Type, those monsters can attack directly this turn. If they have the same original Level, they also cannot be destroyed by battle this turn. You can only activate 1 "Wattsychic Fighting Porter" per 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)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.filter(c, e, tp)
  	return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsLevelBelow(3) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local ct = math.min(2, (Duel.GetLocationCount(tp, LOCATION_MZONE)))
  	if ct <= 0 then
  		return
  	end
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		ct = 1
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_HAND, 0, 1, ct, nil, e, tp)
  	if g:GetCount() == 0 then
  		return
  	end
  	for tc in aux.Next(g) do
  		Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP)
  		if g:GetClassCount(Card.GetOriginalRace) == 1 and g:GetCount() > 1 then
  			local e1 = Effect.CreateEffect(c)
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_DIRECT_ATTACK)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			tc:RegisterEffect(e1)
  		end
  		if g:GetClassCount(Card.GetOriginalLevel) == 1 and g:GetCount() > 1 then
  			local e2 = Effect.CreateEffect(c)
  			e2:SetType(EFFECT_TYPE_SINGLE)
  			e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  			e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			e2:SetValue(1)
  			tc:RegisterEffect(e2)
  		end
  	end
  	Duel.SpecialSummonComplete()
  end
  
  
source_text: Wattsychic
  Special Summon up to 2 Level 3 or lower LIGHT monsters from your hand. If you Summoned 2 monsters with the same original Type, those monsters can attack directly this turn. If they have the same original Level, they also cannot be destroyed by battle this turn. You can only activate 1 "Wattsychic Fighting Porter" per turn.
target_text: -- Wattsychic
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.filter(c, e, tp)
  	return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsLevelBelow(3) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local ct = math.min(2, (Duel.GetLocationCount(tp, LOCATION_MZONE)))
  	if ct <= 0 then
  		return
  	end
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		ct = 1
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_HAND, 0, 1, ct, nil, e, tp)
  	if g:GetCount() == 0 then
  		return
  	end
  	for tc in aux.Next(g) do
  		Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP)
  		if g:GetClassCount(Card.GetOriginalRace) == 1 and g:GetCount() > 1 then
  			local e1 = Effect.CreateEffect(c)
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_DIRECT_ATTACK)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			tc:RegisterEffect(e1)
  		end
  		if g:GetClassCount(Card.GetOriginalLevel) == 1 and g:GetCount() > 1 then
  			local e2 = Effect.CreateEffect(c)
  			e2:SetType(EFFECT_TYPE_SINGLE)
  			e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  			e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			e2:SetValue(1)
  			tc:RegisterEffect(e2)
  		end
  	end
  	Duel.SpecialSummonComplete()
  end
  
  