name: Digit
card_text: During damage calculation, if a monster battles while a monster with 1000 or more ATK is on the field: The ATK of all monsters currently on the field becomes reduced by 1000 for every 1000 ATK they have, also their DEF becomes reduced by 1000 for every 1000 DEF they have. If this card is destroyed: Apply the above ATK/DEF adjustments to all monsters currently on the field, until the end of this turn.
lua: 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
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_ATKCHANGE + CATEGORY_DEFCHANGE)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCondition(s.atkcon1)
  	e2:SetOperation(s.atkop1)
  	c:RegisterEffect(e2)
  	--atk
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_ATKCHANGE + CATEGORY_DEFCHANGE)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e3:SetCode(EVENT_DESTROYED)
  	e3:SetOperation(s.atkop2)
  	c:RegisterEffect(e3)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsAttackAbove(1000)
  end
  function s.atkcon1(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, 0, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  end
  function s.atkop1(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local g = Duel.GetMatchingGroup(Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	for tc in aux.Next(g) do
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e1:SetValue(tc:GetAttack() % 1000)
  		tc:RegisterEffect(e1)
  		if tc:IsDefenseAbove(0) then
  			local e2 = e1:Clone()
  			e2:SetCode(EFFECT_SET_DEFENSE_FINAL)
  			e2:SetValue(tc:GetDefense() % 1000)
  			tc:RegisterEffect(e2)
  		end
  	end
  end
  function s.atkop2(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local g = Duel.GetMatchingGroup(Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	for tc in aux.Next(g) do
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		e1:SetValue(tc:GetAttack() % 1000)
  		tc:RegisterEffect(e1)
  		if tc:IsDefenseAbove(0) then
  			local e2 = e1:Clone()
  			e2:SetCode(EFFECT_SET_DEFENSE_FINAL)
  			e2:SetValue(tc:GetDefense() % 1000)
  			tc:RegisterEffect(e2)
  		end
  	end
  end
  
  
source_text: Digit
  During damage calculation, if a monster battles while a monster with 1000 or more ATK is on the field: The ATK of all monsters currently on the field becomes reduced by 1000 for every 1000 ATK they have, also their DEF becomes reduced by 1000 for every 1000 DEF they have. If this card is destroyed: Apply the above ATK/DEF adjustments to all monsters currently on the field, until the end of this turn.
target_text: -- Digit
  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
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_ATKCHANGE + CATEGORY_DEFCHANGE)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCondition(s.atkcon1)
  	e2:SetOperation(s.atkop1)
  	c:RegisterEffect(e2)
  	--atk
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_ATKCHANGE + CATEGORY_DEFCHANGE)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e3:SetCode(EVENT_DESTROYED)
  	e3:SetOperation(s.atkop2)
  	c:RegisterEffect(e3)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsAttackAbove(1000)
  end
  function s.atkcon1(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, 0, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  end
  function s.atkop1(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local g = Duel.GetMatchingGroup(Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	for tc in aux.Next(g) do
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e1:SetValue(tc:GetAttack() % 1000)
  		tc:RegisterEffect(e1)
  		if tc:IsDefenseAbove(0) then
  			local e2 = e1:Clone()
  			e2:SetCode(EFFECT_SET_DEFENSE_FINAL)
  			e2:SetValue(tc:GetDefense() % 1000)
  			tc:RegisterEffect(e2)
  		end
  	end
  end
  function s.atkop2(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local g = Duel.GetMatchingGroup(Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	for tc in aux.Next(g) do
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		e1:SetValue(tc:GetAttack() % 1000)
  		tc:RegisterEffect(e1)
  		if tc:IsDefenseAbove(0) then
  			local e2 = e1:Clone()
  			e2:SetCode(EFFECT_SET_DEFENSE_FINAL)
  			e2:SetValue(tc:GetDefense() % 1000)
  			tc:RegisterEffect(e2)
  		end
  	end
  end
  
  