Class: AlienSwarmWeapon
- Inherits:
-
Object
- Object
- AlienSwarmWeapon
- Includes:
- GameWeapon
- Defined in:
- lib/steam/community/alien_swarm/alien_swarm_weapon.rb
Overview
This class holds statistical information about weapons used by a player in Alien Swarm
Instance Attribute Summary collapse
-
#accuracy ⇒ Float
readonly
Returns the accuracy of the player with this weapon.
-
#damage ⇒ Fixnum
readonly
Returns the damage achieved with this weapon.
-
#friendly_fire ⇒ Fixnum
readonly
Returns the damage dealt to team mates with this weapon.
-
#name ⇒ String
readonly
Returns the name of this weapon.
Attributes included from GameWeapon
Instance Method Summary collapse
-
#initialize(weapon_data) ⇒ AlienSwarmWeapon
constructor
Creates a new weapon instance based on the assigned weapon XML data.
Methods included from GameWeapon
Constructor Details
#initialize(weapon_data) ⇒ AlienSwarmWeapon
Creates a new weapon instance based on the assigned weapon XML data
39 40 41 42 43 44 45 46 47 |
# File 'lib/steam/community/alien_swarm/alien_swarm_weapon.rb', line 39 def initialize(weapon_data) super @accuracy = weapon_data['accuracy'].to_f @damage = weapon_data['damage'].to_i @friendly_fire = weapon_data['friendlyfire'].to_i @name = weapon_data['name'] @shots = weapon_data['shotsfired'].to_i end |
Instance Attribute Details
#accuracy ⇒ Float (readonly)
Returns the accuracy of the player with this weapon
19 20 21 |
# File 'lib/steam/community/alien_swarm/alien_swarm_weapon.rb', line 19 def accuracy @accuracy end |
#damage ⇒ Fixnum (readonly)
Returns the damage achieved with this weapon
24 25 26 |
# File 'lib/steam/community/alien_swarm/alien_swarm_weapon.rb', line 24 def damage @damage end |
#friendly_fire ⇒ Fixnum (readonly)
Returns the damage dealt to team mates with this weapon
29 30 31 |
# File 'lib/steam/community/alien_swarm/alien_swarm_weapon.rb', line 29 def friendly_fire @friendly_fire end |
#name ⇒ String (readonly)
Returns the name of this weapon
34 35 36 |
# File 'lib/steam/community/alien_swarm/alien_swarm_weapon.rb', line 34 def name @name end |