Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- #include <string>
- #include <iomanip>
- using namespace std;
- struct player {
- string name = "";
- int hp = 99;
- int max = 25;
- int hit = 0;
- };
- struct stats {
- float wins = 0;
- float loss = 0;
- float winsPerc = 0;
- float lossPerc = 0;
- };
- class duelarena {
- public:
- void PrintMenu();
- void myPause();
- private:
- //betting & credits
- int bet;
- int choice;
- int avaCredits = 10000;
- player p1;
- player p2;
- stats dice;
- stats stake;
- stats diceduel;
- //cheats switch
- bool strcheat = false;
- bool hpcheat = false;
- //cheatcode holder
- string code;
- string person;
- string winner;
- void credits();
- void print_stats(stats & x);
- void Play_Dicing();
- void Play_DiceDuel();
- void Play_Staking();
- void cheatCodes();
- void store();
- };
- //credit system
- void duelarena::credits() {
- cout << "Enter betting amount: ";
- cin >> bet;
- if (avaCredits == 0) {
- cout << "You don't have enough coins to continue. # cleaned.";
- cout << " " << endl;
- PrintMenu();
- }
- while (bet > avaCredits) {
- cout << "You don't have enough coins. \nEnter again: ";
- cin >> bet;
- }
- }
- void duelarena::print_stats(stats &x) {
- if (x.wins > 0 || x.loss > 0) {
- x.winsPerc = (x.wins / (x.wins + dice.loss)) * 100;
- x.lossPerc = (x.loss / (x.wins + dice.loss)) * 100;
- }
- cout << " " << endl;
- cout << "---------------------------------------------" << endl;
- cout << "Wins: " << x.wins << " || %" << x.winsPerc << endl;
- cout << "Loss: " << x.loss << " || %" << x.lossPerc << endl;
- cout << "---------------------------------------------" << endl;
- cout << " " << endl;
- cout << "Coins: $" << avaCredits << endl;
- cout << "" << endl;
- credits();
- }
- //Dicing System
- void duelarena::Play_Dicing() {
- char again;
- do {
- int diceRoll = (rand() % 100);
- string plusminus;
- cout << " __________________________________________ " << endl;
- cout << "<| ====== DUEL ARENA - Dicing ====== |>" << endl;
- cout << "<|__________________________________________|> " << endl;
- cout << " " << endl;
- cout << "Roll a 55 or higher to win your bet. " << endl;
- print_stats(dice);
- cout << " ____ " << endl;
- cout << " /\\' .\\ _____ " << endl;
- cout << " /: \\___\\ / . /\\ " << endl;
- cout << " \\' / . / /____/..\\ " << endl;
- cout << " \\/___/ \\' '\\ / " << endl;
- cout << " \\'__'\\/ " << endl;
- cout << " " << endl;
- cout << "[Rolling dice: " << diceRoll << "]" << endl;
- cout << " " << endl;
- if (diceRoll > 55) {
- cout << "Congratulations, you won the bet!" << endl;
- avaCredits = avaCredits - bet;
- avaCredits = avaCredits + (bet * 2);
- plusminus = "+";
- ++dice.wins;
- }
- else {
- cout << "Sorry, you loss the bet!" << endl;
- avaCredits = avaCredits - bet;
- plusminus = "-";
- ++dice.loss;
- }
- cout << " " << endl;
- cout << "Spoils = " << plusminus << " " << bet << endl;
- cout << " " << endl;
- cout << "=============================================" << endl;
- cout << "Coins: " << "$" << avaCredits << endl;
- cout << "=============================================" << endl;
- cout << "Play Again? (y/n): ";
- cin >> again;
- } while (again == 'y');
- if (again == 'n') {
- PrintMenu();
- }
- }
- //Dicing System
- void duelarena::Play_DiceDuel() {
- char again;
- do {
- int p1_diceRoll = (rand() % 100);
- int p2_diceRoll = (rand() % 100);
- string plusminus;
- cout << " __________________________________________ " << endl;
- cout << "<| ====== DUEL ARENA - Dice Duel ====== |>" << endl;
- cout << "<|__________________________________________|> " << endl;
- cout << " " << endl;
- cout << "Roll higher than Player 2 to win your bet. " << endl;
- print_stats(diceduel);
- cout << " ____ " << endl;
- cout << " /\\' .\\ _____ " << endl;
- cout << " /: \\___\\ / . /\\ " << endl;
- cout << " \\' / . / /____/..\\ " << endl;
- cout << " \\/___/ \\' '\\ / " << endl;
- cout << " \\'__'\\/ " << endl;
- cout << " " << endl;
- cout << "[Player 1 rolls: " << p1_diceRoll << "]" << endl;
- cout << "[Player 2 rolls: " << p2_diceRoll << "]" << endl;
- cout << " " << endl;
- if (p1_diceRoll == p2_diceRoll) {
- cout << "You both roll the same number. its a tie!" << endl;
- }
- if (p1_diceRoll > p2_diceRoll) {
- cout << "Congratulations, you won the bet!" << endl;
- avaCredits = avaCredits - bet;
- avaCredits = avaCredits + (bet * 2);
- plusminus = "+";
- ++diceduel.wins;
- cout << " " << endl;
- cout << "Spoils = " << plusminus << " " << bet << endl;
- cout << " " << endl;
- }
- else {
- cout << "Sorry, you loss the bet!" << endl;
- avaCredits = avaCredits - bet;
- plusminus = "-";
- ++diceduel.loss;
- cout << " " << endl;
- cout << "Spoils = " << plusminus << " " << bet << endl;
- cout << " " << endl;
- }
- cout << "=============================================" << endl;
- cout << "Coins: " << "$" << avaCredits << endl;
- cout << "=============================================" << endl;
- cout << "Play Again? (y/n): ";
- cin >> again;
- } while (again == 'y');
- if (again == 'n') {
- PrintMenu();
- }
- }
- //Staking System
- void duelarena::Play_Staking() {
- char again;
- do {
- if (strcheat == true) {
- p1.max = 35;
- }
- if (hpcheat == true){
- p1.hp = 99999;
- }
- string plusminus;
- int i = 0;
- int pid = 1 + (rand() % 2);
- cout << " __________________________________________ " << endl;
- cout << "<| ====== DUEL ARENA - Staking ====== |>" << endl;
- cout << "<|__________________________________________|> " << endl;
- cout << " " << endl;
- cout << "Player 1 and Player 2 fight to the death." << endl;
- print_stats(stake);
- cout << " " << endl;
- cout << "(1) Player 1" << endl;
- cout << "(2) Player 2" << endl;
- cout << " " << endl;
- cout << "Bet on Player(?): ";
- cin >> choice;
- while (choice > 2 || choice == 0) {
- cout << "Invalid player choice, enter again: ";
- cin >> choice;
- }
- if (choice == 1) {
- person = "Player 1";
- }
- else if (choice == 2) {
- person = "Player 2";
- }
- cout << " " << endl;
- cout << " /\\ " << endl;
- cout << " _ )( ___________________________ " << endl;
- cout << "(_)///////(**)_______Fight!!!____________> " << endl;
- cout << " )( " << endl;
- cout << " \\/ " << endl;
- cout << " " << endl;
- if (pid == 1) {
- while (p1.hp > 0 && p2.hp > 0) {
- ++i;
- if (p1.hp > 0 && p2.hp > 0) {
- p1.hit = rand() % p1.max;
- cout << "Player 1: Hits = " << left << setw(15) << p1.hit << "HP = " << p1.hp << endl;
- p2.hp = p2.hp - p1.hit;
- }
- if (p1.hp > 0 && p2.hp > 0) {
- p2.hit = rand() % 25;
- cout << "Player 2: Hits = " << left << setw(15) << p2.hit << "HP = " << p2.hp << endl;
- p1.hp = p1.hp - p2.hit;
- }
- }
- }
- else if (pid == 2) {
- while (p1.hp > 0 && p2.hp > 0) {
- ++i;
- if (p1.hp > 0 && p2.hp > 0) {
- p2.hit = rand() % 25;
- cout << "Player 2: Hits = " << left << setw(15) << p2.hit << "HP = " << p2.hp << endl;
- p1.hp = p1.hp - p2.hit;
- }
- if (p1.hp > 0 && p2.hp > 0) {
- p1.hit = rand() % p1.max;
- cout << "Player 1: Hits = " << left << setw(15) << p1.hit<< "HP = " << p1.hp << endl;
- p2.hp = p2.hp - p1.hit;
- }
- }
- }
- if (p1.hp <= 0) {
- cout << " " << endl;
- cout << "Player 1 DEFEATED with HP = " << p1.hp << endl;
- cout << " " << endl;
- cout << "---------------------------------------------" << endl;
- cout << " " << endl;
- if (choice == 2) {
- cout << "Congratulation, you won the bet!" << endl;
- avaCredits = avaCredits - bet;
- avaCredits = avaCredits + (bet * 2);
- winner = "Player 2";
- plusminus = "+";
- ++stake.wins;
- }
- else if (choice == 1) {
- cout << "Sorry, you loss the bet!" << endl;
- avaCredits = avaCredits - bet;
- winner = "Player 1";
- plusminus = "-";
- ++stake.loss;
- }
- }
- else if (p2.hp <= 0) {
- cout << " " << endl;
- cout << "Player 2 DEFEATED with HP = " << p2.hp << endl;
- cout << " " << endl;
- cout << "---------------------------------------------" << endl;
- cout << " " << endl;
- if (choice == 1) {
- cout << "Congratulation, you won the bet!" << endl;
- avaCredits = avaCredits - bet;
- avaCredits = avaCredits + (bet * 2);
- winner = "Player 1";
- plusminus = "+";
- ++stake.wins;
- }
- else if (choice == 2) {
- cout << "Sorry, you loss the bet!" << endl;
- avaCredits = avaCredits - bet;
- winner = "Player 2";
- plusminus = "-";
- ++stake.loss;
- }
- }
- cout << " " << endl;
- cout << "Winner = " << person << endl;
- cout << "Spoils = " << plusminus << " " << bet << endl;
- p1.hp = 99;
- p2.hp = 99;
- choice = 0;
- cout << " " << endl;
- cout << "=============================================" << endl;
- cout << "Coins: " << "$" << avaCredits << endl;
- cout << "=============================================" << endl;
- cout << "Play Again? (y/n): ";
- cin >> again;
- } while (again == 'y');
- if (again == 'n') {
- PrintMenu();
- }
- }
- void pause() {
- cout << "Press [Enter] to continue." << endl;
- cin.get();
- }
- //Cheat System
- void duelarena::cheatCodes() {
- cout << " __________________________________________ " << endl;
- cout << "<| ======== Add Coins ======== |>" << endl;
- cout << "<|__________________________________________|> " << endl;
- cout << "" << endl;
- cout << "Enter code: ";
- cin >> code;
- cout << " " << endl;
- if (code == "money1") {
- avaCredits = avaCredits + 10000;
- cout << "[You successfully redeem 'money1' for 10,000 coins]" << endl;
- }
- else if (code == "money2") {
- avaCredits = avaCredits + 100000;
- cout << "[You successfully redeem 'money2' for 100,000 coins]" << endl;
- }
- else if (code == "bank") {
- avaCredits = avaCredits + 1000000;
- cout << "[You successfully redeem 'bank' for 1,000,000 coins]" << endl;
- }
- else if (code == "cash") {
- avaCredits = avaCredits + 10000000;
- cout << "[You successfully redeem 'cash' for 10,000,000 coins]" << endl;
- }
- else if (code == "showmethemoney") {
- avaCredits = avaCredits + 100000000;
- cout << "[You successfully redeem 'showmethemoney' for 100,000,000 coins]" << endl;
- }
- else if (code == "strengthpot") {
- strcheat = true;
- cout << "[Player 1 max hit increased to 35]" << endl;
- }
- else if (code == "hacker") {
- hpcheat = true;
- cout << "[Player 1 hp set to 9999]" << endl;
- }
- else {
- cout << "You entered an invalid code, please try again." << endl;
- }
- cout << " " << endl;
- cout << "---------------------------------------------" << endl;
- PrintMenu();
- }
- void duelarena::store() {
- cout << " __________________________________________ " << endl;
- cout << "<| ======== Store ======== |>" << endl;
- cout << "<|__________________________________________|> " << endl;
- cout << "" << endl;
- cout << "Coming soon..." << endl;
- cout << " " << endl;
- cout << "---------------------------------------------" << endl;
- PrintMenu();
- }
- void duelarena::PrintMenu()
- {
- int myChoice = 0;
- cout << " " << endl;
- cout << " __________________________________________ " << endl;
- cout << "<| ======== Main Menu ======== |>" << endl;
- cout << "<|__________________________________________|> " << endl;
- cout << " " << endl;
- cout << "(1): [Play] Dicing." << endl;
- cout << "(2): [Play] Dice Duel." << endl;
- cout << "(3): [Play] Staking." << endl;
- cout << "(4): [Add] Code." << endl;
- cout << "(5): [Buy] Store." << endl;
- cout << "(6): About." << endl;
- cout << " " << endl;
- cout << "---------------------------------------------" << endl;
- cout << " " << endl;
- cout << "Enter menu(?): ";
- cin >> myChoice;
- while (myChoice > 6 || myChoice < 0) {
- cout << "Invalid choice. Enter Menu(?): ";
- cin >> myChoice;
- }
- switch (myChoice)
- {
- case 1:
- Play_Dicing();
- break;
- case 2:
- Play_DiceDuel();
- break;
- case 3:
- Play_Staking();
- break;
- case 4:
- cheatCodes();
- break;
- case 5:
- store();
- break;
- case 6:
- cout << " __________________________________________ " << endl;
- cout << "<| Created by iSayChris - Version 0.95 Beta |>" << endl;
- cout << "<|__________________________________________|> " << endl;
- cout << " " << endl;
- cout << "Redeemable codes:" << endl;
- cout << "'money1' = 10k" << endl;
- cout << "'money2' = 100k" << endl;
- cout << "'bank' = 1M" << endl;
- cout << "'cash' = 10M" << endl;
- cout << "'showmethemoney' = 100M" << endl;
- cout << "'strengthpot' = increases max hit to 35." << endl;
- cout << "'hacker' = ???" << endl;
- cout << " " << endl;
- cout << "---------------------------------------------" << endl;
- cout << "" << endl;
- myPause();
- PrintMenu();
- break;
- }
- }
- void duelarena::myPause()
- {
- cout << "Press [Enter] to go back to Main Menu." << endl;
- cin.clear();
- cin.sync();
- cin.get();
- }
- int main()
- {
- duelarena o;
- cout << " " << endl;
- cout << "// Gambling Simulator 2016" << endl;
- cout << "// Created by iSayChris" << endl;
- cout << "// Version : 1.1" << endl;
- srand(time(0));
- o.PrintMenu();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement