Skip to content
Permalink
Browse files
Merge branch 'master' of github.coventry.ac.uk:wlodarsb/Text-Based-Game
  • Loading branch information
wlodarsb committed Mar 26, 2019
2 parents 4b51fb3 + 5800df9 commit 73f844c7a6eb5e63504b2bed3a217e8c88799f5b
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 33 deletions.
@@ -6,7 +6,7 @@
#include <cstdlib>
#include <ctime>
#include <tuple>
#include "libsqlite.hpp"
#include "libsqlite.hpp" // provided by Hintea, D. in 4005 CEM https://cumoodle.coventry.ac.uk/pluginfile.php/2606853/mod_resource/content/0/libsqlite.hpp
#include "Effect.hpp"
#include <cstdlib>

@@ -6,8 +6,9 @@
#include <cstdlib>
#include <ctime>
#include <tuple>
#include "libsqlite.hpp"
#include "libsqlite.hpp" // provided by Hintea, D. in 4005 CEM https://cumoodle.coventry.ac.uk/pluginfile.php/2606853/mod_resource/content/0/libsqlite.hpp
#include "Ability.hpp"
#include "Effect.hpp"
#include <map>
#include <vector>
#include <cmath>
@@ -25,7 +25,7 @@ void MainMenu()
cur_abilities->set_sql("SELECT * FROM Abilities;");
cur_abilities->prepare();
cur_abilities->step();
vector<string> choices ={"Start Battle","Help","Exit","Character selection"};
vector<string> choices ={"Start Battle","Help","Exit"/*,"Character selection"*/};
bool game_over=false;
while(game_over!=true)
{
@@ -38,9 +38,7 @@ void MainMenu()
{
{"How to play","This will show you the rules of the game"},
{"Heroes description","This will show you a quick description of all the heroes and their stats"},
//{"Abilities","Each of the heroes have 2 unique abilities, this will show you a description of all the abilities"},
{"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"}
};
@@ -61,7 +59,7 @@ void MainMenu()
int help_choice;
help_choice=help_win.Menu(help,help_descr);
// help_choice==5 means we return to the previous menu
if (help_choice==5) {help_win.Clear(false);help_descr.Clear(false);help_over=true;}
if (help_choice==4) {help_win.Clear(false);help_descr.Clear(false);help_over=true;}
else if (help_choice==1)
{
//1 means we go for the hero descriptions. Lines 65 to 98 are there so that we can retrieve info from the database like the descriptions and stats
@@ -77,16 +75,27 @@ void MainMenu()
while(cur_heroes->step())
{
string c;
c+=cur_heroes->get_text(2);

c+="\n Stats: \n Hp=";
c+=to_string(cur_heroes->get_int(3));
c+="\n Mp=";
c+=to_string(cur_heroes->get_int(4));
c+="\n Stamina=";
c+=to_string(cur_heroes->get_int(5));
c+="\n Defence=";
c+=to_string(cur_heroes->get_int(6));
c+=cur_heroes->get_text(2);//Description of hero
c+=" Stats: \n Health points=";
c+=to_string(cur_heroes->get_int(3));//HP
c+=", Mana points=";
c+=to_string(cur_heroes->get_int(4));//MP
c+=", Stamina points=";
c+=to_string(cur_heroes->get_int(5));//SP
c+=", Speed=";
c+=to_string(cur_heroes->get_int(6));//SPD
c+=", Defence=";
c+=to_string(cur_heroes->get_int(7));//DEF
c+=". Abilities: 1)";
cur_abilities->step();
c+=cur_abilities->get_text(1);//Ability name
c+=" - ";
c+=cur_abilities->get_text(2);//Ability description
cur_abilities->step();
c+=" 2)";
c+=cur_abilities->get_text(1);
c+=" - ";
c+=cur_abilities->get_text(2);
heroes.push_back({cur_heroes->get_text(1),c});
}

@@ -96,6 +105,7 @@ void MainMenu()
hero_menu.Clear(false);
help2=true;
}

}
}
else if(help_choice==0)
@@ -152,13 +162,13 @@ void MainMenu()
}
}
}
else if(help_choice==4)
else if(help_choice==3)
{
// we have decide that instead of having a story we will go the dark souls route and add lore for all of the 9 heroes
help_win.Clear(false);
help_descr.Clear(false);
GameWindow lore_hero(3,120,0,COLS/2-60);
GameWindow lore_descr(5,120,3,COLS/2-60);
GameWindow lore_descr(11,120,3,COLS/2-60);
bool lore_over=false;
while(lore_over!=true)
{
@@ -167,15 +177,15 @@ void MainMenu()
{
// Adding all of the lore won't give me any more marks so I have taken it out of the submited code
{"Exit","Go back to the previous menu"},
{"Warrior"," "},
{"Mage"," "},
{"Thief"," "},
{"Knight"," "},
{"Cleric"," "},
{"Hunter"," "},
{"Paladin"," "},
{"Alchemist"," "},
{"Beastman"," "}
{"Warrior","This man was once part of a covenant made with a god of war that would allow his followers to hurl lightning spears at their foes. Sadly the warriors of sunlight were disbanded and they lost they're powers for the god of war had committed a great crime. As punishment the god of war was banished and stripped of his deific status and his name stricken the annals of history. Nowadays his followers roam the land as mercenaries. This one has chosen to fight on as a gladiator in this very arena and has achieved the status of champion among 8 others. "},
{"Mage","This ancient one was once part of the Dragon academy of magic arts where he was once a student and then a teacher. As he grew older his lust for more knowledge grew as well, it is because of this reason that he left the legendary academy to search for even more powerful sorceries. Sadly he was never able to discover any new spells as he was captured and enslaved not long after he left the academy. Now he fights in the arena hoping to earn back his freedom however in his years of fighting the arena he has become one of it's nine champions and now has no chance of escape. The leader of the arena would never lose such a priceless slave. "},
{"Thief","Once a citizen of the great city, now just another slave forced to fight in it's arena. This man was once part of the famous thieves guild however he bit more than he could chew when he tried to steal from a noble. Just when he was about to get away with his prize he had been seen and caught by a guard that was not at his post. This was the end of his career as a thief and the beginning of his reign in the arena as one of the 9 champions."},
{"Knight","Once this man was part of a glorious order of knights serving under a deity simply known as the Darksun. Their role was to hunt down and punish the wicked however one of this so called sinners managed to infiltrate the order and kill their god. Now without a master and cause this knight offers himself to the arena not caring whether he survives the next fight or meets his end. After many years in the arena he too has achieved the rank of champion. "},
{"Cleric","Once a high ranking member of the church now just a gladiator. This man relies on the miracles he can perform in order to win his fights. After reaching the rank of bishop within his faith he was framed and accused for the murder of a minor church official which with he had many fights. Despite his fate the man didnt give up on his god and now he has achieved the rank of champion. He has also become the doctor of the arena. "},
{"Hunter","This hunter of beasts has now become a hunter of man. After being given the contract of killing a great beast and succeeding in his task he was imprisoned by the greedy landlord who would not pay the reward. The hunter fought back and even managed to kill the lord during his arrest however this only sealed his fate. Now after years of killing in the arena he has been named as one of the 9 champions. "},
{"Paladin","He was born in the slums and raised by the church as an enforcer . This man has become a fanatic over the years in service to the gods and he does not care for the standing of his victims whether they are noble or poor, man of woman, adult or child. Because of his devotion he was made a paladin however after 3 decades of service under them even the church could not back up this fanatic tendencies and instead have enslaved him and sent him to the arena. The man still as devout as ever now sees his imprisonment within the arena as a sign that he is supposed to show to everyone the power of god through the people he kills."},
{"Alchemist","As a child the alchemist would always spend her time learning more about different plants, anatomy and the occult. When she was old enough she began travelling the world and soon enough found what she was looking for, someone to take her as an apprentice. After years of being taught more and more about the healing arts the alchemist was finally ready for her final challenge. Become a doctor in the capital and find an apprentice of her own. Unfortunately fate was not kind to her. On the way to the capital she was enslaved and made to fight in the arena. Her whole world has been knocked upside down, instead of healing she would be the cause others die and yet when the masters of the arena saw her talent they decided that as long as she would heal all of the injured gladiators she would not be forced to fight, would be given all the resources she needs to do her work. She hastily accepted and was given an honorary title: the ninth champion of the arena. "},
{"Beastman","After committing a great crime this man was exiled in to the wilderness. Although he had not tools or weapons by his side he managed to adapt to the situation by forsaking his humanity and letting the beast inside take over. After 3 decades of living as a wild animal he was found by some slavers and sold of as an exotic animal to the arena. Because of his time during the forest people actually believed that he was a mix between human and beast, he wore stag antlers on his head, different animal pelts and had many scars all over his body. After he become a slave in service to the arena he become a champion to his great savagery when fighting and become one of the nine champions"}
};
lore_select=lore_hero.Menu(lore_list,lore_descr);
if(lore_select==0){
@@ -194,21 +204,24 @@ void MainMenu()
}
/*This option is not gonna be in the final version of the game
I decided to make an extra option to try and make a character selection menu however it is not yet done*/
else if (choice==3)
/*else if (choice==3)
{
title_win.Clear(false);
menu_win.Clear(false);
GameWindow hero_win(5,130,0,COLS/2-65);
GameWindow selected_descrption(10,130,5,COLS/2-65);
GameWindow player1_choose(5,0,0,0);
player1_choose.Print("Player 1 choose will chose 5 heroes");
GameWindow hero_win(5,130,5,COLS/2-65);
GameWindow selected_descrption(10,130,10,COLS/2-65);
//GameWindow hero_stats(0,0,10,0);
bool char_selection_over=false;
while(char_selection_over!=true)
{
string c;
int char_select=0,i=0;
vector<vector<string>> characters;
while(cur_heroes->step())
{
string c;
c+=cur_heroes->get_text(2);//Description of hero
c+=" Stats: Health points=";
c+=to_string(cur_heroes->get_int(3));//Hp
@@ -232,11 +245,19 @@ void MainMenu()
c+=cur_abilities->get_text(2);
characters.push_back({cur_heroes->get_text(1),c});
}
vector<int> player1;
vector<int> player2;
while(player1.size()!=5 && player2.size()!=5)
{
char_select=hero_win.Menu(characters,selected_descrption);
if(char_select>=0 && char_select<=8)
if(player1.size()!=5) {player1.push_back(cur_heroes->get_int(0)); cur_heroes->step();}
else{player2.push_back(cur_heroes->get_int(0)); cur_heroes->step();}
}
}
}
}*/
}
endwin();
}
@@ -1,5 +1,5 @@
#include <iostream>
#include "../include/libsqlite.hpp"
#include "../include/libsqlite.hpp" // provided by Hintea, D. in 4005 CEM https://cumoodle.coventry.ac.uk/pluginfile.php/2606853/mod_resource/content/0/libsqlite.hpp
#include <tuple>
using namespace std;

0 comments on commit 73f844c

Please sign in to comment.