Commit cc671794 authored by Milwaukee Davis's avatar Milwaukee Davis
Browse files

Upload Inventory class header

parent 7f7ad8a5
//filename: item.h
//Contains the implementation of the more complicated functions from the item class, which represents the items the player is carrying in the form of several dynamic arrays.
//Item accepts new items from the Monster class upon the player 'beating' the room, and allows the player to change which item they have equipped through the Player class.
#ifndef INVENTORY_H
#define INVENTORY_H
#include <iostream> //for output
#include <vector>
#include <string>
#include "Item.h"
using namespace std;
class Inventory{
private:
vector<Item> inventory;
int equipped; // holds the index of the item currently equipped
public:
//Constructs a new Item class.
Inventory();
//Accepts a string and three ints from the Monster class, and adds it into the 'array' of inventory.
void gainItem(string lootName, int lootFight, int lootTalk){
Item newItem(lootName, lootFight, lootTalk);
inventory.push_back(newItem);
}
//returns the fight attribute of the equipped item
int getEquippedFight(){
return inventory.at(equipped).getFight();
}
//returns the talk attribute of the equipped item
int getEquippedTalk(){
return inventory.at(equipped).getTalk();
}
//sets the equipped item to the index given by the player.
void setEquipped(int selection){
equipped = selection;
}
//Outputs your inventory line-by-line.
void listInventory();
};
#endif // INVENTORY_H
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment