name: Metamorformation
card_text: All "Metalfoes" monsters you control gain 300 ATK and DEF. While a "Metalfoes" card is in your Pendulum Zone, "Metalfoes" monsters you control, except Effect Monsters, are unaffected by your opponent's card effects.
external_ids: local SETCARD_ID_0 = 0xe1 --Metalfoes
  
lua: local SETCARD_ID_0 = 0xe1 --Metalfoes
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--atk up
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetTargetRange(LOCATION_MZONE, 0)
  	e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard, SETCARD_ID_0))
  	e2:SetValue(300)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e3)
  	--immune effect
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetCode(EFFECT_IMMUNE_EFFECT)
  	e4:SetRange(LOCATION_FZONE)
  	e4:SetTargetRange(LOCATION_MZONE, 0)
  	e4:SetCondition(s.immcon)
  	e4:SetTarget(s.etarget)
  	e4:SetValue(s.efilter)
  	c:RegisterEffect(e4)
  end
  function s.immcon(e)
  	return Duel.IsExistingMatchingCard(Card.IsSetCard, e:GetHandlerPlayer(), LOCATION_PZONE, 0, 1, nil, 0xe1)
  end
  function s.etarget(e, c)
  	return c:IsSetCard(SETCARD_ID_0) and not c:IsType(TYPE_EFFECT)
  end
  function s.efilter(e, re)
  	return re:GetOwnerPlayer() ~= e:GetHandlerPlayer()
  end
  
  
source_text: Metamorformation
  All "Metalfoes" monsters you control gain 300 ATK and DEF. While a "Metalfoes" card is in your Pendulum Zone, "Metalfoes" monsters you control, except Effect Monsters, are unaffected by your opponent's card effects.
target_text: -- Metamorformation
  local SETCARD_ID_0 = 0xe1 --Metalfoes
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--atk up
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetTargetRange(LOCATION_MZONE, 0)
  	e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard, SETCARD_ID_0))
  	e2:SetValue(300)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e3)
  	--immune effect
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetCode(EFFECT_IMMUNE_EFFECT)
  	e4:SetRange(LOCATION_FZONE)
  	e4:SetTargetRange(LOCATION_MZONE, 0)
  	e4:SetCondition(s.immcon)
  	e4:SetTarget(s.etarget)
  	e4:SetValue(s.efilter)
  	c:RegisterEffect(e4)
  end
  function s.immcon(e)
  	return Duel.IsExistingMatchingCard(Card.IsSetCard, e:GetHandlerPlayer(), LOCATION_PZONE, 0, 1, nil, 0xe1)
  end
  function s.etarget(e, c)
  	return c:IsSetCard(SETCARD_ID_0) and not c:IsType(TYPE_EFFECT)
  end
  function s.efilter(e, re)
  	return re:GetOwnerPlayer() ~= e:GetHandlerPlayer()
  end
  
  