name: Utgarda,
card_text: You can only control 1 "Utgarda, Generaider Boss of Delusion". (Quick Effect): You can Tribute 2 "Generaider" monsters and/or Rock monsters, then target 1 card on the field; banish it. You can only use this effect of "Utgarda, Generaider Boss of Delusion" once per turn.
external_ids: local SETCARD_ID_0 = 0x134 --Generaider
  
lua: local SETCARD_ID_0 = 0x134 --Generaider
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:SetUniqueOnField(1, 0, id)
  	--remove
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_REMOVE)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e1:SetCost(s.rmcost)
  	e1:SetTarget(s.rmtg)
  	e1:SetOperation(s.rmop)
  	c:RegisterEffect(e1)
  end
  function s.costfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) or c:IsRace(RACE_ROCK)
  end
  function s.fselect(g, tp)
  	return Duel.IsExistingTarget(Card.IsAbleToRemove, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, g) and Duel.CheckReleaseGroup(tp, aux.IsInGroup, #g, nil, g)
  end
  function s.rmcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetReleaseGroup(tp):Filter(s.costfilter, nil)
  	if chk == 0 then
  		return g:CheckSubGroup(s.fselect, 2, 2, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local rg = g:SelectSubGroup(tp, s.fselect, false, 2, 2, tp)
  	aux.UseExtraReleaseCount(rg, tp)
  	Duel.Release(rg, REASON_COST)
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsOnField() and chkc:IsAbleToRemove()
  	end
  	if chk == 0 then
  		return true
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectTarget(tp, Card.IsAbleToRemove, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, 1, 0, 0)
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.Remove(tc, POS_FACEUP, REASON_EFFECT)
  	end
  end
  
  
source_text: Utgarda,
  You can only control 1 "Utgarda, Generaider Boss of Delusion". (Quick Effect): You can Tribute 2 "Generaider" monsters and/or Rock monsters, then target 1 card on the field; banish it. You can only use this effect of "Utgarda, Generaider Boss of Delusion" once per turn.
target_text: -- Utgarda,
  local SETCARD_ID_0 = 0x134 --Generaider
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:SetUniqueOnField(1, 0, id)
  	--remove
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_REMOVE)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e1:SetCost(s.rmcost)
  	e1:SetTarget(s.rmtg)
  	e1:SetOperation(s.rmop)
  	c:RegisterEffect(e1)
  end
  function s.costfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) or c:IsRace(RACE_ROCK)
  end
  function s.fselect(g, tp)
  	return Duel.IsExistingTarget(Card.IsAbleToRemove, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, g) and Duel.CheckReleaseGroup(tp, aux.IsInGroup, #g, nil, g)
  end
  function s.rmcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetReleaseGroup(tp):Filter(s.costfilter, nil)
  	if chk == 0 then
  		return g:CheckSubGroup(s.fselect, 2, 2, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local rg = g:SelectSubGroup(tp, s.fselect, false, 2, 2, tp)
  	aux.UseExtraReleaseCount(rg, tp)
  	Duel.Release(rg, REASON_COST)
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsOnField() and chkc:IsAbleToRemove()
  	end
  	if chk == 0 then
  		return true
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectTarget(tp, Card.IsAbleToRemove, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, 1, 0, 0)
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.Remove(tc, POS_FACEUP, REASON_EFFECT)
  	end
  end
  
  