name: Patissciel
card_text: Pendulum Scale = 1
  [ Pendulum Effect ]
  If you have no card in your other Pendulum Zone: You can place 1 face-up Pendulum Monster from your Extra Deck in your Pendulum Zone. You can only use this effect of "Patissciel Couverture" once per turn.
  ----------------------------------------
  [ Monster Effect ]
  2 Pendulum Monsters
  If this card in the Monster Zone is destroyed: You can place this card in your Pendulum Zone.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	aux.AddFusionProcFunRep(c, aux.FilterBoolFunction(Card.IsFusionType, TYPE_PENDULUM), 2, true)
  	aux.EnablePendulumAttribute(c, false)
  	--pendulum set
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_PZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.pctg)
  	e1:SetOperation(s.pcop)
  	c:RegisterEffect(e1)
  	--pendulum
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_DESTROYED)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCondition(s.pencon)
  	e2:SetTarget(s.pentg)
  	e2:SetOperation(s.penop)
  	c:RegisterEffect(e2)
  end
  function s.pcfilter(c, tp)
  	return c:IsFaceup() and c:IsType(TYPE_PENDULUM) and not c:IsForbidden() and c:CheckUniqueOnField(tp, LOCATION_SZONE)
  end
  function s.pctg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return (Duel.CheckLocation(tp, LOCATION_PZONE, 0) or Duel.CheckLocation(tp, LOCATION_PZONE, 1)) and Duel.IsExistingMatchingCard(s.pcfilter, tp, LOCATION_EXTRA, 0, 1, nil, tp)
  	end
  end
  function s.pcop(e, tp, eg, ep, ev, re, r, rp)
  	if not Duel.CheckLocation(tp, LOCATION_PZONE, 0) and not Duel.CheckLocation(tp, LOCATION_PZONE, 1) then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOFIELD)
  	local g = Duel.SelectMatchingCard(tp, s.pcfilter, tp, LOCATION_EXTRA, 0, 1, 1, nil, tp)
  	if g:GetCount() > 0 then
  		Duel.MoveToField(g:GetFirst(), tp, tp, LOCATION_PZONE, POS_FACEUP, true)
  	end
  end
  function s.pencon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup()
  end
  function s.pentg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLocation(tp, LOCATION_PZONE, 0) or Duel.CheckLocation(tp, LOCATION_PZONE, 1)
  	end
  end
  function s.penop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		Duel.MoveToField(c, tp, tp, LOCATION_PZONE, POS_FACEUP, true)
  	end
  end
  
  
source_text: Patissciel
  Pendulum Scale = 1
  [ Pendulum Effect ]
  If you have no card in your other Pendulum Zone: You can place 1 face-up Pendulum Monster from your Extra Deck in your Pendulum Zone. You can only use this effect of "Patissciel Couverture" once per turn.
  ----------------------------------------
  [ Monster Effect ]
  2 Pendulum Monsters
  If this card in the Monster Zone is destroyed: You can place this card in your Pendulum Zone.
target_text: -- Patissciel
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	aux.AddFusionProcFunRep(c, aux.FilterBoolFunction(Card.IsFusionType, TYPE_PENDULUM), 2, true)
  	aux.EnablePendulumAttribute(c, false)
  	--pendulum set
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_PZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.pctg)
  	e1:SetOperation(s.pcop)
  	c:RegisterEffect(e1)
  	--pendulum
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_DESTROYED)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCondition(s.pencon)
  	e2:SetTarget(s.pentg)
  	e2:SetOperation(s.penop)
  	c:RegisterEffect(e2)
  end
  function s.pcfilter(c, tp)
  	return c:IsFaceup() and c:IsType(TYPE_PENDULUM) and not c:IsForbidden() and c:CheckUniqueOnField(tp, LOCATION_SZONE)
  end
  function s.pctg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return (Duel.CheckLocation(tp, LOCATION_PZONE, 0) or Duel.CheckLocation(tp, LOCATION_PZONE, 1)) and Duel.IsExistingMatchingCard(s.pcfilter, tp, LOCATION_EXTRA, 0, 1, nil, tp)
  	end
  end
  function s.pcop(e, tp, eg, ep, ev, re, r, rp)
  	if not Duel.CheckLocation(tp, LOCATION_PZONE, 0) and not Duel.CheckLocation(tp, LOCATION_PZONE, 1) then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOFIELD)
  	local g = Duel.SelectMatchingCard(tp, s.pcfilter, tp, LOCATION_EXTRA, 0, 1, 1, nil, tp)
  	if g:GetCount() > 0 then
  		Duel.MoveToField(g:GetFirst(), tp, tp, LOCATION_PZONE, POS_FACEUP, true)
  	end
  end
  function s.pencon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup()
  end
  function s.pentg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLocation(tp, LOCATION_PZONE, 0) or Duel.CheckLocation(tp, LOCATION_PZONE, 1)
  	end
  end
  function s.penop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		Duel.MoveToField(c, tp, tp, LOCATION_PZONE, POS_FACEUP, true)
  	end
  end
  
  