name: Wolf
card_text: Activate only when you take Battle Damage from your opponent's monster's direct attack. Reveal 1 Level 1 monster in your hand. Special Summon it from your hand, and 1 monster with the same name from your Deck.
external_ids: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  
lua: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_BATTLE_DAMAGE)
  	e1:SetCondition(s.condition)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	e1:SetLabel(1)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return eg:GetFirst():IsControler(1 - tp) and ep == tp and Duel.GetAttackTarget() == nil
  end
  function s.spfilter(c, e, tp)
  	return c:IsLevel(1) and not c:IsPublic() and c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and Duel.IsExistingMatchingCard(s.spfilter2, tp, LOCATION_DECK, 0, 1, nil, e, tp, c:GetCode())
  end
  function s.spfilter2(c, e, tp, code)
  	return c:IsCode(code) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	e:SetLabel(0)
  	return true
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		if e:GetLabel() ~= 0 then
  			return false
  		end
  		e:SetLabel(1)
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) and Duel.GetLocationCount(tp, LOCATION_MZONE) > 1 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_HAND, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
  	local g = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_HAND, 0, 1, 1, nil, e, tp)
  	local tc = g:GetFirst()
  	Duel.ConfirmCards(1 - tp, g)
  	Duel.SetTargetCard(g)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 2, tp, LOCATION_HAND + LOCATION_DECK)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		return
  	end
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) < 2 then
  		return
  	end
  	local tc1 = Duel.GetFirstTarget()
  	if not tc1:IsRelateToEffect(e) or not tc1:IsCanBeSpecialSummoned(e, 0, tp, false, false) then
  		return
  	end
  	local tc2 = Duel.GetFirstMatchingCard(s.spfilter2, tp, LOCATION_DECK, 0, nil, e, tp, tc1:GetCode())
  	if tc2 then
  		Duel.SpecialSummonStep(tc1, 0, tp, tp, false, false, POS_FACEUP)
  		Duel.SpecialSummonStep(tc2, 0, tp, tp, false, false, POS_FACEUP)
  		Duel.SpecialSummonComplete()
  	end
  end
  
  
source_text: Wolf
  Activate only when you take Battle Damage from your opponent's monster's direct attack. Reveal 1 Level 1 monster in your hand. Special Summon it from your hand, and 1 monster with the same name from your Deck.
target_text: -- Wolf
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_BATTLE_DAMAGE)
  	e1:SetCondition(s.condition)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	e1:SetLabel(1)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return eg:GetFirst():IsControler(1 - tp) and ep == tp and Duel.GetAttackTarget() == nil
  end
  function s.spfilter(c, e, tp)
  	return c:IsLevel(1) and not c:IsPublic() and c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and Duel.IsExistingMatchingCard(s.spfilter2, tp, LOCATION_DECK, 0, 1, nil, e, tp, c:GetCode())
  end
  function s.spfilter2(c, e, tp, code)
  	return c:IsCode(code) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	e:SetLabel(0)
  	return true
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		if e:GetLabel() ~= 0 then
  			return false
  		end
  		e:SetLabel(1)
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) and Duel.GetLocationCount(tp, LOCATION_MZONE) > 1 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_HAND, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
  	local g = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_HAND, 0, 1, 1, nil, e, tp)
  	local tc = g:GetFirst()
  	Duel.ConfirmCards(1 - tp, g)
  	Duel.SetTargetCard(g)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 2, tp, LOCATION_HAND + LOCATION_DECK)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		return
  	end
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) < 2 then
  		return
  	end
  	local tc1 = Duel.GetFirstTarget()
  	if not tc1:IsRelateToEffect(e) or not tc1:IsCanBeSpecialSummoned(e, 0, tp, false, false) then
  		return
  	end
  	local tc2 = Duel.GetFirstMatchingCard(s.spfilter2, tp, LOCATION_DECK, 0, nil, e, tp, tc1:GetCode())
  	if tc2 then
  		Duel.SpecialSummonStep(tc1, 0, tp, tp, false, false, POS_FACEUP)
  		Duel.SpecialSummonStep(tc2, 0, tp, tp, false, false, POS_FACEUP)
  		Duel.SpecialSummonComplete()
  	end
  end
  
  