diff --git a/Boss.cpp b/Boss.cpp index f2287b408f98ae7edc32c6929dbffe29461ac183..825dee39aac963f6fe3deb7e7d647b287d956620 100644 --- a/Boss.cpp +++ b/Boss.cpp @@ -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) { case 1: diff --git a/Boss.h b/Boss.h index 14b6e51473d55e472a9a40f8e22aed8a92d0760d..44866106a94443e7efe957b4c3f31b31907ccd21 100644 --- a/Boss.h +++ b/Boss.h @@ -32,7 +32,7 @@ class Boss { // Other Functions void summonBoss(int floorNum); void bossResponse(int floorNum, bool playerWon); - void giveBossItems(int floorNum, Inventory inventory); + void giveBossItems(int floorNum, Inventory &inventory); }; diff --git a/DunGen.pptx b/DunGen.pptx index a88d1799800051a95bbba900b371984cf7fda441..ba1a697a90c7f79997077faa42804aa228bacbf4 100644 Binary files a/DunGen.pptx and b/DunGen.pptx differ diff --git a/Monster.cpp b/Monster.cpp index 08976c65d327840f94591e3f8bf059cd414368ee..a023e2a819cf322da2fbfcff5ffa94c84d9ee289 100644 --- a/Monster.cpp +++ b/Monster.cpp @@ -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) { case 1: diff --git a/Monster.h b/Monster.h index 2bf1022472304cf69aa89a33b747bae046b76dd5..25aabfd90fbc686bc5700362780148c4b6dfb314 100644 --- a/Monster.h +++ b/Monster.h @@ -32,7 +32,7 @@ class Monster { // Other Functions void summon(int encounterNum); - void giveMonsterItems(int encounterNum, Inventory inventory); + void giveMonsterItems(int encounterNum, Inventory &inventory); void monsterResponse(int encounterNum, int playerWon); diff --git a/main.cpp b/main.cpp index 151d42648239a2f96aef75d87b29295d238ddce0..954c5ac1ac64085650d37a67dd0fc9d5f69c2941 100644 --- a/main.cpp +++ b/main.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "Player.h" #include "Boss.h" #include "Monster.h" @@ -12,7 +13,7 @@ using namespace std; void introMenu(); -void ingameMenu(Inventory); +void ingameMenu(Inventory, Player); int main() { @@ -25,9 +26,9 @@ int main() { bool playerVictory = false; string name; - int seed; - cout << "Enter a seed: "; - cin >> seed; + srand(time(NULL)); + + int seed = rand() % 650 + 1; introMenu(); @@ -39,7 +40,7 @@ int main() { playerPtr->setStats(seed); inventoryPtr->gainItem("Sword", 0, 0); cout << "Player has been made" << endl; - ingameMenu(*inventoryPtr); + ingameMenu(*inventoryPtr, *playerPtr); do { //floor 1-3 @@ -50,6 +51,7 @@ int main() { dungeonPtr->roomEncounter = dungeonPtr->rollRoom(); if(dungeonPtr->roomCounter % 5 == 0) { + cout << endl; cout << "You enter the room" << endl; dungeonPtr->getBoss(dungeonPtr->floorNum); @@ -60,8 +62,8 @@ int main() { if(playerPtr->getFight() >= bossPtr->getFight(dungeonPtr->floorNum)) { playerWon = true; dungeonPtr->bossResponse(dungeonPtr->floorNum, playerWon); + bossPtr->giveBossItems(dungeonPtr->floorNum, *inventoryPtr); dungeonPtr->floorNum++; - dungeonPtr->giveBossItems(dungeonPtr->floorNum, *inventoryPtr); } else { dungeonPtr->bossResponse(dungeonPtr->floorNum, playerWon); playerPtr->doDamage(); @@ -70,8 +72,8 @@ int main() { if(playerPtr->getFight() >= bossPtr->getTalk(dungeonPtr->floorNum)) { playerWon = true; dungeonPtr->bossResponse(dungeonPtr->floorNum, playerWon); + bossPtr->giveBossItems(dungeonPtr->floorNum, *inventoryPtr); dungeonPtr->floorNum++; - dungeonPtr->giveBossItems(dungeonPtr->floorNum, *inventoryPtr); } else { dungeonPtr->bossResponse(dungeonPtr->floorNum, playerWon); } @@ -79,13 +81,14 @@ int main() { cout << "You run crying out of the room. Shame haunts your footsteps" << endl; playerWon = true; } - + ingameMenu(*inventoryPtr, *playerPtr); } while (playerWon == false); playerWon = false; dungeonPtr->roomCounter++; } else { + cout << endl; cout << "You enter the room" << endl; dungeonPtr->getMonster(dungeonPtr->roomEncounter); do { @@ -95,16 +98,16 @@ int main() { if(playerPtr->getFight() >= monsterPtr->getFight(dungeonPtr->roomEncounter)) { playerWon = true; dungeonPtr->monsterResponse(dungeonPtr->roomEncounter, playerWon); - dungeonPtr->giveMonsterItems(dungeonPtr->roomEncounter, *inventoryPtr); + monsterPtr->giveMonsterItems(dungeonPtr->roomEncounter, *inventoryPtr); } else { - dungeonPtr->monsterResponse(dungeonPtr->roomEncounter, playerWon); + monsterPtr->monsterResponse(dungeonPtr->roomEncounter, playerWon); playerPtr->doDamage(); } } else if (response == "Talk") { if(playerPtr->getFight() >= monsterPtr->getTalk(dungeonPtr->roomEncounter)) { playerWon = true; dungeonPtr->monsterResponse(dungeonPtr->roomEncounter, playerWon); - dungeonPtr->giveMonsterItems(dungeonPtr->roomEncounter, *inventoryPtr); + monsterPtr->giveMonsterItems(dungeonPtr->roomEncounter, *inventoryPtr); } else { dungeonPtr->monsterResponse(dungeonPtr->roomEncounter, playerWon); playerPtr->doDamage(); @@ -113,7 +116,7 @@ int main() { cout << "You run crying out of the room. Shame haunts your footsteps" << endl; playerWon = true; } - + ingameMenu(*inventoryPtr, *playerPtr); } while (playerWon == false); playerWon = false; @@ -125,6 +128,7 @@ int main() { //floor 4 + cout << endl; cout << "You enter the room" << endl; dungeonPtr->getBoss(dungeonPtr->floorNum); do { @@ -155,13 +159,14 @@ int main() { cout << "You run crying out of the room. Shame haunts your footsteps" << endl; playerWon = true; } + ingameMenu(*inventoryPtr, *playerPtr); }while (playerWon == false); } while (playerVictory == false); cout << "You win!" << endl; cout << "Final Inventory" << endl; - ingameMenu(*inventoryPtr); + ingameMenu(*inventoryPtr, *playerPtr); delete monsterPtr; delete bossPtr; @@ -177,9 +182,10 @@ void introMenu() { << " 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 << "Inventory" << endl;; + cout << "Inventory" << endl; + cout << "Player health: " << player.health << endl; inventory.listInventory(); cout << "--------------------------------" << endl; } \ No newline at end of file