name: Prank-Kids
card_text: "Prank-Kids Lampsies" + "Prank-Kids Dropsies" + "Prank-Kids Fansies"
  Must be Fusion Summoned. (Quick Effect): You can Tribute this card; destroy all monsters your opponent controls. If this card in your possession is sent to your GY by your opponent's card: You can target 1 non-Fusion Monster in your GY; Special Summon it. You can only use this effect of "Prank-Kids Battle Butler" once per turn.
external_ids: local CARD_ID_0 = 55725117 --Prank-Kids Dropsies
  local CARD_ID_1 = 25725326 --Prank-Kids Meow-Meow-Mu
  local CARD_ID_2 = 81119816 --Prank-Kids Fansies
  local CARD_ID_3 = 18236002 --Prank-Kids Lampsies
  
lua: local CARD_ID_0 = 55725117 --Prank-Kids Dropsies
  local CARD_ID_1 = 25725326 --Prank-Kids Meow-Meow-Mu
  local CARD_ID_2 = 81119816 --Prank-Kids Fansies
  local CARD_ID_3 = 18236002 --Prank-Kids Lampsies
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcCode3(c, CARD_ID_2, CARD_ID_3, CARD_ID_0, true, true)
  	--spsummon condition
  	local e0 = Effect.CreateEffect(c)
  	e0:SetType(EFFECT_TYPE_SINGLE)
  	e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e0:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e0:SetValue(aux.fuslimit)
  	c:RegisterEffect(e0)
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCost(s.descost)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  	--spsum
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DELAY)
  	e2:SetCode(EVENT_TO_GRAVE)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.spcon)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  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.descost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(s.excostfilter, tp, LOCATION_MZONE + LOCATION_GRAVE, 0, nil, tp)
  	if e:GetHandler():IsReleasable() then
  		g:AddCard(e:GetHandler())
  	end
  	if chk == 0 then
  		return #g > 0
  	end
  	local tc
  	if #g > 1 then
  		Duel.Hint(HINT_SELECTMSG, tp, aux.Stringid(CARD_ID_1, 0))
  		tc = g:Select(tp, 1, 1, nil):GetFirst()
  	else
  		tc = g: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.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(aux.TRUE, tp, 0, LOCATION_MZONE, nil)
  	if chk == 0 then
  		return #g > 0
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, #g, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(aux.TRUE, tp, 0, LOCATION_MZONE, nil)
  	Duel.Destroy(g, REASON_EFFECT)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return rp == 1 - tp and c:IsPreviousControler(tp)
  end
  function s.spfilter(c, e, tp)
  	return not c:IsType(TYPE_FUSION) 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 s.spfilter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingTarget(s.spfilter, tp, LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectTarget(tp, s.spfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc and tc:IsRelateToEffect(e) then
  		Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  
  
source_text: Prank-Kids
  "Prank-Kids Lampsies" + "Prank-Kids Dropsies" + "Prank-Kids Fansies"
  Must be Fusion Summoned. (Quick Effect): You can Tribute this card; destroy all monsters your opponent controls. If this card in your possession is sent to your GY by your opponent's card: You can target 1 non-Fusion Monster in your GY; Special Summon it. You can only use this effect of "Prank-Kids Battle Butler" once per turn.
target_text: -- Prank-Kids
  local CARD_ID_0 = 55725117 --Prank-Kids Dropsies
  local CARD_ID_1 = 25725326 --Prank-Kids Meow-Meow-Mu
  local CARD_ID_2 = 81119816 --Prank-Kids Fansies
  local CARD_ID_3 = 18236002 --Prank-Kids Lampsies
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcCode3(c, CARD_ID_2, CARD_ID_3, CARD_ID_0, true, true)
  	--spsummon condition
  	local e0 = Effect.CreateEffect(c)
  	e0:SetType(EFFECT_TYPE_SINGLE)
  	e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e0:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e0:SetValue(aux.fuslimit)
  	c:RegisterEffect(e0)
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCost(s.descost)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  	--spsum
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DELAY)
  	e2:SetCode(EVENT_TO_GRAVE)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.spcon)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  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.descost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(s.excostfilter, tp, LOCATION_MZONE + LOCATION_GRAVE, 0, nil, tp)
  	if e:GetHandler():IsReleasable() then
  		g:AddCard(e:GetHandler())
  	end
  	if chk == 0 then
  		return #g > 0
  	end
  	local tc
  	if #g > 1 then
  		Duel.Hint(HINT_SELECTMSG, tp, aux.Stringid(CARD_ID_1, 0))
  		tc = g:Select(tp, 1, 1, nil):GetFirst()
  	else
  		tc = g: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.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(aux.TRUE, tp, 0, LOCATION_MZONE, nil)
  	if chk == 0 then
  		return #g > 0
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, #g, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(aux.TRUE, tp, 0, LOCATION_MZONE, nil)
  	Duel.Destroy(g, REASON_EFFECT)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return rp == 1 - tp and c:IsPreviousControler(tp)
  end
  function s.spfilter(c, e, tp)
  	return not c:IsType(TYPE_FUSION) 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 s.spfilter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingTarget(s.spfilter, tp, LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectTarget(tp, s.spfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc and tc:IsRelateToEffect(e) then
  		Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  
  