name: Mokey
card_text: If a face-up Fairy monster you control is destroyed while you control "Mokey Mokey", until the end of this turn the ATK of each "Mokey Mokey" you control will become 3000.
external_ids: local CARD_ID_0 = 27288416 --Mokey Mokey
  
lua: local CARD_ID_0 = 27288416 --Mokey Mokey
  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)
  	--reg
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCode(EVENT_DESTROYED)
  	e2:SetCondition(s.regcon)
  	e2:SetOperation(s.regop)
  	c:RegisterEffect(e2)
  	--atk
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_SET_ATTACK)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetTargetRange(LOCATION_MZONE, 0)
  	e3:SetTarget(s.atktg)
  	e3:SetCondition(s.atkcon)
  	e3:SetValue(3000)
  	c:RegisterEffect(e3)
  end
  function s.cfilter(c, tp)
  	return c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousControler(tp) and c:GetPreviousRaceOnField() & RACE_FAIRY ~= 0
  end
  function s.cfilter2(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.regcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetFlagEffect(id) == 0 and eg:IsExists(s.cfilter, 1, nil, tp) and Duel.IsExistingMatchingCard(s.cfilter2, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  end
  function s.atkcon(e)
  	return e:GetHandler():GetFlagEffect(id) ~= 0
  end
  function s.atktg(e, c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  
  
source_text: Mokey
  If a face-up Fairy monster you control is destroyed while you control "Mokey Mokey", until the end of this turn the ATK of each "Mokey Mokey" you control will become 3000.
target_text: -- Mokey
  local CARD_ID_0 = 27288416 --Mokey Mokey
  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)
  	--reg
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCode(EVENT_DESTROYED)
  	e2:SetCondition(s.regcon)
  	e2:SetOperation(s.regop)
  	c:RegisterEffect(e2)
  	--atk
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_SET_ATTACK)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetTargetRange(LOCATION_MZONE, 0)
  	e3:SetTarget(s.atktg)
  	e3:SetCondition(s.atkcon)
  	e3:SetValue(3000)
  	c:RegisterEffect(e3)
  end
  function s.cfilter(c, tp)
  	return c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousControler(tp) and c:GetPreviousRaceOnField() & RACE_FAIRY ~= 0
  end
  function s.cfilter2(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.regcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetFlagEffect(id) == 0 and eg:IsExists(s.cfilter, 1, nil, tp) and Duel.IsExistingMatchingCard(s.cfilter2, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  end
  function s.atkcon(e)
  	return e:GetHandler():GetFlagEffect(id) ~= 0
  end
  function s.atktg(e, c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  
  