Class: Sc2::Player
- Inherits:
-
Object
- Object
- Sc2::Player
- Defined in:
- lib/sc2/wrappers/player.rb
Constant Summary collapse
- OUTCOMES =
[:unknown, :win, :loss]
- ATTRIBUTES =
{ :player_race => { "RAND" => :random, "Terr" => 'terran', "Prot" => 'protoss', "Zerg" => 'zerg' } }
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(params) ⇒ Player
constructor
A new instance of Player.
- #loss? ⇒ Boolean
- #name ⇒ Object
- #race ⇒ Object
- #win? ⇒ Boolean
Constructor Details
Instance Method Details
#id ⇒ Object
18 19 20 |
# File 'lib/sc2/wrappers/player.rb', line 18 def id @params[:id] end |
#loss? ⇒ Boolean
30 31 32 |
# File 'lib/sc2/wrappers/player.rb', line 30 def loss? @params[:outcome] == :loss end |
#name ⇒ Object
22 23 24 |
# File 'lib/sc2/wrappers/player.rb', line 22 def name @params[:name] end |
#race ⇒ Object
12 13 14 15 16 |
# File 'lib/sc2/wrappers/player.rb', line 12 def race @params[:attrs].each do |attr| return ATTRIBUTES[:player_race][attr[:value]] if attr[:attr_id] == 3001 end end |
#win? ⇒ Boolean
26 27 28 |
# File 'lib/sc2/wrappers/player.rb', line 26 def win? @params[:outcome] == :win end |