Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <stdio.h>
- #include <Windows.h>
- #include <cstdlib>
- #include <time.h>
- using namespace std;
- void display_menu(bool room_discovered[], string room_description[], int lenght)
- {
- for (int i=0; i< lenght; i++)
- {
- if(room_discovered[i])
- {
- cout << i+1 <<". "<< room_description[i] << endl;
- }
- else
- {
- cout << i+1 << ". Nieznane pomieszczenie" << endl;
- }
- }
- }
- int fight(string attacker, string defender, int attack)
- {
- cout << attacker << " atakuje " << defender << " z siłą " << attack << endl;
- Sleep(100);
- return attack;
- }
- int main()
- {
- SetConsoleOutputCP(65001); // strona kodowa na polskie znaki
- int health_player = 100;
- int health_enemy{};
- int enemy_killed{};
- bool sealFounded = false;
- bool is_victory = false; // stan gry
- bool room_discovered[] = {false, false, false};
- string room_description[] = {"Komnata leczenia", "Pokój strażnika", "Komnata bossa"};
- int choice = 0;
- srand(time(nullptr));
- cout << "Jesteście śmiałkami którzy trafili do legendarnego lochu Nexraxonu. ";
- cout << "Musicie pokonać Ahzoga plugawiciela dusz aby zdobyć legendarny skarb. ";
- cout << "Jednak droga niejest łatwa, loch jest najeżony wieloma pułapkami, a dostępu ";
- cout << "do Ahzoga pilnują jego wierni słudzy których należy pokonać.\n\n";
- while (health_player > 0 && !is_victory)
- {
- // funkcja display_stats
- printf("Twoje życie wynosi %d \nStażnikow pokonanych %d \nOdkrytych pieczęci %d\n",
- health_player, enemy_killed, sealFounded);
- cout << endl;
- // display_menu
- cout << "Widzisz trzy pomieszczenia. Do ktorego chesz iść? " << endl;
- display_menu(room_discovered, room_description, 3);
- cin >> choice;
- switch (choice)
- {
- case 1:
- room_discovered[0] = true;
- cout << "Wchodzisz do komnaty leczenia. Twoje zdrowie wzrasta do 100" << endl;
- health_player = 100;
- break;
- case 2:
- room_discovered[1] = true;
- cout << "Atakuje cie strażnik pieczęci, Gradon \n";
- health_enemy = rand() % 31 + 40;
- while (health_enemy >0 && health_player > 0)
- {
- // fight(kto, kogo, wartość_ataku)
- int enemy_attack = rand()%5 + 3;
- int player_attack = rand()%5 + 3;
- health_player -= enemy_attack;
- health_enemy -= player_attack;
- }
- break;
- case 3:
- room_discovered[2] = true;
- break;
- default:
- cout << "Nieznane pomieszczenie \n";
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement