name: Dharma-Eye
card_text: Pendulum Scale = 2
  [ Pendulum Effect ]
  Once per turn: You can reveal 1 Pendulum Monster in your hand, then target 1 "Magician" card in your Pendulum Zone; that target's Pendulum Scale becomes the same as the revealed Pendulum Monster's, until the end of this turn (even if this card leaves the field).
  ----------------------------------------
  [ Monster Effect ]
  While this Pendulum Summoned card is on the field, "Magician" Pendulum Monsters you control cannot be destroyed by your opponent's card effects during the turn this card was Pendulum Summoned.
external_ids: local SETCARD_ID_0 = 0x98 --Magician
  
lua: local SETCARD_ID_0 = 0x98 --Magician
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--pendulum summon
  	aux.EnablePendulumAttribute(c)
  	--change scale
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_PZONE)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetCountLimit(1)
  	e2:SetTarget(s.sctg)
  	e2:SetOperation(s.scop)
  	c:RegisterEffect(e2)
  	--indes
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e3:SetOperation(s.sumsuc)
  	c:RegisterEffect(e3)
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetTargetRange(LOCATION_MZONE, 0)
  	e4:SetCondition(s.indcon)
  	e4:SetTarget(s.indtg)
  	e4:SetValue(aux.indoval)
  	c:RegisterEffect(e4)
  end
  function s.cfilter(c, tp)
  	return c:IsType(TYPE_PENDULUM) and not c:IsPublic() and Duel.IsExistingTarget(s.scfilter, tp, LOCATION_PZONE, 0, 1, nil, c)
  end
  function s.scfilter(c, pc)
  	return c:IsSetCard(SETCARD_ID_0) and c:GetLeftScale() ~= pc:GetLeftScale()
  end
  function s.sctg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_PZONE) and s.scfilter(chkc, e:GetLabelObject())
  	end
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_HAND, 0, 1, nil, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
  	local cg = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_HAND, 0, 1, 1, nil, tp)
  	Duel.ConfirmCards(1 - tp, cg)
  	Duel.ShuffleHand(tp)
  	e:SetLabelObject(cg:GetFirst())
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	Duel.SelectTarget(tp, s.scfilter, tp, LOCATION_PZONE, 0, 1, 1, nil, cg:GetFirst())
  end
  function s.scop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	local pc = e:GetLabelObject()
  	if tc:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CHANGE_LSCALE)
  		e1:SetValue(pc:GetLeftScale())
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_CHANGE_RSCALE)
  		e2:SetValue(pc:GetRightScale())
  		tc:RegisterEffect(e2)
  	end
  end
  function s.sumsuc(e, tp, eg, ep, ev, re, r, rp)
  	e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + 0x1ec0000 + RESET_PHASE + PHASE_END, 0, 1)
  end
  function s.indcon(e)
  	local c = e:GetHandler()
  	return c:GetFlagEffect(id) ~= 0 and c:IsSummonType(SUMMON_TYPE_PENDULUM)
  end
  function s.indtg(e, c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_PENDULUM)
  end
  
  
source_text: Dharma-Eye
  Pendulum Scale = 2
  [ Pendulum Effect ]
  Once per turn: You can reveal 1 Pendulum Monster in your hand, then target 1 "Magician" card in your Pendulum Zone; that target's Pendulum Scale becomes the same as the revealed Pendulum Monster's, until the end of this turn (even if this card leaves the field).
  ----------------------------------------
  [ Monster Effect ]
  While this Pendulum Summoned card is on the field, "Magician" Pendulum Monsters you control cannot be destroyed by your opponent's card effects during the turn this card was Pendulum Summoned.
target_text: -- Dharma-Eye
  local SETCARD_ID_0 = 0x98 --Magician
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--pendulum summon
  	aux.EnablePendulumAttribute(c)
  	--change scale
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_PZONE)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetCountLimit(1)
  	e2:SetTarget(s.sctg)
  	e2:SetOperation(s.scop)
  	c:RegisterEffect(e2)
  	--indes
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e3:SetOperation(s.sumsuc)
  	c:RegisterEffect(e3)
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetTargetRange(LOCATION_MZONE, 0)
  	e4:SetCondition(s.indcon)
  	e4:SetTarget(s.indtg)
  	e4:SetValue(aux.indoval)
  	c:RegisterEffect(e4)
  end
  function s.cfilter(c, tp)
  	return c:IsType(TYPE_PENDULUM) and not c:IsPublic() and Duel.IsExistingTarget(s.scfilter, tp, LOCATION_PZONE, 0, 1, nil, c)
  end
  function s.scfilter(c, pc)
  	return c:IsSetCard(SETCARD_ID_0) and c:GetLeftScale() ~= pc:GetLeftScale()
  end
  function s.sctg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_PZONE) and s.scfilter(chkc, e:GetLabelObject())
  	end
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_HAND, 0, 1, nil, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
  	local cg = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_HAND, 0, 1, 1, nil, tp)
  	Duel.ConfirmCards(1 - tp, cg)
  	Duel.ShuffleHand(tp)
  	e:SetLabelObject(cg:GetFirst())
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	Duel.SelectTarget(tp, s.scfilter, tp, LOCATION_PZONE, 0, 1, 1, nil, cg:GetFirst())
  end
  function s.scop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	local pc = e:GetLabelObject()
  	if tc:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CHANGE_LSCALE)
  		e1:SetValue(pc:GetLeftScale())
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_CHANGE_RSCALE)
  		e2:SetValue(pc:GetRightScale())
  		tc:RegisterEffect(e2)
  	end
  end
  function s.sumsuc(e, tp, eg, ep, ev, re, r, rp)
  	e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + 0x1ec0000 + RESET_PHASE + PHASE_END, 0, 1)
  end
  function s.indcon(e)
  	local c = e:GetHandler()
  	return c:GetFlagEffect(id) ~= 0 and c:IsSummonType(SUMMON_TYPE_PENDULUM)
  end
  function s.indtg(e, c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_PENDULUM)
  end
  
  