| Total Complexity | 3 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Coverage | 45.45% |
| Changes | 0 | ||
| 1 | # Todos los hechizos disponibles en el juego |
||
| 2 | 1 | class Magia < Hash |
|
| 3 | 1 | attr_accessor :id, :name, :efecto, :potencia, |
|
| 4 | :diablura, :duracion, :alcance, :tipo, :maestría, :ardid, |
||
| 5 | :summun, :chakra # Only in plegarias |
||
| 6 | |||
| 7 | 1 | 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 | 1 | def img_path |
|
| 14 | "'../../images/magia/#{elemento}s#{nivel}/#{name}.png'" |
||
| 15 | end |
||
| 16 | |||
| 17 | 1 | def color # Returns color code by position in colors array |
|
| 18 | colors = %w(FF6633 CCFFFF CC9966 44CCFF CC9999 |
||
| 19 | EED6AF 99FFCC CC4545 FAEE96 E0FFFF |
||
| 20 | 688426) |
||
| 21 | elems = %w(fuego aire tierra agua sombra |
||
| 22 | arena elfico sangre plegaria hielo |
||
| 23 | execración) |
||
| 24 | |||
| 25 | 'background-color:#' + colors[elems.find_index(elemento)] |
||
| 26 | end |
||
| 27 | end |
||
| 28 |