name: MiSolfachord
card_text: Pendulum Scale = 6
  [ Pendulum Effect ]
  Pendulum Summons of your "Solfachord" Pendulum Monsters cannot be negated.
  ----------------------------------------
  [ Monster Effect ]
  While you have an even Pendulum Scale in your Pendulum Zone, you take no damage from battles involving your "Solfachord" Pendulum Monsters. If this card is Normal or Special Summoned: You can target 1 Spell/Trap your opponent controls; return it to the hand. You can only use this effect of "MiSolfachord Eliteia" once per turn.
external_ids: local SETCARD_ID_0 = 0x162 --Solfachord
  
lua: local SETCARD_ID_0 = 0x162 --Solfachord
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--pendulum summon
  	aux.EnablePendulumAttribute(c)
  	--cannot disable spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_DISABLE_SPSUMMON)
  	e1:SetProperty(EFFECT_FLAG_IGNORE_RANGE + EFFECT_FLAG_SET_AVAILABLE)
  	e1:SetRange(LOCATION_PZONE)
  	e1:SetTarget(s.distg)
  	c:RegisterEffect(e1)
  	--to hand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_TOHAND)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SUMMON_SUCCESS)
  	e2:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_CARD_TARGET)
  	e2:SetCountLimit(1, id)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e3)
  	--avoid battle damage
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
  	e4:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetTargetRange(LOCATION_MZONE, 0)
  	e4:SetCondition(s.avcon)
  	e4:SetTarget(s.avfilter)
  	e4:SetValue(1)
  	c:RegisterEffect(e4)
  end
  function s.distg(e, c)
  	return c:IsControler(e:GetHandlerPlayer()) and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_PENDULUM) and c:IsSummonType(SUMMON_TYPE_PENDULUM)
  end
  function s.thfilter(c)
  	return c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsOnField() and chkc:IsControler(1 - tp) and s.thfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.thfilter, tp, 0, LOCATION_ONFIELD, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RTOHAND)
  	local g = Duel.SelectTarget(tp, s.thfilter, tp, 0, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, 1, 0, 0)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.SendtoHand(tc, nil, REASON_EFFECT)
  	end
  end
  function s.pfilter(c)
  	return c:GetCurrentScale() % 2 == 0
  end
  function s.avcon(e)
  	local tp = e:GetHandlerPlayer()
  	return Duel.IsExistingMatchingCard(s.pfilter, tp, LOCATION_PZONE, 0, 1, nil)
  end
  function s.avfilter(e, c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_PENDULUM)
  end
  
  
source_text: MiSolfachord
  Pendulum Scale = 6
  [ Pendulum Effect ]
  Pendulum Summons of your "Solfachord" Pendulum Monsters cannot be negated.
  ----------------------------------------
  [ Monster Effect ]
  While you have an even Pendulum Scale in your Pendulum Zone, you take no damage from battles involving your "Solfachord" Pendulum Monsters. If this card is Normal or Special Summoned: You can target 1 Spell/Trap your opponent controls; return it to the hand. You can only use this effect of "MiSolfachord Eliteia" once per turn.
target_text: -- MiSolfachord
  local SETCARD_ID_0 = 0x162 --Solfachord
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--pendulum summon
  	aux.EnablePendulumAttribute(c)
  	--cannot disable spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_DISABLE_SPSUMMON)
  	e1:SetProperty(EFFECT_FLAG_IGNORE_RANGE + EFFECT_FLAG_SET_AVAILABLE)
  	e1:SetRange(LOCATION_PZONE)
  	e1:SetTarget(s.distg)
  	c:RegisterEffect(e1)
  	--to hand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_TOHAND)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SUMMON_SUCCESS)
  	e2:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_CARD_TARGET)
  	e2:SetCountLimit(1, id)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e3)
  	--avoid battle damage
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
  	e4:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetTargetRange(LOCATION_MZONE, 0)
  	e4:SetCondition(s.avcon)
  	e4:SetTarget(s.avfilter)
  	e4:SetValue(1)
  	c:RegisterEffect(e4)
  end
  function s.distg(e, c)
  	return c:IsControler(e:GetHandlerPlayer()) and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_PENDULUM) and c:IsSummonType(SUMMON_TYPE_PENDULUM)
  end
  function s.thfilter(c)
  	return c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsOnField() and chkc:IsControler(1 - tp) and s.thfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.thfilter, tp, 0, LOCATION_ONFIELD, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RTOHAND)
  	local g = Duel.SelectTarget(tp, s.thfilter, tp, 0, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, 1, 0, 0)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.SendtoHand(tc, nil, REASON_EFFECT)
  	end
  end
  function s.pfilter(c)
  	return c:GetCurrentScale() % 2 == 0
  end
  function s.avcon(e)
  	local tp = e:GetHandlerPlayer()
  	return Duel.IsExistingMatchingCard(s.pfilter, tp, LOCATION_PZONE, 0, 1, nil)
  end
  function s.avfilter(e, c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_PENDULUM)
  end
  
  