Inventory.h 1.38 KB
Newer Older
Milwaukee Davis's avatar
Milwaukee Davis committed
1
//filename: inventory.h
Milwaukee Davis's avatar
Milwaukee Davis committed
2
//Contains the declaration of the functions from the inventory class, which represents the items the player is carrying in the form of a dynamic array.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
//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:
Milwaukee Davis's avatar
Milwaukee Davis committed
21
	//Constructs a new Inventory class.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
	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