name: Batteryman
card_text: If all "Batteryman AA"(s) on your side of the field are in Attack Position, this card gains 1000 ATK for each "Batteryman AA" on your side of the field. If all "Batteryman AA"(s) on your side of the field are in Defense Position, this card gains 1000 DEF for each "Batteryman AA" on your side of the field.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--atk,def
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetValue(s.atkval)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_UPDATE_DEFENSE)
  	e2:SetValue(s.defval)
  	c:RegisterEffect(e2)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsCode(id)
  end
  function s.atkval(e, c)
  	local g = Duel.GetMatchingGroup(s.filter, c:GetControler(), LOCATION_MZONE, 0, nil)
  	if g:IsExists(Card.IsDefensePos, 1, nil) then
  		return 0
  	end
  	return g:GetCount() * 1000
  end
  function s.defval(e, c)
  	local g = Duel.GetMatchingGroup(s.filter, c:GetControler(), LOCATION_MZONE, 0, nil)
  	if g:IsExists(Card.IsAttackPos, 1, nil) then
  		return 0
  	end
  	return g:GetCount() * 1000
  end
  
  
source_text: Batteryman
  If all "Batteryman AA"(s) on your side of the field are in Attack Position, this card gains 1000 ATK for each "Batteryman AA" on your side of the field. If all "Batteryman AA"(s) on your side of the field are in Defense Position, this card gains 1000 DEF for each "Batteryman AA" on your side of the field.
target_text: -- Batteryman
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--atk,def
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetValue(s.atkval)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_UPDATE_DEFENSE)
  	e2:SetValue(s.defval)
  	c:RegisterEffect(e2)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsCode(id)
  end
  function s.atkval(e, c)
  	local g = Duel.GetMatchingGroup(s.filter, c:GetControler(), LOCATION_MZONE, 0, nil)
  	if g:IsExists(Card.IsDefensePos, 1, nil) then
  		return 0
  	end
  	return g:GetCount() * 1000
  end
  function s.defval(e, c)
  	local g = Duel.GetMatchingGroup(s.filter, c:GetControler(), LOCATION_MZONE, 0, nil)
  	if g:IsExists(Card.IsAttackPos, 1, nil) then
  		return 0
  	end
  	return g:GetCount() * 1000
  end
  
  