name: Performapal
card_text: Pendulum Scale = 4
  [ Pendulum Effect ]
  If your opponent controls a face-up monster that was Special Summoned from the Extra Deck and you do not: You can Special Summon this card from your Pendulum Zone. You can only use this effect of "Performapal Whim Witch" once per turn.
  ----------------------------------------
  [ Monster Effect ]
  This card can be treated as 2 Tributes for the Tribute Summon of a Pendulum Monster.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--pendulum summon
  	aux.EnablePendulumAttribute(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_PZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--double tribute
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_DOUBLE_TRIBUTE)
  	e2:SetValue(s.dtcon)
  	c:RegisterEffect(e2)
  end
  function s.cfilter(c)
  	return c:IsSummonLocation(LOCATION_EXTRA)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return not Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil) and Duel.IsExistingMatchingCard(s.cfilter, tp, 0, LOCATION_MZONE, 1, nil)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) then
  		return
  	end
  	Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  end
  function s.dtcon(e, c)
  	return c:IsType(TYPE_PENDULUM)
  end
  
  
source_text: Performapal
  Pendulum Scale = 4
  [ Pendulum Effect ]
  If your opponent controls a face-up monster that was Special Summoned from the Extra Deck and you do not: You can Special Summon this card from your Pendulum Zone. You can only use this effect of "Performapal Whim Witch" once per turn.
  ----------------------------------------
  [ Monster Effect ]
  This card can be treated as 2 Tributes for the Tribute Summon of a Pendulum Monster.
target_text: -- Performapal
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--pendulum summon
  	aux.EnablePendulumAttribute(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_PZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--double tribute
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_DOUBLE_TRIBUTE)
  	e2:SetValue(s.dtcon)
  	c:RegisterEffect(e2)
  end
  function s.cfilter(c)
  	return c:IsSummonLocation(LOCATION_EXTRA)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return not Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil) and Duel.IsExistingMatchingCard(s.cfilter, tp, 0, LOCATION_MZONE, 1, nil)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) then
  		return
  	end
  	Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  end
  function s.dtcon(e, c)
  	return c:IsType(TYPE_PENDULUM)
  end
  
  