name: Yummyusment☆Mignon
card_text: "Yummy" monsters you control gain 500 ATK for each LIGHT Beast monster on the field. You can only use each of the following effects of "Yummyusment☆Mignon" once per turn. If you control a Link-1 monster: You can target 1 Level 1 "Yummy" monster in your GY; Special Summon it. If this card is in your GY: You can target 2 "Yummy" monsters in your GY and/or banishment; place this card, and them, on the bottom of the Deck in any order.
external_ids: local SETCARD_ID_0 = 0x1ca --Yummy
  
lua: local SETCARD_ID_0 = 0x1ca --Yummy
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--atk
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetTargetRange(LOCATION_MZONE, 0)
  	e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard, SETCARD_ID_0))
  	e2:SetValue(s.atkval)
  	c:RegisterEffect(e2)
  	--spsummon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetRange(LOCATION_FZONE)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e3:SetCountLimit(1, id)
  	e3:SetCondition(s.spcon)
  	e3:SetTarget(s.sptg)
  	e3:SetOperation(s.spop)
  	c:RegisterEffect(e3)
  	--to deck
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 2))
  	e4:SetCategory(CATEGORY_TODECK)
  	e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_GRAVE)
  	e4:SetCountLimit(1, id + o)
  	e4:SetTarget(s.tdtg)
  	e4:SetOperation(s.tdop)
  	c:RegisterEffect(e4)
  end
  function s.atkfilter(c)
  	return c:IsFaceup() and c:IsRace(RACE_BEAST) and c:IsAttribute(ATTRIBUTE_LIGHT)
  end
  function s.atkval(e, c)
  	return Duel.GetMatchingGroupCount(s.atkfilter, e:GetHandlerPlayer(), LOCATION_MZONE, LOCATION_MZONE, nil) * 500
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsLink(1)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsLevel(1) 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 chkc:IsControler(tp) 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:IsRelateToEffect(e) and aux.NecroValleyFilter()(tc) then
  		Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  function s.tdfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeck() and c:IsFaceupEx()
  end
  function s.tdtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local c = e:GetHandler()
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE + LOCATION_REMOVED) and chkc:IsControler(tp) and s.tdfilter(chkc)
  	end
  	if chk == 0 then
  		return c:IsAbleToDeck() and Duel.IsExistingTarget(s.tdfilter, tp, LOCATION_GRAVE + LOCATION_REMOVED, 0, 2, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
  	local g = Duel.SelectTarget(tp, s.tdfilter, tp, LOCATION_GRAVE + LOCATION_REMOVED, 0, 2, 2, nil)
  	g:AddCard(c)
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, g, g:GetCount(), 0, 0)
  end
  function s.tdop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local sg = Duel.GetTargetsRelateToChain():Filter(aux.NecroValleyFilter(aux.TRUE), nil)
  	if #sg == 0 then
  		return
  	end
  	if not c:IsRelateToEffect(e) or not aux.NecroValleyFilter()(c) then
  		return
  	end
  	sg:AddCard(c)
  	aux.PlaceCardsOnDeckBottom(tp, sg)
  end
  
  
source_text: Yummyusment☆Mignon
  "Yummy" monsters you control gain 500 ATK for each LIGHT Beast monster on the field. You can only use each of the following effects of "Yummyusment☆Mignon" once per turn. If you control a Link-1 monster: You can target 1 Level 1 "Yummy" monster in your GY; Special Summon it. If this card is in your GY: You can target 2 "Yummy" monsters in your GY and/or banishment; place this card, and them, on the bottom of the Deck in any order.
target_text: -- Yummyusment☆Mignon
  local SETCARD_ID_0 = 0x1ca --Yummy
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--atk
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetTargetRange(LOCATION_MZONE, 0)
  	e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard, SETCARD_ID_0))
  	e2:SetValue(s.atkval)
  	c:RegisterEffect(e2)
  	--spsummon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetRange(LOCATION_FZONE)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e3:SetCountLimit(1, id)
  	e3:SetCondition(s.spcon)
  	e3:SetTarget(s.sptg)
  	e3:SetOperation(s.spop)
  	c:RegisterEffect(e3)
  	--to deck
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 2))
  	e4:SetCategory(CATEGORY_TODECK)
  	e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_GRAVE)
  	e4:SetCountLimit(1, id + o)
  	e4:SetTarget(s.tdtg)
  	e4:SetOperation(s.tdop)
  	c:RegisterEffect(e4)
  end
  function s.atkfilter(c)
  	return c:IsFaceup() and c:IsRace(RACE_BEAST) and c:IsAttribute(ATTRIBUTE_LIGHT)
  end
  function s.atkval(e, c)
  	return Duel.GetMatchingGroupCount(s.atkfilter, e:GetHandlerPlayer(), LOCATION_MZONE, LOCATION_MZONE, nil) * 500
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsLink(1)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsLevel(1) 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 chkc:IsControler(tp) 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:IsRelateToEffect(e) and aux.NecroValleyFilter()(tc) then
  		Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  function s.tdfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeck() and c:IsFaceupEx()
  end
  function s.tdtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local c = e:GetHandler()
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE + LOCATION_REMOVED) and chkc:IsControler(tp) and s.tdfilter(chkc)
  	end
  	if chk == 0 then
  		return c:IsAbleToDeck() and Duel.IsExistingTarget(s.tdfilter, tp, LOCATION_GRAVE + LOCATION_REMOVED, 0, 2, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
  	local g = Duel.SelectTarget(tp, s.tdfilter, tp, LOCATION_GRAVE + LOCATION_REMOVED, 0, 2, 2, nil)
  	g:AddCard(c)
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, g, g:GetCount(), 0, 0)
  end
  function s.tdop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local sg = Duel.GetTargetsRelateToChain():Filter(aux.NecroValleyFilter(aux.TRUE), nil)
  	if #sg == 0 then
  		return
  	end
  	if not c:IsRelateToEffect(e) or not aux.NecroValleyFilter()(c) then
  		return
  	end
  	sg:AddCard(c)
  	aux.PlaceCardsOnDeckBottom(tp, sg)
  end
  
  