Skip to content
Permalink
master
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
#include <iostream>
#include <string>
#include "combat.cpp"
#include "scenarios.h"
//Code of the main scenarios in the game
using namespace std;
void golemRoom() //Code for the Golem encouter scenario
{
string player_input;
int golem_health = 20;
int damage_done;
int character_health = 20;
int character_defence = 0;
cout<<"\n";
cout<<"You enter a room and you immediately smell rust."<<"\n"<<"Then you notice a rust golem!"<<"\n";
cout<<"You can see that this being is very old and maybe even as old as the whole dungeon!"<<"\n";
cout<<"\n";
cout<<"The battle begins!"<<endl;
while (golem_health > 0)
{
cout<<"To attack press 1"<<"\n";
cout<<"To defend press 2"<<"\n";
cout<<"\n";
cin>>player_input;
if (character_health <= 0)
{
cout<<"You died and lost the game."<<"\n";
exit(0);
}
if(character_health <= 0 && golem_health <= 0)
{
cout<<"You defeated the enemy but you succumbed to your wounds"<<"\n";
exit(0);
}
if (character_health > 0)
{
if(player_input == "1")
{
cout<<"\n";
combat(golem_health, 5, 0, 1 );
cout<<"\n";
combat2(character_health, 0, 0, character_defence);
cout<<"\n";
cout<<"Your hp is "<<character_health;
cout<<"\n";
cout<<"Enemies hp is "<<golem_health;
cout<<"\n";
}
else if(player_input == "2")
{
cout<<"\n";
//cout<<"Your defence was increased by 1 point"<<"\n";
//character_defence = character_defence + 1;
combat2(character_health, 0, 0, character_defence);
cout<<"\n";
cout<<"Your hp is "<<character_health;
cout<<"\n";
cout<<"Enemies hp is "<<golem_health;
cout<<"\n";
}
else
{
cout<<"You have only two options: number 1 and number 2"<<"\n";
}
}
}
if(character_health <= 0)
{
cout<<"You died and lost the game."<<"\n";
exit(0);
}
cout<<"\n";
cout<<"You defeated the monstrocity, good job!"<<"\n";
cout<<"After such a fierce battle you decide to rest a bit."<<"\n";
cout<<"Your health is full now!"<<"\n";
cout<<"\n";
}
void fallenKnightRoom() //Code for the Knight encouter scenario
{
string player_input;
int fallen_knight_health = 25;
int damage_done;
int character_health = 20;
int character_defence = 1;
cout<<"You continue your journey through the dungeon"<<"\n";
cout<<"You can hear a weird sobbing sound in the corner of the dark room you just entered"<<"\n";
cout<<"You can see a man wearing an old, rusty set of knight armor"<<"\n";
cout<<"He notices you and starts screaming at the top of his lungs and attacks you!"<<"\n";
cout<<"\n";
cout<<"The battle begins!"<<endl;
while (fallen_knight_health > 0)
{
cout<<"To attack press 1"<<"\n";
cout<<"To defend press 2"<<"\n";
cout<<"\n";
cin>>player_input;
if(character_health <= 0)
{
cout<<"You died and lost the game."<<"\n";
exit(0);
}
if(character_health <= 0 && fallen_knight_health <= 0)
{
cout<<"You defeated the enemy but you succumbed to your wounds"<<"\n";
exit(0);
}
if(player_input == "1")
{
cout<<"\n";
combat( fallen_knight_health, 4, 0, 1 );
cout<<"\n";
combat2(character_health, 0, 0, character_defence);
cout<<"\n";
cout<<"Your hp is "<<character_health;
cout<<"\n";
cout<<"Enemies hp is "<<fallen_knight_health<<"\n";
cout<<"\n";
}
else if(player_input == "2")
{
cout<<"\n";
//cout<<"Your defence was increased by 1 point"<<"\n";
//character_defence = character_defence + 1;
combat2(character_health, 0, 0, character_defence);
cout<<"\n";
cout<<"Your hp is "<<character_health;
cout<<"\n";
cout<<"Enemies hp is "<<fallen_knight_health;
cout<<"\n";
}
else
{
cout<<"You have only two options: number 1 and number 2"<<"\n";
}
}
if(character_health <= 0)
{
cout<<"You died and lost the game."<<"\n";
exit(0);
}
cout<<"\n";
cout<<"His last words were, thank you traveler..."<<"\n";
cout<<"You defeated the monstrocity, good job!"<<"\n";
cout<<"You decided to take his weapon to honor the dead warrior."<<"\n";
cout<<"\n";
cout<<"Your strength increased by 5!"<<"\n";
cout<<"\n";
cout<<"After resting for a while your hp is restored"<<"\n";
cout<<"\n";
}
void TreasureRoom() //Code for the Treasure Chest encouter scenario
{
string player_input;
int chest_health = 1;
cout<<"You continue your journey through the dungeon"<<"\n";
cout<<"You enter a small, dimly lit room"<<"\n";
cout<<"You see a gold plated chest in the middle of the room, it really looks out of place"<<"\n";
while (chest_health > 0)
{
cout<<"\n";
cout<<"To open the chest press 1"<<"\n";
cout<<"To ignore the chest and move forward press 2"<<"\n";
cout<<"\n";
cin>>player_input;
if(player_input == "1")
{
cout<<"You open the chest and see a small shining orb shaped item"<<"\n";
cout<<"The second you touch the orb you feel as if you were born anew"<<"\n";
cout<<"Your max health was increased by 10 points!"<<"\n";
cout<<"Your hp is: 30"<<"\n";
cout<<"\n";
chest_health = chest_health - 1;
}
else if(player_input == "2")
{
cout<<"You ignore the chest and move on"<<"\n";
cout<<"Suddenly a huge dark spirit emerges from the chest and instantly you cann feel losing your concience"<<"\n";
cout<<"You died and lost the game"<<"\n";
exit(0);
}
else
{
cout<<"You have only two options: number 1 and number 2"<<"\n";
}
}
}
void DemonTreasureRoom() //Code for the Demon encouter scenario
{
int room_health = 1;
int demon_health = 25;
int character_health = 30;
int character_defence = 1;
string player_input;
cout<<"You continue your journey through the dungeon"<<"\n";
cout<<"You enter a large room"<<"\n";
cout<<"You spot a dangerous looking demon holding a heart in his hand but he seems to ignore you"<<"\n";
while (room_health > 0)
{
cout<<"To attack him press 1"<<"\n";
cout<<"To ignore him press 2"<<"\n";
cin>>player_input;
if(player_input == "1")
{
cout<<"You ready your weapon and you attack the demon"<<"\n";
while (demon_health > 0)
{
cout<<"To attack press 1"<<"\n";
cout<<"To defend press 2"<<"\n";
cout<<"\n";
cin>>player_input;
if (character_health <= 0)
{
cout<<"You died and lost the game."<<"\n";
exit(0);
}
if(character_health <= 0 && demon_health <= 0)
{
cout<<"You defeated the enemy but you succumbed to your wounds"<<"\n";
exit(0);
}
if (character_health > 0)
{
if(player_input == "1")
{
cout<<"\n";
combat(demon_health, 7, 0, 0 );
cout<<"\n";
combat2(character_health, 0, 0, character_defence);
cout<<"\n";
cout<<"Your hp is "<<character_health;
cout<<"\n";
cout<<"Enemies hp is "<<demon_health;
cout<<"\n";
}
else if(player_input == "2")
{
cout<<"\n";
cout<<"Your defence was increased by 1 point"<<"\n";
character_defence = character_defence + 1;
combat2(character_health, 0, 0, character_defence);
cout<<"\n";
cout<<"Your hp is "<<character_health;
cout<<"\n";
cout<<"Enemies hp is "<<demon_health;
cout<<"\n";
}
else
{
cout<<"You have only two options: number 1 and number 2"<<"\n";
}
}
}
cout<<"You killed the demon and took the beating heart out of his claws"<<"\n";
cout<<"Suddenly you feel a huge feeling of guilt! "<<"\n";
cout<<"You feel like it was your first time killing a creature that didn't want to fight back"<<"\n";
cout<<"The heart in your hands becomes black and fades away"<<"\n";
cout<<"Confused and sad you continue your journey"<<"\n";
room_health = room_health - 1;
}
else if(player_input == "2")
{
cout<<"You continue your journey through the dungeon"<<"\n";
cout<<"Nothing happens"<<"\n";
room_health = room_health - 1;
}
else
{
cout<<"You have only two options: number 1 and number 2"<<"\n";
}
}
}
void BlackDragonBossRoom() //Code for the Boss Dragon encouter scenario
{
string player_input;
int black_dragon_health = 60;
int damage_done;
int character_health = 30;
int character_defence = 1;
cout<<"You enter a huge cavern"<<"\n";
cout<<"Instantly you can feel immense pressure from above"<<"\n";
cout<<"The first thing that comes to your mind is run away but the door closes behind you"<<"\n";
cout<<"A huge dragon lands before you!"<<"\n";
cout<<"His skin is darker then the night and his teeth are larger then your hands"<<"\n";
cout<<"He grinds his teeth and attacks you!"<<"\n";
cout<<"\n";
cout<<"The boss encounter begins!"<<endl;
while (black_dragon_health > 0)
{
cout<<"To attack press 1"<<"\n";
cout<<"To defend press 2"<<"\n";
cout<<"\n";
cin>>player_input;
if(character_health <= 0)
{
cout<<"You died and lost the game."<<"\n";
exit(0);
}
if(character_health <= 0 && black_dragon_health <= 0)
{
cout<<"You defeated the enemy but you sucumbed to your wounds"<<"\n";
exit(0);
}
if(player_input == "1")
{
cout<<"\n";
combat( black_dragon_health, 5, 0, 1 );
cout<<"\n";
combat2(character_health, 0, 0, character_defence);
cout<<"\n";
cout<<"Your hp is "<<character_health;
cout<<"\n";
cout<<"Enemies hp is "<<black_dragon_health<<"\n";
cout<<"\n";
}
else if(player_input == "2")
{
cout<<"\n";
//cout<<"Your defence was increased by 1 point"<<"\n";
//character_defence = character_defence + 1;
combat2(character_health, 0, 0, character_defence);
cout<<"\n";
cout<<"Your hp is "<<character_health;
cout<<"\n";
cout<<"Enemies hp is "<<black_dragon_health;
cout<<"\n";
}
else
{
cout<<"You have only two options: number 1 and number 2"<<"\n";
}
}
cout<<"\n";
cout<<"You defeated the huge lizard!"<<"\n";
cout<<"\n";
cout<<"But your journey is still far from over"<<"\n";
cout<<"\n";
}
void scenarios::start_scenarios()
{
golemRoom();
fallenKnightRoom();
TreasureRoom();
DemonTreasureRoom();
BlackDragonBossRoom();
}