name: Naturia
card_text: "Naturia Beast" + "Naturia Barkion"
  A Fusion Summon of this card can only be done with the above Fusion Materials. When a Spell/Trap Card is activated (Quick Effect): You can banish 1 card from your GY, then send the top card of your Deck to the GY; negate the activation, and if you do, destroy that card. This card must be face-up on the field to activate and to resolve this effect.
external_ids: local CARD_ID_0 = 33198837 --Naturia Beast
  local CARD_ID_1 = 2956282 --Naturia Barkion
  
lua: local CARD_ID_0 = 33198837 --Naturia Beast
  local CARD_ID_1 = 2956282 --Naturia Barkion
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcCode2(c, CARD_ID_0, CARD_ID_1, false, false)
  	--negate
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_NEGATE + CATEGORY_DESTROY)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DAMAGE_CAL)
  	e2:SetCode(EVENT_CHAINING)
  	e2:SetCondition(s.discon)
  	e2:SetCost(s.discost)
  	e2:SetTarget(s.distg)
  	e2:SetOperation(s.disop)
  	c:RegisterEffect(e2)
  end
  s.material_type = TYPE_SYNCHRO
  function s.discon(e, tp, eg, ep, ev, re, r, rp)
  	return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev)
  end
  function s.discost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDiscardDeckAsCost(tp, 1) and Duel.IsExistingMatchingCard(Card.IsAbleToRemoveAsCost, tp, LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, Card.IsAbleToRemoveAsCost, tp, LOCATION_GRAVE, 0, 1, 1, nil)
  	Duel.Remove(g, POS_FACEUP, REASON_COST)
  	Duel.DiscardDeck(tp, 1, REASON_COST)
  end
  function s.distg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_NEGATE, eg, 1, 0, 0)
  	if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
  	end
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsFacedown() or not c:IsRelateToEffect(e) then
  		return
  	end
  	if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
  		Duel.Destroy(eg, REASON_EFFECT)
  	end
  end
  
  
source_text: Naturia
  "Naturia Beast" + "Naturia Barkion"
  A Fusion Summon of this card can only be done with the above Fusion Materials. When a Spell/Trap Card is activated (Quick Effect): You can banish 1 card from your GY, then send the top card of your Deck to the GY; negate the activation, and if you do, destroy that card. This card must be face-up on the field to activate and to resolve this effect.
target_text: -- Naturia
  local CARD_ID_0 = 33198837 --Naturia Beast
  local CARD_ID_1 = 2956282 --Naturia Barkion
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcCode2(c, CARD_ID_0, CARD_ID_1, false, false)
  	--negate
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_NEGATE + CATEGORY_DESTROY)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DAMAGE_CAL)
  	e2:SetCode(EVENT_CHAINING)
  	e2:SetCondition(s.discon)
  	e2:SetCost(s.discost)
  	e2:SetTarget(s.distg)
  	e2:SetOperation(s.disop)
  	c:RegisterEffect(e2)
  end
  s.material_type = TYPE_SYNCHRO
  function s.discon(e, tp, eg, ep, ev, re, r, rp)
  	return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev)
  end
  function s.discost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDiscardDeckAsCost(tp, 1) and Duel.IsExistingMatchingCard(Card.IsAbleToRemoveAsCost, tp, LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, Card.IsAbleToRemoveAsCost, tp, LOCATION_GRAVE, 0, 1, 1, nil)
  	Duel.Remove(g, POS_FACEUP, REASON_COST)
  	Duel.DiscardDeck(tp, 1, REASON_COST)
  end
  function s.distg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_NEGATE, eg, 1, 0, 0)
  	if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
  	end
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsFacedown() or not c:IsRelateToEffect(e) then
  		return
  	end
  	if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
  		Duel.Destroy(eg, REASON_EFFECT)
  	end
  end
  
  