Total Complexity | 6 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | # Cada heroe coge 2 poderes al subir de nivel |
||
3 | class Habilidad < Hash |
||
4 | attr_accessor :id, :name, :description, :invocación, |
||
5 | :type, :nivel, :requisitos, :foco, :rangos, :coste, :char |
||
6 | |||
7 | def initialize(args) |
||
8 | args.each do |k, v| |
||
9 | instance_variable_set("@#{k}".to_sym, v) unless v.nil? |
||
10 | end |
||
11 | end |
||
12 | |||
13 | # Las habilidades únicas tienen 6 rangos máximo. |
||
14 | def ranks |
||
15 | if rangos |
||
16 | rangos |
||
17 | else |
||
18 | if type == 'Única' |
||
19 | (nivel * 6) <= 25 ? 6 : ( 25 / nivel ) |
||
20 | else |
||
21 | 1 |
||
22 | end |
||
23 | end |
||
24 | end |
||
25 | |||
26 | def img_path |
||
27 | "/images/skills/#{char}/#{name}.png" |
||
28 | end |
||
29 | end |
||
30 |