Skip to content
Permalink
12d06b305d
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
187 lines (183 sloc) 9.73 KB
#include "../include/MainMenu.hpp"
#include "../include/Game.hpp"
#include <ncurses.h>
#include <locale.h>
#include <iostream>
#include <string>
#include "../include/GameWindow.hpp"
using namespace std;
void MainMenu()
{
setlocale(LC_ALL, "");
initscr();
cbreak();
noecho();
curs_set(0);
vector<string> choices ={"Start Battle","Help","Exit"};
bool gameOver=false;
while(gameOver!=true)
{
GameWindow titleWin(9, 52, 0, COLS/2 - 26);
GameWindow menuWin(5,52,10,COLS/2 - 26);
const char *c="______ _ _ ___ \n | ___ (_) | | / _ \\ \n | |_/ /___ _____| | / /_\\ \\_ __ ___ _ __ __ _ \n | __/| \\ \\/ / _ \\ | | _ | '__/ _ \\ '_ \\ / _` | \n | | | |> < __/ | | | | | | | __/ | | | (_| | \n \\_| |_/_/\\_\\___|_| \\_| |_/_| \\___|_| |_|\\__,_|";
titleWin.Print(c);
/*vector<string> help={"How to play","Heroes description","Lore","Exit help"};
*/vector<vector<string>> help =
{
{"How to play","This will show you the rules of the game"},
{"Heroes description","This will show you all of the heroes,their stats and special abilities"},
{"Damage types","There is more than on type of damage, select this if you want to learn more about this"},
{"Status effects","There are several types, select this for more info"},
{"transformations","I don't know how this will actually work but hey we have them and they're gonna be explained here later"},
{"Lore","This will tell you the story of all the various heroes that fight in the arena"},
{"Exit help","Return to the starting menu"}
};
int choice;
choice=menuWin.Menu(choices);
if(choice==2) {titleWin.Clear(false);menuWin.Clear(false);gameOver=true;}
else if(choice==1)
{
titleWin.Clear(false);
menuWin.Clear(false);
bool helpOver=false;
while(helpOver!=true)
{
GameWindow helpWin(9,120,0,COLS/2-60);
GameWindow helpDescr(5,120,9,COLS/2-60);
int helpChoice;
helpChoice=helpWin.Menu(help,helpDescr);
if (helpChoice==6) {helpWin.Clear(false);helpDescr.Clear(false);helpOver=true;}
else if (helpChoice==1)
{
helpWin.Clear(false);
helpDescr.Clear(false);
GameWindow heroMenu(4,126,0,COLS/2-63);
GameWindow heroDescr(10,126,4,COLS/2-63);
bool help2=false;
while(help2!=true)
{
int selectDescription;
vector <vector<string>> heroes=
{
{"exit","select this when you want to go back to the help menu"},
{"warrior","Fearless warrior and weapon expert. A good choice for players who like a good combination of damage and speed.\n Abilities :\n 1)shield bash(attacks the enemy hero with a shield and has a chance to stun the other hero for 1 turn )\n 2)spear charge(sprints towards the enemy to stab him with the spear,ignores armor and has slight chance to cause bleed for 3 turns"},
{"mage","Mage of the famous dragon academy of sorcery. This mage is able to attack from a distance with devastating spells.\n Abilities :\n 1)Magic Arrow(shoots an arrow made up of magic)\n 2)Curse(decreases the damage,defense and speed of a chosen enemy hero for 2 turns) "},
{"thief","Thief : A lowly man that was forced to resort thievery in order to make it through the day. This thief relies on high damage and poison in order to kill his enemies.\n Abilities :\n 1)Poison dagger(does not deal a lot of damage however it has a big chance to poison the enemy and deal damage for 3 turns) \n 2)Parry(if the thief is attacked by an enemy hero immediatly after using this ability there is a 50% chance that the nemy hero will miss and get stunned for 2 turns) "}
};
selectDescription=heroMenu.Menu(heroes,heroDescr);
if(selectDescription==0) {
heroDescr.Clear(false);
heroMenu.Clear(false);
help2=true;
}
}
}
else if(helpChoice==0)
{
helpWin.Clear(false);
helpDescr.Clear(false);
GameWindow rulesWin(3,120,0,COLS/2-60);
GameWindow rulesDescr(8,170,3,COLS/2-85);
bool rules=false;
while(rules!=true)
{
int selectOption;
vector<vector<string>> rulesVector{
{"rules","Each player has to select 5 heroes, 3 of them will be on the battlefield while the remaining 2 are backup. \n The player with the fastest hero starts.\n After this the next player's turn comes and so on. \n The players are not allowed to select the hero with witch they attack.\n Instead the selected hero is decided by the speed stat and the fastest hero will go first followed by the second fastest and so on.\n The fight ends when all the heroes on one team are dead and the player that still has someone in his team alive is declared the winner.\n "},
{"exit","Go back to the previous menu"}
};
selectOption=rulesWin.Menu(rulesVector,rulesDescr);
if(selectOption==1){
rulesWin.Clear(false);
rulesDescr.Clear(false);
rules=true;
}
}
}
else if(helpChoice==2){
helpWin.Clear(false);
helpDescr.Clear(false);
GameWindow dmgType(3,120,0,COLS/2-60);
GameWindow dmgDescr(5,120,3,COLS/2-60);
bool damageOver=false;
while(damageOver!=true)
{
int dmgOption;
vector<vector<string>> dmg=
{
{"Exit","Go back to previous menu"},
{"Physical","This type of damage is the most common and has no effects"},
{"Fire","This type of damage can burn the target for up to 3 turns, the damage done each turn can vary"},
{"Bleed","This type of damage will make the enemy hero bleed for up to 3 turns, damage can vary from turn to turn "},
{"Poison","This type of damage will poison the enemy hero for up to 5 turns, damage is constant each turn"}
};
dmgOption=dmgType.Menu(dmg,dmgDescr);
if(dmgOption==0){
dmgType.Clear(false);
dmgDescr.Clear(false);
damageOver=true;
}
}
}
else if(helpChoice==3)
{
helpWin.Clear(false);
helpDescr.Clear(false);
GameWindow statusWin(3,120,0,COLS/2-60);
GameWindow statusDescr(3,120,3,COLS/2-60);
bool statusOver=false;
while(statusOver!=true)
{
int statusSelect;
vector<vector<string>> statusList
{
{"Exit","Return to previous menu"},
{"Burning","Does fire damage to the hero affected by it"},
{"Bleeding","The aflicted hero is slowly losing blood"},
{"Poisoned","The hero has been poisoned and is slowly dying"},
{"Stuned","The stunned hero won't be able to move for a few turns"},
{"Cursed","The aflicted hero is debuffed(Attack,speed and defence are lowered)"}
};
statusSelect=statusWin.Menu(statusList,statusDescr);
if(statusSelect==0)
{
statusDescr.Clear(false);
statusWin.Clear(false);
statusOver=true;
}
}
}
else if(helpChoice==5)
{
helpWin.Clear(false);
helpDescr.Clear(false);
GameWindow loreHero(3,120,0,COLS/2-60);
GameWindow loreDescr(5,120,3,COLS/2-60);
bool loreOver=false;
while(loreOver!=true)
{
int loreSelect;
vector<vector<string>> loreList=
{
{"Exit","Go back to the previous menu"},
{"Warrior"," "},
{"Mage"," "},
{"Thief"," "}
};
loreSelect=loreHero.Menu(loreList,loreDescr);
if(loreSelect==0){
loreHero.Clear(false);
loreDescr.Clear(false);
loreOver=true;
}
}
}
}
}
else if (choice==0)
{
mainGame();
}
}
endwin();
}