item.cpp 917 Bytes
Newer Older
Milwaukee Davis's avatar
Milwaukee Davis committed
1
2
3
//filename: item.cpp
//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.

4
5
6
7
8
9
10
11
12
13
#include <iostream> //for output
#include <vector>
#include "item.h"

using namespace std;

//Constructs a new Item class.
Item::Item(){
	equipped = 0;
}
Milwaukee Davis's avatar
Milwaukee Davis committed
14
	
15
16
17
18
19
20
21
22
23
//Accepts a string and three ints from the Monster class, and adds it into the 'array' of inventory.
void Item::gainItem(string lootName, int lootFight, int lootFlee , int lootTalk){
	itemName.push_back(lootName);
	itemFight.push_back(lootFight);
	itemFlee.push_back(lootFlee);
	itemTalk.push_back(lootTalk);
}

//outputs the inventory array	
24
void Item::listInventory(){
25
26
27
	for(int i = 0; i < itemName.size(); i++){
   		cout << itemName.at(i) << ": Fight: " << itemFight.at(i) << " Flee: "<< itemFlee.at(i) << " Talk: " << itemTalk.at(i) << endl;
   	}
Milwaukee Davis's avatar
Milwaukee Davis committed
28
29
30
31
}