Commit 1bd0a3ed authored by Aaron Sturtevant's avatar Aaron Sturtevant

committing

parent 716c41ab
......@@ -14,6 +14,7 @@
#include <iostream>
using namespace std;
// Outputs the intro for the boss of a given floor
void Boss::summonBoss(int floorNum) {
switch(floorNum) {
......@@ -33,7 +34,7 @@ void Boss::summonBoss(int floorNum) {
}
}
// Accessor for fight
int Boss::getFight(int floorNum) {
switch(floorNum) {
......@@ -52,6 +53,7 @@ int Boss::getFight(int floorNum) {
}
}
// Accessor for talk
int Boss::getTalk(int floorNum) {
switch(floorNum) {
......@@ -70,6 +72,7 @@ int Boss::getTalk(int floorNum) {
}
}
// The response for if the player beats the boss of a given floor number
void Boss::bossResponse(int floorNum, bool playerWon) {
if (playerWon == true) {
......@@ -116,6 +119,7 @@ void Boss::bossResponse(int floorNum, bool playerWon) {
}
}
// Puts items into the inventory of the player from the boss of a given floor
void Boss::giveBossItems(int floorNum, Inventory &inventory) {
switch(floorNum) {
......
......@@ -22,16 +22,20 @@ using namespace std;
class Boss {
private:
//boss stats
int fight;
int talk;
public:
// Get Functions
// Accesssor Functions for a boss on a given floor
int getFight(int floorNum);
int getTalk(int floorNum);
// Other Functions
// Outputs the intro for the boss of a given floor
void summonBoss(int floorNum);
// The response for if the player beats the boss of a given floor number
void bossResponse(int floorNum, bool playerWon);
// Puts items into the inventory of the player from the boss of a given floor
void giveBossItems(int floorNum, Inventory &inventory);
};
......
......@@ -7,34 +7,42 @@
#include "Monster.h"
using namespace std;
// initiating sudo classes
Monster monster;
Boss boss;
// randomly rooms the monster from 1 to 20
int Dungeon::rollRoom() {
int roll = rand() % 20 + 1;
return roll;
}
// summons the monster rolled
void Dungeon::getMonster(int encounterNum) {
monster.summon(encounterNum);
}
// gets the monster's responce if they were beaten
void Dungeon::monsterResponse(int encounterNum, bool playerWon) {
monster.monsterResponse(encounterNum, playerWon);
}
// summons the boss of a given floor
void Dungeon::getBoss(int floorNum) {
boss.summonBoss(floorNum);
}
// gets the boss' response if it was beaten or not
void Dungeon::bossResponse(int floorNum, bool playerWon) {
boss.bossResponse(floorNum, playerWon);
}
// gives items to the player given the encounter number and the player's inventory
void Dungeon::giveBossItems(int encounterNum, Inventory inventory) {
boss.giveBossItems(floorNum, inventory);
}
void Dungeon::giveMonsterItems(int encounterNum, Inventory inventory) {
monster.giveMonsterItems(encounterNum, inventory);
// gives items to the player given the floor number of the boss and the player's inventory
void Dungeon::giveMonsterItems(int floorNum, Inventory inventory) {
monster.giveMonsterItems(floorNum, inventory);
}
......@@ -12,17 +12,26 @@
using namespace std;
class Dungeon {
public:
//stats the dungeon keeps track of
int roomEncounter;
int floorNum = 1;
int roomCounter = 1;
// roll the room enoucnter
int rollRoom();
// gets the output for the room that was rolled from monster
void getMonster(int encounterNum);
// gets the monster's response from the monster if they were beaten or if they beat the player
void monsterResponse(int encounterNum, bool playerWon);
// gets the output for the boss for a given floor number
void getBoss(int floorNum);
// gets the boss' response from the monster if they were beaten or if they beat the player
void bossResponse(int floorNum, bool plyarWon);
// gives items of the boss on a given floor
void giveBossItems(int floorNum, Inventory inventory);
// gives items of a monster that was rolled
void giveMonsterItems(int encounterNum, Inventory inventory);
};
......
......@@ -15,7 +15,7 @@
using namespace std;
// takes an ecnounter number and outputs the intro for the number
void Monster::summon(int encounterNum) {
switch(encounterNum) {
......@@ -82,6 +82,7 @@ void Monster::summon(int encounterNum) {
}
}
// Accessor for the fight stat given an encouter number
int Monster::getFight(int encounterNum) {
switch (encounterNum) {
......@@ -148,7 +149,8 @@ int Monster::getFight(int encounterNum) {
return fight = 10;
}
}
// Accessor for the talk given and encounter number
int Monster::getTalk(int encounterNum) {
switch (encounterNum) {
......@@ -215,6 +217,7 @@ int Monster::getTalk(int encounterNum) {
}
}
// gives items to the inventory provided gien an encounter number
void Monster::giveMonsterItems(int encounterNum, Inventory &inventory) {
switch(encounterNum) {
......@@ -301,6 +304,7 @@ void Monster::giveMonsterItems(int encounterNum, Inventory &inventory) {
}
}
// gets the response if a player was beaten or beats the monster given an encounter number
void Monster::monsterResponse(int encounterNum, int playerWon) {
if (playerWon == true) {
switch(encounterNum) {
......
......@@ -22,17 +22,21 @@ using namespace std;
class Monster {
private:
// monster stats
int fight;
int talk;
public:
// Get Functions
// Accessor Functions
int getFight(int encounterNum);
int getTalk(int encounterNum);
// Other Functions
// Outputs the intro for the boss of a given floor
void summon(int encounterNum);
// gives items to the inventory given based on the encounter number provided
void giveMonsterItems(int encounterNum, Inventory &inventory);
// The response for if the player beats the monster given an encounter number
void monsterResponse(int encounterNum, int playerWon);
......
......@@ -16,6 +16,7 @@
#include <iostream>
using namespace std;
// takes a seed and randomly sets the players stats
void Player::setStats(int seed) {
srand(seed);
......
......@@ -22,18 +22,16 @@ using namespace std;
class Player {
private:
// players stats
int fight;
int talk;
int fightModifier;
int talkModifier;
int finalFight;
int finalTalk;
string playerName;
public:
// inventory and health management
int inventoryIndex;
int health = 100;
// Get Functions
// Accessor Functions
int getFight() { return fight; }
int getTalk() { return talk; }
string getPlayerName() { return playerName; }
......@@ -43,6 +41,8 @@ class Player {
void setFight(int Fight) { fight = Fight; }
void setTalk(int Talk) { talk = Talk; }
void setPlayerName(string name) { playerName = name; }
// deals damage to the players health when called
void doDamage() { health -= 5; }
// Check Victory
......
......@@ -11,31 +11,36 @@
#include "Dungeon.h"
using namespace std;
//prototypes for the menus
// Shows a welcome message
void introMenu();
// Takes info from the inventory of the player and the player stats and displays it
void ingameMenu(Inventory, Player);
int main() {
// initating class pointers so they can be deleted later to save space
Dungeon *dungeonPtr = new Dungeon;
Player *playerPtr = new Player;
Inventory *inventoryPtr = new Inventory;
Monster *monsterPtr = new Monster;
Boss *bossPtr = new Boss;
//victory condition checkers
bool playerWon = false;
bool playerVictory = false;
string name;
//randomizing based on time and seeting the seed randomly between 1 and 650
srand(time(NULL));
int seed = rand() % 650 + 1;
introMenu();
// getting and displaying player info
cout << "Enter your name adventurer!" << endl;
cin >> name;
cin.ignore(1000, '\n');
playerPtr->setPlayerName(name);
playerPtr->setStats(seed);
inventoryPtr->gainItem("Sword", 0, 0);
......@@ -46,13 +51,16 @@ int main() {
//floor 1-3
do {
//getting the room encounter
string response;
playerWon = false;
dungeonPtr->roomEncounter = dungeonPtr->rollRoom();
// runs the encounter every five floors to show a boss
if(dungeonPtr->roomCounter % 5 == 0) {
cout << endl;
cout << "You enter the room" << endl;
// outputting the boss and getting responses till they either run from the boss or kill the boss
dungeonPtr->getBoss(dungeonPtr->floorNum);
do {
......@@ -82,14 +90,16 @@ int main() {
playerWon = true;
}
ingameMenu(*inventoryPtr, *playerPtr);
} while (playerWon == false);
} while (playerWon == false); // checks for defeat of the boss
playerWon = false;
dungeonPtr->roomCounter++;
// runs this if the encounter is not a boss
} else {
cout << endl;
cout << "You enter the room" << endl;
// shows the encounter and gets responses till they either run from the encounter or defeat the encounter
dungeonPtr->getMonster(dungeonPtr->roomEncounter);
do {
cout << "How do you respond? (Fight, Talk, Or Flee): ";
......@@ -117,19 +127,20 @@ int main() {
playerWon = true;
}
ingameMenu(*inventoryPtr, *playerPtr);
} while (playerWon == false);
} while (playerWon == false); // checks for defeat of the monster
playerWon = false;
dungeonPtr->roomCounter++;
}
} while(dungeonPtr->floorNum <= 3);
} while(dungeonPtr->floorNum <= 3); //checks to see if the room is less than 3 to know when to go onto the final boss
//floor 4
cout << endl;
cout << "You enter the room" << endl;
// out puts the final boss and gets responses until they either run from the boss or defeat it
dungeonPtr->getBoss(dungeonPtr->floorNum);
do {
string response;
......@@ -160,14 +171,15 @@ int main() {
playerWon = true;
}
ingameMenu(*inventoryPtr, *playerPtr);
}while (playerWon == false);
}while (playerWon == false); // checks to see if they win the encounter
} while (playerVictory == false);
} while (playerVictory == false); // checks to see if the final boss was beaten
cout << "You win!" << endl;
cout << "Final Inventory" << endl;
ingameMenu(*inventoryPtr, *playerPtr);
//delets the class pointers
delete monsterPtr;
delete bossPtr;
delete inventoryPtr;
......@@ -176,12 +188,14 @@ int main() {
return 0;
}
// intro function
void introMenu() {
cout << "Welcome to DunGen::theExperience()!" << endl;
cout << "You will be diving into the most interesting dungeon around,"
<< " so good luck fighting, talking or fleeing like a little baby!" << endl;
}
//shows stats based on the inventory input and the player input
void ingameMenu(Inventory inventory, Player player) {
cout << "--------------------------------" << endl;
cout << "Inventory" << endl;
......
Markdown is supported
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