name: Dream
card_text: Activate 1 of these effects.
  ● When your opponent activates a Spell/Trap Card while a "Dream Mirror of Joy" is in a Field Zone: Negate the activation, and if you do, destroy that card.
  ● When your opponent would Special Summon monster(s) while a "Dream Mirror of Terror" is in a Field Zone: Negate the Summon, and if you do, destroy that monster.
  You can only activate 1 "Dream Mirror Oneiromancy" per turn.
external_ids: local CARD_ID_0 = 74665651 --Dream Mirror of Joy
  local CARD_ID_1 = 1050355 --Dream Mirror of Terror
  
lua: local CARD_ID_0 = 74665651 --Dream Mirror of Joy
  local CARD_ID_1 = 1050355 --Dream Mirror of Terror
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0, CARD_ID_1)
  	--activate(effect)
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_NEGATE + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.condition1)
  	e1:SetTarget(s.target1)
  	e1:SetOperation(s.activate1)
  	c:RegisterEffect(e1)
  	--activate(spsummon)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetCategory(CATEGORY_DISABLE_SUMMON + CATEGORY_DESTROY)
  	e2:SetType(EFFECT_TYPE_ACTIVATE)
  	e2:SetCode(EVENT_SPSUMMON)
  	e2:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e2:SetCondition(s.condition2)
  	e2:SetTarget(s.target2)
  	e2:SetOperation(s.activate2)
  	c:RegisterEffect(e2)
  end
  function s.condition1(e, tp, eg, ep, ev, re, r, rp)
  	return re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) and rp == 1 - tp and Duel.IsEnvironment(CARD_ID_0, PLAYER_ALL, LOCATION_FZONE)
  end
  function s.target1(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)
  	if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
  	end
  end
  function s.activate1(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
  		Duel.Destroy(eg, REASON_EFFECT)
  	end
  end
  function s.condition2(e, tp, eg, ep, ev, re, r, rp)
  	return aux.NegateSummonCondition() and rp == 1 - tp and Duel.IsEnvironment(CARD_ID_1, PLAYER_ALL, LOCATION_FZONE)
  end
  function s.target2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DISABLE_SUMMON, eg, eg:GetCount(), 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, eg:GetCount(), 0, 0)
  end
  function s.activate2(e, tp, eg, ep, ev, re, r, rp)
  	Duel.NegateSummon(eg)
  	Duel.Destroy(eg, REASON_EFFECT)
  end
  
  
source_text: Dream
  Activate 1 of these effects.
  ● When your opponent activates a Spell/Trap Card while a "Dream Mirror of Joy" is in a Field Zone: Negate the activation, and if you do, destroy that card.
  ● When your opponent would Special Summon monster(s) while a "Dream Mirror of Terror" is in a Field Zone: Negate the Summon, and if you do, destroy that monster.
  You can only activate 1 "Dream Mirror Oneiromancy" per turn.
target_text: -- Dream
  local CARD_ID_0 = 74665651 --Dream Mirror of Joy
  local CARD_ID_1 = 1050355 --Dream Mirror of Terror
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0, CARD_ID_1)
  	--activate(effect)
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_NEGATE + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.condition1)
  	e1:SetTarget(s.target1)
  	e1:SetOperation(s.activate1)
  	c:RegisterEffect(e1)
  	--activate(spsummon)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetCategory(CATEGORY_DISABLE_SUMMON + CATEGORY_DESTROY)
  	e2:SetType(EFFECT_TYPE_ACTIVATE)
  	e2:SetCode(EVENT_SPSUMMON)
  	e2:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e2:SetCondition(s.condition2)
  	e2:SetTarget(s.target2)
  	e2:SetOperation(s.activate2)
  	c:RegisterEffect(e2)
  end
  function s.condition1(e, tp, eg, ep, ev, re, r, rp)
  	return re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) and rp == 1 - tp and Duel.IsEnvironment(CARD_ID_0, PLAYER_ALL, LOCATION_FZONE)
  end
  function s.target1(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)
  	if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
  	end
  end
  function s.activate1(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
  		Duel.Destroy(eg, REASON_EFFECT)
  	end
  end
  function s.condition2(e, tp, eg, ep, ev, re, r, rp)
  	return aux.NegateSummonCondition() and rp == 1 - tp and Duel.IsEnvironment(CARD_ID_1, PLAYER_ALL, LOCATION_FZONE)
  end
  function s.target2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DISABLE_SUMMON, eg, eg:GetCount(), 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, eg:GetCount(), 0, 0)
  end
  function s.activate2(e, tp, eg, ep, ev, re, r, rp)
  	Duel.NegateSummon(eg)
  	Duel.Destroy(eg, REASON_EFFECT)
  end
  
  