Completed
Push — master ( dc035d...9f8676 )
by Borja
03:16
created

honor()   A

Complexity

Conditions 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1.6296

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 1
c 3
b 0
f 0
dl 0
loc 15
ccs 1
cts 7
cp 0.1429
crap 1.6296
rs 9.4285
1
# Honor calculator, based on char lvl owned by player.
2 1
def honor(jugador)
0 ignored issues
show
Coding Style introduced by
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