Inventory.h 1.39 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
//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