Class: AlienSwarmWeapon

Inherits:
Object
  • Object
show all
Includes:
GameWeapon
Defined in:
lib/steam/community/alien_swarm/alien_swarm_weapon.rb

Overview

AlienSwarmWeapon holds statistical information about weapons used by a player in Alien Swarm.

Instance Attribute Summary collapse

Attributes included from GameWeapon

#id, #kills

Instance Method Summary collapse

Methods included from GameWeapon

#avg_shots_per_kill

Constructor Details

#initialize(weapon_data) ⇒ AlienSwarmWeapon

Creates a new instance of AlienSwarmWeapon based on the assigned weapon XML data



18
19
20
21
22
23
24
25
26
# File 'lib/steam/community/alien_swarm/alien_swarm_weapon.rb', line 18

def initialize(weapon_data)
  super

  @accuracy      = weapon_data.elements['accuracy'].text.to_f
  @damage        = weapon_data.elements['damage'].text.to_i
  @friendly_fire = weapon_data.elements['friendlyfire'].text.to_i
  @name          = weapon_data.elements['name'].text
  @shots         = weapon_data.elements['shotsfired'].text.to_i
end

Instance Attribute Details

#accuracyObject (readonly)

Returns the value of attribute accuracy.



14
15
16
# File 'lib/steam/community/alien_swarm/alien_swarm_weapon.rb', line 14

def accuracy
  @accuracy
end

#damageObject (readonly)

Returns the value of attribute damage.



14
15
16
# File 'lib/steam/community/alien_swarm/alien_swarm_weapon.rb', line 14

def damage
  @damage
end

#friendly_fireObject (readonly)

Returns the value of attribute friendly_fire.



14
15
16
# File 'lib/steam/community/alien_swarm/alien_swarm_weapon.rb', line 14

def friendly_fire
  @friendly_fire
end

#nameObject (readonly)

Returns the value of attribute name.



14
15
16
# File 'lib/steam/community/alien_swarm/alien_swarm_weapon.rb', line 14

def name
  @name
end

#shotsObject (readonly)

Returns the value of attribute shots.



14
15
16
# File 'lib/steam/community/alien_swarm/alien_swarm_weapon.rb', line 14

def shots
  @shots
end