Commit 0f0ac21c authored by Eli Chung's avatar Eli Chung

Merge branch 'master' of gitlab.cs.wallawalla.edu:sturaa/cptr142_group_project

parents d96b695c 0088dd91
...@@ -116,7 +116,7 @@ void Boss::bossResponse(int floorNum, bool playerWon) { ...@@ -116,7 +116,7 @@ void Boss::bossResponse(int floorNum, bool playerWon) {
} }
} }
void Boss::giveBossItems(int floorNum, Inventory inventory) { void Boss::giveBossItems(int floorNum, Inventory &inventory) {
switch(floorNum) { switch(floorNum) {
case 1: case 1:
......
...@@ -32,7 +32,7 @@ class Boss { ...@@ -32,7 +32,7 @@ class Boss {
// Other Functions // Other Functions
void summonBoss(int floorNum); void summonBoss(int floorNum);
void bossResponse(int floorNum, bool playerWon); void bossResponse(int floorNum, bool playerWon);
void giveBossItems(int floorNum, Inventory inventory); void giveBossItems(int floorNum, Inventory &inventory);
}; };
......
No preview for this file type
...@@ -215,7 +215,7 @@ int Monster::getTalk(int encounterNum) { ...@@ -215,7 +215,7 @@ int Monster::getTalk(int encounterNum) {
} }
} }
void Monster::giveMonsterItems(int encounterNum, Inventory inventory) { void Monster::giveMonsterItems(int encounterNum, Inventory &inventory) {
switch(encounterNum) { switch(encounterNum) {
case 1: case 1:
......
...@@ -32,7 +32,7 @@ class Monster { ...@@ -32,7 +32,7 @@ class Monster {
// Other Functions // Other Functions
void summon(int encounterNum); void summon(int encounterNum);
void giveMonsterItems(int encounterNum, Inventory inventory); void giveMonsterItems(int encounterNum, Inventory &inventory);
void monsterResponse(int encounterNum, int playerWon); void monsterResponse(int encounterNum, int playerWon);
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <cstdlib> #include <cstdlib>
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <time.h>
#include "Player.h" #include "Player.h"
#include "Boss.h" #include "Boss.h"
#include "Monster.h" #include "Monster.h"
...@@ -12,7 +13,7 @@ using namespace std; ...@@ -12,7 +13,7 @@ using namespace std;
void introMenu(); void introMenu();
void ingameMenu(Inventory); void ingameMenu(Inventory, Player);
int main() { int main() {
...@@ -25,9 +26,9 @@ int main() { ...@@ -25,9 +26,9 @@ int main() {
bool playerVictory = false; bool playerVictory = false;
string name; string name;
int seed; srand(time(NULL));
cout << "Enter a seed: ";
cin >> seed; int seed = rand() % 650 + 1;
introMenu(); introMenu();
...@@ -39,7 +40,7 @@ int main() { ...@@ -39,7 +40,7 @@ int main() {
playerPtr->setStats(seed); playerPtr->setStats(seed);
inventoryPtr->gainItem("Sword", 0, 0); inventoryPtr->gainItem("Sword", 0, 0);
cout << "Player has been made" << endl; cout << "Player has been made" << endl;
ingameMenu(*inventoryPtr); ingameMenu(*inventoryPtr, *playerPtr);
do { do {
//floor 1-3 //floor 1-3
...@@ -50,6 +51,7 @@ int main() { ...@@ -50,6 +51,7 @@ int main() {
dungeonPtr->roomEncounter = dungeonPtr->rollRoom(); dungeonPtr->roomEncounter = dungeonPtr->rollRoom();
if(dungeonPtr->roomCounter % 5 == 0) { if(dungeonPtr->roomCounter % 5 == 0) {
cout << endl;
cout << "You enter the room" << endl; cout << "You enter the room" << endl;
dungeonPtr->getBoss(dungeonPtr->floorNum); dungeonPtr->getBoss(dungeonPtr->floorNum);
...@@ -60,8 +62,8 @@ int main() { ...@@ -60,8 +62,8 @@ int main() {
if(playerPtr->getFight() >= bossPtr->getFight(dungeonPtr->floorNum)) { if(playerPtr->getFight() >= bossPtr->getFight(dungeonPtr->floorNum)) {
playerWon = true; playerWon = true;
dungeonPtr->bossResponse(dungeonPtr->floorNum, playerWon); dungeonPtr->bossResponse(dungeonPtr->floorNum, playerWon);
bossPtr->giveBossItems(dungeonPtr->floorNum, *inventoryPtr);
dungeonPtr->floorNum++; dungeonPtr->floorNum++;
dungeonPtr->giveBossItems(dungeonPtr->floorNum, *inventoryPtr);
} else { } else {
dungeonPtr->bossResponse(dungeonPtr->floorNum, playerWon); dungeonPtr->bossResponse(dungeonPtr->floorNum, playerWon);
playerPtr->doDamage(); playerPtr->doDamage();
...@@ -70,8 +72,8 @@ int main() { ...@@ -70,8 +72,8 @@ int main() {
if(playerPtr->getFight() >= bossPtr->getTalk(dungeonPtr->floorNum)) { if(playerPtr->getFight() >= bossPtr->getTalk(dungeonPtr->floorNum)) {
playerWon = true; playerWon = true;
dungeonPtr->bossResponse(dungeonPtr->floorNum, playerWon); dungeonPtr->bossResponse(dungeonPtr->floorNum, playerWon);
bossPtr->giveBossItems(dungeonPtr->floorNum, *inventoryPtr);
dungeonPtr->floorNum++; dungeonPtr->floorNum++;
dungeonPtr->giveBossItems(dungeonPtr->floorNum, *inventoryPtr);
} else { } else {
dungeonPtr->bossResponse(dungeonPtr->floorNum, playerWon); dungeonPtr->bossResponse(dungeonPtr->floorNum, playerWon);
} }
...@@ -79,13 +81,14 @@ int main() { ...@@ -79,13 +81,14 @@ int main() {
cout << "You run crying out of the room. Shame haunts your footsteps" << endl; cout << "You run crying out of the room. Shame haunts your footsteps" << endl;
playerWon = true; playerWon = true;
} }
ingameMenu(*inventoryPtr, *playerPtr);
} while (playerWon == false); } while (playerWon == false);
playerWon = false; playerWon = false;
dungeonPtr->roomCounter++; dungeonPtr->roomCounter++;
} else { } else {
cout << endl;
cout << "You enter the room" << endl; cout << "You enter the room" << endl;
dungeonPtr->getMonster(dungeonPtr->roomEncounter); dungeonPtr->getMonster(dungeonPtr->roomEncounter);
do { do {
...@@ -95,16 +98,16 @@ int main() { ...@@ -95,16 +98,16 @@ int main() {
if(playerPtr->getFight() >= monsterPtr->getFight(dungeonPtr->roomEncounter)) { if(playerPtr->getFight() >= monsterPtr->getFight(dungeonPtr->roomEncounter)) {
playerWon = true; playerWon = true;
dungeonPtr->monsterResponse(dungeonPtr->roomEncounter, playerWon); dungeonPtr->monsterResponse(dungeonPtr->roomEncounter, playerWon);
dungeonPtr->giveMonsterItems(dungeonPtr->roomEncounter, *inventoryPtr); monsterPtr->giveMonsterItems(dungeonPtr->roomEncounter, *inventoryPtr);
} else { } else {
dungeonPtr->monsterResponse(dungeonPtr->roomEncounter, playerWon); monsterPtr->monsterResponse(dungeonPtr->roomEncounter, playerWon);
playerPtr->doDamage(); playerPtr->doDamage();
} }
} else if (response == "Talk") { } else if (response == "Talk") {
if(playerPtr->getFight() >= monsterPtr->getTalk(dungeonPtr->roomEncounter)) { if(playerPtr->getFight() >= monsterPtr->getTalk(dungeonPtr->roomEncounter)) {
playerWon = true; playerWon = true;
dungeonPtr->monsterResponse(dungeonPtr->roomEncounter, playerWon); dungeonPtr->monsterResponse(dungeonPtr->roomEncounter, playerWon);
dungeonPtr->giveMonsterItems(dungeonPtr->roomEncounter, *inventoryPtr); monsterPtr->giveMonsterItems(dungeonPtr->roomEncounter, *inventoryPtr);
} else { } else {
dungeonPtr->monsterResponse(dungeonPtr->roomEncounter, playerWon); dungeonPtr->monsterResponse(dungeonPtr->roomEncounter, playerWon);
playerPtr->doDamage(); playerPtr->doDamage();
...@@ -113,7 +116,7 @@ int main() { ...@@ -113,7 +116,7 @@ int main() {
cout << "You run crying out of the room. Shame haunts your footsteps" << endl; cout << "You run crying out of the room. Shame haunts your footsteps" << endl;
playerWon = true; playerWon = true;
} }
ingameMenu(*inventoryPtr, *playerPtr);
} while (playerWon == false); } while (playerWon == false);
playerWon = false; playerWon = false;
...@@ -125,6 +128,7 @@ int main() { ...@@ -125,6 +128,7 @@ int main() {
//floor 4 //floor 4
cout << endl;
cout << "You enter the room" << endl; cout << "You enter the room" << endl;
dungeonPtr->getBoss(dungeonPtr->floorNum); dungeonPtr->getBoss(dungeonPtr->floorNum);
do { do {
...@@ -155,13 +159,14 @@ int main() { ...@@ -155,13 +159,14 @@ int main() {
cout << "You run crying out of the room. Shame haunts your footsteps" << endl; cout << "You run crying out of the room. Shame haunts your footsteps" << endl;
playerWon = true; playerWon = true;
} }
ingameMenu(*inventoryPtr, *playerPtr);
}while (playerWon == false); }while (playerWon == false);
} while (playerVictory == false); } while (playerVictory == false);
cout << "You win!" << endl; cout << "You win!" << endl;
cout << "Final Inventory" << endl; cout << "Final Inventory" << endl;
ingameMenu(*inventoryPtr); ingameMenu(*inventoryPtr, *playerPtr);
delete monsterPtr; delete monsterPtr;
delete bossPtr; delete bossPtr;
...@@ -177,9 +182,10 @@ void introMenu() { ...@@ -177,9 +182,10 @@ void introMenu() {
<< " so good luck fighting, talking or fleeing like a little baby!" << endl; << " so good luck fighting, talking or fleeing like a little baby!" << endl;
} }
void ingameMenu(Inventory inventory) { void ingameMenu(Inventory inventory, Player player) {
cout << "--------------------------------" << endl; cout << "--------------------------------" << endl;
cout << "Inventory" << endl;; cout << "Inventory" << endl;
cout << "Player health: " << player.health << endl;
inventory.listInventory(); inventory.listInventory();
cout << "--------------------------------" << endl; cout << "--------------------------------" << endl;
} }
\ 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