Class: L4D2Weapon
- Inherits:
-
Object
- Object
- L4D2Weapon
- Includes:
- AbstractL4DWeapon
- Defined in:
- lib/steam/community/l4d/l4d2_weapon.rb
Overview
This class represents the statistics of a single weapon for a user in Left4Dead 2
Instance Attribute Summary collapse
-
#damage ⇒ Fixnum
readonly
Returns the amount of damage done by the player with this weapon.
-
#weapon_group ⇒ String
readonly
Returns the weapon group this weapon belongs to.
Attributes included from AbstractL4DWeapon
#accuracy, #headshots_percentage, #id, #kill_percentage, #shots
Attributes included from GameWeapon
Instance Method Summary collapse
-
#initialize(weapon_name, weapon_data) ⇒ L4D2Weapon
constructor
Creates a new instance of a weapon based on the given XML data.
Methods included from GameWeapon
Constructor Details
#initialize(weapon_name, weapon_data) ⇒ L4D2Weapon
Creates a new instance of a weapon based on the given XML data
30 31 32 33 34 35 36 |
# File 'lib/steam/community/l4d/l4d2_weapon.rb', line 30 def initialize(weapon_name, weapon_data) super @damage = weapon_data['damage'].to_i @kill_percentage = weapon_data['pctkills'].to_f * 0.01 @weapon_group = weapon_data['group'] end |
Instance Attribute Details
#damage ⇒ Fixnum (readonly)
Returns the amount of damage done by the player with this weapon
19 20 21 |
# File 'lib/steam/community/l4d/l4d2_weapon.rb', line 19 def damage @damage end |
#weapon_group ⇒ String (readonly)
Returns the weapon group this weapon belongs to
24 25 26 |
# File 'lib/steam/community/l4d/l4d2_weapon.rb', line 24 def weapon_group @weapon_group end |