Commit 23b3e678 authored by Aaron Sturtevant's avatar Aaron Sturtevant

commiting

parent 4ce54cd2
#include <iomanip> #include <iomanip>
#include <iostream> #include <iostream>
#include <stdlib.h> #include <stdlib.h>
...@@ -10,11 +11,11 @@ class Dungeon { ...@@ -10,11 +11,11 @@ class Dungeon {
int monsterRoll; int monsterRoll;
int roomCounter = 1; int roomCounter = 1;
int rollRoom(int seed); int rollRoom();
void dungeonOutput(int encounterNum); void getMonster(int encounterNum);
monsterResponse(int encounterNum, string response); void monsterResponse(int encounterNum, string response);
getBoss(int floorNum); void getBoss(int floorNum);
bossResponse(int floorNum, string response); void bossResponse(int floorNum, string response);
......
...@@ -3,13 +3,18 @@ ...@@ -3,13 +3,18 @@
#include <cstdlib> #include <cstdlib>
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include "Player.h"
#include "Boss.h"
#include "Monster.h"
#include "Inventory.h"
#include "Dungeon.h"
using namespace std; using namespace std;
int main() { int main() {
Dungeon *dungeonPtr = new Dungeon; Dungeon *dungeonPtr = new Dungeon;
Player *playerPtr = new Player; Player *playerPtr = new Player;
Items *itemPtr = new Item; Inventory *inventoryPtr = new Inventory;
Monster *monsterPtr = new Monster; Monster *monsterPtr = new Monster;
Boss *bossPtr = new Boss; Boss *bossPtr = new Boss;
bool playerWon = false; bool playerWon = false;
...@@ -37,7 +42,7 @@ int main() { ...@@ -37,7 +42,7 @@ int main() {
while(dungeonPtr.floorNum <= 3) { while(dungeonPtr.floorNum <= 3) {
string *response = new string; string *response = new string;
playerWon = false; playerWon = false;
dungeon.roomEncounter = dungeon.rollRoom(seed); dungeon.roomEncounter = dungeon.rollRoom();
if(dungeonPtr.roomCounter % 5 == 0) { if(dungeonPtr.roomCounter % 5 == 0) {
dungeon.getBoss(dungeonPtr.floorNum); dungeon.getBoss(dungeonPtr.floorNum);
...@@ -49,7 +54,7 @@ int main() { ...@@ -49,7 +54,7 @@ int main() {
dungeonPtr.bossResponse(dungeonPtr.floorNum, playerWon); dungeonPtr.bossResponse(dungeonPtr.floorNum, playerWon);
playerWon = true; playerWon = true;
dungeonPtr.floorNum++; dungeonPtr.floorNum++;
monsterPtr.giveItems(dungeonPtr.floorNum, itemPtr); monsterPtr.giveItems(dungeonPtr.floorNum, inventoryPtr);
} else { } else {
dungeonPtr.bossResponse(dungeonPtr.floorNum, playerWon); dungeonPtr.bossResponse(dungeonPtr.floorNum, playerWon);
} }
...@@ -73,11 +78,11 @@ int main() { ...@@ -73,11 +78,11 @@ int main() {
cin >> response; cin >> response;
if((response == 'Fight') || (response == 'Talk') { if((response == 'Fight') || (response == 'Talk') {
if(dungeon.compareStats(playerPtr, monsterPtr, dungeon.roomEncounter)) { if(dungeon.compareStats(playerPtr, monsterPtr, dungeon.roomEncounter)) {
dungeonPtr.monsterResponse(dungeonPtr.floorNum, playerWon); dungeonPtr.monsterResponse(dungeonPtr.encounterNum, playerWon);
playerWon = true; playerWon = true;
monsterPtr.giveItems(dungeonPtr.encounterNum, itemPtr); monsterPtr.giveItems(dungeonPtr.encounterNum, inventoryPtr);
} else { } else {
dungeonPtr.bossResponse(dungeonPtr.floorNum, playerWon); dungeonPtr.bossResponse(dungeonPtr.encounterNum, playerWon);
} }
} else { } else {
...@@ -92,7 +97,8 @@ int main() { ...@@ -92,7 +97,8 @@ int main() {
dungeon.roomCounter++; dungeon.roomCounter++;
} }
delete response;
} }
...@@ -100,6 +106,7 @@ int main() { ...@@ -100,6 +106,7 @@ int main() {
dungeon.getBoss(dungeonPtr.floorNum); dungeon.getBoss(dungeonPtr.floorNum);
do { do {
string *response = new string;
cout << "How do you respond? (Fight, Talk, Or Flee): "; cout << "How do you respond? (Fight, Talk, Or Flee): ";
cin >> response; cin >> response;
if((response == 'Fight') || (response == 'Talk') { if((response == 'Fight') || (response == 'Talk') {
...@@ -108,7 +115,7 @@ int main() { ...@@ -108,7 +115,7 @@ int main() {
playerWon = true; playerWon = true;
playerVictory = true; playerVictory = true;
dungeonPtr.floorNum++; dungeonPtr.floorNum++;
monsterPtr.giveItems(dungeonPtr.floorNum, itemPtr); monsterPtr.giveItems(dungeonPtr.floorNum, inventoryPtr);
} else { } else {
dungeonPtr.bossResponse(dungeonPtr.floorNum, playerWon); dungeonPtr.bossResponse(dungeonPtr.floorNum, playerWon);
} }
...@@ -118,11 +125,18 @@ int main() { ...@@ -118,11 +125,18 @@ int main() {
playerWon = true; playerWon = true;
dungeon.floorNum--; dungeon.floorNum--;
} }
delete response;
} while (playerWon == false;); } while (playerWon == false;);
} }
cout << "You win!"; cout << "You win!";
delete monsterPtr;
delete dungeonPtr;
delete bossPtr;
delete inventoryPtr;
delete playerPtr;
return 0; return 0;
} }
\ No newline at end of file
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