name: CONTAIN!
card_text: (This card is always treated as a "Rescue-ACE" card.)
  If you control a "Rescue-ACE" monster: Target 1 Effect Monster your opponent controls; this turn, that Effect Monster cannot attack, also its effects are negated. If you control "Rescue-ACE Hydrant" at resolution of this effect, that monster also cannot be used as material for a Fusion, Synchro, Xyz, or Link Summon this 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:SetCategory(CATEGORY_DISABLE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  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)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp) and aux.NegateEffectMonsterFilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(aux.NegateEffectMonsterFilter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DISABLE)
  	local g = Duel.SelectTarget(tp, aux.NegateEffectMonsterFilter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DISABLE, g, 1, 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	local check = Duel.IsExistingMatchingCard(s.checkfilter, tp, LOCATION_ONFIELD, 0, 1, nil)
  	if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsType(TYPE_EFFECT) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CANNOT_ATTACK)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  		if not tc:IsDisabled() then
  			Duel.NegateRelatedChain(tc, RESET_TURN_SET)
  			local e2 = Effect.CreateEffect(c)
  			e2:SetType(EFFECT_TYPE_SINGLE)
  			e2:SetCode(EFFECT_DISABLE)
  			e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			tc:RegisterEffect(e2)
  			local e3 = e2:Clone()
  			e3:SetCode(EFFECT_DISABLE_EFFECT)
  			e3:SetValue(RESET_TURN_SET)
  			tc:RegisterEffect(e3)
  			if tc:IsType(TYPE_TRAPMONSTER) then
  				local e4 = e2:Clone()
  				e4:SetCode(EFFECT_DISABLE_TRAPMONSTER)
  				tc:RegisterEffect(e4)
  			end
  			Duel.AdjustInstantly()
  		end
  		if check and not tc:IsImmuneToEffect(e) then
  			local e5 = Effect.CreateEffect(c)
  			e5:SetType(EFFECT_TYPE_SINGLE)
  			e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE + EFFECT_FLAG_IGNORE_IMMUNE)
  			e5:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
  			e5:SetRange(LOCATION_MZONE)
  			e5:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			e5:SetValue(1)
  			tc:RegisterEffect(e5)
  			local e6 = e5:Clone()
  			e6:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
  			e6:SetValue(s.fuslimit)
  			tc:RegisterEffect(e6)
  			local e7 = e5:Clone()
  			e7:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
  			tc:RegisterEffect(e7)
  			local e8 = e5:Clone()
  			e8:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
  			tc:RegisterEffect(e8)
  		end
  	end
  end
  function s.fuslimit(e, c, sumtype)
  	return sumtype == SUMMON_TYPE_FUSION
  end
  
  
source_text: CONTAIN!
  (This card is always treated as a "Rescue-ACE" card.)
  If you control a "Rescue-ACE" monster: Target 1 Effect Monster your opponent controls; this turn, that Effect Monster cannot attack, also its effects are negated. If you control "Rescue-ACE Hydrant" at resolution of this effect, that monster also cannot be used as material for a Fusion, Synchro, Xyz, or Link Summon this turn.
target_text: -- CONTAIN!
  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:SetCategory(CATEGORY_DISABLE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  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)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp) and aux.NegateEffectMonsterFilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(aux.NegateEffectMonsterFilter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DISABLE)
  	local g = Duel.SelectTarget(tp, aux.NegateEffectMonsterFilter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DISABLE, g, 1, 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	local check = Duel.IsExistingMatchingCard(s.checkfilter, tp, LOCATION_ONFIELD, 0, 1, nil)
  	if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsType(TYPE_EFFECT) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CANNOT_ATTACK)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  		if not tc:IsDisabled() then
  			Duel.NegateRelatedChain(tc, RESET_TURN_SET)
  			local e2 = Effect.CreateEffect(c)
  			e2:SetType(EFFECT_TYPE_SINGLE)
  			e2:SetCode(EFFECT_DISABLE)
  			e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			tc:RegisterEffect(e2)
  			local e3 = e2:Clone()
  			e3:SetCode(EFFECT_DISABLE_EFFECT)
  			e3:SetValue(RESET_TURN_SET)
  			tc:RegisterEffect(e3)
  			if tc:IsType(TYPE_TRAPMONSTER) then
  				local e4 = e2:Clone()
  				e4:SetCode(EFFECT_DISABLE_TRAPMONSTER)
  				tc:RegisterEffect(e4)
  			end
  			Duel.AdjustInstantly()
  		end
  		if check and not tc:IsImmuneToEffect(e) then
  			local e5 = Effect.CreateEffect(c)
  			e5:SetType(EFFECT_TYPE_SINGLE)
  			e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE + EFFECT_FLAG_IGNORE_IMMUNE)
  			e5:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
  			e5:SetRange(LOCATION_MZONE)
  			e5:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			e5:SetValue(1)
  			tc:RegisterEffect(e5)
  			local e6 = e5:Clone()
  			e6:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
  			e6:SetValue(s.fuslimit)
  			tc:RegisterEffect(e6)
  			local e7 = e5:Clone()
  			e7:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
  			tc:RegisterEffect(e7)
  			local e8 = e5:Clone()
  			e8:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
  			tc:RegisterEffect(e8)
  		end
  	end
  end
  function s.fuslimit(e, c, sumtype)
  	return sumtype == SUMMON_TYPE_FUSION
  end
  
  