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

#include <item.h>

Inheritance diagram for Consumable:
Item

Public Member Functions

 Consumable (int _rarity, int _weight, Tile _sprite, std::string _name, IntPoint _coords, int stat, int val, int _type)
 
 Consumable (IntPoint _coords, ConsumableType cons)
 
void perform_action ()
 
int get_stat ()
 
int get_amount ()
 
int get_type ()
 
- 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 stat_modified
 
int amount_modified
 
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 consumables. Consumables refer to anything that can be consumed to alter a stat in some way.

See also
ConsumableType

Constructor & Destructor Documentation

Consumable::Consumable ( int  _rarity,
int  _weight,
Tile  _sprite,
std::string  _name,
IntPoint  _coords,
int  stat,
int  val,
int  _type 
)

The constructor for the consumable.

Parameters
_raritySets the rarity of the consumable.
_weightSets the weight of the consumable.
_spriteSets the sprite for the consumable.
_nameSets the name of the consumable.
_coordsSets the coordinates of the consumable.
statSets the stat_modified variable of the consumable.
valSets the amount_modified variable of the consumable.
_typeSets the type of the consumable.
Consumable::Consumable ( IntPoint  _coords,
ConsumableType  cons 
)

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

Parameters
_coordsSets the coordinates of the consumable.
consThe template for th consumable.

Member Function Documentation

int Consumable::get_amount ( )

Public accessor for the variable amount_modified.

int Consumable::get_stat ( )

Public accessor for the variable stat_modified.

int Consumable::get_type ( )

Public accessor for the variable type.

void Consumable::perform_action ( )
virtual

For performaing an action other than changing a stat of the character.

See also
Item::perform_action()

Implements Item.

Member Data Documentation

int Consumable::amount_modified
protected

The magnitude that the stat should be modified by.

int Consumable::stat_modified
protected

The stat that will be modified by the consumable. This corresponds an index in the current_stat or stat vector in the character class.

See also
Character::current_stats
Character::stats
int Consumable::type
protected

How the consumable will behave. Corresponds to the enum ConsumableTypes, which defines the behavior of consumable, e.g. restore health vs. fortifying health.


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