name: Geo
card_text: "Genex Controller" + 1 or more non-Tuner EARTH monsters
  Once per turn, if you control a face-up Level 4 or lower "Genex" monster(s), you can switch the original ATK and DEF of this card until the End Phase, for as long as you control a face-up Level 4 or lower "Genex" monster(s).
external_ids: local CARD_ID_0 = 68505803 --Genex Controller
  local SETCARD_ID_0 = 0x2 --Genex
  
lua: local CARD_ID_0 = 68505803 --Genex Controller
  local SETCARD_ID_0 = 0x2 --Genex
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddMaterialCodeList(c, CARD_ID_0)
  	--synchro summon
  	aux.AddSynchroProcedure(c, aux.FilterBoolFunction(Card.IsCode, CARD_ID_0), aux.NonTuner(Card.IsAttribute, ATTRIBUTE_EARTH), 1)
  	c:EnableReviveLimit()
  	--ad change
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.condition)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetCode(EFFECT_SWAP_BASE_AD)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCondition(s.valcon)
  	c:RegisterEffect(e2)
  end
  function s.valcon(e)
  	return e:GetHandler():GetFlagEffect(id) ~= 0 and Duel.IsExistingMatchingCard(s.cfilter, e:GetHandler():GetControler(), LOCATION_MZONE, 0, 1, nil)
  end
  function s.cfilter(c)
  	return c:IsLevelBelow(4) and c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsFaceup() and c:IsRelateToEffect(e) then
  		c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  	end
  end
  
  
source_text: Geo
  "Genex Controller" + 1 or more non-Tuner EARTH monsters
  Once per turn, if you control a face-up Level 4 or lower "Genex" monster(s), you can switch the original ATK and DEF of this card until the End Phase, for as long as you control a face-up Level 4 or lower "Genex" monster(s).
target_text: -- Geo
  local CARD_ID_0 = 68505803 --Genex Controller
  local SETCARD_ID_0 = 0x2 --Genex
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddMaterialCodeList(c, CARD_ID_0)
  	--synchro summon
  	aux.AddSynchroProcedure(c, aux.FilterBoolFunction(Card.IsCode, CARD_ID_0), aux.NonTuner(Card.IsAttribute, ATTRIBUTE_EARTH), 1)
  	c:EnableReviveLimit()
  	--ad change
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.condition)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetCode(EFFECT_SWAP_BASE_AD)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCondition(s.valcon)
  	c:RegisterEffect(e2)
  end
  function s.valcon(e)
  	return e:GetHandler():GetFlagEffect(id) ~= 0 and Duel.IsExistingMatchingCard(s.cfilter, e:GetHandler():GetControler(), LOCATION_MZONE, 0, 1, nil)
  end
  function s.cfilter(c)
  	return c:IsLevelBelow(4) and c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsFaceup() and c:IsRelateToEffect(e) then
  		c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  	end
  end
  
  