Commit 09c2e55e authored by Kameron Kinsey's avatar Kameron Kinsey
Browse files

Initialize repository

parent 12a6cdd5
......@@ -9,6 +9,7 @@
*
*/
#include "item.h"
#include "Player.h"
#include <cstring>
#include <cstdlib>
......@@ -21,6 +22,7 @@ int main() {
// Declare Character Details
int seed;
char command;
Player player;
string name = player.getPlayerName();
......@@ -30,7 +32,7 @@ int main() {
// Enter Name
cout << "Enter Player Name: ";
cin >> name;
getline(cin,name);
player.setPlayerName(name);
int health = player.getHealth();
......@@ -41,20 +43,24 @@ int main() {
cout << name << "'s stats" << endl
<< "========================" << endl
<< "Health: " << health << endl
<< "Fight: " << fight << endl
<< "Flee: " << flee << endl
<< "Talk: " << talk << endl
<< endl;
// << "Armor: " << armor << endl
// << "Weapon: " << weapon << endl;
<< "Fight: " << fight + item.getEquippedFight() << endl
<< "Flee: " << flee + item.getEquippedFlee() << endl
<< "Talk: " << talk + item.getEquippedTalk() << endl
<< "Item: " << item.getEquippedItemName() << endl;
cout << "Check inventory: i";
getline(cin,command);
if (command == 'i') {
item.listInventory();
}
return 0;
}
void Player::setStats(int seed) {
cin >> seed;
getline(cin,seed);
srand(seed);
// Set Fight Stat and Modifier
......@@ -74,6 +80,8 @@ void Player::setStats(int seed) {
}
void check
bool Player::checkVictory(bool win) {
if (win == true) {
cout << "Congratulations " << getPlayerName() << " you have retrieved the Maguffin of Vauge Desirability!" << endl;
......
//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.
#include <vector>
#include <iostream>
#include <string>
using namespace std;
class Item{
//below items will probably be in a different form than straight arrays. Say dynamic pointers or vectors.
string itemName[] = new string[150]; //holds the names of the items in inventory
public:
static const int size = 150;
//below items will probably be in a different form than straight arrays. Say dynamic pointers or vectors.
vector<string> itemName[size]; //holds the names of the items in inventory
vector<int> itemFight[size]; //holds the fight attributes of the items in inventory
vector<int> itemFlee[size]; //holds the flee attributes of the items in inventory
vector<int> itemTalk[size]; // holds the talk attributes of the items in inventory
int equipped = 0; // holds the index of the item currently equipped
//Constructs a new Item class.
Item();
int itemFight[] = new int[150]; //holds the fight attributes of the items in inventory
int itemFlee[] = new int[150]; //holds the flee attributes of the items in inventory
int itemTalk[] = new int[150]; // holds the talk attributes of the items in inventory
int equipped; // holds the index of the item currently equipped
//Constructs a new Item class.
item();
//Accepts a string and three ints from the Monster class, and adds it into the 'array' of inventory.
gainItem(string lootName, int lootFight, int lootFlee , int lootTalk);
//returns the fight attribute of the equipped item
int getEquippedFight(){
return itemFight[equipped];
}
//returns the flee attribute of the equipped item
int getEquippedFlee(){
return itemFlee[equipped];
}
//returns the talk attribute of the equipped item
int getEquippedTalk(){
return itemTalk[equipped];
}
//sets the equipped item to the index given by the player.
void setEquipped(int selection){
equipped = selection;
}
//removes item from inventory. May not implement.
//loseItem(string lootName, int lootFight, int lootFlee, int lootTalk);
//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 lootFlee , int lootTalk);
//returns the name of the equipped item.
string getEquippedItemName(){
return itemName[equipped];
}
//returns the fight attribute of the equipped item
int getEquippedFight(){
return itemFight[equipped];
}
//returns the flee attribute of the equipped item
int getEquippedFlee(){
return itemFlee[equipped];
}
//returns the talk attribute of the equipped item
int getEquippedTalk(){
return itemTalk[equipped];
}
//sets the equipped item to the index given by the player.
void setEquipped(int selection){
equipped = selection;
}
void listInventory() {
for (int i = 0; i < size; i++) {
cout << "Item " << i+1 << ": " << itemName[i] << endl;
cout << "Fight: " << itemFight[i] << " Flee: " << itemFlee[i] << " Talk: " << itemTalk[i] << endl;
}
}
//removes item from inventory. May not implement.
//loseItem(string lootName, int lootFight, int lootFlee, int lootTalk);
}
\ 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