name: Evolzar
card_text: 2 Level 6 Dinosaur monsters
  Cannot be destroyed by card effects while it has material. When your opponent Special Summons a monster(s) (except during the Damage Step): You can detach 1 material from this card; destroy that monster(s).
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, aux.FilterBoolFunction(Card.IsRace, RACE_DINOSAUR), 6, 2)
  	c:EnableReviveLimit()
  	--indes
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCondition(s.indcon)
  	e1:SetValue(1)
  	c:RegisterEffect(e1)
  	--destroy
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_DESTROY)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCost(s.cost)
  	e2:SetTarget(s.target)
  	e2:SetOperation(s.operation)
  	c:RegisterEffect(e2)
  end
  function s.indcon(e)
  	return e:GetHandler():GetOverlayCount() ~= 0
  end
  function s.filter(c, e, tp)
  	return c:IsSummonPlayer(1 - tp) and (not e or c:IsRelateToEffect(e))
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():CheckRemoveOverlayCard(tp, 1, REASON_COST)
  	end
  	e:GetHandler():RemoveOverlayCard(tp, 1, 1, REASON_COST)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return eg:IsExists(s.filter, 1, nil, nil, tp)
  	end
  	local g = eg:Filter(s.filter, nil, nil, tp)
  	Duel.SetTargetCard(eg)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local g = eg:Filter(s.filter, nil, e, tp)
  	Duel.Destroy(g, REASON_EFFECT)
  end
  
  
source_text: Evolzar
  2 Level 6 Dinosaur monsters
  Cannot be destroyed by card effects while it has material. When your opponent Special Summons a monster(s) (except during the Damage Step): You can detach 1 material from this card; destroy that monster(s).
target_text: -- Evolzar
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, aux.FilterBoolFunction(Card.IsRace, RACE_DINOSAUR), 6, 2)
  	c:EnableReviveLimit()
  	--indes
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCondition(s.indcon)
  	e1:SetValue(1)
  	c:RegisterEffect(e1)
  	--destroy
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_DESTROY)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCost(s.cost)
  	e2:SetTarget(s.target)
  	e2:SetOperation(s.operation)
  	c:RegisterEffect(e2)
  end
  function s.indcon(e)
  	return e:GetHandler():GetOverlayCount() ~= 0
  end
  function s.filter(c, e, tp)
  	return c:IsSummonPlayer(1 - tp) and (not e or c:IsRelateToEffect(e))
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():CheckRemoveOverlayCard(tp, 1, REASON_COST)
  	end
  	e:GetHandler():RemoveOverlayCard(tp, 1, 1, REASON_COST)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return eg:IsExists(s.filter, 1, nil, nil, tp)
  	end
  	local g = eg:Filter(s.filter, nil, nil, tp)
  	Duel.SetTargetCard(eg)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local g = eg:Filter(s.filter, nil, e, tp)
  	Duel.Destroy(g, REASON_EFFECT)
  end
  
  