Issues (72)

lib/honor.rb (1 issue)

1
# Honor calculator, based on char lvl owned by player.
2
def honor(jugador)
0 ignored issues
show
The Assignment, Branch, Condition size for honor is considered too high. [16.09/15]. The ABC size is based on assignments, branches (method calls), and conditions.
Loading history...
3
  honor = 0 # Initialize by 0
4
5
  heros.each do |h|
6
    # Increase honor for each player lvl
7
    honor += h.nivel if h.jugador == jugador
8
    # ONLY for MB players
9
    unless ciudad?(jugador).empty?
10
      # Increase honor for each MB player lvl/3
11
      honor += (h.nivel / 3).to_i if h.ciudad == ciudad?(jugador).first['name']
12
    end
13
  end
14
15
  honor
16
end
17