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

#include <item.h>

Inheritance diagram for Item:
Consumable Equipment Misc Weapon

Public Member Functions

 Item (IntPoint _coords)
 
 Item (int _rarity, int _weight, Tile _sprite, std::string _name, IntPoint _coords)
 
int get_weight ()
 
Tileget_sprite ()
 
virtual void perform_action ()=0
 
IntPoint get_coords ()
 
void set_coords (IntPoint _c)
 
std::string get_name ()
 
int get_rarity ()
 
std::string get_description ()
 
int get_size ()
 

Public Attributes

bool can_equip
 
bool can_use
 
bool can_wield
 
bool can_consume
 

Protected Attributes

std::string name
 
std::string description
 
int weight
 
IntPoint coords
 
Tile sprite
 
int rarity
 
int size
 

Detailed Description

The base class for all item types. This class acts as a base for all items, including equipment, weapons, consumables, and other item types.

Constructor & Destructor Documentation

Item::Item ( IntPoint  _coords)

The basic constructor for an item.

Parameters
_coordsThe coordinates to place the item at.
Item::Item ( int  _rarity,
int  _weight,
Tile  _sprite,
std::string  _name,
IntPoint  _coords 
)

A constructor for an item.

Parameters
_raritySets the class member rarity.
_weightSets the weight of the item.
_spriteSets the sprite of the item..
_nameSets the name of the item.
_coordsSet the coordinates of the item.

Member Function Documentation

IntPoint Item::get_coords ( )

Public accessor for the coordinates.

std::string Item::get_description ( )

Public accessor for the description.

std::string Item::get_name ( )

Public accessor for the name.

int Item::get_rarity ( )

Public accessor for the rarity.

int Item::get_size ( )

Public accessor for the size.

Tile * Item::get_sprite ( )

Public accessor for the member variable sprite.

int Item::get_weight ( )

Public accessor for the member variable weight.

virtual void Item::perform_action ( )
pure virtual

At the moment, does nothing (except make Item a virtual class). This will perform the active component of the item.

Todo:
Do something with this.

Implemented in Misc, Consumable, Weapon, and Equipment.

void Item::set_coords ( IntPoint  _c)

Public setter for the coordinates.

Parameters
_cThe new coords to be set.

Member Data Documentation

bool Item::can_consume

Whether or not a character can consume an item.

bool Item::can_equip

Whether or not the item can be equipped by any character.

bool Item::can_use

Whether the item has a usable component. If this is yes, that means that the item has some active component other than its base use, e.g. a sword that has a spell attached to it.

bool Item::can_wield

Whether or not an item can be wielded as a weapon by a character.

IntPoint Item::coords
protected

Where the item currently is. This is only used as a way to graphically represent the item when it is on the ground. When an item is in a character's inventory, the coordinates are wherever it was picked up, and are only updated when the item is dropped again.

std::string Item::description
protected

A brief description of the item.

std::string Item::name
protected

What the item is called.

int Item::rarity
protected

How likely it is that the item will appear.

int Item::size
protected

The size of the item. Will factor into what can use it and how much can be carried at a time (using a unit system that I'm going to conveniently make up whenever I feel like it).

Tile Item::sprite
protected

A graphical representation of the item.

int Item::weight
protected

How much the item weighs.


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