Class: Gloomhaven::Character

Inherits:
Object
  • Object
show all
Defined in:
lib/gloomhaven/character.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Character

Returns a new instance of Character.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/gloomhaven/character.rb', line 5

def initialize(klass)
  validate_class!(klass)
  @klass = klass
  @hand_size = data['hand_size']
  @health_scale = data['health_scale']
  @hex_color = data['hex_color']
  @name = data['name']
  @number = data['number']
  @perks = data['perks']
  @spoiler_name = data['spoiler_name'] || @name
end

Instance Attribute Details

#hand_sizeObject (readonly)

Returns the value of attribute hand_size.



3
4
5
# File 'lib/gloomhaven/character.rb', line 3

def hand_size
  @hand_size
end

#health_scaleObject (readonly)

Returns the value of attribute health_scale.



3
4
5
# File 'lib/gloomhaven/character.rb', line 3

def health_scale
  @health_scale
end

#hex_colorObject (readonly)

Returns the value of attribute hex_color.



3
4
5
# File 'lib/gloomhaven/character.rb', line 3

def hex_color
  @hex_color
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/gloomhaven/character.rb', line 3

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



3
4
5
# File 'lib/gloomhaven/character.rb', line 3

def number
  @number
end

#perksObject (readonly)

Returns the value of attribute perks.



3
4
5
# File 'lib/gloomhaven/character.rb', line 3

def perks
  @perks
end

#spoiler_nameObject (readonly)

Returns the value of attribute spoiler_name.



3
4
5
# File 'lib/gloomhaven/character.rb', line 3

def spoiler_name
  @spoiler_name
end

Instance Method Details

#to_sObject



17
18
19
# File 'lib/gloomhaven/character.rb', line 17

def to_s
  @name
end