Class: Tassadar::SC2::Player
- Inherits:
-
Object
- Object
- Tassadar::SC2::Player
- Defined in:
- lib/tassadar/sc2/player.rb
Instance Attribute Summary collapse
-
#actual_race ⇒ Object
Returns the value of attribute actual_race.
-
#chosen_race ⇒ Object
Returns the value of attribute chosen_race.
-
#color ⇒ Object
Returns the value of attribute color.
-
#handicap ⇒ Object
Returns the value of attribute handicap.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#won ⇒ Object
Returns the value of attribute won.
Instance Method Summary collapse
-
#initialize(details_hash, attributes) ⇒ Player
constructor
A new instance of Player.
- #winner? ⇒ Boolean
Constructor Details
#initialize(details_hash, attributes) ⇒ Player
Returns a new instance of Player.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/tassadar/sc2/player.rb', line 6 def initialize(details_hash, attributes) @name = details_hash[0] @id = details_hash[1][4] @won = [false, true, false][details_hash[8]] @color = {:alpha => details_hash[3][0], :red => details_hash[3][1], :green => details_hash[3][2], :blue => details_hash[3][3]} races = {"Terr" => "Terran", "Prot" => "Protoss", "Zerg" => "Zerg", "RAND" => "Random"} @chosen_race = races[attributes.select {|a| a.id == 0x0BB9 && a.player_number == details_hash[7] + 1}.first.attribute_value] @actual_race = details_hash[2] @handicap = details_hash[6] end |
Instance Attribute Details
#actual_race ⇒ Object
Returns the value of attribute actual_race.
4 5 6 |
# File 'lib/tassadar/sc2/player.rb', line 4 def actual_race @actual_race end |
#chosen_race ⇒ Object
Returns the value of attribute chosen_race.
4 5 6 |
# File 'lib/tassadar/sc2/player.rb', line 4 def chosen_race @chosen_race end |
#color ⇒ Object
Returns the value of attribute color.
4 5 6 |
# File 'lib/tassadar/sc2/player.rb', line 4 def color @color end |
#handicap ⇒ Object
Returns the value of attribute handicap.
4 5 6 |
# File 'lib/tassadar/sc2/player.rb', line 4 def handicap @handicap end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/tassadar/sc2/player.rb', line 4 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/tassadar/sc2/player.rb', line 4 def name @name end |
#won ⇒ Object
Returns the value of attribute won.
4 5 6 |
# File 'lib/tassadar/sc2/player.rb', line 4 def won @won end |
Instance Method Details
#winner? ⇒ Boolean
17 18 19 |
# File 'lib/tassadar/sc2/player.rb', line 17 def winner? @won end |