name: RESCUE!
card_text: (This card is always treated as a "Rescue-ACE" card.)
  Target 1 "Rescue-ACE" monster in your GY, or if you control "Rescue-ACE Hydrant", you can target 1 monster in your opponent's GY instead; Special Summon it to your field. You can only activate 1 "RESCUE!" per turn.
external_ids: local CARD_ID_0 = 37617348 --Rescue-ACE Hydrant
  local SETCARD_ID_0 = 0x18b --Rescue-ACE
  
lua: local CARD_ID_0 = 37617348 --Rescue-ACE Hydrant
  local SETCARD_ID_0 = 0x18b --Rescue-ACE
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.spfilter(c, e, tp, check)
  	return c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and (check and c:IsControler(1 - tp) or c:IsSetCard(SETCARD_ID_0) and c:IsControler(tp))
  end
  function s.checkfilter(c)
  	return c:IsCode(CARD_ID_0) and c:IsFaceup()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local check = Duel.IsExistingMatchingCard(s.checkfilter, tp, LOCATION_ONFIELD, 0, 1, nil)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and s.spfilter(chkc, e, tp, check)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingTarget(s.spfilter, tp, LOCATION_GRAVE, LOCATION_GRAVE, 1, nil, e, tp, check)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectTarget(tp, s.spfilter, tp, LOCATION_GRAVE, LOCATION_GRAVE, 1, 1, nil, e, tp, check)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  
  
source_text: RESCUE!
  (This card is always treated as a "Rescue-ACE" card.)
  Target 1 "Rescue-ACE" monster in your GY, or if you control "Rescue-ACE Hydrant", you can target 1 monster in your opponent's GY instead; Special Summon it to your field. You can only activate 1 "RESCUE!" per turn.
target_text: -- RESCUE!
  local CARD_ID_0 = 37617348 --Rescue-ACE Hydrant
  local SETCARD_ID_0 = 0x18b --Rescue-ACE
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.spfilter(c, e, tp, check)
  	return c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and (check and c:IsControler(1 - tp) or c:IsSetCard(SETCARD_ID_0) and c:IsControler(tp))
  end
  function s.checkfilter(c)
  	return c:IsCode(CARD_ID_0) and c:IsFaceup()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local check = Duel.IsExistingMatchingCard(s.checkfilter, tp, LOCATION_ONFIELD, 0, 1, nil)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and s.spfilter(chkc, e, tp, check)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingTarget(s.spfilter, tp, LOCATION_GRAVE, LOCATION_GRAVE, 1, nil, e, tp, check)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectTarget(tp, s.spfilter, tp, LOCATION_GRAVE, LOCATION_GRAVE, 1, 1, nil, e, tp, check)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  
  