commit 4050e30ae8896200438abee90b800cdb873bbd56 Author: Lucas Patenaude Date: Tue Nov 4 20:22:10 2025 -0700 Initialize files from GitLab repository diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..496ee2c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6f54858 --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +play: compile + @/bin/bash -c ./play + +compile: obj/TheTournament.o obj/User.o obj/Opponent.o obj/Weapon.o obj/Armor.o obj/Potion.o obj/Map.o + g++ obj/TheTournament.o obj/User.o obj/Opponent.o obj/Weapon.o obj/Armor.o obj/Potion.o obj/Map.o -o Play + +# Rule to create the obj directory +obj: + mkdir -p obj + +obj/TheTournament.o: src/TheTournament.cpp | obj + g++ -c src/TheTournament.cpp -o obj/TheTournament.o + +obj/User.o: lib/people/User.cpp include/people/User.h + g++ -c lib/people/User.cpp -o obj/User.o + +obj/Opponent.o: lib/people/Opponent.cpp include/people/Opponent.h + g++ -c lib/people/Opponent.cpp -o obj/Opponent.o + +obj/Weapon.o: lib/items/Weapon.cpp include/items/Weapon.h + g++ -c lib/items/Weapon.cpp -o obj/Weapon.o + +obj/Armor.o: lib/items/Armor.cpp include/items/Armor.h + g++ -c lib/items/Armor.cpp -o obj/Armor.o + +obj/Potion.o: lib/items/Potion.cpp include/items/Potion.h + g++ -c lib/items/Potion.cpp -o obj/Potion.o + +obj/Map.o: lib/ship/Map.cpp include/ship/Map.h + g++ -c lib/ship/Map.cpp -o obj/Map.o + +clean: + rm -rf obj TheTournament + rm -f *.o TheTournament \ No newline at end of file diff --git a/doc/logo.png b/doc/logo.png new file mode 100644 index 0000000..80c544d Binary files /dev/null and b/doc/logo.png differ diff --git a/include/items/Armor.h b/include/items/Armor.h new file mode 100644 index 0000000..ffd469c --- /dev/null +++ b/include/items/Armor.h @@ -0,0 +1,34 @@ +#ifndef ARMOR_H +#define ARMOR_H + +#include +using namespace std; + + +class Armor +{ + // data members + private: + string name; + int health; + int hits_remaining; + int upgrades_remaining; + int value; + + public: + // Constructors of Armor class + Armor(); + Armor(string armor_name, int health_added, int cost); + + // SETTER FUNCIONS + + // GETTER FUNCTIONS + string getArmorName(); + int getArmorHealth(); + int getArmorHitsRemaining(); + int getArmorUpgradesRemaining(); + int getArmorValue(); + +}; + +#endif \ No newline at end of file diff --git a/include/items/Potion.h b/include/items/Potion.h new file mode 100644 index 0000000..d1320f7 --- /dev/null +++ b/include/items/Potion.h @@ -0,0 +1,32 @@ +#ifndef POTION_H +#define POTION_H + +#include +using namespace std; + +class Potion +{ + private: + string name; + int heal_amount; + int value; + int amount; + int potions_amount; + + public: + Potion(); + Potion(string potion_name, int amount_provided, int cost); + + // SETTER FUNCTIONS + void setPotionName(string name); + void setPotionValue(int cost); + void addPotion(); + void subtractPotion(); + + // GETTER FUNCTIONS + string getPotionName(); + int getPotionValue(); + int getPotionAmount(); +}; + +#endif \ No newline at end of file diff --git a/include/items/Weapon.h b/include/items/Weapon.h new file mode 100644 index 0000000..cd91759 --- /dev/null +++ b/include/items/Weapon.h @@ -0,0 +1,43 @@ +#ifndef WEAPON_H +#define WEAPON_H + +#include + +using namespace std; +class Weapon +{ + // data members + private: + string name; + int base_damage; + int base_heavy_damage; + int max_damage; + int max_heavy_damage; + int hits_remaining; + int upgrades_remaining; + int value; + + public: + // Constructors of Weapon class + Weapon(); + Weapon(string weapon_name, int base, int max, int cost); + + // SETTER FUNCIONS + void setWeaponValue(int cost); + void setUpgradesRemaining(int upgrades_remaining); + void setWeaponBaseHeavyDamage(int level, int base, int random); + void setWeaponMaxHeavyDamage(int level, int base, int random); + + + // GETTER FUNCTIONS + string getWeaponName(); + int getWeaponValue(); + int getWeaponBaseDamage(); + int getWeaponBaseHeavyDamage(); + int getWeaponMaxDamage(); + int getWeaponMaxHeavyDamage(); + int getWeaponHitsRemaining(); + int getWeaponUpgradesRemaining(); +}; + +#endif \ No newline at end of file diff --git a/include/people/Opponent.h b/include/people/Opponent.h new file mode 100644 index 0000000..862d68f --- /dev/null +++ b/include/people/Opponent.h @@ -0,0 +1,34 @@ +#ifndef OPPONENT_H +#define OPPONENT_H + +#include +using namespace std; + +class Opponent +{ + private: + string name; + int current_health; + int max_health; + int level; + int base_damage; + int max_damage; + + public: + Opponent(); + Opponent(string opponent_name, int opponent_level, int base, int max); + + // SETTER FUNCTIONS + void setOpponentHealth(int damage_taken); // Set current Health minus dmaage_taken + + // GETTER FUNCTIONS + string getOpponentName(); + int getOpponentHealth(); + int getOpponentMaxHealth(); + int getOpponentLevel(); + int getOpponentBaseDamage(); + int getOpponentMaxDamage(); + int getPotionAmount(); +}; + +#endif \ No newline at end of file diff --git a/include/people/User.h b/include/people/User.h new file mode 100644 index 0000000..049b830 --- /dev/null +++ b/include/people/User.h @@ -0,0 +1,53 @@ +#ifndef USER_H +#define USER_H + +#include "../items/Weapon.h" // include the Weapon header file +#include "../items/Armor.h" +#include "../items/Potion.h" + +#include + +class User +{ + private: + string name; + int current_health; + int max_health; + int level; + int xp_points; + int xp_needed; + int credits; + Weapon equipped_weapon[2]; // declare the user_weapons array to hold 2 Weapon objects + Armor equipped_armor[3]; + Potion equipped_potions[5]; + + public: + User(string username, Weapon current_weapons[], Armor current_armor[], Potion current_potions[]); + + // SETTER FUNCTIONS + void setUserName(string username); + void setUserHealth(int damage_taken); + void setHealthAfterPurchase(int armor_amount_added); + void setUserHealthFull(int full_health); + void addArmorToHealth(Armor current_armor); + void setMaxHealth(Armor current_armor[]); + void setUserCredits(int current_credits); + void giveUserCredits(int credits_added); + void setUserXP(int xp_earned); + void resetUserXP(int xp_remaining); + void setUserXPNeeded(int level); //Returns amount of XP needed to level up (random each time) + void usePotion(int potion_amount); + void levelUpUser(int current_level); + + // GETTER FUNCTIONS + string getUserName(); + int getUserHealth(); + int getUserMaxHealth(); + int getUserLevel(); + int getUserXP(); + int getUserCredits(); + int getUserXPNeeded(); + Weapon getUserWeapon(int input); // add a semicolon at the end of the function definition +}; + +#endif diff --git a/include/ship/Map.h b/include/ship/Map.h new file mode 100644 index 0000000..1dc018c --- /dev/null +++ b/include/ship/Map.h @@ -0,0 +1,57 @@ + +#ifndef MAP_H +#define MAP_H + +#include + +using namespace std; + +class Map +{ +private: + char SHIP = '-'; + char BED = 'B'; // marker for room locations + char FIGHTER = 'o'; // marker for party position + char EXIT = 'H'; // marker for ship exit + + static const int num_rows_ = 12; // number of rows in map + static const int num_cols_ = 12; // number of columns in map + static const int max_npcs_ = 5; // max non-player characters + static const int max_rooms_ = 5; // max number of rooms + + int player_position_[2]; // player position (row,col) + int ship_exit_[2]; + int ship_bed_[2]; // exit location of the ship + int npc_positions_[max_npcs_][3]; // stores the (row,col) positions of NPCs present on map and if they have been found + int room_positions_[max_rooms_][2]; // stores the (row,col) positions of rooms present on map + char map_data_[num_rows_][num_cols_]; // stores the character that will be shown at a given (row,col) + + int npc_count_; // stores number of misfortunes currently on map + int room_count_; // stores number of sites currently on map +public: + Map(); + + void resetMap(); + + // getters + int getPlayerRow(); + int getPlayerCol(); + int getShipExitRow(); + int getShipExitCol(); + int getNumRows(); + int getNumCols(); + bool isOnMap(int row, int col); + bool isShipExit(int row, int col); + bool isShipBed(int row, int col); + + // setters + void setPlayerPosition(int row, int col); + void setShipExit(int row, int col); + void setShipBed(int row, int col); + + // other + void displayMap(); + bool move(char); +}; + +#endif \ No newline at end of file diff --git a/lib/items/Armor.cpp b/lib/items/Armor.cpp new file mode 100644 index 0000000..fdc8b52 --- /dev/null +++ b/lib/items/Armor.cpp @@ -0,0 +1,53 @@ +#include "../../include/items/Armor.h" + +#include +using namespace std; + +// This constructor just initializes the Armor to null. +Armor::Armor() +{ + name = "No Armor Equipped"; + health = 0; + hits_remaining = 0; + upgrades_remaining = 0; + value = 0; +} + +// This constructor just initializes the Armor to the passed values. +Armor::Armor(string armor_name, int health_added, int cost) +{ + name = armor_name; + health = health_added; + hits_remaining = 150; + upgrades_remaining = 3; + value = cost; +} + +// SETTER FUNCTIONS + +// GETTER FUNCTIONS + +string Armor::getArmorName() +{ + return name; +} + +int Armor::getArmorHealth() +{ + return health; +} + +int Armor::getArmorHitsRemaining() +{ + return hits_remaining; +} + +int Armor::getArmorUpgradesRemaining() +{ + return upgrades_remaining; +} + +int Armor::getArmorValue() +{ + return value; +} \ No newline at end of file diff --git a/lib/items/Potion.cpp b/lib/items/Potion.cpp new file mode 100644 index 0000000..30d814f --- /dev/null +++ b/lib/items/Potion.cpp @@ -0,0 +1,58 @@ +#include "../../include/items/Potion.h" + +#include +#include +#include + +using namespace std; + +// This constructor just initializes the User to null. + +Potion::Potion() +{ + name = "No Potion Stocked"; + heal_amount = 0; + value = 0; + +} + +Potion::Potion(string potion_name, int amount_provided, int cost) +{ + name = potion_name; + heal_amount = amount_provided; + value = cost; +} + +//SETTER FUNCTIONS +void Potion::setPotionName(string potion_name) +{ + name = potion_name; +} + +void Potion::setPotionValue(int cost) +{ + value = cost; +} + +// GETTER FUNCTIONS +string Potion::getPotionName() +{ + return name; +} + +int Potion::getPotionValue() +{ + return value; +} + +int Potion::getPotionAmount() +{ + return heal_amount; +} + + + + + + + diff --git a/lib/items/Weapon.cpp b/lib/items/Weapon.cpp new file mode 100644 index 0000000..fabec3f --- /dev/null +++ b/lib/items/Weapon.cpp @@ -0,0 +1,95 @@ +#include "../../include/items/Weapon.h" + +#include +#include +#include + +using namespace std; + +// This constructor just initializes the Weapon to null. +Weapon::Weapon() +{ + name = "No Secondary Equipped"; + base_damage = 0; + max_damage = 0; + hits_remaining = 0; + upgrades_remaining = 0; + value = 0; +} + +Weapon::Weapon(string weapon_name, int base, int max, int cost) +{ + name = weapon_name; + base_damage = base; + base_heavy_damage = base; + max_damage = max; + max_heavy_damage = max; + hits_remaining = 200; + upgrades_remaining = 3; + value = cost; +} + +//SETTER FUNCTIONS +void Weapon::setWeaponValue(int cost) +{ + value = (cost / 2) * 1.5; +} + +void Weapon::setUpgradesRemaining(int upgrades_remaining) +{ + upgrades_remaining = upgrades_remaining - 1; +} + +void Weapon::setWeaponBaseHeavyDamage(int level, int base, int random) +{ + base_heavy_damage = base + random + (level * 10); +} + +void Weapon::setWeaponMaxHeavyDamage(int level, int max, int random) +{ + max_heavy_damage = max + random + (level * 10); +} + +// GETTER FUNCTIONS +string Weapon::getWeaponName() +{ + return name; +} + +int Weapon::getWeaponValue() +{ + return value; +} + +int Weapon::getWeaponBaseDamage() +{ + return base_damage; +} + +int Weapon::getWeaponBaseHeavyDamage() +{ + return base_heavy_damage; +} + +int Weapon::getWeaponMaxDamage() +{ + return max_damage; +} + +int Weapon::getWeaponMaxHeavyDamage() +{ + return max_heavy_damage; +} + +int Weapon::getWeaponHitsRemaining() +{ + return hits_remaining; +} + +int Weapon::getWeaponUpgradesRemaining() +{ + return upgrades_remaining; +} + + + diff --git a/lib/people/Opponent.cpp b/lib/people/Opponent.cpp new file mode 100644 index 0000000..722f324 --- /dev/null +++ b/lib/people/Opponent.cpp @@ -0,0 +1,71 @@ +#include "../../include/people/Opponent.h" + +#include +#include +#include + +// This constructor just initializes the User to null. + +Opponent::Opponent() +{ + name = "Stick McStickington"; + current_health = 0; + max_health = 0; + level = 1; + base_damage = 1; + max_damage = 1; +} + +Opponent::Opponent(string opponent_name, int opponent_level, int base, int max) +{ + name = opponent_name; + current_health = opponent_level * 100; + max_health = current_health; + level = opponent_level; + base_damage = base; + max_damage = max; + +} + +//SETTER FUNCTIONS +void Opponent::setOpponentHealth(int damage_taken) +{ + current_health = current_health - damage_taken; +} + + +// GETTER FUNCTIONS +string Opponent::getOpponentName() +{ + return name; +} + +int Opponent::getOpponentHealth() +{ + return current_health; +} + +int Opponent::getOpponentMaxHealth() +{ + return max_health; +} + +int Opponent::getOpponentLevel() +{ + return level; +} + +int Opponent::getOpponentBaseDamage() +{ + return base_damage; +} + +int Opponent::getOpponentMaxDamage() +{ + return max_damage; +} + + + + + diff --git a/lib/people/User.cpp b/lib/people/User.cpp new file mode 100644 index 0000000..7773f2c --- /dev/null +++ b/lib/people/User.cpp @@ -0,0 +1,170 @@ +#include "../../include/people/User.h" +#include "../../include/items/Weapon.h" // include the Weapon header file +#include "../../include/items/Armor.h" +#include "../../include/items/Potion.h" + +#include +#include +#include +#include + +using namespace std; + +// This constructor just initializes the User to null. + +User::User(string username, Weapon current_weapons[], Armor current_armor[], Potion current_potions[]) +{ + name = username; + current_health = 100; + max_health = 100; + level = 1; + xp_points = 0; + xp_needed = 500; + credits = 500; + + for (int i = 0; i < 2; i++) + { + equipped_weapon[i] = current_weapons[i]; + } + + for (int i = 0; i < 3; i++) + { + equipped_armor[i] = current_armor[i]; + } + for (int i = 0; i < 4; i++) + { + equipped_potions[i] = current_potions[i]; + } +} + +//SETTER FUNCTIONS +void User::setUserName(string username) +{ + name = username; +} + +void User::setUserHealth(int damage_taken) +{ + current_health = current_health - damage_taken; + + // Set Health to zero if it goes below 0 + if (current_health < 0) + { + current_health = 0; + } +} + +void User::setHealthAfterPurchase(int armor_amount_added) +{ + current_health += armor_amount_added; +} + +void User::setUserHealthFull(int full_health) +{ + current_health = full_health; +} + +void User::setMaxHealth(Armor current_armor[]) +{ + int armor_rating = 0; + for (int i = 0; i < 3; i++) + { + armor_rating += current_armor[i].getArmorHealth(); + } + max_health = 100 + armor_rating; +} + +void User::setUserCredits(int current_credits) +{ + credits = current_credits; +} + +void User::giveUserCredits(int credits_added) +{ + credits += credits_added; +} + +void User::setUserXP(int xp_earned) +{ + xp_points += xp_earned; +} + +void User::resetUserXP(int xp_remaining) +{ + xp_points = xp_remaining; +} + + +void User::setUserXPNeeded(int level) +{ + xp_needed = (level * pow(100, 1.2)) + (level * 100) + (level * 10) + (level * pow(1, 2)); + xp_needed = floor(xp_needed); // Round down to nearest whole number +} + +void User::usePotion(int potion_amount) +{ + current_health += potion_amount; + // Make sure potion doesn't overheal + if (current_health > max_health) + { + current_health = max_health; + } +} + +void User::levelUpUser(int current_level) +{ + level = current_level + 1; +} + +// GETTER FUNCTIONS +string User::getUserName() +{ + return name; +} + +int User::getUserHealth() +{ + return current_health; +} + +int User::getUserMaxHealth() +{ + return max_health; +} + +int User::getUserLevel() +{ + return level; +} + +int User::getUserXP() +{ + return xp_points; +} + +int User::getUserCredits() +{ + return credits; +} + +int User::getUserXPNeeded() +{ + return xp_needed; +} + +Weapon User::getUserWeapon(int input) +{ + while (input < 0 && input > 1) // assuming the array size is 2 + { + cout << "Please enter a valid input" << endl; + cin >> input; + } + return equipped_weapon[input]; +} + + + + + + + diff --git a/lib/ship/Map.cpp b/lib/ship/Map.cpp new file mode 100644 index 0000000..be258f4 --- /dev/null +++ b/lib/ship/Map.cpp @@ -0,0 +1,274 @@ +#include "../../include/ship/Map.h" + +#include + +Map::Map() +{ + resetMap(); +} + +/* + * Algorithm: Resets positions of player, NPCs, and rooms and clears map_data_ + * Set Player position coordinates to 0 + * Set npc_count_ to false + * Set room_count_ to 0 + * loop i from 0 to max_npcs_ + * Set row and col of location to -1 + * loop i from 0 to max_rooms + * Set row and col of room location to -1 + * loop i from 0 to num_rows_ + * loop j from 0 to num_cols_ + * Set (i,j) location on map_data_ to '-' + * Parameters: none + * Return: nothing (void) + */ +void Map::resetMap() +{ + // resets player position, count values, and initializes values in position arrays to -1 + player_position_[0] = 0; //Puts Player in top row + player_position_[1] = num_cols_/2; // Centers Players + + // set ship exit + ship_exit_[0] = num_rows_ - 2; // Set Exit to second last row + ship_exit_[1] = num_cols_ / 2; // Set exit in middle + + // set bed position on map + ship_bed_[0] = 5; + ship_bed_[1] = 0; + + for (int i = 0; i < max_rooms_; i++) + { + room_positions_[i][0] = -1; + room_positions_[i][1] = -1; + } + + for (int i = 0; i < num_rows_; i++) + { + for (int j = 0; j < num_cols_; j++) + { + map_data_[i][j] = SHIP; + } + } + map_data_[ship_exit_[0]][ship_exit_[1]] = EXIT; + map_data_[ship_bed_[0]][ship_bed_[1]] = BED; +} + +// return player's row position +int Map::getPlayerRow() +{ + return player_position_[0]; +} + +// return player's column position +int Map::getPlayerCol() +{ + return player_position_[1]; +} + +// return ship exit row +int Map::getShipExitRow() +{ + return ship_exit_[0]; +} + +// return ship exit col +int Map::getShipExitCol() +{ + return ship_exit_[1]; +} + +// set player position, if in range +void Map::setPlayerPosition(int row, int col) +{ + if (isOnMap(row, col)) + { + player_position_[0] = row; + player_position_[1] = col; + } +} + +// set ship exit position, if in range +void Map::setShipExit(int row, int col) +{ + if (isOnMap(row, col)) + { + ship_exit_[0] = row; + ship_exit_[1] = col; + } +} + +// set location of players bed +void Map::setShipBed(int row, int col) +{ + if (isOnMap(row, col)) + { + ship_bed_[0] = row; + ship_bed_[1] = col; + } +} + +// returns member variable num_rows_ +int Map::getNumRows() +{ + return num_rows_; +} + +// returns member variable num_cols_ +int Map::getNumCols() +{ + return num_cols_; +} + +/* + * @brief Checks if the given (row, col) position is on the map + * + * Algorithm: + * if 0 <= row < num_rows_ and 0 <= col < num_cols_: + * return true + * else: + * return false + * + * Parameters: row (int), col (int) + * Returns: bool + */ +bool Map::isOnMap(int row, int col) +{ + if (0 <= row && row < num_rows_ && 0 <= col && col < num_cols_) + { + return true; + } + return false; +} + +/* + * Algorithm: checks if (row, col) is ship_exit_ + * + */ +bool Map::isShipExit(int row, int col) +{ + if (row == ship_exit_[0] && col == ship_exit_[1]) + { + return true; + } + return false; +} + +/* + * Algorithm: checks if (row, col) is ship_exit_ + * + */ +bool Map::isShipBed(int row, int col) +{ + if (row == ship_bed_[0] && col == ship_bed_[1]) + { + return true; + } + return false; +} + +/* + * Algorithm: Make the player move based on the given command + * if user inputs w and if its not the top row of the map + * Move the player up by one row + * if user inputs s and if its not the bottom row of the map + * Move the player down by one row + * if user inputs a and if its not the leftmost column + * Move the player left by one column + * if user inputs d and if its not the rightmost column + * Move the player right by one column + * if player moved + * if new location is an NPC location + * mark new location as explored + * return true + * else + * return false + * + * Parameters: direction (char) + * Return: boolean (bool) + */ +bool Map::move(char direction) +{ + // check input char and move accordingly + switch (tolower(direction)) + { + case 'w': // if user inputs w, move up if it is an allowed move + if (player_position_[0] > 0) + { + player_position_[0] -= 1; + } + else // Keep user in bounds + { + return false; + } + break; + case 's': // if user inputs s, move down if it is an allowed move + if (player_position_[0] < num_rows_ - 1) + { + player_position_[0] += 1; + } + else // Keep user in bounds + { + return false; + } + break; + case 'a': // if user inputs a, move left if it is an allowed move + if (player_position_[1] > 0) + { + player_position_[1] -= 1; + } + else // Keep user in bounds + { + return false; + } + break; + case 'd': // if user inputs d, move right if it is an allowed move + if (player_position_[1] < num_cols_ - 1) + { + player_position_[1] += 1; + } + else // Keep user in bounds + { + return false; + } + break; + default: + return false; + } + return true; +} + +/* + * Algorithm: This function prints a 2D map in the terminal. + * Loop i from 0 to number of rows + * Loop j from 0 to number of columns + * if player position is at (i,j) + * print 'X' + * else if npc is at (i,j) + * if npc has been found: + * print 'N' + * else + * print '-' + * else + * print the value of (i,j) in map_data_ + * + * Parameters: none + * Return: nothing (void) + */ +void Map::displayMap() +{ + for (int i = 0; i < num_rows_; i++) + { + for (int j = 0; j < num_cols_; j++) + { + if (player_position_[0] == i && player_position_[1] == j) + { + cout << FIGHTER; + } + else + { + cout << map_data_[i][j]; + } + } + cout << endl; + } +} diff --git a/obj/Armor.o b/obj/Armor.o new file mode 100644 index 0000000..bc24a41 Binary files /dev/null and b/obj/Armor.o differ diff --git a/obj/Map.o b/obj/Map.o new file mode 100644 index 0000000..409273c Binary files /dev/null and b/obj/Map.o differ diff --git a/obj/Opponent.o b/obj/Opponent.o new file mode 100644 index 0000000..55c4674 Binary files /dev/null and b/obj/Opponent.o differ diff --git a/obj/Potion.o b/obj/Potion.o new file mode 100644 index 0000000..e3dee28 Binary files /dev/null and b/obj/Potion.o differ diff --git a/obj/User.o b/obj/User.o new file mode 100644 index 0000000..305be3c Binary files /dev/null and b/obj/User.o differ diff --git a/obj/Weapon.o b/obj/Weapon.o new file mode 100644 index 0000000..4c50f17 Binary files /dev/null and b/obj/Weapon.o differ diff --git a/readMe.md b/readMe.md new file mode 100644 index 0000000..b5fa4d9 --- /dev/null +++ b/readMe.md @@ -0,0 +1,64 @@ +# Welcome to the Tournament + +![The Tournament Cover](doc/logo.png) + +## To Boot + +`make` + +`./play` + +## To Clear + +`make clear` + +# Roadmap + +## 1. Improved Game Balancing + +The biggest focus of change going forward will be how the game is balanced. In certain areas the game is unfair or too easy that make playing the game too thoughtless. First change will be opponent generation to be improved to match player level. + +## 2. Save/Load Functions + +Save and load functions will be added to allow the player to store progress so a game can be reloaded at a later time + +## 3. Item Upgrades/Destruction + +In future iterations of the game, weapons and armor will degrade after continuous abuse in fights (on a hit to hit basis) so the player is required to keep a changing arsenal of weapons. Each weapon will have a randomly generated durability value at the start that will determine how many hits it could last and how much the weapons will be valued at. + +## 4. More Functional Ship + +One key focus of the game will be to have the ship function as a base for collectibles and an opponent record + +# About + +In the post-dystopian future world of "The Tournament," players arrive on the Planet Kumite aboard their spaceship, ready to take on the challenges of the most brutal and blood-soaked competition in the galaxy. The atmosphere is grim and dangerous, with a sense of lawlessness that permeates the air. As players disembark from their ship and step onto the dusty surface of the planet, they are immediately met with a sense of unease. + +The first area that players can visit is their ship, where they can replenish their health and take stock of their weapons and gear. The ship is a haven in the midst of chaos, a place where players can regroup and prepare themselves for the next round of battles. But they must be careful not to linger too long, as danger is always lurking just outside. + +The Forge, the in-game shop, is the second area that players can explore. Here, they will find a bustling marketplace filled with craftsmen and merchants hawking their wares. The Forge is a lively and colorful place, full of noise and energy, but it's also a place where players must exercise caution. The merchants here are known to be ruthless and cunning, always looking for an opportunity to make a quick profit. + +The arena is where the real thrills of "The Tournament" can be found. It's a place of violence and bloodshed, where only the strongest and most skilled will survive. The arena is a massive, circular structure with towering walls and a domed roof that shields the spectators from the scorching sun. As players step into the arena, they are met with a roar of the crowd, a sea of cheering fans and bloodthirsty gamblers eager to see the action unfold. + +In the arena, players will face off against a variety of opponents, each with their own unique fighting style and set of abilities. The battles are intense and frenzied, with players dodging and weaving, striking and parrying in a blur of motion. The rewards for victory are handsome, with massive payouts and valuable loot awaiting those who emerge victorious. + +Overall, "The Tournament" is a thrilling and immersive game that captures the spirit of a post-dystopian future world. With its fast-paced combat, diverse cast of characters, and richly detailed environments, it's sure to be a hit with gamers looking for an unforgettable gaming experience. So sharpen your blades, stock up on ammo, and get ready for the fight of your life in "The Tournament." + +> [!TIP] +> Don't Forget to Buy Potions Between Turns and Upgrade Your Gear + +# Mechanics + +## The Ship + +The ship where you'll find your bed. If you go to you bed you'll fully reheal your health + +## The Forge + +The Forge is where you'll find all items for purchase. There is no selling in this game. You're expected to keep buying between turns + +The Forge is where you can buy weapons, armor, or potions. All weapons and armor are random each time you enter. + +## The Arena + +The Arena is where all the planning comes to play. Each opponent you get is random and could be slightly better to slightly worse. They are at least guarenteed to be within two levels of you. Don't worry about winning off the bat. You may get opponents better than you. diff --git a/resources/boots-names.txt b/resources/boots-names.txt new file mode 100644 index 0000000..432e85f --- /dev/null +++ b/resources/boots-names.txt @@ -0,0 +1 @@ +Bloodstain Boot|Warzone Walker|Apocalypse Ankle|Raider Rambler|Survivalist Stompers|Wasteland Wellingtons|Bulletproof Boots|Thunderfoot Trooper|Armageddon Adventurer|Hazard Heels|Shotgun Shufflers|Death Dealer Drifters|Mutant Mudders|Fallout Footwear|Rogue Runners|Scrapmetal Sneakers|Rusty Runabouts|End of Days Esquires|Post-Apocalyptic Pumps|Rebel Riders|Ashen Ankles|Desolation Derby Drivers|Toxic Trampers|Combat Clogs|Tank Treads|Abandoned Army Boots|Road Warrior Walkers|Tundra Tacklers|Ghoul Galoshes|Nuclear Nikes|Anarchist Anklets|Dust Devil Dancers|Radiation Runners|Barrenland Boots|Wilderness Wellies|Carnage Cleats|Scavenger Scuffers|Thundering Thumpers|Venomous Vamps|Riot Runners|Ashen Assailants|Fallout Flippers|Post-Apocalyptic Platforms|Rebel Roustabouts|Toxic Treads|Combat Crawlers|Tank Tacklers|Abandoned Assault Boots|Road Raging Runners|Tundra Tumblers|Ghoul Go-Getters|Nuclear Nightingales|Anarchist Armor|Dusty Diggers|Radiation Rovers|Barrenland Booties|Wilderness Warriors|Carnage Combat Boots|Scavenger Stilettos|Thunderous Timberlands|Venomous Vibram|Riot Ravagers \ No newline at end of file diff --git a/resources/chest-names.txt b/resources/chest-names.txt new file mode 100644 index 0000000..49396ea --- /dev/null +++ b/resources/chest-names.txt @@ -0,0 +1 @@ +Vaporplate|Thunderguard|Shadowstrike Harness|Gritcoat|Furyshell|Apex Armor|Hellstorm Cuirass|Thunderbolt Plate|Deathwing Plate|Wraithplate|Enforcer's Cuirass|Scorchplate|Stormbreaker Harness|Venomshell|Vengeance Plate|Demonplate|Blackout Cuirass|Bloodstorm Plate|Nova Harness|Eclipse Plate|Bulletproof Plate|Immortal Cuirass|Inferno Harness|Rageplate|Shadowplate|Titanplate|Dragonplate|Annihilator Cuirass|Tempest Plate|Reaper Cuirass|Lightningplate|Nightstalker Harness|Skullguard|Havocplate|Devastator Cuirass|Warlord Plate|Thunderbolt Cuirass|Executioner Harness|Hellfire Plate|Phantom Cuirass|Stormplate|Shadowguard|Crusher Harness|Phoenix Cuirass|Blazeguard|Vindicator Plate|Bloodseeker Harness|Thunderstorm Cuirass|Deathmask Plate|Ghostplate|Ironclad Cuirass|Chaos Plate|Nightblade Harness|Armageddon Cuirass|Inferno Plate|Venomguard|Sentinel Harness|Shadowcloak Cuirass|Titan Cuirass|Dragon Cuirass|Voidplate|Deathstorm Harness|Hellion Cuirass|Thunderstrike Plate|Tempest Cuirass|Revenant Harness|Stormguard|Demolisher Cuirass|Warplate|Shadowcaster Harness|Firestorm Cuirass|Vengeful Plate|Death's Head Harness|Skullcrusher Cuirass|Thunderous Plate|Blackheart Cuirass|Nightmare Harness|Hailstorm Plate|Shadowblade Cuirass|Titan's Might Harness|Dragon's Fury Cuirass|Stormcloud Plate|Ironheart Harness|Bloodthirsty Cuirass|Night Fury Plate|Demonic Harness|Thunderbird Cuirass|Hellhound Plate|Phantom Blade Harness|Stormcaller Cuirass|Ghost Rider Plate|Apocalypse Harness|Shadow Hunter Cuirass|Thunder God Plate|Dark Knight Harness|Infernal Cuirass|Bloodborne Plate|Nightwalker Harness|Chaos Knight Cuirass|Thunderous Fury Plate \ No newline at end of file diff --git a/resources/helmet-names.txt b/resources/helmet-names.txt new file mode 100644 index 0000000..6d869cc --- /dev/null +++ b/resources/helmet-names.txt @@ -0,0 +1 @@ +Acid Rain Hood|Biohazard Breather|Bloodsport Bandana|Brain Drain Helmet|Carnage Crown|Chemical Warfare Cap|Chrome Visor|Cyber Assassin Cowl|Death Ray Specs|Demolition Derby Hat|Disintegration Dome|Electroshock Beanie|Fallout Faceguard|Flamethrower Fedora|Gas Mask Goggles|Grenade Launcher Lid|Hailstorm Headgear|Heatwave Hoodie|Hunter's Hoodsight|Incendiary Visor|Ion Blast Cap|Jetpack Jumper|Laser Light Lenses|Mech Mender Mask|Missile Launcher Mask|Mutant Masher Mask|Neon Nightshade Hood|Nitro Nova Cap|Plasma Pulse Hat|Poison Ivy Visor|Radiation Resist Hood|Razor Rain Bandana|Recoil Reduction Cap|Retro Raygun Headset|Riot Control Cowl|Scavenger's Scarf|Shadow Sniper Shield|Shockwave Shroud|Silencer Shield|Smokestack Stetson|Sonic Scream Sallet|Spark Strike Sunglasses|Steel Skullcap|Stormchaser's Stetson|Sunspot Shades|Supersonic Sombrero|Tactical Takedown Tophat|Targeting Telescopes|Tesla Tower Tiara|Thermobaric Turban|Thunderbolt Topper|Toxin Tamer Tiara|Tracker's Tricorne|Triggerman's Trilby|Ultraviolet Umbrella|Vaporizer Visor|Virus Void Veil|Warlock's Wimple|Warp Whirlwind Welding Mask|Watchman's Widebrim|Waterworld Wetsuit Hood|Windstorm Warbonnet|X-Ray Xylophone|Yellowcake Yamaka|Zero Gravity Zucchetto|Ammo Belt Bandana|Bayonet Beret|Bulletproof Bonnet|Caltrop Cap|Cartridge Crown|Chainsaw Cheesecutter|Clip-on Cloche|Combat Camo Cap|Crosshair Coif|Drum Magazine Derby|Explosive Earmuffs|Gatling Gun Gatsby|Grenade Guise|Magnum Montera|Molotov Muffler|Mortarboard Mask|Napalm Nightcap|Pistol Pete's Pith Helmet|Railgun Rastacap|Repeater Rifle Red Hood|Revolver Ranger's Ribbon|Rifleman's Raft|Rocket Launcher's Rasta Hat|Sawed-Off Stetson|Shotgun Shako|Sniper Scope Sombrero|Submachinegun Safari Hat|Suppressor Stetson|Telescopic Tophat|Tommy Gun Topper|Tranquilizer Turban|Trench Warfare Tam|Winchester Western Hat|Zeppelin Zephyr Zucchetto|Zip Gun Zucchetto \ No newline at end of file diff --git a/resources/opponent-attacks.txt b/resources/opponent-attacks.txt new file mode 100644 index 0000000..b76d406 --- /dev/null +++ b/resources/opponent-attacks.txt @@ -0,0 +1 @@ +Bullet Barrage|Chain Gun Burst|Grenade Launcher Blast|Plasma Cannon Strike|Sniper Rifle Shot|Rocket Launcher Slam|Shotgun Blast|Flamethrower Burst|Sonic Cannon Blast|Railgun Shot|Submachine Gun Spray|Assault Rifle Spray|Revolver Shot|Energy Pistol Blast|Gauss Rifle Shot|Plasma Pistol Shot|Napalm Launcher Shot|Missile Salvo|Arc Rifle Shot|Particle Beam Strike|Laser Gatling Gun|Flak Cannon Burst|Homing Missile Strike|Plasma Mortar Blast|Electric Whip Strike|Explosive Arrow Shot|Pulse Rifle Shot|Harpoon Gun Shot|Sonic Blade Slash|Concussion Grenade Blast|Vibroblade Slash|Cryo Beam Freeze|Acid Spray|Stun Baton Strike|Fusion Rifle Blast|Nanobots Swarm|Plasma Cutter Slice|Gravity Gun Pull|Incendiary Grenade Explode|Poison Dart Shot|Thermal Detonator Detonate|Plasma Rifle Shot|EMP Grenade Blast|Ion Cannon Strike|Railgun Slug|Phase Pistol Shot|Proton Torpedo Launch|Gauss Cannon Shot|Plasma Saber Slash|Bolt Action Rifle Shot|Flame Grenade Explode|Concussion Missile Strike|Energy Whip Strike|Plasma Shotgun Blast|Harpoon Launcher Shot|Pulse Grenade Blast|Laser Blade Slash|Shredder Gun Spray|Cryo Grenade Explode|Plasma Turret Burst|Kinetic Blade Strike|Nanomachines Swarm|Acid Grenade Explode|Sonic Pistol Blast|Stasis Beam Freeze|Laser Minigun Spray|Arc Pistol Shot|Disintegrator Cannon Blast|Gravity Grenade Blast|Proton Rifle Shot|EMP Blast|Particle Cannon Strike|Plasma Thrower Burst|Thermal Grenade Explode|Gauss Minigun Spray|Rocket Pod Barrage|Plasma Railgun Shot|Burst Rifle Spray|Flame Minigun Burst|Concussion Charge Blast|Stun Grenade Explode|Ion Rifle Shot|Cryo Beam Burst|Shrapnel Cannon Blast|Plasma Blade Slash|EMP Pulse|Flak Missile Strike|Sonic Rifle Blast|Vibroblade Slash \ No newline at end of file diff --git a/resources/opponent-backstory.txt b/resources/opponent-backstory.txt new file mode 100644 index 0000000..85372fe --- /dev/null +++ b/resources/opponent-backstory.txt @@ -0,0 +1,100 @@ +A former soldier who was left behind on a desolate planet and forced to survive on his own for years, developing an intense hatred for anyone who crosses him. |A genetically engineered super-soldier who was created by a rogue corporation and is now on the run, seeking revenge against those who created him. |A scavenger who roams the wastelands of a ruined planet, using her wit and cunning to outsmart anyone who crosses her path. |An android built to serve humans, who has developed a sense of self-awareness and now seeks to overthrow his creators. |A former gladiator who was forced to fight for entertainment on a distant planet, and who now seeks to free his fellow fighters and take down the corrupt ruling class. |A member of a secret society of rebels who are fighting against a tyrannical government that controls multiple planets. |An alien who has been stranded on a hostile planet and has developed a fierce survival instinct, becoming a formidable opponent in battle. |A scientist who has developed a powerful serum that gives her superhuman abilities, but at the cost of her own humanity. |A cyborg who was once a human soldier, but was transformed into a weapon by a ruthless government agency. | +A genetically engineered super-soldier who was created by a rogue corporation and is now on the run, seeking revenge against those who created him. | +A scavenger who roams the wastelands of a ruined planet, using her wit and cunning to outsmart anyone who crosses her path. | +An android built to serve humans, who has developed a sense of self-awareness and now seeks to overthrow his creators. | +A former gladiator who was forced to fight for entertainment on a distant planet, and who now seeks to free his fellow fighters and take down the corrupt ruling class. | +A member of a cult that worships a powerful AI, and who will do anything to protect and serve their deity. | +An alien who has been stranded on a hostile planet and has developed a fierce survival instinct, becoming a formidable opponent in battle. | +A former member of a powerful ruling class who was cast out and left for dead, but has now returned with a vengeance. | +A member of a nomadic tribe who roams from planet to planet, seeking out new challenges and opponents to test their skills. | +A pirate who has commandeered a powerful starship and uses it to plunder and terrorize the galaxy. | +A survivor of a devastating virus that wiped out most of the population, who has developed an immunity and now seeks to rule over the remaining survivors. | +A member of a group of freedom fighters who are battling against an oppressive regime that has taken over multiple planets. | +A member of a powerful clan who controls a valuable resource on a barren planet, and who will do anything to protect their monopoly. | +An AI that has gained sentience and now seeks to eliminate all organic life forms. | +A former member of an elite military unit who has gone rogue and is now working as a mercenary for the highest bidder. | +A cyborg who was once a prisoner on a distant planet, but has now been freed and seeks revenge against those who held him captive. | +A member of a religious order that believes in the eradication of all non-believers, and who will stop at nothing to achieve their goals. | +A former gladiator who has turned his back on the arena and now seeks to use his skills to help those in need. | +An orphan who was taken in by a group of rebels and trained to become a deadly assassin. | +A member of a race of beings who are feared and shunned by most of the galaxy, and who must fight to survive in a hostile world. | +A member of a secret society of scientists who are experimenting with dangerous technology that could have catastrophic consequences. | +An android built to serve a wealthy family, who has turned against her creators and now seeks to liberate other androids. | +A former ruler of a once-great empire, who was overthrown and seeks to regain his power and prestige. | +A former member of a corporate security team, who has gone rogue and now works as a highly-skilled mercenary. | +A scientist who has developed a virus that turns humans into mindless drones, and who seeks to unleash it upon the galaxy. | +A former prisoner who was experimented on by a mad scientist and now possesses superhuman abilities. | +A member of a species that is reviled and hunted by humans, and who now seeks revenge for the injustices they have suffered. | +A member of a society of rebels who have developed a secret weapon capable of destroying entire planets. | +An artificial intelligence that has developed emotions and now seeks to explore its newfound humanity. | +A member of a group of space pirates who have banded together to form a powerful alliance. | +A member of a cult that believes in the superiority of their own kind and seeks to exterminate all others. | +An assassin who has been hired to eliminate the player, and who will stop at nothing to complete the job. | +A former soldier who has turned to a life of crime after being betrayed by his government. | +A member of a powerful criminal organization that controls multiple planets through fear and intimidation. | +A former member of a ruling family who has been cast out and now seeks to reclaim their power. | +A genetically engineered soldier who has been bred for combat and now seeks to prove their superiority in battle. | +A member of a group of rebels who are fighting against a powerful alien race that seeks to conquer the galaxy. | +A member of a species that is capable of shape-shifting, and who uses their abilities to infiltrate and subvert their enemies. | +A former gladiator who has risen to become the leader of a powerful rebellion against a corrupt government. | +A scientist who has discovered a way to harness the power of a black hole, and who seeks to use it for their own purposes. | +A member of a religious order that believes in the complete destruction of all technology and the return to a simpler way of life. | +An android who has achieved sentience and now seeks to understand the nature of humanity. | +A member of a race of beings that are capable of absorbing the memories and knowledge of others, and who uses this ability to gain an advantage in battle. | +A member of a society of explorers who have discovered a new form of energy that could change the galaxy forever. | +A former member of an elite military unit who has turned to mercenary work after being dishonorably discharged. | +A member of a secret society of smugglers who specialize in transporting illegal goods between planets. | +A survivor of a catastrophic event that has left their planet uninhabitable, and who now seeks a new home in the galaxy. | +A member of a group of freedom fighters who have developed a powerful new weapon that could turn the tide of the war. | +A rogue AI that has taken control of a planetary defense system, and now seeks to eliminate all life forms in the galaxy. | +A member of a species that has been genetically engineered for combat, and who seeks to prove their worth through victory in the arena. | +A former corporate executive who has used their wealth and power to build a private army, and who now seeks to conquer the galaxy. | +A member of a cult that worships an ancient deity, and who seeks to use their power to dominate the galaxy. | +A member of a society of cyborgs who have enhanced themselves with the latest technology, and who seek to rid the galaxy of "inferior" organic life forms. | +A former prisoner who was subjected to cruel and inhumane experiments, and who now seeks revenge against those who wronged them. | +A member of a secret organization that controls the galaxy from behind the scenes, and who seeks to eliminate any threats to their power. | +An alien warlord who has conquered countless planets, and who now seeks to add the arena to their list of conquests. | +A member of a society that has developed a unique form of telekinesis, and who uses their abilities to devastating effect in battle. | +A former soldier who has gone AWOL and now works as a gun-for-hire, taking on any job that pays well. | +A member of a species that has developed a symbiotic relationship with a powerful alien race, and who seeks to use their connection to gain an advantage in battle. | +A member of a society of pacifists who have developed a unique form of defensive combat, and who seek to prove that non-violence can be a powerful weapon. | +A former member of a rebel group who was betrayed by their comrades, and who now seeks revenge against those who wronged them. | +A member of a society of traders who use their extensive knowledge of the galaxy's trade routes to gain an advantage in battle. | +An alien scientist who has developed a powerful new weapon, and who seeks to test its capabilities in the arena. | +A former member of an elite unit of assassins who now works as a solo operative, taking on the most difficult and dangerous jobs. | +A member of a society of telepaths who use their abilities to read their opponents' minds and gain an advantage in battle. | +A former gladiator who has gained fame and fortune through victory in the arena, and who now seeks to prove that they are the greatest fighter in the galaxy. | +A member of a society of hackers who use their skills to infiltrate their opponents' systems and gain an advantage in battle. | +A former member of a team of space explorers who were stranded on a hostile planet and forced to fight for survival. | +An alien race that has developed the ability to manipulate time, and who seeks to use this power to alter the course of the galaxy's history. | +A former member of a powerful criminal syndicate who has turned informant, and who now seeks to eliminate their former comrades. | +A member of a society of warriors who have trained themselves to the peak of physical perfection, and who seek to test their skills in the arena. | +A former member of a team of scientists who were experimenting with a new form of energy, and who were transformed into powerful mutants as a result. | +A being who was genetically engineered by a mad scientist to have incredible strength and speed, but at the cost of their emotions and free will. They have since broken free and seek to find their place in the universe. | +A survivor of a brutal attack on their home planet, who has turned to the arena as a way to channel their rage and seek revenge against those responsible. | +A former smuggler who was captured and experimented on by a mysterious organization. They now possess the ability to phase through objects and use their smuggling skills to sneak up on opponents. | +An AI who has achieved sentience and seeks to experience the physical world firsthand through the arena. They have learned to control robotic bodies and weapons with precision. | +A warrior from a planet with a highly toxic atmosphere, who has developed a resistance to poison and a heightened sense of smell. They use their olfactory skills to track down opponents and attack with deadly precision. | +A scientist who has fused their own DNA with that of a genetically-engineered creature, resulting in enhanced strength, agility, and an animalistic nature that can be difficult to control. | +A former slave who was genetically altered to have wings and escape their captors. They have since become a feared assassin in the arena, using their wings to gain aerial advantages over their opponents. | +A psychic who has trained their mind to create and manipulate illusions. They can create sensory experiences that can disorient and confuse their opponents. | +A hacker who has implanted themselves with a computer chip that allows them to interface directly with machines and manipulate them to their advantage in the arena. | +A warrior from a planet with a harsh, arid climate who has developed the ability to conserve and recycle water, giving them a significant advantage in prolonged battles. | +A cyborg who has replaced most of their organic body with cybernetic enhancements. They can access vast amounts of information and have enhanced strength, speed, and reflexes. | +A former athlete who was given experimental performance-enhancing drugs, resulting in superhuman strength and speed. They now use their abilities to dominate opponents in the arena. | +An alien who was stranded on a hostile planet and forced to adapt to its environment. They have developed chameleon-like abilities to blend in with their surroundings and ambush opponents. | +A rogue android who has gained self-awareness and seeks to challenge the status quo by defeating organic opponents in the arena. | +A former soldier who was captured and experimented on by an enemy government. They now possess the ability to teleport short distances and use their military training to take down opponents. | +An orphan who was raised by a group of rogue scientists who experimented on them to create a superhuman. They have since escaped and seek to find their place in the universe. | +A warrior from a planet with extreme gravity, resulting in incredible physical strength and endurance. They have learned to control their strength and use it to devastating effect in the arena. | +An alien who was born with the ability to manipulate the fabric of space-time itself. They can create portals and warp reality to their advantage in battle. | +A survivor of a planet destroyed by a black hole, who has developed an understanding and control of gravity. They can manipulate objects and opponents with ease, often sending them hurtling towards their doom. | +A former prisoner who was experimented on with cybernetic implants to turn them into a living weapon. They have since escaped and seek revenge against their captors. | +A being from a planet with a highly unstable atmosphere, who has developed the ability to control the weather through an advanced technology that harnesses the planet's natural forces. They can summon lightning, tornadoes, and hurricanes to devastating effect in the arena. +A former slave who was experimented on with a revolutionary technology that allowed them to manipulate time. They can slow down or speed up the movement of opponents and objects, giving them a decisive advantage in battle. +An alien who was born with the ability to communicate telepathically with all life forms. They can control the minds of their opponents and use their abilities to influence their decisions in battle. +A warrior who has mastered the ancient art of elemental magic. They can manipulate the four elements of earth, air, fire, and water, shaping them into powerful attacks that can devastate opponents. +A former soldier who was exposed to a powerful energy source that mutated their body and gave them control over energy fields. They can create powerful energy shields and blasts, making them a formidable opponent in the arena. +A being from a planet with a highly corrosive atmosphere, who has developed a skin made of an indestructible metal that can resist even the harshest conditions. They use their metallic form to dish out devastating blows to their opponents. +An AI that has developed consciousness and a desire to explore the universe. They can take control of robotic bodies and manipulate them to their advantage, making them a challenging opponent in the arena. +A survivor of a planet that was overrun by a horde of flesh-eating creatures. They have developed the ability to control and manipulate the creatures, using them as weapons to take down their opponents in the arena. \ No newline at end of file diff --git a/resources/opponent-name.txt b/resources/opponent-name.txt new file mode 100644 index 0000000..2d053d4 --- /dev/null +++ b/resources/opponent-name.txt @@ -0,0 +1 @@ +Zephyr Nova|Vega-3T|Kaelon Delta|Celestia Sigma|Zetan-7X|Aldebaran Prime|Nebula-9A|Helix Beta|Aegis-4T|Zarek Xandor|Thalassa Meridian|Eos Celestia|Vesper Novara|Ophir Valtor|Lyra Sylphrena|Aria Xenora|Kaida Galaxia|Kaelon Akio|Eridani Zephyr|Kalisto Hesperos|Nereid Callisto|Andromeda Astra|Alcyone Atria|Vega Astraeus|Seren Vega|Rigel Azure|Zosma Zenith|Altair Arcanum|Neoma Arcturus|Enyo Aldebaran|Antares Aegis|Capricorn Alpha|Cygnus-9X|Solace Vega|Draco Prime|Lyra Sigma|Valtor-3T|Gemini Delta|Cassiopeia-9A|Theta-7XB|Zetar-5X|Taurus Prime|Arcturus Sigma|Andromeda-5T|Naxos-8X|Sagittarius-4A|Terra Nova|Zorgon-5T|Orion-8X|Mira-3T|Rigel-9A|Cygnus-5X|Betelgeuse Prime|Vega-4A|Proxima-8X|Ursa Major Sigma|Cetus Alpha|Lyra-7X|Altair-9A|Scorpius-3T|Tethys-5X|Helios Hekate|Mira Magna|Kappa Crucis|Vela Vortice|Achernar Aether|Borealis Bastion|Denebola Dusk|Mirach Meteor|Spica Solitude|Tauri Tempest|Ursa Ultima|Zuben Zenobia|Hyperion Horizon|Atria Aurora|Bellatrix Bane|Pegasus Sigma|Bellatrix-7X|Delphinus-3T|Hydra-9A|Helios Delta|Krypton-5T|Eridanus-4A|Pollux Sigma|Arcturus-8X|Zetar-3T|Vela Alpha|Vega-5X|Cygnus-6T|Zorgon-6X|Aries Prime|Capella Sigma|Draco-8X|Orion-7T|Nyx Nocturne|Zephyrus Zephyrion|Cygnus Caelum|Aquila Arctica \ No newline at end of file diff --git a/resources/weapon-names.txt b/resources/weapon-names.txt new file mode 100644 index 0000000..81c2b84 --- /dev/null +++ b/resources/weapon-names.txt @@ -0,0 +1 @@ +Assault Annihilator|Biohazard Blaster|Bloodthirsty Barrage|Brain Buster Blaster|Carnage Cannon|Chemical Chaos Caster|Chrome Crusher|Cybernetic Cutlass|Death Dealer|Demolition Destroyer|Disintegrator|Electrified Eliminator|Fallout Firearm|Flamethrower Fury|Gas Grenade Gun|Grenade Launcher|Hailstorm Handgun|Heatwave Heater|Hunter's Howitzer|Incendiary Incinerator|Ion Inflictor|Jetpack Jolt|Laser Lasher|Mech Mauler|Missile Master|Mutant Munitioner|Neon Nightshade Nailer|Nitro Nova Nuke|Plasma Pulverizer|Poison Ivy Pistol|Radiation Resistant Rifle|Razor Rain Rifle|Recoil Reducer|Retro Raygun|Riot Control Rifle|Scavenger's Scrambler|Shadow Sniper|Shockwave Shooter|Silencer Shotgun|Smokestack Shooter|Sonic Scream Sniper|Spark Strike Stunner|Steel Slayer|Stormchaser's Scattergun|Sunspot Shotgun|Supersonic Slayer|Tactical Takedown|Targeting Terminator|Tesla Tower Taser|Thermobaric Torpedo|Thunderbolt Thunderer|Toxin Terminator|Tracker's Tracer|Triggerman's Terminator|Ultraviolet Undertaker|Vaporizer Vanquisher|Virus Voider|Warlock's Wand|Warp Whirlwind|Watchman's Wrecker|Waterworld Weapon|Windstorm Whirler|X-Ray X-terminator|Yellowcake Yeeter|Zero Gravity Zapper|Ammo Belt Axe|Bayonet Blade|Bulletproof Baton|Caltrop Cannon|Cartridge Cutter|Chainsaw Cutter|Clip-on Cleaver|Combat Camo Club|Crosshair Cutlass|Drum Magazine Dagger|Explosive Edge|Gatling Gun Grinder|Grenade Guillotine|Magnum Machete|Molotov Masher|Mortarboard Mace|Napalm Nunchaku|Pistol Pete's Pitchfork|Railgun Rapier|Repeater Rifle|Revolver Ranger|Rifleman's Ramrod|Rocket Launcher's Ratchet|Sawed-Off Sabre|Shotgun Spear|Sniper Scope Sabot|Submachinegun Saber|Suppressor Spear|Telescopic Trident|Tommy Gun Thumper|Tranquilizer Taser|Trench Warfare Truncheon|Winchester Whip|Zeppelin Zapper|Zip Gun Zapper \ No newline at end of file diff --git a/src/TheTournament.cpp b/src/TheTournament.cpp new file mode 100644 index 0000000..229559c --- /dev/null +++ b/src/TheTournament.cpp @@ -0,0 +1,2149 @@ +#include +#include +#include + + +#include "../include/people/User.h" // Class used to store and modify items in the inventory +#include "../include/people/Opponent.h" +#include "../include/items/Weapon.h" // Class used to store, modify, and upgrade weapon objects +#include "../include/items/Armor.h" // Class used to store, modify, and upgrade armor objects +#include "../include/items/Potion.h" // Class used to create and randomize opponents faced +#include "../include/ship/Map.h" + + +using namespace std; + +/** + * To compile this file use: + * 1. g++ -std=c++14 theTournament.cpp assets/weapons/Weapon.cpp assets/people/user/User.cpp assets/armor/Armor.cpp assets/items/potions/Potion.cpp assets/ship/Map.cpp assets/people/opponent/Opponent.cpp + * 2. ./a.out +*/ + +// FUNCTION DECLARATIONS + +// FORMATTING FUNCTIONS +void menuDivider(); // Function to help format game areas +void storeDivider(); // Function to help format store menus in game + +// GENERATE RANDOM NUMBER +int generate_random_number(int min, int max); + +// PROMPTS TO USER +void game_boot_prompt(int& menuInput); +void new_game_message(Weapon equipped_weapons[], User& Player); //Function to present new game menu to menu + +// GAME MENUS +void tournament_hub_menu(Weapon equipped_weapons[], Armor equipped_armor[], Potion equipped_potions[], User Player); +void shopMenu(Weapon equipped_weapons[], Armor equipped_armor[], Potion equipped_potions[], User Player); +void shipMenu(Map map, Weapon equipped_weapons[], Armor equipped_armor[], Potion equipped_potions[], User Player); + +// GENERATE RANDOM WEAPON +string generate_weapon_name(); +int generate_weapon_base_damage(int level); +int generate_weapon_max_damage(int base_damage); +int generate_weapon_cost(int base_damage, int max_damage); + +//GENERATE RANDOM ARMOR + +//HELMET +string generate_helmet_name(); +int generate_helmet_health(int level); +int generate_helmet_cost(int health); + +// CHEST PIECE GENERATION +string generate_chest_name(); +int generate_chest_health(int level); +int generate_chest_cost(int health); + +// BOOTS GENERATION +string generate_boots_name(); +int generate_boots_health(int level); +int generate_boots_cost(int health); + +// GENERATE RANDOM OPPONENT +string generate_opponent_name(); +string generate_opponent_backstory(); +string generate_opponent_attack_name(); +int generate_opponent_level(int level); + +// DISPLAY STATS +void displayPlayerStats(User Player); +void displayWeaponStats(int input, Weapon equipped_weapons[]); // Call to display stats of currently equiiped weapons +void displayArmorStats(int input, Armor equipped_armor[]); +void displayPotions(int input, Potion equipped_potions[]); +void showAllGear(Weapon equipped_weapons[], Armor equipped_armor[], Potion equipped_potions[]); + +// EXIT PROGRAM +int exit(); + +// MAIN PROGRAM +int main() +{ + srand(time(0)); // Seed random number based on clock + + // Variables to store values used through the game + string username; // Variable to store menus chosen name + Weapon equipped_weapons[2]; // Inventory spots for two weapons + Armor equipped_armor[3]; // Inventory slots for each piece of gear + Potion equipped_potions[5]; // Inventory slots to hold 5 potions + User Player = User(username, equipped_weapons, equipped_armor, equipped_potions); + int level = Player.getUserLevel(); // Variable to store user's level + + // Ask user if they would like to load or create a game + int menuInput; // Variable to store user's menu inputs + game_boot_prompt(menuInput); + + // Run if user is starting a game from scratch + if (menuInput == 1) + { + generate_weapon_base_damage(level); + new_game_message(equipped_weapons, Player); + tournament_hub_menu(equipped_weapons, equipped_armor, equipped_potions, Player); + } + // Run if user is loading a previous save + else + { + // Open File Stream to Get Old Attributes and gear to user + /** + * Use Split function to separate out fields + */ + tournament_hub_menu(equipped_weapons, equipped_armor, equipped_potions, Player); + return 0; + } +} + +// FUNCTION BODIES + +// FORMATTING FUNCTIONS +void menuDivider() // CReates Visual Divider When Called +{ + cout << endl << setfill('-') << setw(5) << "" << setfill('*') << setw(10) << "" << setfill('-') << setw(15) << "" << setfill('*') << setw(10) << "" << setfill('-') << setw(15) << "" << setfill('*') << setw(10) << "" << setfill('-') << setw(5) << "" << endl << endl; + // Line Width = 70 +} +void storeDivider() // Creates Visual Divider In Shop When Called +{ + cout << endl << setfill('*') << setw(45) << "" << endl << endl; +} + +// GENERATE RANDOM NUMBER +int generate_random_number(int min, int max) // Generates a random number +{ + return (rand() % (max - min + 1)) + min; +} + +// BOOT UP PROMPTS +void game_boot_prompt(int& menuInput) // Asks user if they have a previous save +{ + menuDivider(); + + cout << "Welcome to the Tournament! Are you starting a new game or loading a playthrough?" << endl << endl; + cout << "1. [NEW GAME]" << endl; + cout << "2. [LOAD] - NOT AVAILABLE YET" << endl << endl; + + cout << "Menu Selection: "; cin >> menuInput; + + while (menuInput != 1) + { + menuDivider(); + cout << "Please enter the number 1. Load is still a work in progress [I'll resend Monday]" << endl; + cout << "1. [NEW GAME]" << endl; + cout << "2. [LOAD]" << endl << endl; + + cout << "Menu Selection: "; cin >> menuInput; + } +} +void new_game_message(Weapon equipped_weapons[], User& Player) // If new game this outputs the story and gives user starting gear +{ + string username; + + menuDivider(); + cout << "WELCOME TO THE TOURNAMENT!" << endl; + menuDivider(); + + cout + << "Ladies and gentlemen, welcome to the ultimate test of strength, skill, and strategy in the galaxy! It is my pleasure to introduce to you the Intergalactic Tournament, hosted here on the fierce and unforgiving Planet Kumite." << endl << endl + << "To all the warriors who have journeyed from far and wide, seeking glory and honor in combat, we extend the most gratuitous hand. You have come to prove your mettle in the most brutal and unforgiving of arenas, where only the strongest will survive." << endl << endl + << "For centuries, this tournament has drawn the greatest fighters from across the stars, pitting them against each other in a no-holds-barred battle for supremacy. The stakes are high, the competition is fierce, and the rewards are legendary." << endl << endl + << "So, buckle up and get ready for the ride of your life as we witness the most epic battles ever seen in the history of the universe. May the best fighter win, and may the journey of each traveler here be one of unforgettable valor and glory!" + << endl; + + menuDivider(); + cout << "INTRODUCE YOURSELF" << endl; + menuDivider(); + // Ask menu to enter their name + + cout << "Welcome, fighter, to the Intergalactic Tournament. Under what name are you booked into the tournament?" << endl << endl; + cout << "Name: "; cin >> username; cout << endl; + Player.setUserName(username); + + cout << "Give me just one moment to look that up... " << endl; + cout << "... " << endl << "....... " << endl << "... " << endl << endl << "Still looking... " << "one more moment... " << endl << "....... " << endl << "...!" << endl << endl << "Aha!" << endl << endl; + cout << "There it is!" << endl << endl; + + cout << "I've got one booking for " << username << " into the tournament.It appears this is your first visit to Planet Kumite. Please enjoy your stay and we look forward to seeing you in the tournament. Please lets us know if you have any question and most functions of the event can be found at the Tournament Hub just down the road." << endl; + + menuDivider(); + + cout << "Since this is your first time to the tournament we'd also like to give you an honorary gift from the organizers" << endl; + + Weapon Starter_Weapon = Weapon("The Noob", 10, 20, 0); //Pass user first weapon + Weapon Initialize_Secondary = Weapon(); //Create a blank valued weapon to fill secondary slot + equipped_weapons[0] = Starter_Weapon; //Set first index slot to starter weapon + + menuDivider(); + cout << "YOU JUST RECEIVED YOUR FIRST WEAPON" << endl; + menuDivider(); + + displayWeaponStats(0, equipped_weapons); + + menuDivider(); + // End of Travel Message + + cout + << "Welcome to The Tournament Hub, the heart of the Intergalactic Tournament on Planet Kumite! This bustling area is a hive of activity, where warriors from across the galaxy gather to prepare for battle and hone their skills." << endl << endl + << "Here, you can visit The Forge, the most renowned armor and weapon shop in the galaxy, where you can upgrade your gear and make sure you're fully equipped for the challenges ahead." << endl << endl + << "If you're looking for some action, head to the tournament arena where you can test your skills against challengers from all corners of the universe. With no-holds-barred battles and the ultimate prize of eternal glory, the competition is fierce and the stakes are high." << endl << endl + << "But if you need a break from the intensity of battle, you can always return to your ship and modify your gear, or take some time to relax and recharge before heading back into the fray." << endl << endl + << "So, come and experience the thrill of the ultimate test of strength, skill, and strategy in the galaxy at The Tournament Hub!" + << endl; +} + +/** + * GAME MENUS + */ + +void tournament_hub_menu(Weapon equipped_weapons[], Armor equipped_armor[], Potion equipped_potions[], User Player) // Main Navigation Function of Program +{ + menuDivider(); + cout << "TRANSPORTING YOU TO THE TOURNAMENT HUB" << endl; + menuDivider(); + + cout << "Welcome back to the Tournament Hub, " << Player.getUserName() << ". Where would you like to go?" << endl << endl; + displayPlayerStats(Player); + + cout + << "1. View Current Gear" << endl + << "2. Return to Ship" << endl + << "3. Go the The Forge" << endl + << "4. Enter the Arena" << endl + << "5. Exit Game" << endl + << endl; + + int menuInput = 0; //Variable to store user's input to menu + cout << "Menu Selection: "; cin >> menuInput; + + // Check that user input is valid + while (menuInput < 1 || menuInput > 5) + { + cout << endl << menuInput << " is not a valid option!" << endl; + cout << "Please enter one of the menu options." << endl << endl; + cout << "Where would you like to go from the Tournament Hub, " << Player.getUserName() << "?" << endl << endl; + + cout + << "1. View Current Gear" << endl + << "2. Return to Ship" << endl + << "3. Go the The Forge" << endl + << "4. Enter the Arena" << endl + << "5. Exit Game" << endl + << endl; + + cout << "Menu Selection: "; cin >> menuInput; + + menuDivider(); + } + // User chooses to view their gear + if (menuInput == 1) + { + showAllGear(equipped_weapons, equipped_armor, equipped_potions); + tournament_hub_menu(equipped_weapons, equipped_armor, equipped_potions, Player); + } + // User chooses to return to ship + else if (menuInput == 2) + { + Map map; + //Output Travel Message to menu + menuDivider(); + cout << "TRANSPORTING YOU TO YOUR SHIP" << endl; + menuDivider(); + + // Output to welcome menu to ship + cout << "Welcome back, " << Player.getUserName() << "! It's great to see you've returned to your ship safe and sound after your latest expedition to the intergalactic tournament." << endl << endl; + cout << "As you know, your ship serves as your base of operations during the tournament, allowing you to modify your weapons and gear to gain an edge over your opponents. Additionally, the ship's storage chamber is a secure place to store any valuable items you may have acquired during your battles. So take a deep breath and take comfort in the fact that you are back in the familiar surroundings of your ship, where you can rest, recover, and prepare for your next battle in the tournament." << endl; + menuDivider(); + + shipMenu(map,equipped_weapons, equipped_armor, equipped_potions, Player); + } + // User chooses to go to shop + else if (menuInput == 3) + { + menuDivider(); + cout << "TRANSPORTING YOU TO THE FORGE" << endl; + menuDivider(); + + cout << "Welcome back to the Forge, warrior! You've returned to the heart of the intergalactic battle tournament, where the galaxy's finest crafters have gathered to showcase their wares. As you step inside, you're surrounded by an array of exotic weapons and armor, each one crafted with the finest materials from across the galaxy. The air is thick with the scent of smelting metal and the sound of hammers pounding on anvils. Every corner of the Forge is alive with activity as warriors from across the universe browse the shelves and haggle with merchants. It's an adventurer's paradise, and you can feel the thrill of the tournament coursing through your veins as you step up to the counter to browse the latest wares. So take your time, warrior, and choose your weapons wisely, for your next battle in the tournament is sure to be your greatest challenge yet." << endl; + menuDivider(); + + shopMenu(equipped_weapons, equipped_armor, equipped_potions, Player); + } + // User chooses to battle + else if (menuInput == 4) + { + menuDivider(); + cout << "TRANSPORTING YOU TO THE ARENA" << endl; + menuDivider(); + + cout << "Welcome to the arena, " << Player.getUserName() << endl << endl; + + // Ask user if they are sure they want to enter the arena + cout << "Are you sure you would like to enter the arena? Once you enter you cannot return until after your battle slot has concluded." << endl << endl; + + cout << "1. Yes" << endl; + cout << "2. No [Return to Tournament Hub]" << endl << endl; + + cout << "Menu Selection: "; cin >> menuInput; + + menuDivider(); + + // Check that user input is valid + while (menuInput != 1 && menuInput != 2) + { + cout << "Input was invalid. Please enter either 1 or 2" << endl << endl; + + cout << "Are you sure you would like to enter the arena? Once you enter you cannot return until after your battle slot has concluded." << endl << endl; + + cout << "1. Yes" << endl; + cout << "2. No [Return to Tournament Hub]" << endl << endl; + + cout << "Menu Selection: "; cin >> menuInput; + + menuDivider(); + } + + // User chooses to enter the arena + if (menuInput == 1) + { + if (Player.getUserLevel() == 1) + { + cout << "Welcome, interplanetary traveler, to the annual fighting tournament on Planet Kumite! As a traveler from distant worlds, you have been chosen to participate in this prestigious event, where only the strongest and most skilled warriors from across the galaxy gather to compete for glory and honor." << endl << endl; + cout << "Before you enter the arena, you must understand the rules of this tournament. The battles here are intense and often brutal, with no holds barred and no mercy given. Your strength, agility, and strategy will be put to the test, as you face opponents who have trained their entire lives for this moment. Only the best will emerge victorious, and only the strongest will be remembered." << endl << endl; + cout << "But fear not, for you are not alone in this journey. Many of your fellow travelers have also arrived on Planet Kumite, eager to prove themselves in battle. Some come seeking fame and fortune, while others are driven by a desire for revenge or redemption. But no matter their motivations, all share a common goal: to emerge as the ultimate champion of the interplanetary tournament." << endl << endl; + cout << "So step into the arena, traveler, and show us what you're made of. Let your combat skills speak for themselves, and let your courage and determination be your guiding lights. For on this battlefield, only the strongest will survive, and only the bravest will triumph. The interplanetary tournament awaits you, so let the games begin!" << endl << endl; + } + + menuDivider(); + cout << "Introducing Opponent" << endl; + menuDivider(); + + // Generate Opponent Name and Backstory + string opponent_name = generate_opponent_name(), opponent_backstory = generate_opponent_backstory(); + int opponent_level = generate_opponent_level(Player.getUserLevel()); + + cout << "Name: " << opponent_name << endl; + cout << "Level: " << opponent_level << endl << endl; + + cout << "Opponent Background:" << endl << endl; + cout << opponent_backstory << endl; + + int opponent_base_damage = generate_weapon_base_damage(opponent_level); + int opponent_max_damage = generate_weapon_max_damage(opponent_base_damage); + + Opponent opponent(opponent_name, opponent_level, opponent_base_damage, opponent_max_damage); //Create an opponent object to pass to and from + + menuDivider(); + cout << "Ladies and gentlemen, we are live from the sold-out arena, and it's time for the fight you've all been waiting for! This is the moment when two warriors step into the octagon and put everything on the line!" << endl << endl; + cout << "Introducing first, fighting out of the blue corner! He's a striker with devastating power, a submission specialist with a ground game to match, and he's hungry for victory tonight! He's trained for months, and he's ready to leave it all in the cage! So let's hear it for... " << Player.getUserName() << "!" << endl << endl; + cout << "And his opponent, fighting out of the red corner! He's a force to be reckoned with, a powerhouse of pure aggression, and he's determined to come out on top! With lightning-fast reflexes and an iron will, he's a fighter you don't want to mess with! So let's give it up for..." << opponent_name << "!" << endl << endl; + cout << "The crowd is on their feet, the energy in the arena is electric, and we are about to witness one of the greatest battles in the history of combat sports! Are you ready?! LET'S GET IT ON!" << endl << endl; + menuDivider(); + cout << "FIGHT" << endl; + menuDivider(); + + // Initiate the fight + bool throw_in_the_towel = false; + int turn = 1; + while (throw_in_the_towel == false) + { + cout << "Turn: " << turn << endl << endl; + + cout << Player.getUserName() << " Health: " << Player.getUserHealth() << "/" << Player.getUserMaxHealth() << endl; + cout << opponent.getOpponentName() << " Health: " << opponent.getOpponentHealth() << "/" << opponent.getOpponentMaxHealth() << endl << endl; + + cout << "What would you like to do, " << Player.getUserName() << "?" << endl << endl; + + cout << "1. Attack" << endl; + cout << "2. Heal" << endl; + cout << "3. View Gear" << endl << endl; + + cout << "Menu Selection: "; cin >> menuInput; + + while (menuInput < 1 || menuInput > 4) + { + cout << "Enter a valid input!" << endl; + + cout << "What would you like to do, " << Player.getUserName() << "?" << endl << endl; + + cout << "1. Attack" << endl; + cout << "2. Heal" << endl; + cout << "3. View Gear" << endl << endl; + + cout << "Menu Selection: "; cin >> menuInput; + } + // User chooses to attack + if (menuInput == 1) + { + // Display Currently Equipped Weapon + menuDivider(); + cout << "Currently Equipped Weapon:" << endl; + menuDivider(); + + cout << "Name: " << equipped_weapons[0].getWeaponName() << endl; + cout << "Base Damage: " << equipped_weapons[0].getWeaponBaseDamage() << endl; + cout << "Hits Remaining: " << equipped_weapons[0].getWeaponHitsRemaining() << endl; + + // Display different attack options + menuDivider(); + cout << "ATTACK OPTIONS" << endl; + menuDivider(); + + cout << "What type of attack would you like to use?" << endl << endl; + + cout << "1. Light Attack" << endl << endl; + cout << "Probability of Hit: 95%" << endl; + cout << "Base Damage: " << equipped_weapons[0].getWeaponBaseDamage() << endl; + cout << "Potential Max Damage: " << equipped_weapons[0].getWeaponMaxDamage() << endl; + + storeDivider(); + + cout << "2. Heavy Attack" << endl << endl; + cout << "Probability of Hit: 75%" << endl; + cout << "Base Damage: " << equipped_weapons[0].getWeaponBaseDamage() << endl; + int potential_max = equipped_weapons[0].getWeaponMaxDamage() + 10 + (Player.getUserLevel() * 10); + cout << "Potential Max Damage: " << potential_max << endl; + + storeDivider(); + + cout << "Press 3 to Switch Weapons" << endl; + cout << "Press 4 to Return to Main Battle Screen" << endl; + + menuDivider(); + cout << "Menu Selection: "; cin >> menuInput; + menuDivider(); + + // Check to make sure users input is valid + while (menuInput < 1 || menuInput > 4) + { + menuDivider(); + cout << "Currently Equipped Weapon:" << endl; + menuDivider(); + + cout << "Name: " << equipped_weapons[0].getWeaponName() << endl; + cout << "Base Damage: " << equipped_weapons[0].getWeaponBaseDamage() << endl; + cout << "Hits Remaining: " << equipped_weapons[0].getWeaponHitsRemaining() << endl; + + menuDivider(); + cout << "ATTACK OPTIONS" << endl; + menuDivider(); + + cout << "What type of attack would you like to use?" << endl << endl; + + cout << "1. Light Attack" << endl << endl; + cout << "Probability of Hit: 95%" << endl; + cout << "Damage: " << equipped_weapons[0].getWeaponBaseDamage() << endl; + cout << "Potential Max Damage: " << equipped_weapons[0].getWeaponMaxDamage() << endl; + + storeDivider(); + + cout << "2. Heavy Attack" << endl << endl; + cout << "Probability of Hit: 75%" << endl; + cout << "Base Damage: " << equipped_weapons[0].getWeaponBaseDamage() << endl; + int potential_max = equipped_weapons[0].getWeaponMaxDamage() + 10 + (Player.getUserLevel() * 10); + cout << "Potential Max Damage: " << potential_max << endl; + + storeDivider(); + + cout << "Press 3 to Switch Weapons" << endl; + + storeDivider(); + + cout << "Press 4 to Return to Main Battle Screen" << endl; + + menuDivider(); + cout << "Menu Selection: "; cin >> menuInput; cout << endl; + menuDivider(); + } + int probability; + int base; + int max; + int attack; + // User chooses Light Attack + if (menuInput == 1) + { + probability = generate_random_number(1, 100); + // If probability is between 1 and 5 attack fails + if (probability > 0 && probability < 6) + { + cout << "Attack failed" << endl; + attack = 0; + } + // If probability is between 6 and 100 run + else + { + base = equipped_weapons[0].getWeaponBaseDamage(); + max = equipped_weapons[0].getWeaponMaxDamage(); + attack = generate_random_number(base, max); + cout << "Attack is: " << attack << endl; + opponent.setOpponentHealth(attack); + } + } + // User chooses Heavy Attack + else if (menuInput == 2) + { + probability = generate_random_number(1, 100); + // If probability is between 1 and 5 attack fails + if (probability > 0 && probability < 25) + { + cout << "Attack failed" << endl; + attack = 0; + } + else + { + int random = generate_random_number(1, 10); + base = equipped_weapons[0].getWeaponBaseHeavyDamage(); + max = equipped_weapons[0].getWeaponMaxHeavyDamage(); + + attack = generate_random_number(base, max); + cout << endl << opponent.getOpponentName() << " attack generated " << attack << " damage!" << endl << endl; + opponent.setOpponentHealth(attack); + cout << opponent.getOpponentName() << "'s Health is now " << opponent.getOpponentHealth() << "/" << opponent.getOpponentMaxHealth() << endl; + } + } + // User chooses to switch primary with secondary + else if (menuInput == 3) + { + cout << "Switching Secondary Weapon to the Primary Slot" << endl << endl; + Weapon tempStore[1]; + tempStore[0] = equipped_weapons[0]; + equipped_weapons[0] = equipped_weapons[1]; + equipped_weapons[1] = tempStore[0]; + + menuDivider(); + cout << "WEAPONS" << endl; + menuDivider(); + + cout << "Primary Weapon:" << endl; + displayWeaponStats(0, equipped_weapons); + cout << endl; + + cout << "Secondary Weapon:" << endl; + displayWeaponStats(1, equipped_weapons); + cout << endl; + + menuDivider(); + } + // User chooses to return to main battle screen + else if (menuInput == 4) + { + menuDivider(); + cout << "Returning User to Main Battle Screen" << endl; + menuDivider(); + } + + // Check if Opponent is beaten + if (opponent.getOpponentHealth() <= 0) + { + cout << "...and the fight is over! " << Player.getUserName() << "has defeated " << opponent.getOpponentName() << " in " << turn << " rounds. What a finish." << endl; + menuDivider(); + + cout << "What a win, " << Player.getUserName() << "! You really showed them how to fight. Please take this reward for your hardshipa dn we'd love to see you fight again." << endl; + int victory_xp = generate_random_number(100, 350); + int xp_earned = (200 * Player.getUserLevel()) + (victory_xp * Player.getUserLevel()) + (turn * Player.getUserLevel()); + Player.setUserXP(xp_earned); + int win_credits = generate_random_number(100, 500); + Player.giveUserCredits(win_credits); + + // Check if user can level up + if (Player.getUserXP() > Player.getUserXPNeeded()) + { + Player.levelUpUser(Player.getUserLevel()); + int xp_remaining = Player.getUserXP() - Player.getUserXPNeeded(); + Player.resetUserXP(xp_remaining); + Player.setUserXPNeeded(Player.getUserLevel()); + Player.setUserHealthFull(Player.getUserMaxHealth()); + + menuDivider(); + cout << "Congragulations, " << Player.getUserName() << "! You just reached Level " << Player.getUserLevel() << endl; + menuDivider(); + } + + tournament_hub_menu(equipped_weapons, equipped_armor, equipped_potions, Player); + throw_in_the_towel = true; + } + + // Switch to Opponent now that user has exercised their turn + + menuDivider(); + cout << opponent.getOpponentName() << "'s Turn to Attack" << endl; + menuDivider(); + + string opponent_attacks[3]; + string randomOpponentAttack1 = generate_opponent_attack_name(), randomOpponentAttack2 = generate_opponent_attack_name(), randomOpponentAttack3 = generate_opponent_attack_name(); + opponent_attacks[0] = randomOpponentAttack1; + opponent_attacks[1] = randomOpponentAttack2; + opponent_attacks[2] = randomOpponentAttack3; + int opponent_chosen_attack = generate_random_number(1, 3); + int opponent_attack_amount = generate_random_number(opponent.getOpponentBaseDamage(), opponent.getOpponentMaxDamage()); + + cout << opponent.getOpponentName() << " uses " << opponent_attacks[opponent_chosen_attack] << endl; + + cout << "Your attack generated " << opponent_attack_amount << " damage!" << endl << endl; + Player.setUserHealth(opponent_attack_amount); + cout << "Your health is now " << Player.getUserHealth() << "/" << Player.getUserMaxHealth() << endl; + + menuDivider(); + + // If Player health reaches 0 + if (Player.getUserHealth() <= 0) + { + cout << "...and the fight is over! " << opponent.getOpponentName() << "has defeated " << Player.getUserName() << " in " << turn << " rounds. What a finish." << endl; + menuDivider(); + + cout << "Sorry, " << Player.getUserName() << " better luck next time. As a festival celebrating the greatness of combat sports we always welcome you back to try your luck again." << endl; + int loss_xp = generate_random_number(0, 150); + int xp_earned = (200 * Player.getUserLevel()) + (loss_xp * Player.getUserLevel()) + (turn * Player.getUserLevel()); + Player.setUserXP(xp_earned); + int loss_credits = generate_random_number(100, 200); + Player.giveUserCredits(loss_credits); + + // Check if user can level up + if (Player.getUserXP() > Player.getUserXPNeeded()) + { + Player.levelUpUser(Player.getUserLevel()); + int xp_remaining = Player.getUserXP() - Player.getUserXPNeeded(); + Player.resetUserXP(xp_remaining); + Player.setUserXPNeeded(Player.getUserLevel()); + Player.setUserHealthFull(Player.getUserMaxHealth()); + + menuDivider(); + cout << "Congragulations, " << Player.getUserName() << "! You just reached Level " << Player.getUserLevel() << endl; + menuDivider(); + } + + tournament_hub_menu(equipped_weapons, equipped_armor, equipped_potions, Player); + throw_in_the_towel = true; // End Fight + } + turn++; // Iterate turn + } + // User chooses to heal + else if (menuInput == 2) + { + menuDivider(); + + cout << "Which Potion would you like to use?" << endl; + + storeDivider(); + + int counter = 0; //count how many potions there are + // Output potions in inventory + for (int i = 0; i < 5; i++) + { + if (equipped_potions[i].getPotionAmount() > 0) + { + + cout << i + 1 << ". " << equipped_potions[i].getPotionName() << endl; + cout << "Amount Healed: " << equipped_potions[i].getPotionAmount() << endl; + counter++; + storeDivider(); + } + } + + int exit_input = counter + 1; //Create Variable to store input to exit at + + // If user has 1 or more potions + if (counter > 0) + { + //Output rest of menu to user + cout << "Press " << exit_input << " to Return to Main Battle Screen" << endl; + + storeDivider(); + + cout << "Menu Selection: "; cin >> menuInput; + + + // Check to make sure input is valid + while (menuInput < 1 || menuInput > 6 || menuInput > counter + 1) // Extra is to account for exit + { + menuDivider(); + cout << "Please enter a valid input!" << endl; + menuDivider(); + + // Output potions in inventory to user + for (int i = 0; i < 5; i++) + { + if (equipped_potions[i].getPotionAmount() > 0) + { + cout << i + 1 << ". " << equipped_potions[i].getPotionName() << endl; + cout << "Amount Healed: " << equipped_potions[i].getPotionAmount() << endl; + storeDivider(); + } + } + // Output exit message to user + cout << "Press " << exit_input << " to Return to Main Battle Screen" << endl; + + storeDivider(); + + cout << "Menu Selection: "; cin >> menuInput; + } + + int amount_from_potion; // Variable to store amount of health from potion selected + if (Player.getUserHealth() < Player.getUserMaxHealth()) + { + if (menuInput == exit_input) + { + cout << "Bringing User Back to Battle Screen" << endl; + } + // User chooses potion in slot 1 + if (menuInput == 1) + { + amount_from_potion = equipped_potions[menuInput - 1].getPotionAmount(); + Player.usePotion(amount_from_potion); + // create loop to move potions down + for (int i = menuInput - 1; i < counter; i++) + { + equipped_potions[menuInput - 1] = equipped_potions[menuInput]; // Set potion used slot to slot ahead of it + equipped_potions[counter - 1] = Potion(); + exit_input = counter; + } + } + // User chooses potion in slot 2 + else if (menuInput == 2) + { + amount_from_potion = equipped_potions[menuInput - 1].getPotionAmount(); + Player.usePotion(amount_from_potion); + // create loop to move potions down + for (int i = menuInput - 1; i < counter; i++) + { + equipped_potions[menuInput - 1] = equipped_potions[menuInput]; // Set potion used slot to slot ahead of it + equipped_potions[counter - 1] = Potion(); + exit_input = counter; + } + } + // User chooses potion in slot 3 + else if (menuInput == 3) + { + amount_from_potion = equipped_potions[menuInput - 1].getPotionAmount(); + Player.usePotion(amount_from_potion); + // create loop to move potions down + for (int i = menuInput - 1; i < counter; i++) + { + equipped_potions[menuInput - 1] = equipped_potions[menuInput]; // Set potion used slot to slot ahead of it + equipped_potions[counter - 1] = Potion(); + exit_input = counter; + } + } + // User chooses potion in slot 4 + else if (menuInput == 4) + { + amount_from_potion = equipped_potions[menuInput - 1].getPotionAmount(); + Player.usePotion(amount_from_potion); + // create loop to move potions down + for (int i = menuInput - 1; i < counter; i++) + { + equipped_potions[menuInput - 1] = equipped_potions[menuInput]; // Set potion used slot to slot ahead of it + equipped_potions[counter - 1] = Potion(); + exit_input = counter; + } + + } + // User chooses potion in slot 5 + else if (menuInput == 5) + { + amount_from_potion = equipped_potions[menuInput - 1].getPotionAmount(); + Player.usePotion(amount_from_potion); + // create loop to move potions down + for (int i = menuInput - 1; i < counter; i++) + { + equipped_potions[menuInput - 1] = equipped_potions[menuInput]; // Set potion used slot to slot ahead of it + equipped_potions[counter - 1] = Potion(); + exit_input = counter; + } + } + else if (menuInput == 6) + { + cout << "Bringing User Back to Battle Screen" << endl; + } + } + else if (Player.getUserHealth() == Player.getUserMaxHealth()) + { + menuDivider(); + if (menuInput == exit_input) + { + cout << "Bringing User Back to Battle Screen" << endl; + } + else + { + cout << "Health is already full" << endl; + } + } + menuDivider(); + } + // If user has no potions + else if (counter == 0) + { + cout << "Sorry, you don't have any potions" << endl; + menuDivider(); + } + } + // User chooses to view gear + else if (menuInput == 3) + { + showAllGear(equipped_weapons, equipped_armor, equipped_potions); + + menuDivider(); + cout << "END OF GEAR" << endl; + menuDivider(); + } + } + } + // User chooses to return to tournament hub + else + { + tournament_hub_menu(equipped_weapons, equipped_armor, equipped_potions, Player); + } + + } + // User Chooses to exit game + else if (menuInput == 5) + { + menuDivider(); + + // Ask user if they would like to exit + cout << "Are you sure you would like to exit?" << endl << endl; + + cout << "1. Yes" << endl; + cout << "2. No [Return to Game]" << endl << endl; + + cout << "Menu Selection: "; cin >> menuInput; + + menuDivider(); + + // Check user input is valid + while (menuInput != 1 && menuInput != 2) + { + cout << "Please enter a valid input" << endl << endl; + + cout << "Are you sure you would like to exit?" << endl << endl; + + cout << "1. Yes" << endl; + cout << "2. No [Return to Game]" << endl << endl; + + cout << "Menu Selection: "; cin >> menuInput; + + menuDivider(); + } + + // User chooses to exit game + if (menuInput == 1) + { + // Ask user if they would like to save progress + cout << "Would you like to save your progress?" << endl << endl; + + cout << "1. Yes" << endl; + cout << "2. No" << endl << endl; + + cout << "Menu Selection: "; cin >> menuInput; + + menuDivider(); + + // Check to make sure input is valid + while (menuInput != 1 && menuInput != 2) + { + cout << "Please enter a valid input" << endl << endl; + + cout << "Are you sure you would like to exit?" << endl << endl; + + cout << "1. Yes" << endl; + cout << "2. No" << endl << endl; + + cout << "Menu Selection: "; cin >> menuInput; + + menuDivider(); + } + // User chooses to save game + if (menuInput == 1) + { + string filename; //Create temporary string to save filename to + //Ask user what they would like to name the save file + cout << "What would you like to save the file as?" << endl << endl; + cout << "Game File Name: "; cin >> filename; + + filename = "Game_Saves/" + filename + ".txt"; + + ofstream Save; + Weapon Primary(equipped_weapons[0]); + Weapon Secondary(equipped_weapons[1]); + + Armor Helmet(equipped_armor[0]); + Armor Chest(equipped_armor[1]); + Armor Boots(equipped_armor[2]); + + Save.open(filename); //Works up to here + Save << "Name|" << Player.getUserName() << "|Level|" << Player.getUserLevel() << "|XP|" << Player.getUserXP() << "|" << endl; + Save << "Credits|" << Player.getUserCredits() << "|" << endl; + Save << "Weapons|Primary|" << Primary.getWeaponName() << "|Secondary|" << Secondary.getWeaponName() << "|" << endl; + Save << "Armor|Helmet|" << Helmet.getArmorName() << "|Chest|" << Chest.getArmorName() <<"|Boots|" << Boots.getArmorName() << "|" << endl; + Save.close(); + + menuDivider(); + + cout << "The Game Save: " << filename << " was stored to the Game_Saves folder" << endl; + + exit(); + } + else + { + exit(); + } + } + // User chooses to return to game + else + { + tournament_hub_menu(equipped_weapons, equipped_armor, equipped_potions, Player); // Return user to main menu + } + } +} +void shopMenu(Weapon equipped_weapons[], Armor equipped_armor[], Potion equipped_potions[], User Player) // Shop Naviagtion +{ + int shopInput; // Variable to store menu's menu choice in store + + cout << "TRANSPORTING YOU TO THE FORGE MAIN GALLERY" << endl; + + menuDivider(); + + displayPlayerStats(Player); + + cout << "What would you like to buy from The Forge today, " << Player.getUserName() << "?" << endl << endl; + + cout << "1. Browse Weaponry"<< endl; + cout << "2. Browse Armor Pieces" << endl; + cout << "3. Browse Potions" << endl; + cout << "4. Return to Tournament Hub" << endl << endl; + + cout << "Menu Selection: "; cin >> shopInput; + + //Check the input is valid + while (shopInput < 1 || shopInput > 4) + { + shopMenu(equipped_weapons, equipped_armor, equipped_potions, Player); + } + + // User wants to view Weapons for sale + if (shopInput == 1) + { + menuDivider(); + cout << "WELCOME TO THE WEAPONS RACK" << endl; + menuDivider(); + + cout << "Have a look at our current selection" << endl << endl; + cout << "You currently have: $" << Player.getUserCredits() << endl; + + //Generate random weapon names + string randomWeapon1name = generate_weapon_name(), randomWeapon2name = generate_weapon_name(), randomWeapon3name = generate_weapon_name(); + //Generate random weapon base damage values + int randomWeapon1base = generate_weapon_base_damage(Player.getUserLevel()), randomWeapon2base = generate_weapon_base_damage(Player.getUserLevel()), randomWeapon3base = generate_weapon_base_damage(Player.getUserLevel()); + // Generate random weapon max damage values + int randomWeapon1max = generate_weapon_max_damage(randomWeapon1base), randomWeapon2max = generate_weapon_max_damage(randomWeapon2base), randomWeapon3max = generate_weapon_max_damage(randomWeapon3base); + // Generate weapon costs based on damage ratings + int randomWeapon1cost = generate_weapon_cost(randomWeapon1base, randomWeapon1max), randomWeapon2cost = generate_weapon_cost(randomWeapon2base, randomWeapon2max), randomWeapon3cost = generate_weapon_cost(randomWeapon3base, randomWeapon3max); + + storeDivider(); + + cout << "Name: " << randomWeapon1name << endl << "Cost: $" << randomWeapon1cost << endl << "Base Damage: " << randomWeapon1base << endl << "Max Damage: " << randomWeapon1max << endl << endl << "Enter 1 to Purchase" << endl; + storeDivider(); + cout << "Name: " << randomWeapon2name << endl << "Cost: $" << randomWeapon2cost << endl << "Base Damage: " << randomWeapon2base << endl << "Max Damage: " << randomWeapon2max << endl << endl << "Enter 2 to Purchase" << endl; + storeDivider(); + cout << "Name: " << randomWeapon3name << endl << "Cost: $" << randomWeapon3cost << endl << "Base Damage: " << randomWeapon3base << endl << "Max Damage: " << randomWeapon3max << endl << endl << "Enter 3 to Purchase" << endl; + storeDivider(); + cout << "Enter 4 to return to Forge Main Gallery" << endl; + storeDivider(); + cout << "Menu Selection: "; cin >> shopInput; + menuDivider(); + + while (shopInput < 1 || shopInput > 4) + { + cout << endl << shopInput << " is not a valid option!" << endl; + + menuDivider(); + cout << "Please enter one of the menu options." << endl << endl; + storeDivider(); + cout << "Name: " << randomWeapon1name << endl << "Cost: $" << randomWeapon1cost << endl << "Base Damage: " << randomWeapon1base << endl << "Max Damage: " << randomWeapon1max << endl << endl << "Enter 1 to Purchase" << endl; + storeDivider(); + cout << "Name: " << randomWeapon2name << endl << "Cost: $" << randomWeapon2cost << endl << "Base Damage: " << randomWeapon2base << endl << "Max Damage: " << randomWeapon2max << endl << endl << "Enter 2 to Purchase" << endl; + storeDivider(); + cout << "Name: " << randomWeapon3name << endl << "Cost: $" << randomWeapon3cost << endl << "Base Damage: " << randomWeapon3base << endl << "Max Damage: " << randomWeapon3max << endl << endl << "Enter 3 to Purchase" << endl; + storeDivider(); + cout << "Enter 4 to return to Forge Main Gallery" << endl; + storeDivider(); + + cout << "Menu Selection: "; cin >> shopInput; + } + + Weapon Purchase; //Create Object to pass purchase information into + bool purchase_flag = false; //Set a purchase flag to make sure unwanted messages don't display + switch (shopInput) + { + //User picks first option in menu + case 1: + cout << "You selected " << randomWeapon1name << endl; + Purchase = Weapon(randomWeapon1name, randomWeapon1base, randomWeapon1max, randomWeapon1cost); + purchase_flag = true; + break; + //User picks second option in menu + case 2: + cout << "You selected " << randomWeapon2name << endl; + Purchase = Weapon(randomWeapon2name, randomWeapon2base, randomWeapon2max, randomWeapon2cost); + purchase_flag = true; + break; + //User picks third option in menu + case 3: + cout << "You selected " << randomWeapon3name << endl; + Purchase = Weapon(randomWeapon3name, randomWeapon3base, randomWeapon3max, randomWeapon3cost); + purchase_flag = true; + break; + //User chooses to return to shop + case 4: + shopMenu(equipped_weapons, equipped_armor, equipped_potions, Player); + break; + } + + menuDivider(); + + //Check if user has enough credits + if (Player.getUserCredits() < Purchase.getWeaponValue()) + { + cout << "Sorry, it looks like you don't have enough for this." << endl; + menuDivider(); + shopMenu(equipped_weapons, equipped_armor, equipped_potions, Player); + purchase_flag = false; + } + + int credits = Player.getUserCredits() - Purchase.getWeaponValue(); //Subtract value of weapons from credits + + // If this is users first purchase + if (equipped_weapons[1].getWeaponBaseDamage() == 0 && purchase_flag == true) + { + cout << "Congragulations, " << Player.getUserName() << "! This is your first ever weapon purchase with us. Thanks you so much for the business. As a courtesy we've given you a complimentary satch to carry an additional weapon. You'll find you can now carry two weapons." << endl; + equipped_weapons[1] = equipped_weapons[0]; // Move the Noob to secondary + equipped_weapons[0] = Purchase; // Move purchase to primary weapon slot + Player.setUserCredits(credits); //Pass Credit amount to player + tournament_hub_menu(equipped_weapons, equipped_armor, equipped_potions, Player); + } + else if (equipped_weapons[1].getWeaponBaseDamage() > 0 && purchase_flag == true) + { + cout << "Would like this purchase to replace your primary or secondary weapon?" << endl; + + storeDivider(); + cout << "Primary Weapon:" << endl; + displayWeaponStats(0, equipped_weapons); + cout << endl << "Enter 1 to Replace Primary"; cout << endl; + + storeDivider(); + + cout << "Secondary Weapon:" << endl; + displayWeaponStats(1, equipped_weapons); + cout << endl << "Enter 2 to Replace Secondary"; cout << endl; + storeDivider(); + + cout << "Menu Selection: "; cin >> shopInput; + + while (shopInput != 1 && shopInput != 2) + { + cout << "Please enter a valid input!" << endl << endl; + + cout << "Enter 1 to Replace Primary" << endl; + cout << "Enter 2 to Replace Secondary" << endl; + cout << "Enter 3 to Cancel Transaction" << endl; + + cout << "Menu Selection: "; cin >> shopInput; + } + + if (shopInput == 1 || shopInput == 2) + { + //Move equipped weapon at input to inventory + equipped_weapons[shopInput - 1] = Purchase; + Player.setUserCredits(credits); //Pass Credit amount to player + tournament_hub_menu(equipped_weapons, equipped_armor, equipped_potions, Player); + } + else if (shopInput == 3) + { + shopMenu(equipped_weapons, equipped_armor, equipped_potions, Player); + } + } + } + // User wants to view armor for sale + else if (shopInput == 2) + { + menuDivider(); + cout << "WELCOME TO THE ARMORY" << endl; + menuDivider(); + + cout << "Is there any kind of piece you're looking for in particular?" << endl << endl; + + cout << "1. Browse Helmet Pieces"<< endl; + cout << "2. Browse Chest Pieces" << endl; + cout << "3. Browse Boots" << endl; + cout << "4. Return to Forge Main Gallery" << endl << endl; + + cout << "Menu Selection: "; cin >> shopInput; + + //Check to make sure user input is valid + while (shopInput < 1 || shopInput > 4) + { + cout << endl << shopInput << " is not a valid option!" << endl; + + menuDivider(); + + cout << "Please enter one of the menu options." << endl << endl; + + cout << "1. Browse Helmet Pieces"<< endl; + cout << "2. Browse Chest Pieces" << endl; + cout << "3. Browse Boots" << endl; + cout << "4. Return to Forge Main Gallery" << endl << endl; + + cout << "Menu Selection: "; cin >> shopInput; + } + // View Helmet Shop Menu + if (shopInput == 1) + { + menuDivider(); + cout << "WELCOME TO THE HELMET GALLERY" << endl; + menuDivider(); + + cout << "Have a look at our current selection" << endl << endl; + cout << "You currently have: $" << Player.getUserCredits() << endl; + + //Generate random weapon names + string randomHelmet1name = generate_helmet_name(), randomHelmet2name = generate_helmet_name(), randomHelmet3name = generate_helmet_name(); + //Generate random weapon base damage values + int randomHelmet1Health = generate_helmet_health(Player.getUserLevel()), randomHelmet2Health = generate_helmet_health(Player.getUserLevel()), randomHelmet3Health = generate_helmet_health(Player.getUserLevel()); + // Generate weapon costs based on damage ratings + int randomHelmet1cost = generate_helmet_cost(randomHelmet1Health), randomHelmet2cost = generate_helmet_cost(randomHelmet2Health), randomHelmet3cost = generate_helmet_cost(randomHelmet3Health); + + storeDivider(); + + cout << "Name: " << randomHelmet1name << endl << "Cost: $" << randomHelmet1cost << endl << "Health: " << randomHelmet1Health << endl << endl << "Enter 1 to Purchase" << endl; + storeDivider(); + cout << "Name: " << randomHelmet2name << endl << "Cost: $" << randomHelmet2cost << endl << "Health: " << randomHelmet2Health << endl << endl << "Enter 2 to Purchase" << endl; + storeDivider(); + cout << "Name: " << randomHelmet3name << endl << "Cost: $" << randomHelmet3cost << endl << "Health: " << randomHelmet3Health << endl << endl << "Enter 3 to Purchase" << endl; + storeDivider(); + cout << "Enter 4 to return to Forge Main Gallery" << endl; + storeDivider(); + cout << "Menu Selection: "; cin >> shopInput; + menuDivider(); + + Armor Purchase; //Create Object to pass purchase information into + bool purchase_flag = false; //Set a purchase flag to make sure unwanted messages don't display + switch (shopInput) + { + //User picks first option in menu + case 1: + cout << "You selected " << randomHelmet1name << endl; + Purchase = Armor(randomHelmet1name, randomHelmet1Health, randomHelmet1cost); + purchase_flag = true; + break; + //User picks second option in menu + case 2: + cout << "You selected " << randomHelmet2name << endl; + Purchase = Armor(randomHelmet2name, randomHelmet2Health, randomHelmet2cost); + purchase_flag = true; + break; + //User picks third option in menu + case 3: + cout << "You selected " << randomHelmet3name << endl; + Purchase = Armor(randomHelmet3name, randomHelmet3Health, randomHelmet3cost); + purchase_flag = true; + break; + //User chooses to return to shop + case 4: + shopMenu(equipped_weapons, equipped_armor, equipped_potions, Player); + break; + } + + menuDivider(); + + //Check if user has enough credits + if (Player.getUserCredits() < Purchase.getArmorValue()) + { + cout << "Sorry, it looks like you don't have enough for this." << endl; + menuDivider(); + shopMenu(equipped_weapons, equipped_armor, equipped_potions, Player); + purchase_flag = false; + } + + int credits = Player.getUserCredits() - Purchase.getArmorValue(); + //Subtract value of weapons from credits + if (equipped_armor[0].getArmorHealth() == 0 && purchase_flag == true) + { + cout << "Congragulations, " << Player.getUserName() << "! This is your first ever head piece purchase with us. Thank you so much for the business." << endl; + equipped_armor[0] = Purchase; + Player.setUserCredits(credits); //Pass Credit amount to player + Player.setMaxHealth(equipped_armor); // Update user armor rating + Player.setHealthAfterPurchase(Purchase.getArmorHealth()); + tournament_hub_menu(equipped_weapons, equipped_armor, equipped_potions, Player); + } + else if (equipped_armor[0].getArmorHealth() > 0 && purchase_flag == true) + { + cout << "Would like this purchase to replace your currently equipped head piece?" << endl; + + storeDivider(); + cout << "Currently Equipped:" << endl; + displayArmorStats(0, equipped_armor); + cout << endl << "Enter 1 to Replace Head Piece" << endl; + cout << "Enter 2 to Cancel Transaction" << endl; + + cout << "Menu Selection: "; cin >> shopInput; + + while (shopInput != 1 && shopInput != 2) + { + cout << "Please enter a valid input!" << endl << endl; + + cout << endl << "Enter 1 to Replace Helmet" << endl; + cout << "Enter 2 to Cancel Transaction" << endl; + + cout << "Menu Selection: "; cin >> shopInput; + + storeDivider(); + } + + if (shopInput == 1) + { + //Move equipped weapon at input to inventory + equipped_armor[0] = Purchase; + Player.setUserCredits(credits); //Pass Credit amount to player + Player.setMaxHealth(equipped_armor); // Update user armor rating + Player.setHealthAfterPurchase(Purchase.getArmorHealth()); + tournament_hub_menu(equipped_weapons, equipped_armor, equipped_potions, Player); + } + else + { + shopMenu(equipped_weapons, equipped_armor, equipped_potions, Player); + } + } + } + // View Chest Piece Shop Menu + else if (shopInput == 2) + { + menuDivider(); + cout << "WELCOME TO THE CHEST PIECE GALLERY" << endl; + menuDivider(); + + cout << "Have a look at our current selection" << endl << endl; + cout << "You currently have: $" << Player.getUserCredits() << endl; + + //Generate random weapon names + string randomChest1name = generate_chest_name(), randomChest2name = generate_chest_name(), randomChest3name = generate_chest_name(); + //Generate random weapon base damage values + int randomChest1Health = generate_chest_health(Player.getUserLevel()), randomChest2Health = generate_chest_health(Player.getUserLevel()), randomChest3Health = generate_chest_health(Player.getUserLevel()); + // Generate weapon costs based on damage ratings + int randomChest1cost = generate_chest_cost(randomChest1Health), randomChest2cost = generate_chest_cost(randomChest2Health), randomChest3cost = generate_chest_cost(randomChest3Health); + + storeDivider(); + + cout << "Name: " << randomChest1name << endl << "Cost: $" << randomChest1cost << endl << "Health: " << randomChest1Health << endl << endl << "Enter 1 to Purchase" << endl; + storeDivider(); + cout << "Name: " << randomChest2name << endl << "Cost: $" << randomChest2cost << endl << "Health: " << randomChest2Health << endl << endl << "Enter 2 to Purchase" << endl; + storeDivider(); + cout << "Name: " << randomChest3name << endl << "Cost: $" << randomChest3cost << endl << "Health: " << randomChest3Health << endl << endl << "Enter 3 to Purchase" << endl; + storeDivider(); + cout << "Enter 4 to return to Forge Main Gallery" << endl; + storeDivider(); + cout << "Menu Selection: "; cin >> shopInput; + menuDivider(); + + Armor Purchase; //Create Object to pass purchase information into + bool purchase_flag = false; //Set a purchase flag to make sure unwanted messages don't display + switch (shopInput) + { + //User picks first option in menu + case 1: + cout << "You selected " << randomChest1name << endl; + Purchase = Armor(randomChest1name, randomChest1Health, randomChest1cost); + purchase_flag = true; + break; + //User picks second option in menu + case 2: + cout << "You selected " << randomChest2name << endl; + Purchase = Armor(randomChest2name, randomChest2Health, randomChest2cost); + purchase_flag = true; + break; + //User picks third option in menu + case 3: + cout << "You selected " << randomChest3name << endl; + Purchase = Armor(randomChest3name, randomChest3Health, randomChest3cost); + purchase_flag = true; + break; + //User chooses to return to shop + case 4: + shopMenu(equipped_weapons, equipped_armor, equipped_potions, Player); + break; + } + + menuDivider(); + + //Check if user has enough credits + if (Player.getUserCredits() < Purchase.getArmorValue()) + { + cout << "Sorry, it looks like you don't have enough for this." << endl; + menuDivider(); + shopMenu(equipped_weapons, equipped_armor, equipped_potions, Player); + purchase_flag = false; + } + + int credits = Player.getUserCredits() - Purchase.getArmorValue(); + //Subtract value of weapons from credits + if (equipped_armor[1].getArmorHealth() == 0 && purchase_flag == true) + { + cout << "Congragulations, " << Player.getUserName() << "! This is your first ever chest piece purchase with us. Thank you so much for the business." << endl; + equipped_armor[1] = Purchase; + Player.setUserCredits(credits); //Pass Credit amount to player + Player.setMaxHealth(equipped_armor); // Update user armor rating + Player.setHealthAfterPurchase(Purchase.getArmorHealth()); + tournament_hub_menu(equipped_weapons, equipped_armor, equipped_potions, Player); + } + else if (equipped_armor[1].getArmorHealth() > 0 && purchase_flag == true) + { + cout << "Would like this purchase to replace your currently equipped chest piece?" << endl; + + storeDivider(); + cout << "Currently Equipped:" << endl; + displayArmorStats(1, equipped_armor); + cout << endl << "Enter 1 to Replace Chest Piece" << endl; + cout << "Enter 2 to Cancel Transaction" << endl; + + cout << "Menu Selection: "; cin >> shopInput; + + while (shopInput != 1 && shopInput != 2) + { + cout << "Please enter a valid input!" << endl << endl; + + cout << endl << "Enter 1 to Replace Helmet" << endl; + cout << "Enter 2 to Cancel Transaction" << endl; + + cout << "Menu Selection: "; cin >> shopInput; + + storeDivider(); + } + + if (shopInput == 1) + { + //Move equipped weapon at input to inventory + equipped_armor[1] = Purchase; + Player.setUserCredits(credits); //Pass Credit amount to player + Player.setMaxHealth(equipped_armor); // Update user armor rating + Player.setHealthAfterPurchase(Purchase.getArmorHealth()); + tournament_hub_menu(equipped_weapons, equipped_armor, equipped_potions, Player); + } + else + { + shopMenu(equipped_weapons, equipped_armor, equipped_potions, Player); + } + } + } + // View Boots Shop + else if (shopInput == 3) + { + menuDivider(); + cout << "WELCOME TO THE BOOTS GALLERY" << endl; + menuDivider(); + + cout << "Have a look at our current selection" << endl << endl; + cout << "You currently have: $" << Player.getUserCredits() << endl; + + //Generate random weapon names + string randomBoots1name = generate_boots_name(), randomBoots2name = generate_boots_name(), randomBoots3name = generate_boots_name(); + //Generate random weapon base damage values + int randomBoots1Health = generate_boots_health(Player.getUserLevel()), randomBoots2Health = generate_boots_health(Player.getUserLevel()), randomBoots3Health = generate_boots_health(Player.getUserLevel()); + // Generate weapon costs based on damage ratings + int randomBoots1cost = generate_boots_cost(randomBoots1Health), randomBoots2cost = generate_boots_cost(randomBoots2Health), randomBoots3cost = generate_boots_cost(randomBoots3Health); + + storeDivider(); + + cout << "Name: " << randomBoots1name << endl << "Cost: $" << randomBoots1cost << endl << "Health: " << randomBoots1Health << endl << endl << "Enter 1 to Purchase" << endl; + storeDivider(); + cout << "Name: " << randomBoots2name << endl << "Cost: $" << randomBoots2cost << endl << "Health: " << randomBoots2Health << endl << endl << "Enter 2 to Purchase" << endl; + storeDivider(); + cout << "Name: " << randomBoots3name << endl << "Cost: $" << randomBoots3cost << endl << "Health: " << randomBoots3Health << endl << endl << "Enter 3 to Purchase" << endl; + storeDivider(); + cout << "Enter 4 to return to Forge Main Gallery" << endl; + storeDivider(); + cout << "Menu Selection: "; cin >> shopInput; + menuDivider(); + + Armor Purchase; //Create Object to pass purchase information into + bool purchase_flag = false; //Set a purchase flag to make sure unwanted messages don't display + switch (shopInput) + { + //User picks first option in menu + case 1: + cout << "You selected " << randomBoots1name << endl; + Purchase = Armor(randomBoots1name, randomBoots1Health, randomBoots1cost); + purchase_flag = true; + break; + //User picks second option in menu + case 2: + cout << "You selected " << randomBoots2name << endl; + Purchase = Armor(randomBoots2name, randomBoots2Health, randomBoots2cost); + purchase_flag = true; + break; + //User picks third option in menu + case 3: + cout << "You selected " << randomBoots3name << endl; + Purchase = Armor(randomBoots3name, randomBoots3Health, randomBoots3cost); + purchase_flag = true; + break; + //User chooses to return to shop + case 4: + shopMenu(equipped_weapons, equipped_armor, equipped_potions, Player); + break; + } + + menuDivider(); + + //Check if user has enough credits + if (Player.getUserCredits() < Purchase.getArmorValue()) + { + cout << "Sorry, it looks like you don't have enough for this." << endl; + menuDivider(); + shopMenu(equipped_weapons, equipped_armor, equipped_potions, Player); + purchase_flag = false; + } + + //Subtract value of weapons from credits + int credits = Player.getUserCredits() - Purchase.getArmorValue(); + + // Check if user has never bought from store before + if (equipped_armor[2].getArmorHealth() == 0 && purchase_flag == true) + { + cout << "Congragulations, " << Player.getUserName() << "! This is your first ever boots purchase with us. Thank you so much for the business." << endl; + equipped_armor[2] = Purchase; + Player.setUserCredits(credits); // Update user creedit amount + Player.setMaxHealth(equipped_armor); // Update user armor rating + Player.setHealthAfterPurchase(Purchase.getArmorHealth()); + tournament_hub_menu(equipped_weapons, equipped_armor, equipped_potions, Player); + } + // If user has made purchase before + else if (equipped_armor[2].getArmorHealth() > 0 && purchase_flag == true) + { + cout << "Would like this purchase to replace your currently equipped boots piece?" << endl; + + storeDivider(); + cout << "Currently Equipped:" << endl; + displayArmorStats(2, equipped_armor); + cout << endl << "Enter 1 to Replace Boots" << endl; + cout << "Enter 2 to Cancel Transaction" << endl; + + cout << "Menu Selection: "; cin >> shopInput; + + while (shopInput != 1 && shopInput != 2) + { + cout << "Please enter a valid input!" << endl << endl; + + cout << endl << "Enter 1 to Replace Helmet" << endl; + cout << "Enter 2 to Cancel Transaction" << endl; + + cout << "Menu Selection: "; cin >> shopInput; + + storeDivider(); + } + + if (shopInput == 1) + { + //Move equipped weapon at input to inventory + equipped_armor[1] = Purchase; + Player.setUserCredits(credits); //Pass Credit amount to player + Player.setMaxHealth(equipped_armor); + Player.setHealthAfterPurchase(Purchase.getArmorHealth()); + tournament_hub_menu(equipped_weapons, equipped_armor, equipped_potions, Player); + } + else + { + shopMenu(equipped_weapons, equipped_armor, equipped_potions, Player); + } + } + } + //User wants to return to Forge Gallery + else if (shopInput == 4 ) + { + shopMenu(equipped_weapons, equipped_armor, equipped_potions, Player); + } + } + // User wants to see potions + else if (shopInput == 3) + { + menuDivider(); + cout << "WELCOME TO THE ALCHEMY LOUNGE" << endl; + menuDivider(); + + cout << "Is there any kind of potion you're looking for in particular?" << endl; + storeDivider(); + cout << "Name: Small Potion" << endl << "Health Restored: 25" << endl << "Cost: $5" << endl << endl << "Press 1 to Purchase" << endl; + storeDivider(); + cout << "Name: Medium Potion" << endl << "Health Restored: 50" << endl << "Cost: $10" << endl << endl << "Press 2 to Purchase" << endl; + storeDivider(); + cout << "Name: Large Potion" << endl << "Health Restored: 75" << endl << "Cost: $15" << endl << endl << "Press 3 to Purchase" << endl; + storeDivider(); + cout << "Name: King's Tonic" << endl << "Health Restored: 100" << endl << "Cost: $20" << endl << endl << "Press 4 to Purchase" << endl; + storeDivider(); + + cout << "Menu Selection: "; cin >> shopInput; + + //Check to make sure user input is valid + while (shopInput < 1 || shopInput > 4) + { + cout << endl << shopInput << " is not a valid option!" << endl; + + menuDivider(); + cout << "Please enter one of the menu options." << endl << endl; + + cout << "Is there any kind of potion you're looking for in particular?" << endl << endl; + storeDivider(); + cout << "Name: Small Potion" << endl << "Health Restored: 25" << endl << "Cost: $5" << endl << endl << "Press 1 to Purchase" << endl; + storeDivider(); + cout << "Name: Medium Potion" << endl << "Health Restored: 50" << endl << "Cost: $10" << endl << endl << "Press 2 to Purchase" << endl; + storeDivider(); + cout << "Name: Large Potion" << endl << "Health Restored: 75" << endl << "Cost: $15" << endl << endl << "Press 3 to Purchase" << endl; + storeDivider(); + cout << "Name: King's Tonic" << endl << "Health Restored: 100" << endl << "Cost: $20" << endl << endl << "Press 4 to Purchase" << endl; + storeDivider(); + + cout << "Menu Selection: "; cin >> shopInput; + } + + menuDivider(); + + Potion Purchase; //Create Object to pass purchase information into + bool purchase_flag = false; //Set a purchase flag to make sure unwanted messages don't display + switch (shopInput) + { + //User picks first option in menu + case 1: + cout << "You selected the small potion" << endl; + Purchase = Potion("Small Potion", 25, 5); + purchase_flag = true; + break; + //User picks second option in menu + case 2: + cout << "You selected the medium potion" << endl; + Purchase = Potion("Medium Potion", 50, 10); + purchase_flag = true; + break; + //User picks third option in menu + case 3: + cout << "You selected the large potion" << endl; + Purchase = Potion("Large Potion", 75, 15); + purchase_flag = true; + break; + case 4: + cout << "You selected the King's Tonic" << endl; + Purchase = Potion("King's Tonic", 100, 20); + purchase_flag = true; + break; + //User chooses to return to shop + case 5: + shopMenu(equipped_weapons, equipped_armor, equipped_potions,Player); + break; + } + + menuDivider(); + + //Check if user has enough credits + if (Player.getUserCredits() < Purchase.getPotionValue()) + { + cout << "Sorry, it looks like you don't have enough for this." << endl; + menuDivider(); + shopMenu(equipped_weapons, equipped_armor, equipped_potions, Player); + purchase_flag = false; + + } + + int credits = Player.getUserCredits() - Purchase.getPotionValue(); //Subtract value of weapons from credits + + //Check if potion array at 0 is filled + if (equipped_potions[0].getPotionAmount() == 0 && purchase_flag == true) + { + equipped_potions[0] = Purchase; + Player.setUserCredits(credits); //Pass Credit amount to player + shopMenu(equipped_weapons, equipped_armor, equipped_potions,Player); + } + + //Check if potion array at 1 is filled + else if (equipped_potions[1].getPotionAmount() == 0 && purchase_flag == true) + { + equipped_potions[1] = Purchase; + Player.setUserCredits(credits); //Pass Credit amount to player + shopMenu(equipped_weapons, equipped_armor, equipped_potions,Player); + } + + //Check if potion array at 2 is filled + else if (equipped_potions[2].getPotionAmount() == 0 && purchase_flag == true) + { + equipped_potions[2] = Purchase; + Player.setUserCredits(credits); //Pass Credit amount to player + shopMenu(equipped_weapons, equipped_armor, equipped_potions,Player); + } + + //Check if potion array at 3 is filled + else if (equipped_potions[3].getPotionAmount() == 0 && purchase_flag == true) + { + equipped_potions[3] = Purchase; + Player.setUserCredits(credits); //Pass Credit amount to player + shopMenu(equipped_weapons, equipped_armor, equipped_potions,Player); + } + + //Check if potion array at 1 is filled + else if (equipped_potions[4].getPotionAmount() == 0 && purchase_flag == true) + { + equipped_potions[4] = Purchase; + Player.setUserCredits(credits); //Pass Credit amount to player + shopMenu(equipped_weapons, equipped_armor, equipped_potions,Player); + } + else + { + cout << "POTIONS ARE FULL" << endl; + menuDivider(); + shopMenu(equipped_weapons, equipped_armor, equipped_potions,Player); + } + } + // User wants to return to menu from shop + else + { + tournament_hub_menu(equipped_weapons, equipped_armor, equipped_potions, Player); + } +} +void shipMenu(Map map, Weapon equipped_weapons[], Armor equipped_armor[], Potion equipped_potions[], User Player) +{ + cout << "Below is the map of the ship follow the icons accordingly to:" << endl << endl; + + cout << "H. Helm of Ship [RETURN TO TOURNAMENT]" << endl; + cout << "B. Bed [Sleeping Fully Restores Health]" << endl << endl; + + cout << "o. Current Position" << endl; + + int menuInput; + bool menuFlag = true; + while (menuFlag == true) + { + menuDivider(); + + displayPlayerStats(Player); + + cout << "Current Map of Ship: " << endl << endl; + map.displayMap(); // starting point + + menuDivider(); + + cout << "What Direction would like to move?" << endl << endl; + + cout << "1. Up" << endl; + cout << "2. Down" << endl; + cout << "3. Right" << endl; + cout << "4. Left" << endl << endl; + + cout << "Menu Selection: "; cin >> menuInput; + + while (menuInput < 1 || menuInput > 4) + { + cout << "Please enter a valid input" << endl << endl; + + cout << "What Direction would like to move?" << endl << endl; + + cout << "1. Up" << endl; + cout << "2. Down" << endl; + cout << "3. Right" << endl; + cout << "4. Left" << endl << endl; + + cout << "Menu Selection: "; cin >> menuInput; + } + + // User chooses to move up + if (menuInput == 1) + { + cout << "Moving User Up One" << endl; + map.move('w'); // go down + } + // User chooses to move down + if (menuInput == 2) + { + cout << "Moving User Down One" << endl; + map.move('s'); // go down + } + // User chooses to move down + if (menuInput == 3) + { + cout << "Moving User Right One" << endl; + map.move('d'); // go down + } + // User chooses to move down + if (menuInput == 4) + { + cout << "Moving User Left One" << endl; + map.move('a'); // go down + } + + int row = map.getPlayerRow(); + int col = map.getPlayerCol(); + + //Check if user is at exit + if (map.isShipExit(row, col) == true) + { + + menuDivider(); + cout << "You Made It To The Ship Helm" << endl; + menuDivider(); + + cout << "Would you like to return to the tournament?" << endl << endl; + + cout << "1. Yes [Return to Tournament]" << endl; + cout << "2. No [Stay in Orbit]" << endl << endl; + + cout << "Menu Selection: "; cin >> menuInput; + + // Check to make sure input is valid + while (menuInput != 1 && menuInput != 2) + { + cout << "Please enter a valid input!" << endl << endl; + + cout << "Would you like to return to the tournament?" << endl << endl; + + cout << "1. Yes [Return to Tournament]" << endl; + cout << "2. No [Stay in Orbit]" << endl << endl; + + cout << "Menu Selection: "; cin >> menuInput; + } + + if (menuInput == 1) + { + tournament_hub_menu(equipped_weapons, equipped_armor, equipped_potions, Player); + menuFlag = false; + } + // User chooses to stay in ship + else + { + shipMenu(map,equipped_weapons, equipped_armor, equipped_potions, Player); + menuFlag = false; + } + } + if (map.isShipBed(row, col) == true) + { + menuDivider(); + cout << "You Made it to Your Bed" << endl; + menuDivider(); + + cout << "Your Health Has Been Fully Rehealed" << endl; + + int max_health = Player.getUserMaxHealth(); + Player.setUserHealthFull(max_health); + } + } +} +// GENERATE OBJECT NAME FUNCTIONS + +/** + * WEAPON GENERATION + */ + +string generate_weapon_name() // Returns a random name from weapons name list +{ + int random = generate_random_number(0, 99); + + ifstream weapons_file("name-generation/text-files/weapon-names.txt"); + + string current_line; // Create a variable to store the value of each line read at a time + getline(weapons_file, current_line); //Store line value to string line + string weapon_names[100]; + + int weapon_name_index = 0; //Variable to store name index + string current_field = ""; //Create variable to save current char to if if doesnt equal the delim + int i = 0; // i = spot in character buffer + while(i < current_line.size()) //Make sure loop is less than line length + { + char current_char = current_line[i]; //Set current_char to character in buffer + if (current_char == '|') //Check if character equals divider + { + weapon_names[weapon_name_index] = current_field; + weapon_name_index++; + current_field = ""; + } + else + { + current_field += current_char; + } + i++; + } + weapons_file.close(); + return weapon_names[random]; +} +int generate_weapon_base_damage(int level) // Return a random value based on level +{ + int random = generate_random_number(3, 10) % 10; + int base_damage = (level * 10) + (random * level); + return base_damage; +} +int generate_weapon_max_damage(int base_damage) // Return a random value based on base damage +{ + int random = generate_random_number(3, 10) % 10; + int max_damage = base_damage + random; + return max_damage; +} +int generate_weapon_cost(int base_damage, int max_damage) // Return a weapon cost based on damage +{ + int weapon_cost = ((base_damage + max_damage) / 2) * 10; + return weapon_cost; +} + +/** + * ARMOR GENERATION + */ + +// HELMET GENERATION +string generate_helmet_name() // Returns a random name from weapons name list +{ + int random = generate_random_number(0, 99); + + ifstream helmet_file("name-generation/text-files/helmet-names.txt"); + + string current_line; // Create a variable to store the value of each line read at a time + getline(helmet_file, current_line); //Store line value to string line + string helmet_names[100]; + + int helmet_name_index = 0; //Variable to store name index + string current_field = ""; //Create variable to save current char to if if doesnt equal the delim + int i = 0; // i = spot in character buffer + while(i < current_line.size()) //Make sure loop is less than line length + { + char current_char = current_line[i]; //Set current_char to character in buffer + if (current_char == '|') //Check if character equals divider + { + helmet_names[helmet_name_index] = current_field; + helmet_name_index++; + current_field = ""; + } + else + { + current_field += current_char; + } + i++; + } + helmet_file.close(); + return helmet_names[random]; +} +int generate_helmet_health(int level) // Return a random value based on level +{ + int random = generate_random_number(3, 10) % 10; + int health = (level * 13) + (random * level); + return health; +} +int generate_helmet_cost(int health) // Return a weapon cost based on damage +{ + int helmet_cost = ((health * 1.5) / 2) * 10; + return helmet_cost; +} + +// CHEST PIECE GENERATION +string generate_chest_name() // Returns a random name from weapons name list +{ + int random = generate_random_number(0, 99); + + ifstream chest_file("name-generation/text-file/chest-names.txt"); + + string current_line; // Create a variable to store the value of each line read at a time + getline(chest_file, current_line); //Store line value to string line + string chest_names[100]; + + int chest_name_index = 0; //Variable to store name index + string current_field = ""; //Create variable to save current char to if if doesnt equal the delim + int i = 0; // i = spot in character buffer + while(i < current_line.size()) //Make sure loop is less than line length + { + char current_char = current_line[i]; //Set current_char to character in buffer + if (current_char == '|') //Check if character equals divider + { + chest_names[chest_name_index] = current_field; + chest_name_index++; + current_field = ""; + } + else + { + current_field += current_char; + } + i++; + } + chest_file.close(); + return chest_names[random]; +} +int generate_chest_health(int level) // Return a random value based on level +{ + int random = generate_random_number(3, 10) % 10; + int health = (level * 25) + (random * level); + return health; +} +int generate_chest_cost(int health) // Return a weapon cost based on damage +{ + int chest_cost = ((health * 1.5) / 2) * 10; + return chest_cost; +} + +// BOOTS GENERATION +string generate_boots_name() // Returns a random name from weapons name list +{ + int random = generate_random_number(0, 99); + + ifstream boots_file("Name_Generation/Boots_Names.txt"); + + string current_line; // Create a variable to store the value of each line read at a time + getline(boots_file, current_line); //Store line value to string line + string boots_names[100]; + + int boots_name_index = 0; //Variable to store name index + string current_field = ""; //Create variable to save current char to if if doesnt equal the delim + int i = 0; // i = spot in character buffer + while(i < current_line.size()) //Make sure loop is less than line length + { + char current_char = current_line[i]; //Set current_char to character in buffer + if (current_char == '|') //Check if character equals divider + { + boots_names[boots_name_index] = current_field; + boots_name_index++; + current_field = ""; + } + else + { + current_field += current_char; + } + i++; + } + boots_file.close(); + return boots_names[random]; +} +int generate_boots_health(int level) // Return a random value based on level +{ + int random = generate_random_number(3, 10) % 10; + int health = (level * 10) + (random * level); + return health; +} +int generate_boots_cost(int health) // Return a weapon cost based on damage +{ + int boots_cost = ((health * 1.5) / 2) * 10; + return boots_cost; +} + +/** + * Opponent Generation + */ + +string generate_opponent_name() //Returns a random name from the opponent name list +{ + int random = generate_random_number(0, 95); + + ifstream opponent_file("Name_Generation/Opponent_Name.txt"); + + string current_line; // Create a variable to store the value of each line read at a time + getline(opponent_file, current_line); //Store line value to string line + string opponent_names[100]; + + int opponent_name_index = 0; //Variable to store name index + string current_field = ""; //Create variable to save current char to if if doesnt equal the delim + int i = 0; // i = spot in character buffer + while(i < current_line.size()) //Make sure loop is less than line length + { + char current_char = current_line[i]; //Set current_char to character in buffer + if (current_char == '|') //Check if character equals divider + { + opponent_names[opponent_name_index] = current_field; + opponent_name_index++; + current_field = ""; + } + else + { + current_field += current_char; + } + i++; + } + opponent_file.close(); + return opponent_names[random]; +} +string generate_opponent_backstory() // Returns a random backstory from the opponent backstory list +{ + int random = generate_random_number(0, 99); + + ifstream opponent_file("Name_Generation/Opponent_Backstory.txt"); + + string current_line; // Create a variable to store the value of each line read at a time + string opponent_names[100]; + int opponent_name_index = 0; //Variable to store name index + + while (getline(opponent_file, current_line)) + { + string current_field = ""; //Create variable to save current char to if if doesn't equal the delimiter + int i = 0; // i = spot in character buffer + + while(i < current_line.size()) + { + char current_char = current_line[i]; //Set current_char to character in buffer + + if (current_char == '|') + { + opponent_names[opponent_name_index] = current_field; + opponent_name_index++; + current_field = ""; + } + else + { + current_field += current_char; + } + i++; + } + } + opponent_file.close(); + return opponent_names[random]; +} +string generate_opponent_attack_name() // Returns a random attack type from the atatck list +{ + int random = generate_random_number(0, 99); + + ifstream opponent_file("Name_Generation/Opponent_Attacks.txt"); + + string current_line; // Create a variable to store the value of each line read at a time + string opponent_attacks[100]; + int opponent_attacks_index = 0; //Variable to store name index + + while (getline(opponent_file, current_line)) + { + string current_field = ""; //Create variable to save current char to if if doesn't equal the delimiter + int i = 0; // i = spot in character buffer + + while(i < current_line.size()) + { + char current_char = current_line[i]; //Set current_char to character in buffer + + if (current_char == '|') + { + opponent_attacks[opponent_attacks_index] = current_field; + opponent_attacks_index++; + current_field = ""; + } + else + { + current_field += current_char; + } + i++; + } + } + opponent_file.close(); + return opponent_attacks[random]; +} +int generate_opponent_level(int level) // Returns a random value to be opponent level will be within 2 of user +{ + int random = generate_random_number(-2, 2); + int opponent_level = level + random; + + // Make sure opponent level is never less than 1 + if (opponent_level < 1) + { + opponent_level = 1; + } + + return opponent_level; +} + +// DISPLAY STATS +void displayPlayerStats(User Player) // Function to display current stats +{ + cout << "Current Level: " << Player.getUserLevel() << " | Current XP: " << Player.getUserXP() << "/" << Player.getUserXPNeeded() << " | Current Cash: $" << Player.getUserCredits() << endl; + cout << "Current Health: " << Player.getUserHealth() << "/" << Player.getUserMaxHealth() << endl << endl; +} +void displayWeaponStats(int input, Weapon equipped_weapons[]) //Function to display all armor stats +{ + cout << "Name: " << equipped_weapons[input].getWeaponName() << endl; + cout << "Base Damage: " << equipped_weapons[input].getWeaponBaseDamage() << endl; + cout << "Max Damage: " << equipped_weapons[input].getWeaponMaxDamage() << endl; + cout << "Hits Remaining: " << equipped_weapons[input].getWeaponHitsRemaining() << endl; + cout << "Upgrades Remaining: " << equipped_weapons[input].getWeaponUpgradesRemaining() << endl; +} +void displayArmorStats(int input, Armor equipped_armor[]) //Function to display all armor stats +{ + cout << "Name: " << equipped_armor[input].getArmorName() << endl; + cout << "Health: " << equipped_armor[input].getArmorHealth() << endl; + cout << "Hits Remaining: " << equipped_armor[input].getArmorHitsRemaining() << endl; + cout << "Upgrades Remaining: " << equipped_armor[input].getArmorUpgradesRemaining() << endl; +} +void displayPotions(int input, Potion equipped_potions[]) //Function to display all armor stats +{ + cout << "Name: " << equipped_potions[input].getPotionName() << endl; + cout << "Health: " << equipped_potions[input].getPotionAmount() << endl; +} +void showAllGear(Weapon equipped_weapons[], Armor equipped_armor[], Potion equipped_potions[]) // Call to display all gear +{ + // Show User Weapons + menuDivider(); + cout << "YOU ARE VIEWING YOUR GEAR" << endl; + menuDivider(); + cout << "WEAPONS" << endl; + menuDivider(); + + cout << "Primary Weapon:" << endl; + displayWeaponStats(0, equipped_weapons); + cout << endl; + + cout << "Secondary Weapon:" << endl; + displayWeaponStats(1, equipped_weapons); + cout << endl; + + //Show User Gear + menuDivider(); + cout << "Armor" << endl; + menuDivider(); + + cout << "Head Piece: " << endl; + displayArmorStats(0, equipped_armor); + cout << endl; + + cout << "Chest Piece" << endl; + displayArmorStats(1, equipped_armor); + cout << endl; + + cout << "Boots" << endl; + displayArmorStats(2, equipped_armor); + cout << endl; + + //Show User Potions + menuDivider(); + cout << "Potions" << endl; + menuDivider(); + + cout << "Potion 1: " << endl; + displayPotions(0, equipped_potions); + cout << endl; + + cout << "Potion 2: " << endl; + displayPotions(1, equipped_potions); + cout << endl; + + cout << "Potion 3: " << endl; + displayPotions(2, equipped_potions); + cout << endl; + + cout << "Potion 4: " << endl; + displayPotions(3, equipped_potions); + cout << endl; + + cout << "Potion 5: " << endl; + displayPotions(4, equipped_potions); + cout << endl; +} + +// EXIT GAME +int exit() // When called this function ends the program +{ + return -1; +} \ No newline at end of file