Roguelike
 All Classes Namespaces Functions Variables Typedefs Friends Pages
Public Member Functions | Protected Attributes | List of all members
Weapon Class Reference

#include <item.h>

Inheritance diagram for Weapon:
Item

Public Member Functions

 Weapon (int _rarity, int _weight, Tile _sprite, std::string _name, IntPoint _coords, int t, int _dam)
 
 Weapon (IntPoint _coords, WeaponType wpn)
 
void perform_action ()
 
int get_type ()
 
int get_damage ()
 
- Public Member Functions inherited from Item
 Item (IntPoint _coords)
 
 Item (int _rarity, int _weight, Tile _sprite, std::string _name, IntPoint _coords)
 
int get_weight ()
 
Tileget_sprite ()
 
IntPoint get_coords ()
 
void set_coords (IntPoint _c)
 
std::string get_name ()
 
int get_rarity ()
 
std::string get_description ()
 
int get_size ()
 

Protected Attributes

int damage
 
int range
 
int type
 
- Protected Attributes inherited from Item
std::string name
 
std::string description
 
int weight
 
IntPoint coords
 
Tile sprite
 
int rarity
 
int size
 

Additional Inherited Members

- Public Attributes inherited from Item
bool can_equip
 
bool can_use
 
bool can_wield
 
bool can_consume
 

Detailed Description

Class for creating weapons. Weapons refer to anything that can be wielded to alter a character's attack.

See also
WeaponType

Constructor & Destructor Documentation

Weapon::Weapon ( int  _rarity,
int  _weight,
Tile  _sprite,
std::string  _name,
IntPoint  _coords,
int  t,
int  _dam 
)

The constructor for the weapon.

Parameters
_raritySets the rarity of the weapon.
_weightSets the weight of the weapon.
_spriteSets the sprite for the weapon.
_nameSets the name of the weapon.
_coordsSets the coordinates of the weapon.
tSets the type of the weapon.
_damSets the damage of the weapon.
Weapon::Weapon ( IntPoint  _coords,
WeaponType  wpn 
)

Constructor for the weapon. This is the normally used constructor, relying on the defined WeaponTypes and taking a set of coordinates.

Parameters
_coordsSets the coordinates of the weapon.
wpnThe template for the weapon.

Member Function Documentation

int Weapon::get_damage ( )

Public accessor for the variable to_dam.

int Weapon::get_type ( )

Public accessor for the variable type.

void Weapon::perform_action ( )
virtual

For performaing an action other than changing the attack of the character.

See also
Item::perform_action()

Implements Item.

Member Data Documentation

int Weapon::damage
protected

The value the character's attack will become. A character's attack will be replaced by (not added to) the damage done by a weapon.

int Weapon::range
protected

How many tiles the weapon can reach.

int Weapon::type
protected

The possible types that the weapon can be. The possible types are as follows: 1 = piercing, 2 = slashing, and 3 = bludgeoning.

See also
WeaponType::type

The documentation for this class was generated from the following files: