name: D/D
card_text: Pendulum Scale = 3
  [ Pendulum Effect ]
  You can target 1 Fusion, Synchro, or Xyz Monster your opponent controls; negate its effects until the end of this turn, then destroy this card. You can only use this effect of "D/D Dog" once per turn.
  ----------------------------------------
  [ Monster Effect ]
  Once per turn, if your opponent Special Summons a Fusion, Synchro, or Xyz Monster(s) (except during the Damage Step): You can target 1 of those monsters; this turn, that face-up monster cannot attack, also its effects are negated.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--pendulum summon
  	aux.EnablePendulumAttribute(c)
  	--disable1
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DISABLE + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetRange(LOCATION_PZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.distg1)
  	e1:SetOperation(s.disop1)
  	c:RegisterEffect(e1)
  	--disable2
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DISABLE)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DELAY)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(s.discon2)
  	e2:SetTarget(s.distg2)
  	e2:SetOperation(s.disop2)
  	c:RegisterEffect(e2)
  end
  function s.filter(c)
  	return c:IsType(TYPE_FUSION + TYPE_SYNCHRO + TYPE_XYZ) and aux.NegateMonsterFilter(c)
  end
  function s.distg1(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DISABLE)
  	Duel.SelectTarget(tp, s.filter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, e:GetHandler(), 1, 0, 0)
  end
  function s.disop1(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsCanBeDisabledByEffect(e) then
  		Duel.NegateRelatedChain(tc, RESET_TURN_SET)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_DISABLE_EFFECT)
  		e2:SetValue(RESET_TURN_SET)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e2)
  		if c:IsRelateToEffect(e) and c:IsLocation(LOCATION_PZONE) then
  			Duel.BreakEffect()
  			Duel.Destroy(c, REASON_EFFECT)
  		end
  	end
  end
  function s.cfilter(c, tp)
  	return c:IsFaceup() and c:IsSummonPlayer(1 - tp) and c:IsType(TYPE_FUSION + TYPE_SYNCHRO + TYPE_XYZ) and aux.NegateMonsterFilter(c)
  end
  function s.discon2(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.cfilter, 1, nil, tp)
  end
  function s.disfilter(c, g)
  	return g:IsContains(c)
  end
  function s.distg2(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local g = eg:Filter(s.cfilter, nil, tp)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and s.disfilter(chkc, g)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.disfilter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil, g)
  	end
  	if g:GetCount() == 1 then
  		Duel.SetTargetCard(g)
  	else
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  		Duel.SelectTarget(tp, s.disfilter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil, g)
  	end
  end
  function s.disop2(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and tc:IsFaceup() then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CANNOT_ATTACK)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		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 = Effect.CreateEffect(c)
  			e3:SetType(EFFECT_TYPE_SINGLE)
  			e3:SetCode(EFFECT_DISABLE_EFFECT)
  			e3:SetValue(RESET_TURN_SET)
  			e3:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			tc:RegisterEffect(e3)
  		end
  	end
  end
  
  
source_text: D/D
  Pendulum Scale = 3
  [ Pendulum Effect ]
  You can target 1 Fusion, Synchro, or Xyz Monster your opponent controls; negate its effects until the end of this turn, then destroy this card. You can only use this effect of "D/D Dog" once per turn.
  ----------------------------------------
  [ Monster Effect ]
  Once per turn, if your opponent Special Summons a Fusion, Synchro, or Xyz Monster(s) (except during the Damage Step): You can target 1 of those monsters; this turn, that face-up monster cannot attack, also its effects are negated.
target_text: -- D/D
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--pendulum summon
  	aux.EnablePendulumAttribute(c)
  	--disable1
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DISABLE + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetRange(LOCATION_PZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.distg1)
  	e1:SetOperation(s.disop1)
  	c:RegisterEffect(e1)
  	--disable2
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DISABLE)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DELAY)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(s.discon2)
  	e2:SetTarget(s.distg2)
  	e2:SetOperation(s.disop2)
  	c:RegisterEffect(e2)
  end
  function s.filter(c)
  	return c:IsType(TYPE_FUSION + TYPE_SYNCHRO + TYPE_XYZ) and aux.NegateMonsterFilter(c)
  end
  function s.distg1(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DISABLE)
  	Duel.SelectTarget(tp, s.filter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, e:GetHandler(), 1, 0, 0)
  end
  function s.disop1(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsCanBeDisabledByEffect(e) then
  		Duel.NegateRelatedChain(tc, RESET_TURN_SET)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_DISABLE_EFFECT)
  		e2:SetValue(RESET_TURN_SET)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e2)
  		if c:IsRelateToEffect(e) and c:IsLocation(LOCATION_PZONE) then
  			Duel.BreakEffect()
  			Duel.Destroy(c, REASON_EFFECT)
  		end
  	end
  end
  function s.cfilter(c, tp)
  	return c:IsFaceup() and c:IsSummonPlayer(1 - tp) and c:IsType(TYPE_FUSION + TYPE_SYNCHRO + TYPE_XYZ) and aux.NegateMonsterFilter(c)
  end
  function s.discon2(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.cfilter, 1, nil, tp)
  end
  function s.disfilter(c, g)
  	return g:IsContains(c)
  end
  function s.distg2(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local g = eg:Filter(s.cfilter, nil, tp)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and s.disfilter(chkc, g)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.disfilter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil, g)
  	end
  	if g:GetCount() == 1 then
  		Duel.SetTargetCard(g)
  	else
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  		Duel.SelectTarget(tp, s.disfilter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil, g)
  	end
  end
  function s.disop2(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and tc:IsFaceup() then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CANNOT_ATTACK)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		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 = Effect.CreateEffect(c)
  			e3:SetType(EFFECT_TYPE_SINGLE)
  			e3:SetCode(EFFECT_DISABLE_EFFECT)
  			e3:SetValue(RESET_TURN_SET)
  			e3:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			tc:RegisterEffect(e3)
  		end
  	end
  end
  
  