name: Arcana
card_text: 3 Warrior monsters with different names
  Once per turn, when a Spell/Trap Card, or monster effect, is activated that targets this face-up card on the field or a monster this card points to (Quick Effect): You can discard the same type of card (Monster, Spell, or Trap); negate the activation. When this Link Summoned card is destroyed by battle and sent to the GY: You can Special Summon 1 Level 4 Warrior Normal Monster from your Deck, and if you do, add 1 Level 4 Warrior monster from your Deck to your hand.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	aux.AddLinkProcedure(c, aux.FilterBoolFunction(Card.IsLinkRace, RACE_WARRIOR), 3, 3, s.lcheck)
  	c:EnableReviveLimit()
  	--negate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_NEGATE)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DAMAGE_CAL)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.negcon)
  	e1:SetCost(s.negcost)
  	e1:SetTarget(s.negtg)
  	e1:SetOperation(s.negop)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_BATTLE_DESTROYED)
  	e2:SetCondition(s.spcon)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  end
  function s.lcheck(g, lc)
  	return g:GetClassCount(Card.GetLinkCode) == g:GetCount()
  end
  function s.negfilter(c, g)
  	return g:IsContains(c)
  end
  function s.negcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsStatus(STATUS_BATTLE_DESTROYED) then
  		return false
  	end
  	if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then
  		return
  	end
  	local lg = e:GetHandler():GetLinkedGroup()
  	lg:AddCard(c)
  	local tg = Duel.GetChainInfo(ev, CHAININFO_TARGET_CARDS)
  	return tg and lg:IsExists(s.negfilter, 1, nil, tg) and Duel.IsChainNegatable(ev)
  end
  function s.costfilter(c, tpe)
  	return c:IsType(tpe) and c:IsDiscardable()
  end
  function s.negcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local rtype = bit.band(re:GetActiveType(), 0x7)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.costfilter, tp, LOCATION_HAND, 0, 1, nil, rtype)
  	end
  	Duel.DiscardHand(tp, s.costfilter, 1, 1, REASON_COST + REASON_DISCARD, nil, rtype)
  end
  function s.negtg(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)
  end
  function s.negop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.NegateActivation(ev)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsLocation(LOCATION_GRAVE) and c:IsReason(REASON_BATTLE) and c:IsSummonType(SUMMON_TYPE_LINK)
  end
  function s.spfilter(c, e, tp)
  	return c:IsType(TYPE_NORMAL)
  		and c:IsLevel(4)
  		and c:IsRace(RACE_WARRIOR)
  		and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  		and Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, c)
  end
  function s.thfilter(c)
  	return c:IsLevel(4) and c:IsRace(RACE_WARRIOR) and c:IsAbleToHand()
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g1 = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp)
  	if g1:GetCount() > 0 and Duel.SpecialSummon(g1, 0, tp, tp, false, false, POS_FACEUP) ~= 0 then
  		Duel.ConfirmCards(1 - tp, g1)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  		local g2 = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  		if g2:GetCount() > 0 then
  			Duel.SendtoHand(g2, tp, REASON_EFFECT)
  		end
  	end
  end
  
  
source_text: Arcana
  3 Warrior monsters with different names
  Once per turn, when a Spell/Trap Card, or monster effect, is activated that targets this face-up card on the field or a monster this card points to (Quick Effect): You can discard the same type of card (Monster, Spell, or Trap); negate the activation. When this Link Summoned card is destroyed by battle and sent to the GY: You can Special Summon 1 Level 4 Warrior Normal Monster from your Deck, and if you do, add 1 Level 4 Warrior monster from your Deck to your hand.
target_text: -- Arcana
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	aux.AddLinkProcedure(c, aux.FilterBoolFunction(Card.IsLinkRace, RACE_WARRIOR), 3, 3, s.lcheck)
  	c:EnableReviveLimit()
  	--negate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_NEGATE)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DAMAGE_CAL)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.negcon)
  	e1:SetCost(s.negcost)
  	e1:SetTarget(s.negtg)
  	e1:SetOperation(s.negop)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_BATTLE_DESTROYED)
  	e2:SetCondition(s.spcon)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  end
  function s.lcheck(g, lc)
  	return g:GetClassCount(Card.GetLinkCode) == g:GetCount()
  end
  function s.negfilter(c, g)
  	return g:IsContains(c)
  end
  function s.negcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsStatus(STATUS_BATTLE_DESTROYED) then
  		return false
  	end
  	if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then
  		return
  	end
  	local lg = e:GetHandler():GetLinkedGroup()
  	lg:AddCard(c)
  	local tg = Duel.GetChainInfo(ev, CHAININFO_TARGET_CARDS)
  	return tg and lg:IsExists(s.negfilter, 1, nil, tg) and Duel.IsChainNegatable(ev)
  end
  function s.costfilter(c, tpe)
  	return c:IsType(tpe) and c:IsDiscardable()
  end
  function s.negcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local rtype = bit.band(re:GetActiveType(), 0x7)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.costfilter, tp, LOCATION_HAND, 0, 1, nil, rtype)
  	end
  	Duel.DiscardHand(tp, s.costfilter, 1, 1, REASON_COST + REASON_DISCARD, nil, rtype)
  end
  function s.negtg(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)
  end
  function s.negop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.NegateActivation(ev)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsLocation(LOCATION_GRAVE) and c:IsReason(REASON_BATTLE) and c:IsSummonType(SUMMON_TYPE_LINK)
  end
  function s.spfilter(c, e, tp)
  	return c:IsType(TYPE_NORMAL)
  		and c:IsLevel(4)
  		and c:IsRace(RACE_WARRIOR)
  		and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  		and Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, c)
  end
  function s.thfilter(c)
  	return c:IsLevel(4) and c:IsRace(RACE_WARRIOR) and c:IsAbleToHand()
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g1 = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp)
  	if g1:GetCount() > 0 and Duel.SpecialSummon(g1, 0, tp, tp, false, false, POS_FACEUP) ~= 0 then
  		Duel.ConfirmCards(1 - tp, g1)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  		local g2 = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  		if g2:GetCount() > 0 then
  			Duel.SendtoHand(g2, tp, REASON_EFFECT)
  		end
  	end
  end
  
  