name: Prank-Kids
card_text: 2 "Prank-Kids" monsters
  If your "Prank-Kids" monster attacks, your opponent cannot activate cards or effects until the end of the Damage Step. During your opponent's turn (Quick Effect): You can Tribute this card, then target 2 "Prank-Kids" non-Fusion Monsters with different names in your GY; Special Summon them. They cannot be destroyed by battle this turn. You can only use this effect of "Prank-Kids Weather Washer" once per turn.
external_ids: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 25725326 --Prank-Kids Meow-Meow-Mu
  local SETCARD_ID_0 = 0x120 --Prank-Kids
  
lua: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 25725326 --Prank-Kids Meow-Meow-Mu
  local SETCARD_ID_0 = 0x120 --Prank-Kids
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcFunRep(c, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_0), 2, true)
  	--actlimit
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTargetRange(0, 1)
  	e1:SetValue(1)
  	e1:SetCondition(s.actcon)
  	c:RegisterEffect(e1)
  	--spsummon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id)
  	e2:SetHintTiming(0, TIMING_BATTLE_START + TIMING_END_PHASE)
  	e2:SetCondition(s.spcon)
  	e2:SetCost(s.spcost)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  end
  function s.actcon(e)
  	local a = Duel.GetAttacker()
  	return a and a:IsControler(e:GetHandlerPlayer()) and a:IsSetCard(SETCARD_ID_0)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() ~= tp
  end
  function s.excostfilter(c, tp)
  	return (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) and c:IsAbleToRemoveAsCost() and c:IsHasEffect(CARD_ID_1, tp)
  end
  function s.costfilter(c, tp, g)
  	local tg = g:Clone()
  	tg:RemoveCard(c)
  	return Duel.GetMZoneCount(tp, c) > 1 and tg:GetClassCount(Card.GetCode) >= 2
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	e:SetLabel(0)
  	local g = Duel.GetMatchingGroup(s.excostfilter, tp, LOCATION_MZONE + LOCATION_GRAVE, 0, nil, tp)
  	local tg = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_GRAVE, 0, nil, e, tp)
  	if e:GetHandler():IsReleasable() then
  		g:AddCard(e:GetHandler())
  	end
  	if chk == 0 then
  		e:SetLabel(100)
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) and g:IsExists(s.costfilter, 1, nil, tp, tg)
  	end
  	local cg = g:Filter(s.costfilter, nil, tp, tg)
  	local tc
  	if #cg > 1 then
  		Duel.Hint(HINT_SELECTMSG, tp, aux.Stringid(CARD_ID_1, 0))
  		tc = cg:Select(tp, 1, 1, nil):GetFirst()
  	else
  		tc = cg:GetFirst()
  	end
  	local te = tc:IsHasEffect(CARD_ID_1, tp)
  	if te then
  		te:UseCountLimit(tp)
  		Duel.Remove(tc, POS_FACEUP, REASON_COST + REASON_REPLACE)
  	else
  		Duel.Release(tc, REASON_COST)
  	end
  end
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and not c:IsType(TYPE_FUSION) and c:IsCanBeEffectTarget(e) 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 false
  	end
  	if chk == 0 then
  		return e:GetLabel() == 100
  	end
  	e:SetLabel(0)
  	local g = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_GRAVE, 0, nil, e, tp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g1 = g:SelectSubGroup(tp, aux.dncheck, false, 2, 2)
  	Duel.SetTargetCard(g1)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g1, 2, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	local tg = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS)
  	local g = tg:Filter(Card.IsRelateToEffect, nil, e)
  	if g:GetCount() == 0 or ft <= 0 or (g:GetCount() > 1 and Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)) then
  		return
  	end
  	if ft < g:GetCount() then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		g = g:Select(tp, ft, ft, nil)
  	end
  	local tc = g:GetFirst()
  	while tc do
  		if Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP) then
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  			e1:SetValue(1)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			tc:RegisterEffect(e1)
  		end
  		tc = g:GetNext()
  	end
  	Duel.SpecialSummonComplete()
  end
  
  
source_text: Prank-Kids
  2 "Prank-Kids" monsters
  If your "Prank-Kids" monster attacks, your opponent cannot activate cards or effects until the end of the Damage Step. During your opponent's turn (Quick Effect): You can Tribute this card, then target 2 "Prank-Kids" non-Fusion Monsters with different names in your GY; Special Summon them. They cannot be destroyed by battle this turn. You can only use this effect of "Prank-Kids Weather Washer" once per turn.
target_text: -- Prank-Kids
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 25725326 --Prank-Kids Meow-Meow-Mu
  local SETCARD_ID_0 = 0x120 --Prank-Kids
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcFunRep(c, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_0), 2, true)
  	--actlimit
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTargetRange(0, 1)
  	e1:SetValue(1)
  	e1:SetCondition(s.actcon)
  	c:RegisterEffect(e1)
  	--spsummon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id)
  	e2:SetHintTiming(0, TIMING_BATTLE_START + TIMING_END_PHASE)
  	e2:SetCondition(s.spcon)
  	e2:SetCost(s.spcost)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  end
  function s.actcon(e)
  	local a = Duel.GetAttacker()
  	return a and a:IsControler(e:GetHandlerPlayer()) and a:IsSetCard(SETCARD_ID_0)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() ~= tp
  end
  function s.excostfilter(c, tp)
  	return (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) and c:IsAbleToRemoveAsCost() and c:IsHasEffect(CARD_ID_1, tp)
  end
  function s.costfilter(c, tp, g)
  	local tg = g:Clone()
  	tg:RemoveCard(c)
  	return Duel.GetMZoneCount(tp, c) > 1 and tg:GetClassCount(Card.GetCode) >= 2
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	e:SetLabel(0)
  	local g = Duel.GetMatchingGroup(s.excostfilter, tp, LOCATION_MZONE + LOCATION_GRAVE, 0, nil, tp)
  	local tg = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_GRAVE, 0, nil, e, tp)
  	if e:GetHandler():IsReleasable() then
  		g:AddCard(e:GetHandler())
  	end
  	if chk == 0 then
  		e:SetLabel(100)
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) and g:IsExists(s.costfilter, 1, nil, tp, tg)
  	end
  	local cg = g:Filter(s.costfilter, nil, tp, tg)
  	local tc
  	if #cg > 1 then
  		Duel.Hint(HINT_SELECTMSG, tp, aux.Stringid(CARD_ID_1, 0))
  		tc = cg:Select(tp, 1, 1, nil):GetFirst()
  	else
  		tc = cg:GetFirst()
  	end
  	local te = tc:IsHasEffect(CARD_ID_1, tp)
  	if te then
  		te:UseCountLimit(tp)
  		Duel.Remove(tc, POS_FACEUP, REASON_COST + REASON_REPLACE)
  	else
  		Duel.Release(tc, REASON_COST)
  	end
  end
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and not c:IsType(TYPE_FUSION) and c:IsCanBeEffectTarget(e) 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 false
  	end
  	if chk == 0 then
  		return e:GetLabel() == 100
  	end
  	e:SetLabel(0)
  	local g = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_GRAVE, 0, nil, e, tp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g1 = g:SelectSubGroup(tp, aux.dncheck, false, 2, 2)
  	Duel.SetTargetCard(g1)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g1, 2, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	local tg = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS)
  	local g = tg:Filter(Card.IsRelateToEffect, nil, e)
  	if g:GetCount() == 0 or ft <= 0 or (g:GetCount() > 1 and Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)) then
  		return
  	end
  	if ft < g:GetCount() then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		g = g:Select(tp, ft, ft, nil)
  	end
  	local tc = g:GetFirst()
  	while tc do
  		if Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP) then
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  			e1:SetValue(1)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			tc:RegisterEffect(e1)
  		end
  		tc = g:GetNext()
  	end
  	Duel.SpecialSummonComplete()
  end
  
  