name: Performapal
card_text: Pendulum Scale = 4
  [ Pendulum Effect ]
  Once per turn: You can Fusion Summon 1 Fusion Monster from your Extra Deck, using monsters you control as Fusion Materials.
  ----------------------------------------
  [ Monster Effect ]
  You can Tribute this card; add 1 "Polymerization" from your Deck or Graveyard to your hand.
external_ids: local CARD_ID_0 = 24094653 --Polymerization
  
lua: local CARD_ID_0 = 24094653 --Polymerization
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--pendulum summon
  	aux.EnablePendulumAttribute(c)
  	--fusion summon
  	local e1 = FusionSpell.CreateSummonEffect(c, {
  		pre_select_mat_location = LOCATION_MZONE,
  	})
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_PZONE)
  	e1:SetCountLimit(1)
  	c:RegisterEffect(e1)
  	--tohand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetCategory(CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCost(s.thcost)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  end
  
  function s.thcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsReleasable()
  	end
  	Duel.Release(e:GetHandler(), REASON_COST)
  end
  
  function s.thfilter(c)
  	return c:IsCode(CARD_ID_0) and c:IsAbleToHand()
  end
  
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK + LOCATION_GRAVE)
  end
  
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.thfilter), tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  
source_text: Performapal
  Pendulum Scale = 4
  [ Pendulum Effect ]
  Once per turn: You can Fusion Summon 1 Fusion Monster from your Extra Deck, using monsters you control as Fusion Materials.
  ----------------------------------------
  [ Monster Effect ]
  You can Tribute this card; add 1 "Polymerization" from your Deck or Graveyard to your hand.
target_text: -- Performapal
  local CARD_ID_0 = 24094653 --Polymerization
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--pendulum summon
  	aux.EnablePendulumAttribute(c)
  	--fusion summon
  	local e1 = FusionSpell.CreateSummonEffect(c, {
  		pre_select_mat_location = LOCATION_MZONE,
  	})
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_PZONE)
  	e1:SetCountLimit(1)
  	c:RegisterEffect(e1)
  	--tohand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetCategory(CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCost(s.thcost)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  end
  
  function s.thcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsReleasable()
  	end
  	Duel.Release(e:GetHandler(), REASON_COST)
  end
  
  function s.thfilter(c)
  	return c:IsCode(CARD_ID_0) and c:IsAbleToHand()
  end
  
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK + LOCATION_GRAVE)
  end
  
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.thfilter), tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  