name: Fluffal
card_text: When this card is Normal or Special Summoned from the hand: You can add 1 "Polymerization" from your Deck to your hand. You can pay 500 LP; Fusion Summon 1 "Frightfur" Fusion Monster from your Extra Deck, using monsters from your hand or field as Fusion Materials. You can only use 1 "Fluffal Owl" effect per turn, and only once that turn.
external_ids: local CARD_ID_0 = 24094653 --Polymerization
  local SETCARD_ID_0 = 0xad --Frightfur
  
lua: local CARD_ID_0 = 24094653 --Polymerization
  local SETCARD_ID_0 = 0xad --Frightfur
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--search
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.thcon)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  	--fusion summon
  	local e3 = FusionSpell.CreateSummonEffect(c, {
  		fusfilter = s.fusfilter,
  	})
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1, id)
  	e3:SetCost(s.cost)
  	c:RegisterEffect(e3)
  end
  
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsPreviousLocation(LOCATION_HAND)
  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, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 500)
  	end
  	Duel.PayLPCost(tp, 500)
  end
  
  function s.fusfilter(c)
  	return c:IsSetCard(SETCARD_ID_0)
  end
  
  
source_text: Fluffal
  When this card is Normal or Special Summoned from the hand: You can add 1 "Polymerization" from your Deck to your hand. You can pay 500 LP; Fusion Summon 1 "Frightfur" Fusion Monster from your Extra Deck, using monsters from your hand or field as Fusion Materials. You can only use 1 "Fluffal Owl" effect per turn, and only once that turn.
target_text: -- Fluffal
  local CARD_ID_0 = 24094653 --Polymerization
  local SETCARD_ID_0 = 0xad --Frightfur
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--search
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.thcon)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  	--fusion summon
  	local e3 = FusionSpell.CreateSummonEffect(c, {
  		fusfilter = s.fusfilter,
  	})
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1, id)
  	e3:SetCost(s.cost)
  	c:RegisterEffect(e3)
  end
  
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsPreviousLocation(LOCATION_HAND)
  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, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 500)
  	end
  	Duel.PayLPCost(tp, 500)
  end
  
  function s.fusfilter(c)
  	return c:IsSetCard(SETCARD_ID_0)
  end
  
  