Forgotten Heros
Source Code:
#include <iostream.h>
#include <dos.h>
#include <mem.h>
#include <conio.h>
#include <ctime>
#include <windows.h>
#include <string>
//#include <msoftcon.h>
//#include <iomanip>
using namespace std;
//------------------------------------------------------------------------------
// Text Output Functions
//------------------------------------------------------------------------------
void DrawColorString(string szText, int X, int Y, WORD color)
{
HANDLE OutputH; // This will be used for our handle to the output (basically, holds permission to change the output settings)
COORD position = {X, Y}; // Create a COORD and set it's x and y to the X and Y passed in.
OutputH = GetStdHandle(STD_OUTPUT_HANDLE); // Get a OUTPUT handle to our screen.
SetConsoleTextAttribute(OutputH, color); // Set the text attribute to what ever color that was passed in.
// The function SetConsoleTextAttribute takes (the handle to the output, and the color);
SetConsoleCursorPosition(OutputH, position); // Set the cursor position to the desire position passed in.
cout << szText; // Now print out what we wanted to at the position that was passed in.
}
void gotoxy( int x, int y )
{
COORD c;
c.X = x - 1 ;
c.Y = y - 1 ;
SetConsoleCursorPosition( GetStdHandle( STD_OUTPUT_HANDLE ), c ) ;
}
//------------------------------------------------------------------------------
// All the variables and stuff like that
//------------------------------------------------------------------------------
// -- System
void SetSVGA();
void SetText();
void AltEnter();
// -- Setup
void TopBorder();
void introScreen();
void introStory();
void NameCharacter();
void CharacterSelect();
void StatAssign();
void StatBorder();
void introWelcomeOne();
void introWelcomeTwo();
void introWelcomeThree();
void introWelcomeFour();
// -- The Game
void mainGameLoop();
void AtTheInn();
void InTheTemple();
void TempleQuest();
void InTheMagicShop();
void GymnasiumTrain();
void SeekChallenge();
void CityGates();
void OpenFieldOne();
void RockyPassageOne();
void ForestOne();
void DenseWoodOne();
void DenseWoodTwo();
void DenseSmallPassage();
void DensePSGRandom();
void DensePSGFightInit();
void DensePSGFighting();
void DensePSGFightProcess();
void DensePSGFight();
void DenseTheHoleOne();
void AtTheFarm();
void ZombieAttack();
void FightFarm();
void FarmFight();
void FarmFightProcess();
void TheCellar();
void CellarRoomOne();
void CellarRoomTwo();
void CellarRoomQuest();
void NecroAttack();
void FightNecro();
void NecroFight();
void NecroFightProcess();
// -- Magic
void CastSpell();
// -- Raising the Character
void LevelUp();
void StrenghtRaise();
void DexterityRaise();
void HitPointRaise();
void AttackRaise();
void DefenceRaise();
void MagicRaise();
//---- Game Engine Specifics ----
//---- Melee Combat ----
void PlyAttackPct();
void EnemyAttackPct();
//---- Magic Engine ----
void MagicUserMagic();
void ClericMagic();
void MagicMissile();
void AcidRain();
void Fireball();
void DeathRay();
void CureWounds();
void Bless();
void DefensiveAura();
void Rejuvenation();
//---- Outro ----
void TheEnd();
//---- Variables for other stuff ----
int StatStr;
int StatDex;
int StatInt;
int MaxHp;
int MaxDefence;
int MaxMagic;
int PlyHP;
int PlyAttack;
int PlyMagic;
int PlyGold = 5;
int PlyExperience = 0;
int tempGold;
int NumberDay = 1;
int PlyLevel = 1;
int FarmCheck = 0;
int FarmCheckRest = 0;
int EnemyAttack;
int EnemyMaxHP;
int EnemyDef;
int EnemyGold;
int EnemyHP;
int EnemyExp;
int TempleCheck = 0;
int diceRoller(int min_value, int max_value);
int dice;
int diceTwo;
int DamDone;
int PlyATW;
int ExDam;
int ExDef;
int EnemyDamDone;
int EnemyATW;
int TempInt;
int NextLevel = 100;
char NameOfPlayer[50];
char Player;
char Choice;
char Job;
char PlyWeapon;
int main()
{
/* SetSVGA();
SetText();*/
AltEnter();
//init_graphics();
system("cls");
TopBorder();
introScreen();
introStory();
NameCharacter();
CharacterSelect();
StatAssign();
introWelcomeOne();
introWelcomeTwo();
introWelcomeThree();
introWelcomeFour();
mainGameLoop();
TheEnd();
return 0;
}
void TopBorder()
{
DrawColorString("", 0, 1, FOREGROUND_RED|FOREGROUND_GREEN|BACKGROUND_BLUE);
cout <<"\xda\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4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\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc5\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xb4";
cout <<"\xb3 \xb3 \xb3";
cout <<"\xb3 \xb3 \xb3";
cout <<"\xb3 \xb3 \xb3";
cout <<"\xd4\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcf\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xbe";
gotoxy(74,7);cout << ""<<StatStr<<"";
gotoxy(74,9);cout << ""<<StatDex<<"";
gotoxy(74,11);cout << ""<<StatInt<<"";
gotoxy(10,7);cout <<""<<NameOfPlayer<<"";
gotoxy(16,9);cout <<""<<PlyExperience<<"/"<<NextLevel<<"";
gotoxy(16,11);cout <<""<<PlyAttack<<"";
gotoxy(16,13);cout <<""<<MaxDefence<<" + "<<ExDef<<"";
gotoxy(40,7);cout <<""<<PlyLevel<<"";
gotoxy(40,9);cout <<""<<PlyGold<<"";
gotoxy(40,11);
if (PlyWeapon == 0){cout << "Hands 1d"<<PlyATW<<"+"<<ExDam<<"\n";}
if (PlyWeapon == 1){cout << "Dagger 1d"<<PlyATW<<"+"<<ExDam<<"\n";}
if (PlyWeapon == 2){cout << "Warhammer 1d"<<PlyATW<<"+"<<ExDam<<"\n";}
if (PlyWeapon == 3){cout << "Sword 1d"<<PlyATW<<"+"<<ExDam<<"\n";}
if (PlyWeapon == 4){cout << "Axe 1d"<<PlyATW<<"+"<<ExDam<<"\n";}
if (PlyWeapon == 5){cout << "Halberd 1d"<<PlyATW<<"+"<<ExDam<<"\n";}
gotoxy(40,13);cout <<""<<PlyHP<<"/"<<MaxHp<<"";
gotoxy(54,7);cout <<""<<Job<<"";
gotoxy(54,9);cout <<""<<NumberDay<<"";
if (Job == 'M')
{
gotoxy(68,13);cout <<""<<PlyMagic<<"/"<<MaxMagic<<"";
}
if (Job == 'C')
{
gotoxy(68,13);cout <<""<<PlyMagic<<"/"<<MaxMagic<<"";
}
DrawColorString("Name :", 2, 6, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Day :", 45, 8 , FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Level :", 25, 6, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Class :", 45, 6, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Strenght :", 59, 6, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Dexterity :", 59, 8, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Inteligence :", 59, 10, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Experience :", 2, 8, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Gold :", 25, 8, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Attack :", 2, 10, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Weapon :", 25, 10, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Defence :", 2, 12, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Hit Points :", 25, 12, FOREGROUND_RED | FOREGROUND_BLUE);
if (Job == 'M')
{
DrawColorString("Mana :", 59,12, FOREGROUND_RED | FOREGROUND_BLUE);
}
if (Job == 'C')
{
DrawColorString("Mana :", 59,12, FOREGROUND_RED | FOREGROUND_BLUE);
}
DrawColorString("", 80, 50, FOREGROUND_RED | FOREGROUND_GREEN);
cout << "\n\n";
}
void introScreen()
{
cout <<"\n\n\n\n\n\n\n\n\n\n THIS GAME IS CASE SENSITIVE - DON'T FORGET TO TURN CAPS ON!\n\n\n\n\n\n\n";
cout <<" This game is V0.3b, which means, it is playable, but many functions are not\n";
cout <<" yet implemented. Magic is not very usable, so it is recomended, NOT to play as\n";
cout <<" a magic-user or cleric yet! Though it's quite enjoyable as a fighter :)\n\n";
cout <<" To exit the game, keep pressing CTRL + C, until it exits....\n";
DrawColorString("\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2", 0, 20, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2", 0, 28, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 0, 21, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 0, 22, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 0, 23, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 0, 24, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 0, 25, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 0, 26, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 0, 27, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 79, 21, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 79, 22, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 79, 23, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 79, 24, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 79, 25, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 79, 26, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 79, 27, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("",80,60, FOREGROUND_BLUE | FOREGROUND_GREEN);
getch();
system("cls");
return;
}
void introStory()
{
TopBorder();
cout <<"\n\n";
cout <<" Welcome to Forgotten Heroes! A game where you set off in hot pursuit of fame\n";
cout <<" and adventure! You, like so many other heroes of today, have been summoned to\n";
cout <<" Crowenburg, in the hope of finding glory and riches, while valiantly defending\n";
cout <<" peace and the forces of good....";
cout <<"\n\n\n\n\n\n\n\n";
getch();
system("cls");
return;
}
//------------------------------------------------------------------------------
// Character Generation
//------------------------------------------------------------------------------
void NameCharacter()
{
TopBorder();
cout <<"\n\n\n\n By which name shall you be known (no spaces allowed)?\n";
cout <<" ?";
cin >> NameOfPlayer;
cout <<"\n\n\n\n\n\n\n\n";
system("cls");
return ;
}
void CharacterSelect()
{
TopBorder();
cout <<"\n\n\n So, "<<NameOfPlayer<<", what profession do you practice?\n\n";
cout <<"--------------------------------------------------------------------------------\n";
cout <<" (F) ighter\n";
cout <<" (R) ogue\n";
cout <<" (M) agic-User\n";
cout <<" (C) leric\n\n\n\n";
cout <<" ?";
cin >> Choice;
switch (Choice)
{
case 'F':
Job = 'F';
break;
case 'R':
Job = 'R';
break;
case 'M':
Job = 'M';
break;
case 'C':
Job = 'C';
break;
default:
CharacterSelect();
break;
}
/*
if (Choice == 'F'){Job = 'F';}
if (Choice == 'R'){Job = 'R';}
if (Choice == 'M'){Job = 'M';}
if (Choice == 'C'){Job = 'C';}
else */
PlyWeapon = 0;
system("cls");
return;
}
//------------------------------------------------------------------------------
// Intro Story
//------------------------------------------------------------------------------
void introWelcomeOne()
{
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" You travelled long and far, and";
gotoxy(3,18);cout <<"reached Crowenburg a little later";
gotoxy(3,19);cout <<"than youexpected. You're now";
gotoxy(3,20);cout <<"standing in the town center, a";
gotoxy(3,21);cout <<"busy place, where people rush back";
gotoxy(3,22);cout <<"and forth, on unknown errands.";
getch();
system("cls");
return;
}
void introWelcomeTwo()
{
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" You are quick to locate an inn";
gotoxy(3,18);cout <<"called 'The Golden Dragon', whose";
gotoxy(3,19);cout <<"name alone,fitted your tastes.";
getch();
system("cls");
return;
}
void introWelcomeThree()
{
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" A sudden rustle in the air, made";
gotoxy(3,18);cout <<"people scream, and they run for it!";
gotoxy(3,19);cout <<"name alone,fitted your tastes.";
gotoxy(3,20);cout <<"A huge reptile with wings, have";
gotoxy(3,21);cout <<"anded on a nearby rooftop, with a";
gotoxy(3,22);cout <<"black-clad rider atop. When the";
gotoxy(3,23);cout <<"panic had settled a bit, the rider";
gotoxy(3,24);cout <<"shouted in an unnatural voice :";
gotoxy(3,26);cout <<"'PEOPLE OF CROWENBURG! YOU HAVE BEEN";
gotoxy(3,27);cout <<"CHALLENGED TO PRODUCE A CHAMPION";
gotoxy(3,28);cout <<"WORTHY TO MEET MY LORD ATHAMOS IN";
gotoxy(3,29);cout <<"OPEN COMBAT! I WILL HAVE YOUR CHOSEN";
gotoxy(3,30);cout <<"HERE. BUT DO NOT WASTE TIME!'";
getch();
system("cls");
return;
}
void introWelcomeFour()
{
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" After shouting his challenge, both";
gotoxy(3,18);cout <<"steed and rider, turns to stone,";
gotoxy(3,19);cout <<"perched on the rooftop, only a red";
gotoxy(3,20);cout <<"shimmering light emitting from the ";
gotoxy(3,21);cout <<"deepset eyes.";
getch();
system("cls");
return;
}
//------------------------------------------------------------------------------
// In the city of Crowenburg
//------------------------------------------------------------------------------
void mainGameLoop()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" Crowenburg Town Center";
gotoxy(3,18);cout <<"";
gotoxy(3,19);cout <<" There's a lot of people walking";
gotoxy(3,20);cout <<"around the place, preoccupied with";
gotoxy(3,21);cout <<"their own businesses.";
gotoxy(3,22);cout <<"";
gotoxy(3,23);cout <<"";
gotoxy(41,17);cout <<"(S)eek Rider (Accept the challenge)";
gotoxy(41,18);cout <<"(I)nn (Rest # 1 Gold)";
gotoxy(41,19);cout <<"(T)emple (Healing # 10 Gold)";
gotoxy(41,20);cout <<"(M)agic shop (Recharge # 25 Gold)";
gotoxy(41,21);cout <<"(G)ymnasium (Train abilities)";
gotoxy(41,22);cout <<"(A)rmoury (NOT IMPLEMENTED YET!)";
gotoxy(41,23);cout <<"(L)eave town";
gotoxy(3,34);cout <<"? ";cin >> Choice;
switch (Choice)
{
case 'S':
SeekChallenge();
break;
case 'I':
AtTheInn();
break;
case 'T':
InTheTemple();
break;
case 'M':
InTheMagicShop();
break;
case 'G':
GymnasiumTrain();
break;
case 'L':
CityGates();
break;
default:
mainGameLoop();
break;
}
/*
if (Choice == 'I'){AtTheInn();}
if (Choice == 'T'){InTheTemple();}
if (Choice == 'M'){InTheMagicShop();}
if (Choice == 'G'){GymnasiumTrain();}
if (Choice == 'L'){CityGates();}
if (Choice == 'S'){SeekChallenge();}
*/
system("cls");
return;
}
void AtTheInn()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" 'The Golden Dragon'";
gotoxy(3,18);cout <<"Around you, people are shouting and ";
gotoxy(3,19);cout <<"drinking. Generally, they seem to be";
gotoxy(3,20);cout <<"having a wonderful time.";
if (FarmCheckRest == 0){
gotoxy(3,22);cout <<" You overhear someone saying, 'I ";
gotoxy(3,23);cout <<"hear the old farmer was killed by";
gotoxy(3,24);cout <<"an evil wizard! One of them ";
gotoxy(3,25);cout <<"necromancer kinda ones!'";}
if (FarmCheckRest == 1){
gotoxy(3,22);cout <<" You sense, that some of the people";
gotoxy(3,23);cout <<"here know, you were the one, who";
gotoxy(3,24);cout <<"avenged the old farmer. Some even";
gotoxy(3,25);cout <<"smile at you!";
FarmCheckRest = 2;}
gotoxy(41,17);cout <<" Do you require rest?";
gotoxy(41,19);cout <<"(Y)es, turn in for the night";
gotoxy(41,20);cout <<"(N)o, I'm not even sleepy yet!\n";
gotoxy(3,34);cout <<" ?";cin >> Choice;
switch (Choice)
{
case 'Y':
{
if(PlyGold < 1)
{
gotoxy(41,34);cout << "Sorry not enough gold!"<<endl;
}
else
{
PlyGold = PlyGold - 1;
PlyHP = PlyHP + (PlyHP / 2);
if (PlyHP >= MaxHp)
{PlyHP = MaxHp;}
PlyMagic++;
if (PlyMagic >= MaxMagic)
{PlyMagic = MaxMagic;}
gotoxy(41,34);cout <<"You sleep securely through the night" <<endl;
NumberDay++;
}
}
break;
case 'N':
{
gotoxy(41,34);cout <<" Ok, we'll keep a bed ready\n\n";
}
break;
default :
AtTheInn();
break;
}
getch();
mainGameLoop();
return;
}
void InTheTemple()
{
system("cls");
TopBorder();
StatBorder();
if (TempleCheck == 0 && FarmCheckRest == 2){TempleQuest();}
gotoxy(3,17);cout <<" Temple of Manag";
gotoxy(3,19);cout <<" Along the walls of the midship, ";
gotoxy(3,20);cout <<"monks and priests, are in deep ";
gotoxy(3,21);cout <<"prayer. At the altar, at the end ";
gotoxy(3,22);cout <<"of the temple, the High Priest ";
gotoxy(3,23);cout <<"Gomgha, is ready toheal the ";
gotoxy(3,24);cout <<"wounds of visitors.";
if (TempleCheck == 1){
gotoxy(3,26);cout <<"'Remember the witch!'";
}
gotoxy(41,17);cout <<"Do you require healing?";
gotoxy(41,19);cout <<"(Y)es, patch me up!";
gotoxy(41,20);cout <<"(N)o, it's only a fleshwound!";
gotoxy(3,34);cout <<" ?";cin >> Choice;
switch(Choice)
{
case 'Y':
{
if(PlyGold < 10)
{
gotoxy(41,34);cout << "Sorry not enough gold!";
}
else
{
PlyGold = PlyGold - 10;
PlyHP = MaxHp;
gotoxy(41,34);cout <<"You feel better already";
}
break;
}
case 'n':
{
gotoxy(41,34);cout <<"Blessings unto you";
}
break;
default:
InTheTemple();
break;
}
getch();
mainGameLoop();
return;
}
void TempleQuest()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" Temple of Manag";
gotoxy(3,19);cout <<" Gomgha turns to you and speaks:";
gotoxy(3,20);cout <<"'Well done dealing with that";
gotoxy(3,21);cout <<"necromancer, he was starting to";
gotoxy(3,22);cout <<"cause unrest. I have a job for";
gotoxy(3,23);cout <<"you, should you chose to accept";
gotoxy(3,24);cout <<"it... in the northern forest,";
gotoxy(3,25);cout <<"there is an evil witch, who have";
gotoxy(3,26);cout <<"poisoned the minds, of some of";
gotoxy(3,27);cout <<"the cityfolk... we of the church";
gotoxy(3,28);cout <<"would like to see an end to that";
getch();
TempleCheck = 1;
InTheTemple();
return;
}
void InTheMagicShop()
{
system("cls");
TopBorder();
StatBorder();
if (Job == 'F')
{
gotoxy(41,34); cout <<"You do not have any magic abilities!";
getch();
mainGameLoop();
}
if (Job == 'R')
{
gotoxy(41,34); cout <<"You do not have any magic abilities!";
getch();
mainGameLoop();
}
gotoxy(3,17);cout <<" Crowenburg Magic Shop";
gotoxy(3,19);cout <<" Strange smells, fill the air around";
gotoxy(3,20);cout <<"you, and lesser spells, fizzle";
gotoxy(3,21);cout <<"harmlessly around your feet. The old";
gotoxy(3,22);cout <<"shopkeeper Kilam, is looking at you ";
gotoxy(3,23);cout <<"from over the edge, of his broken ";
gotoxy(3,24);cout <<"glasses.";
gotoxy(41,17);cout <<"Do you require a recharge?";
gotoxy(41,19);cout <<"(Y)es, fill me up!";
gotoxy(41,20);cout <<"(N)o thanks";
gotoxy(3,34);cout <<" ?";cin >> Choice;
switch (Choice)
{
case 'Y':
{
if(PlyGold < 25)
{
gotoxy(41,34);cout << "Sorry not enough gold!"<<endl;
}
else
{
PlyGold = PlyGold - 25;
PlyHP = MaxHp;
gotoxy(41,34);cout <<"You feel recharged" <<endl;
}
}
break;
case'N':
{
gotoxy(41,34);cout <<"Ok, come back when you need more power";
}
break;
default:
InTheMagicShop();
break;
}
getch();
mainGameLoop();
return;
}
void GymnasiumTrain()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" Crowenburg Gymnasium";
gotoxy(3,19);cout <<" All sorts of wanna-be heroes train";
gotoxy(3,20);cout <<"and hone their skills, either with";
gotoxy(3,21);cout <<"each other or alone, in deep concen-";
gotoxy(3,22);cout <<"tration.";
gotoxy(41,17);cout <<"Do you wish to train?";
gotoxy(41,19);cout <<"(Y)es, I'm ready!";
gotoxy(41,20);cout <<"(N)o thanks";
gotoxy(3,34);cout <<" ?";cin >> Choice;
switch (Choice)
{
case 'Y':
{
if(PlyExperience < NextLevel)
{
gotoxy(41,34);cout << "Sorry not enough experience!";
}
else
{
PlyLevel++;
NextLevel = NextLevel + (100 * PlyLevel);
if (Job == 'F')
{dice = diceRoller(1,6);
MaxHp = MaxHp + dice;
diceTwo = diceRoller(1,100);
if (diceTwo >= 90)
{
dice = diceRoller(1,3);
PlyAttack = PlyAttack + dice;
}
}
if (Job == 'R')
{dice = diceRoller(1,4);
MaxHp = MaxHp + dice;
diceTwo = diceRoller(1,100);
if (diceTwo >= 90)
{
MaxDefence++;
}
}
if (Job == 'C')
{dice = diceRoller(1,4);
MaxHp = MaxHp + dice;
diceTwo = diceRoller(1,100);
if (diceTwo >= 90)
{
dice = diceRoller(1,2);
PlyMagic = PlyMagic + dice;
}
}
if (Job == 'M')
{dice = diceRoller(1,2);
MaxHp = MaxHp + dice;
diceTwo = diceRoller(1,100);
if (diceTwo >= 90)
{
dice = diceRoller(1,4);
PlyMagic = PlyMagic + dice;
}
}
}
LevelUp();
}
break;
case 'N':
{
gotoxy(41,34);cout <<"Come back when you need a lesson";
}
break;
default:
GymnasiumTrain();
break;
}
getch();
mainGameLoop();
return;
}
//------------------------------------------------------------------------------
// Just outside Crowenburg - Crossroad
//------------------------------------------------------------------------------
void CityGates()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" Crowenburg Crossroads";
gotoxy(3,19);cout <<" You are standing a few paces";
gotoxy(3,20);cout <<"outside the city of Crowenburg.";
gotoxy(3,21);cout <<"Nearby, you can see, an open field,";
gotoxy(3,22);cout <<"a rocky passage, a forest and a";
gotoxy(3,23);cout <<"dense wood.";
gotoxy(41,17);cout <<"Where do you want to go from here?";
gotoxy(41,19);cout <<"(C)rowenburg";
gotoxy(41,20);cout <<"(O)pen field";
gotoxy(41,21);cout <<"(R)ocky passage";
gotoxy(41,22);cout <<"(F)orest";
gotoxy(41,23);cout <<"(D)ense wood";
gotoxy(3,34);cout <<" ?";cin >> Choice;
switch (Choice)
{
case 'C':
mainGameLoop();
break;
case 'O':
OpenFieldOne();
break;
case 'R':
RockyPassageOne();
break;
case 'F':
ForestOne();
break;
case 'D':
DenseWoodOne();
break;
default:
CityGates();
break;
}
/*
if (Choice == 'C'){mainGameLoop();}
if (Choice == 'O'){OpenFieldOne();}
if (Choice == 'R'){RockyPassageOne();}
if (Choice == 'F'){ForestOne();}
if (Choice == 'D'){DenseWoodOne();}
*/
system("cls");
return;
getch();
mainGameLoop();
return;
}
//------------------------------------------------------------------------------
// The Road to Ancorheim
//------------------------------------------------------------------------------
void RockyPassageOne()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" Rocky Passage";
gotoxy(3,19);cout <<" You are on a rocky passage leading";
gotoxy(3,20);cout <<"eastward to the city of Anchorheim.";
gotoxy(3,21);cout <<"The cool wind is blowing in from ";
gotoxy(3,22);cout <<"between the huge rocks. You do not";
gotoxy(3,23);cout <<"want to stick around this place for";
gotoxy(3,24);cout <<"too long.";
gotoxy(41,17);cout <<"NO ROAD HERE YET!";
gotoxy(41,18);cout <<"";
gotoxy(3,34);cout <<"? ";cin >> Choice;
getch();
CityGates();
return;
}
//------------------------------------------------------------------------------
// The Forest
//------------------------------------------------------------------------------
void ForestOne()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" The Forest";
gotoxy(3,19);cout <<" You are in the forest to the west";
gotoxy(3,20);cout <<"of Crowenburg. Birds are chirping ";
gotoxy(3,21);cout <<"cheerfully in the trees. The moss under ";
gotoxy(3,22);cout <<"your feet, gives in softly as you walk.";
gotoxy(3,23);cout <<"There's a sweet smell of flowers in the";
gotoxy(3,24);cout <<"air.";
gotoxy(41,17);cout <<"NO ROAD HERE YET!";
gotoxy(41,18);cout <<"";
gotoxy(3,34);cout <<"? ";cin >> Choice;
getch();
CityGates();
return;
}
//------------------------------------------------------------------------------
// The Dense Woods
//------------------------------------------------------------------------------
void DenseWoodOne()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" The Dense Wood";
gotoxy(3,19);cout <<" You are the dense northern woods.";
gotoxy(3,20);cout <<"not much light is passing through ";
gotoxy(3,21);cout <<"the heavy treetops. There is an ";
gotoxy(3,22);cout <<"eerie silence...";
gotoxy(41,17);cout <<"(F)urther North";
gotoxy(41,18);cout <<"(A) small passage";
gotoxy(41,19);cout <<"(O)utside Crowenburg";
gotoxy(3,34);cout <<"? ";cin >> Choice;
switch (Choice)
{
case 'F':
DenseWoodTwo();
break;
case 'A':
DenseSmallPassage();
break;
case 'O':
CityGates();
break;
default:
DenseWoodOne();
break;
}
/*
if (Choice == 'F'){DenseWoodTwo();}
if (Choice == 'A'){DenseSmallPassage();}
if (Choice == 'O'){CityGates();}
*/
return;
}
void DenseWoodTwo()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" In the dark forest";
gotoxy(3,19);cout <<" The air is standing still here, and";
gotoxy(3,20);cout <<"only a few lazy insects are flying";
gotoxy(3,21);cout <<"around, making the place as silent as";
gotoxy(3,22);cout <<"a tomb.";
gotoxy(41,17);cout <<"(F)urther north";
gotoxy(41,17);cout <<"(E)ast towards a clearing";
gotoxy(41,17);cout <<"(W)est";
gotoxy(41,17);cout <<"(B)eginning of the forest";
gotoxy(3,34);cout <<"? ";cin >> Choice;
/* switch(Choice)
{
case 'F':
DenseWoodThree()
break;
case 'E':
DenseClearing()
break;
case 'W':
DenseWestOne()
break;
case 'B':
DenseWoodOne()
break;
default:
DenseWoodTwo()
break;
}*/
getch();
DenseWoodOne();
return;
}
void DenseSmallPassage()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" A passage in the trees";
gotoxy(3,19);cout <<" You make your way through the thick";
gotoxy(3,20);cout <<"underbrush, along the unseen path. A";
gotoxy(3,21);cout <<"heavy smell of animals, assault your";
gotoxy(3,22);cout <<"nostrils. There is a hole in the";
gotoxy(3,23);cout <<"ground, wide enough, for you to ";
gotoxy(3,24);cout <<"squeeze in.";
dice = diceRoller(1, 100);
if (dice <= 20){DensePSGRandom();}
gotoxy(41,17);cout <<"(B)ack to the main road";
gotoxy(41,18);cout <<"(H)ole in the ground";
gotoxy(3,34);cout <<"? ";cin >> Choice;
switch (Choice)
{
case 'B':
DenseWoodOne();
break;
case 'H':
DenseTheHoleOne();
break;
default:
DenseSmallPassage();
break;
}
return;
}
void DensePSGRandom()
{
gotoxy(41,20);cout <<"Suddenly, you encounter a ";
dice = diceRoller(1, 4);
if (dice == 1){cout <<"wild dog\n\n"; getch(); TempInt = 1; DensePSGFightInit();}
if (dice == 2){cout <<"rabid badger\n\n";getch(); TempInt = 2; DensePSGFightInit();}
if (dice == 3){cout <<"lone wolf\n\n";getch(); TempInt = 3; DensePSGFightInit();}
if (dice == 4){cout <<"black bear\n\n";getch(); TempInt = 4; DensePSGFightInit();}
getch();
return;
}
void DenseTheHoleOne()
{
system("cls");
TopBorder();
StatBorder();
cout <<" The hole.";
getch();
return;
}
void DensePSGFightInit()
{
if (TempInt == 1)
{
EnemyAttack = 25;
EnemyMaxHP = 20;
EnemyDef = 1;
EnemyGold = 5;
EnemyHP = EnemyMaxHP;
EnemyExp = 15;
EnemyATW = 4;
}
if (TempInt == 2)
{
EnemyAttack = 20;
EnemyMaxHP = 18;
EnemyDef = 2;
EnemyGold = 5;
EnemyHP = EnemyMaxHP;
EnemyExp = 15;
EnemyATW = 5;
}
if (TempInt == 3)
{
EnemyAttack = 30;
EnemyMaxHP = 25;
EnemyDef = 3;
EnemyGold = 10;
EnemyHP = EnemyMaxHP;
EnemyExp = 20;
EnemyATW = 5;
}
if (TempInt == 4)
{
EnemyAttack = 25;
EnemyMaxHP = 40;
EnemyDef = 1;
EnemyGold = 15;
EnemyHP = EnemyMaxHP;
EnemyExp = 30;
EnemyATW = 6;
}
DensePSGFight();
return;
}
void DensePSGFighting()
{
system("cls");
TopBorder();
StatBorder ();
if(EnemyHP <= 0)
{
gotoxy(41,18);cout <<"You defeated your foe!";
gotoxy(41,20);cout <<"Gained " << EnemyGold << " Gold!";
gotoxy(41,21);cout <<"Gained " << EnemyExp << " Experience!";
PlyGold = PlyGold + EnemyGold;
PlyExperience = PlyExperience + EnemyExp;
EnemyHP = EnemyMaxHP;
getch();
DenseSmallPassage();
}
if(PlyHP <= 0)
{
gotoxy(41,18);cout <<"You were defeated in combat!" ;
gotoxy(41,20);cout <<"You lost gold and experience and";
gotoxy(41,21);cout <<"are back in 'The Golden Dragon'!";
PlyGold = PlyGold - (PlyGold / 3);
PlyExperience = PlyExperience - (PlyExperience / 4);
PlyHP = MaxHp / 2;
getch();
mainGameLoop();
}
DensePSGFight();
return;
}
void DensePSGFightProcess()
{
system("cls");
TopBorder();
StatBorder ();
if (Choice == 'C')
{
cout << "\n\n ";
getch();
gotoxy(41,17);cout << "Your enemy strikes out at you!";
gotoxy(41,18);cout << "And it ";
EnemyAttackPct();
cout << "\n\n\n";
}
else
{
gotoxy(41,17);cout << "You strike out at your enemy!";
gotoxy(41,18);cout << "And you ";
PlyAttackPct();
getch();
gotoxy(41,22);cout << "The enemy strikes out at you!\n";
gotoxy(41,23);cout << "And it ";
EnemyAttackPct();
cout << "\n\n\n";
getch();
DensePSGFighting();
}
return;
}
void DensePSGFight()
{
system("cls");
TopBorder();
StatBorder ();
gotoxy(6,17);cout <<"You are engaged in combat!";
gotoxy(6,19);cout <<"Opponent Hit Points :" << EnemyHP << " / " <<EnemyMaxHP<< "";
gotoxy(41,17);cout <<"(A)ttack";
gotoxy(41,18);cout <<"(F)lee";
if (Job == 'M'){gotoxy(41,21);cout << "(C)ast spell";}
if (Job == 'C'){gotoxy(41,21);cout << "(C)ast spell";}
gotoxy(3,34);cout <<" ?";cin >> Choice;
switch (Choice)
{
case 'F':
PlyExperience = PlyExperience - (PlyExperience / 50);
if (PlyExperience <= 0){PlyExperience = 0;}
DenseWoodOne();
break;
case 'A':
DensePSGFightProcess();
break;
case 'C':
{
if (Job = 'M'||'C')
{
CastSpell();
gotoxy(41,17);cout << "The enemy strikes out at you!";
gotoxy(41,18);cout << " And it ";
EnemyAttackPct();
cout << "\n\n\n";
getch();
DensePSGFighting();
}
else
gotoxy(41,34);cout << "You cannot use magic!";
DensePSGFight();
}
break;
default:
DensePSGFight();
break;
}
}
//------------------------------------------------------------------------------
// The farm, the open field, the Cellar - and the farm subquest
//------------------------------------------------------------------------------
void OpenFieldOne()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" The Open Field";
gotoxy(3,19);cout <<" You are on an open field. In the";
gotoxy(3,20);cout <<"distance you can see an old farm ";
gotoxy(3,21);cout <<"house.";
gotoxy(41,17);cout <<"(F)arm";
gotoxy(41,18);cout <<"(O)utside Crowenburg";
gotoxy(3,34);cout <<"? ";cin >> Choice;
switch (Choice)
{
case 'F':
AtTheFarm();
break;
case 'O':
CityGates();
break;
default:
OpenFieldOne();
break;
}
/*
if (Choice == 'F'){AtTheFarm();}
if (Choice == 'O'){CityGates();}
*/
getch();
CityGates();
return;
}
void AtTheFarm()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" The Farm";
gotoxy(3,19);cout <<" You are in the old farm. Moldy";
gotoxy(3,20);cout <<"boards are barely holding this";
gotoxy(3,21);cout <<"heap of logs together. There is a";
gotoxy(3,22);cout <<"foul odeur here, like that, of a";
gotoxy(3,23);cout <<"rotting corpse.";
getch();
if (FarmCheckRest == 0){
if (FarmCheck == 0){ZombieAttack();}
if (FarmCheck == 1){gotoxy(3,25);cout <<" The corpse of the old farmer is";
gotoxy(3,26);cout <<"lying here.";}
}
if (FarmCheckRest == 1)
{gotoxy(3,25);cout <<" The spirit of the old farmer, has ";
gotoxy(3,26);cout <<"left the house, and has found peace.";}
gotoxy(41,17);cout <<"(T)he cellar";
gotoxy(41,18);cout <<"(O)pen field";
gotoxy(3,34);cout <<"? ";cin >> Choice;
switch (Choice)
{
case 'T':
TheCellar();
break;
case 'O':
OpenFieldOne();
break;
default:
AtTheFarm();
break;
}
/*
if (Choice == 'T'){TheCellar();}
if (Choice == 'O'){OpenFieldOne();}
*/
getch();
}
void ZombieAttack()
{
gotoxy(41,20);cout <<"You are attacked by the reanimated";
gotoxy(41,21);cout <<"corpse of the old farmer!";
if (PlyLevel == 1)
{
EnemyAttack = 25;
EnemyMaxHP = 20;
EnemyDef = 1;
EnemyGold = 5;
EnemyHP = EnemyMaxHP;
EnemyExp = 15;
EnemyATW = 4;
}
if (PlyLevel == 2)
{
EnemyAttack = 25;
EnemyMaxHP = 25;
EnemyDef = 2;
EnemyGold = 5;
EnemyHP = EnemyMaxHP;
EnemyExp = 10;
EnemyATW = 4;
}
if (PlyLevel >= 3)
{
EnemyAttack = 30;
EnemyMaxHP = 30;
EnemyDef = 3;
EnemyGold = 5;
EnemyHP = EnemyMaxHP;
EnemyExp = 5;
EnemyATW = 6;
}
FarmFight();
FarmCheck = 1;
AtTheFarm();
return;
}
void FightFarm()
{
system("cls");
TopBorder();
StatBorder ();
if(EnemyHP <= 0)
{
FarmCheck = 1;
gotoxy(41,18);cout <<"You defeated your foe!";
gotoxy(41,20);cout <<"Gained " << EnemyGold << " Gold!";
gotoxy(41,21);cout <<"Gained " << EnemyExp << " Experience!";
PlyGold = PlyGold + EnemyGold;
PlyExperience = PlyExperience + EnemyExp;
EnemyHP = EnemyMaxHP;
getch();
AtTheFarm();
}
if(PlyHP <= 0)
{
gotoxy(41,18);cout <<"You were defeated in combat!" ;
gotoxy(41,20);cout <<"You lost gold and experience and";
gotoxy(41,21);cout <<"are back in 'The Golden Dragon'!";
PlyGold = PlyGold - (PlyGold / 3);
PlyExperience = PlyExperience - (PlyExperience / 4);
PlyHP = MaxHp / 2;
getch();
mainGameLoop();
}
FarmFight();
return;
}
void FarmFightProcess()
{
system("cls");
TopBorder();
StatBorder ();
if (Choice == 'C')
{
getch();
gotoxy(41,18);cout << "The zombie strikes out at you!";
gotoxy(41,19);cout << "And it ";
EnemyAttackPct();
}
else
{
gotoxy(41,18);cout << "You strike out at the zombie!";
gotoxy(41,19);cout << "And you ";
PlyAttackPct();
getch();
gotoxy(41,22);cout << "The zombie strikes out at you!";
gotoxy(41,23);cout << "And it ";
EnemyAttackPct();
getch();
FightFarm();
}
return;
}
void FarmFight()
{
system("cls");
TopBorder();
StatBorder ();
gotoxy(3,20);cout <<"You are attacked by the reanimated";
gotoxy(3,21);cout <<"corpse of the old farmer!";
gotoxy(3,23);cout <<"Opponent Hit Points : " << EnemyHP << "/" <<EnemyMaxHP<<"";
gotoxy(41,17);cout <<"(A)ttack\n";
gotoxy(41,18);cout <<"(F)lee\n";
if (Job == 'M'){gotoxy(41,19);cout << "(C)ast spell\n";}
if (Job == 'C'){gotoxy(41,19);cout << "(C)ast spell\n";}
gotoxy(3,34);cout <<" ?";cin >> Choice;
switch (Choice)
{
case 'F':
PlyExperience = PlyExperience - (PlyExperience / 50);
if (PlyExperience <= 0){PlyExperience = 0;}
OpenFieldOne();
break;
case 'A':
FarmFightProcess();
break;
case 'C':
{
if (Job = 'M'||'C')
{
CastSpell();
cout << "\n\n\n\n The zombie strikes out at you!\n";
cout << " And it ";
EnemyAttackPct();
cout << "\n\n\n";
getch();
FightFarm();
}
else
cout << "\n\n You cannot use magic!";
FarmFight();
}
break;
default:
FarmFight();
break;
}
}
void TheCellar()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" The Cellar";
gotoxy(3,19);cout <<" You descend the stairs into a damp";
gotoxy(3,20);cout <<"and dark cellar. Light is coming ";
gotoxy(3,21);cout <<"down from cracks in the ceiling";
gotoxy(3,22);cout <<"above. Around you, some crates and";
gotoxy(3,23);cout <<"barrels litter the floor. On the far";
gotoxy(3,24);cout <<"side of the northern wall, is a door";
gotoxy(3,25);cout <<"leading into darkness.";
gotoxy(41,17);cout <<"(F)arm";
gotoxy(41,18);cout <<"(D)escend into darkness";
gotoxy(3,34);cout <<"? ";cin >> Choice;
switch (Choice)
{
case 'D':
CellarRoomOne();
break;
case 'F':
AtTheFarm();
break;
default:
TheCellar();
break;
}
/*
if (Choice == 'D'){CellarRoomOne();}
if (Choice == 'F'){AtTheFarm();}
*/
getch();
AtTheFarm();
return;
}
void CellarRoomOne()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" The Tunnel in The Cellar";
gotoxy(3,19);cout <<" You are in a damp and narrow ";
gotoxy(3,20);cout <<"passageway, leading into the ";
gotoxy(3,21);cout <<"underground beneath the farmhouse.";
gotoxy(3,22);cout <<"Rats squeak and scurry around your ";
gotoxy(3,23);cout <<"feet, and the soft mushy dirt, gives";
gotoxy(3,24);cout <<"in, with a sticky release.";
gotoxy(41,17);cout <<"(F)urther down";
gotoxy(41,18);cout <<"(T)he Cellar";
gotoxy(3,34);cout <<"? ";cin >> Choice;
switch (Choice)
{
case 'F':
CellarRoomTwo();
break;
case 'T':
TheCellar();
break;
default:
CellarRoomOne();
break;
}
return;
}
void CellarRoomTwo()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" The Tunnel in The Cellar";
gotoxy(3,19);cout <<" Light becomes dimmer as you descend";
gotoxy(3,20);cout <<"further down into the earth. Now you";
gotoxy(3,21);cout <<"can barely make out the details of";
gotoxy(3,22);cout <<"the tunnel. In the distance is what";
gotoxy(3,23);cout <<"appears to be a door, with a little";
gotoxy(3,24);cout <<"light coming out under.";
gotoxy(41,17);cout <<"(G)o through";
gotoxy(41,18);cout <<"(B)ack";
gotoxy(3,34);cout <<"? ";cin >> Choice;
switch (Choice)
{
case 'G':
CellarRoomQuest();
break;
case 'B':
CellarRoomOne();
break;
default:
CellarRoomTwo();
break;
}
}
void CellarRoomQuest()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" The Necromancers Room";
gotoxy(3,19);cout <<" You enter a workroom. A crude book-";
gotoxy(3,20);cout <<"shelf is mounted on the wall, the";
gotoxy(3,21);cout <<"titles covered in filth. In the ";
gotoxy(3,22);cout <<"middle of the room, there's a ";
gotoxy(3,23);cout <<"workdesk, with various papers, ";
gotoxy(3,24);cout <<"spread across the surface. You can't";
gotoxy(3,25);cout <<"read any of them.";
if (FarmCheckRest == 0)
{gotoxy(3,27);cout <<"The necromancer is here";getch();NecroAttack();}
gotoxy(41,17);cout <<"(B)ack";
gotoxy(3,34);cout <<"? ";cin >> Choice;
getch();
CellarRoomTwo();
}
void NecroAttack()
{
EnemyAttack = 10;
EnemyMaxHP = 40;
EnemyDef = 2;
EnemyGold = 50;
EnemyHP = EnemyMaxHP;
EnemyExp = 50;
EnemyATW = 4;
NecroFight();
return;
}
void FightNecro()
{
system("cls");
TopBorder();
StatBorder ();
if(EnemyHP <= 0)
{
FarmCheckRest = 1;
gotoxy(41,18);cout <<"You defeated the necromancer!";
gotoxy(41,20);cout <<"Gained " << EnemyGold << " Gold!";
gotoxy(41,21);cout <<"Gained " << EnemyExp << " Experience!";
PlyGold = PlyGold + EnemyGold;
PlyExperience = PlyExperience + EnemyExp;
EnemyHP = EnemyMaxHP;
getch();
CellarRoomQuest();
}
if(PlyHP <= 0)
{
gotoxy(41,18);cout <<"You were defeated in combat!" ;
gotoxy(41,20);cout <<"You lost gold and experience and";
gotoxy(41,21);cout <<"are back in 'The Golden Dragon'!";
PlyGold = PlyGold - (PlyGold / 3);
PlyExperience = PlyExperience - (PlyExperience / 4);
PlyHP = MaxHp / 2;
getch();
mainGameLoop();
}
NecroFight();
return;
}
void NecroFightProcess()
{
system("cls");
TopBorder();
StatBorder ();
if (Choice == 'C')
{
getch();
gotoxy(41,18);cout << "The nectomancer strikes out at you!";
gotoxy(41,19);cout << "And it ";
EnemyAttackPct();
}
else
{
gotoxy(41,18);cout << "You strike out at the necromancer!";
gotoxy(41,19);cout << "And you ";
PlyAttackPct();
getch();
dice = diceRoller(1, 100);
if (dice <=5)
{
diceTwo = diceRoller(1, 4);
PlyHP = PlyHP - diceTwo;
gotoxy(41,25);cout << "The necromancer casts a spell!";
gotoxy(41,26);cout << "Purple rays hit you for "<<diceTwo<<" damage!";
}
gotoxy(41,22);cout << "The necromancer strikes out at you!";
gotoxy(41,23);cout << "And it ";
EnemyAttackPct();
getch();
FightNecro();
}
return;
}
void NecroFight()
{
system("cls");
TopBorder();
StatBorder ();
gotoxy(3,20);cout <<"The Necromancer is here and he wants";
gotoxy(3,21);cout <<"your flesh!";
gotoxy(3,23);cout <<"Opponent Hit Points : " << EnemyHP << "/" <<EnemyMaxHP<<"";
gotoxy(41,17);cout <<"(A)ttack\n";
gotoxy(41,18);cout <<"(F)lee\n";
if (Job == 'M'){gotoxy(41,19);cout << "(C)ast spell\n";}
if (Job == 'C'){gotoxy(41,19);cout << "(C)ast spell\n";}
gotoxy(3,34);cout <<" ?";cin >> Choice;
switch (Choice)
{
case 'F':
PlyExperience = PlyExperience - (PlyExperience / 50);
if (PlyExperience <= 0){PlyExperience = 0;}
CellarRoomOne();
break;
case 'A':
NecroFightProcess();
break;
case 'C':
{
if (Job = 'M'||'C')
{
CastSpell();
cout << "\n\n\n\n The necromancer strikes out at you!\n";
cout << " And it ";
EnemyAttackPct();
cout << "\n\n\n";
getch();
FightNecro();
}
else
cout << "\n\n You cannot use magic!";
NecroFight();
}
break;
default:
NecroFight();
break;
}
}
//------------------------------------------------------------------------------
// The endgame
//------------------------------------------------------------------------------
void SeekChallenge()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<"Nothing happens. The rider is still";
gotoxy(3,18);cout <<"set in stone.";
getch();
mainGameLoop();
return;
}
void TheEnd()
{
TopBorder();
cout <<"\n\n\n\n\n\n\n\n";
cout <<" "<<NameOfPlayer<<".. This is ...\n";
cout <<" The End\n";
cout <<" You finished the game in "<<NumberDay<<" days";
cout <<"\n\n\n\n\n\n";
getch();
system("cls");
return;
}
//------------------------------------------------------------------------------
// Training in the gym (this may change in the future)
//------------------------------------------------------------------------------
void LevelUp()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" Crowenburg Gymnasium";
gotoxy(3,19);cout <<" All sorts of wanna-be heroes train";
gotoxy(3,20);cout <<"and hone their skills, either with";
gotoxy(3,21);cout <<"each other or alone, in deep concen-";
gotoxy(3,22);cout <<"tration.";
gotoxy(41,17);cout <<"What would you like to train?";
gotoxy(41,19);cout <<"(S)trenght 50 Gold";
gotoxy(41,20);cout <<"(D)exterity 50 Gold";
gotoxy(41,21);cout <<"(M)ax Hit Points 500 Gold";
gotoxy(41,22);cout <<"(A)ttack 100 Gold";
gotoxy(41,23);cout <<"D(E)fence 200 Gold";
gotoxy(41,24);cout <<"Ma(X) Magic Points 1000 Gold";
gotoxy(41,26);cout <<"(C)ome back later";
gotoxy(3,34);cout <<" ?";cin >> Choice;
switch (Choice)
{
case 'S':
StrenghtRaise();
break;
case 'D':
DexterityRaise();
break;
case 'M':
HitPointRaise();
break;
case 'A':
AttackRaise();
break;
case 'E':
DefenceRaise();
break;
case 'X':
MagicRaise();
break;
case 'C':
mainGameLoop();
break;
default:
LevelUp();
break;
}
/*
if (Choice == 'S'){StrenghtRaise();}
if (Choice == 'D'){DexterityRaise();}
if (Choice == 'M'){HitPointRaise();}
if (Choice == 'A'){AttackRaise();}
if (Choice == 'E'){DefenceRaise();}
if (Choice == 'X'){MagicRaise();}
*/
mainGameLoop();
return;
}
void StrenghtRaise()
{
if(PlyGold < 50)
{
gotoxy(41,34);cout << "Sorry not enough gold!"<<endl;
}
else
{
StatStr = StatStr + 1;
gotoxy(41,34);cout <<"You feel stronger";
PlyGold = PlyGold - 50;
getch();
}
LevelUp();
return;
}
void DexterityRaise()
{
if(PlyGold < 50)
{
gotoxy(41,34);cout << "Sorry not enough gold!"<<endl;
}
else
{
StatDex = StatDex + 1;
gotoxy(41,34);cout <<"You feel more dextrous";
PlyGold = PlyGold - 50;
getch();
}
LevelUp();
return;
}
void HitPointRaise()
{
if(PlyGold < 500)
{
gotoxy(41,34);cout << "Sorry not enough gold!"<<endl;
}
else
{
MaxHp = MaxHp + (MaxHp / 4);
gotoxy(41,34);cout <<"You can endure more";
PlyGold = PlyGold - 500;
getch();
}
LevelUp();
return;
}
void AttackRaise()
{
if(PlyGold < 100)
{
gotoxy(41,34);cout << "Sorry not enough gold!"<<endl;
}
else
{
dice = diceRoller(1,4);
PlyAttack = PlyAttack + dice;
gotoxy(41,34);cout <<"You can attack more effectively";
PlyGold = PlyGold - 100;
getch();
}
LevelUp();
return;
}
void DefenceRaise()
{
if(PlyGold < 200)
{
gotoxy(41,34);cout << "Sorry not enough gold!"<<endl;
}
else
{
MaxDefence = MaxDefence + 1;
gotoxy(41,34);cout <<"You feel more protected";
PlyGold = PlyGold - 200;
getch();
}
LevelUp();
return;
}
void MagicRaise()
{
if (Job == 'F')
{
system("cls");
TopBorder();
StatBorder();
gotoxy(41,34);cout <<"You do not have any magic abilities!";
getch();
LevelUp();
}
if (Job == 'R')
{
system("cls");
TopBorder();
StatBorder();
gotoxy(41,34);cout <<"You do not have any magic abilities!";
getch();
LevelUp();
}
if(PlyGold < 1000)
{
gotoxy(41,34);cout << "Sorry not enough gold!"<<endl;
}
else
{
PlyMagic = PlyMagic + 10;
gotoxy(41,34);cout <<"You feel more powerful";
PlyGold = PlyGold - 1000;
getch();
}
LevelUp();
return;
}
//------------------------------------------------------------------------------
// Assigning stats to the character. This may change in the future
//------------------------------------------------------------------------------
void StatAssign()
{
if (Job == 'F')
{
StatStr = 18;
StatDex = 14;
StatInt = 8;
MaxHp = 10;
PlyHP = MaxHp;
MaxDefence = 4;
PlyAttack = 50;
MaxMagic = 0;
PlyMagic = MaxMagic;
PlyATW = 6;
ExDam = (StatStr / 2) - 7;
if(ExDam <= 0){ExDam = 0;}
}
if (Job == 'R')
{
StatStr = 14;
StatDex = 18;
StatInt = 10;
MaxHp = 4;
PlyHP = MaxHp;
MaxDefence = 6;
PlyAttack = 35;
MaxMagic = 0;
PlyMagic = MaxMagic;
PlyATW = 4;
ExDef = (StatDex / 2) - 7;
if(ExDef <= 0){ExDef = 0;}
}
if (Job == 'M')
{
StatStr = 8;
StatDex = 10;
StatInt = 18;
MaxHp = 4;
PlyHP = MaxHp;
MaxDefence = 4;
PlyAttack = 10;
MaxMagic = 10;
PlyMagic = MaxMagic;
PlyATW = 2;
}
if (Job == 'C')
{
StatStr = 14;
StatDex = 14;
StatInt = 10;
MaxHp = 8;
PlyHP = MaxHp;
MaxDefence = 4;
PlyAttack = 25;
MaxMagic = 4;
PlyMagic = MaxMagic;
PlyATW = 4;
}
}
//------------------------------------------------------------------------------
// Auto Fullscreen Function (essentially it makes the program press Alt + Enter
// automatically)
//------------------------------------------------------------------------------
void AltEnter()
{
keybd_event(VK_MENU, 0x38, 0, 0);
keybd_event(VK_RETURN, 0x1c, 0, 0);
keybd_event(VK_RETURN, 0x1c, KEYEVENTF_KEYUP, 0);
keybd_event(VK_MENU, 0x38, KEYEVENTF_KEYUP, 0);
return;
}
//------------------------------------------------------------------------------
// The (amazing) diceRoll function
//------------------------------------------------------------------------------
int diceRoller(int min_value, int max_value)
{
int random;
srand ( static_cast <unsigned> (time(0)) );
while(1)
{
random = rand();
if((random >= min_value)&&(random <= max_value))
break;
}
return random;
}
//------------------------------------------------------------------------------
// The hit and miss functions
//------------------------------------------------------------------------------
void PlyAttackPct()
{
ExDam = (StatStr / 2) - 7;
if(ExDam <= 0){ExDam = 0;}
dice = diceRoller(1, 100);
if (dice <= PlyAttack)
{
cout << "HIT! ";
diceTwo = diceRoller(1, PlyATW) + ExDam;
DamDone = diceTwo - EnemyDef;
if (DamDone <= 0){DamDone = 1;}
gotoxy(41,19);cout << "You deal your opponent "<<DamDone<<" damage!\n\n";
EnemyHP = EnemyHP - DamDone;
}
if (dice >= PlyAttack)
{
cout << "miss...";
}
return;
}
void EnemyAttackPct()
{
dice = diceRoller(1, 100);
if (dice <= EnemyAttack)
{
cout << "HIT!";
diceTwo = diceRoller(1, EnemyATW);
ExDef = (StatDex / 2) - 7;
if(ExDef <= 0){ExDef = 0;}
EnemyDamDone = diceTwo - (MaxDefence + ExDef);
if (EnemyDamDone <= 0){EnemyDamDone = 1;}
gotoxy(41,24);cout << "You are struck for "<<EnemyDamDone<<" damage!\n\n";
PlyHP = PlyHP - EnemyDamDone;
}
if (dice >= EnemyAttack)
{
cout << "misses...";
}
return;
}
//------------------------------------------------------------------------------
// The Player Magic System
//------------------------------------------------------------------------------
void CastSpell()
{
system("cls");
TopBorder();
StatBorder();
if (Job == 'M'){MagicUserMagic();}
if (Job == 'C'){ClericMagic();}
return;
}
void MagicUserMagic()
{
system("cls");
TopBorder();
StatBorder();
cout << "\n\n What spell would you like to cast?\n\n";
cout << " (M)agic Missile (MP : 1 Damage : 1d6)\n";
cout << " (A)cid Rain (MP : 2 Damage : 1d6+1)\n";
cout << " (F)ireball (MP : 5 Damage : 1d8+1\n";
cout << " (D)eath Ray (MP : 8 Damage : 1d12\n";
cout << " ?";
cin >> Choice;
switch (Choice)
{
case 'M':
MagicMissile();
break;
case 'A':
AcidRain();
break;
case 'F':
Fireball();
break;
case 'D':
DeathRay();
break;
default:
MagicUserMagic();
break;
}
return;
}
void ClericMagic()
{
system("cls");
TopBorder();
StatBorder();
cout << "\n\n What spell would you like to cast?\n\n";
cout << " (H)eal (MP : 2 Heals 3 HP)\n";
cout << " (B)less (MP : 3 Raises Attack)\n";
cout << " (D)efensive Aura (MP : 3 Raise Defence)\n";
cout << " (R)ejuvenation (MP : 8 Heals 50% HP)\n";
cout << " ?";
cin >> Choice;
switch (Choice)
{
case 'H':
CureWounds();
break;
case 'B':
Bless();
break;
case 'D':
DefensiveAura();
break;
case 'R':
Rejuvenation();
break;
default:
ClericMagic();
break;
}
return;
}
void MagicMissile()
{
system("cls");
TopBorder();
StatBorder();
if(PlyMagic <= 1)
{
cout << "/n Not enough Magic!\n\n"<<endl;
}
else
{
dice = diceRoller(1, 6);
cout << "\n You send missiles of magic at your opponent!\n";
cout << " It is struck for "<<dice<<" points of damage!\n\n";
EnemyHP = EnemyHP - dice;
PlyMagic = PlyMagic - 1;
}
return;
}
void AcidRain()
{
system("cls");
TopBorder();
StatBorder();
if (PlyMagic <2)
{
cout << "/n Not enough Magic!\n\n"<<endl;
}
else
{
dice = (diceRoller(1, 6))+1;
cout << "\n You let corrosive acid, rain on your opponent!\n";
cout << " It is struck for "<<dice<<" points of damage!\n\n";
EnemyHP = EnemyHP - dice;
PlyMagic = PlyMagic - 2;
}
return;
}
void Fireball()
{system("cls");
TopBorder();
StatBorder();
if (PlyMagic <5)
{
cout << "/n Not enough Magic!\n\n"<<endl;
}
else
{
dice = (diceRoller(1, 8)+1);
cout << "\n You fling a scorching ball of fire unto your enemy!\n";
cout << " It is struck for "<<dice<<" points of damage!\n\n";
EnemyHP = EnemyHP - dice;
PlyMagic = PlyMagic - 5;
}
return;
}
void DeathRay()
{
system("cls");
TopBorder();
StatBorder();
if (PlyMagic <8)
{
cout << "/n Not enough Magic!\n\n"<<endl;
}
else
{
dice = diceRoller(1, 12);
cout << "\n You send a deadly ray of death at your enemy!\n";
cout << " It is struck for "<<dice<<" points of damage!\n\n";
EnemyHP = EnemyHP - dice;
PlyMagic = PlyMagic - 8;
}
return;
}
void CureWounds()
{
return;
}
void Bless()
{
return;
}
void DefensiveAura()
{
return;
}
void Rejuvenation()
{
return;
}
//------------------------------------------------------------------------------
// Future implementations
//------------------------------------------------------------------------------
/*
void SetSVGA()
{
_AX = 0x4f02;
_BX = 0x101;
geninterrupt (0x10);
}
void SetText()
{
_AX = 0x0003;
geninterrupt (0x10);
}*/
/* Never mind the following ....
{
srand(static_cast<unsigned>(time(0)));
int random_integer;
for(int index=0; index<10; index++)
{
random_integer = rand();
cout << random_integer << endl;
}
}
*/
#include <dos.h>
#include <mem.h>
#include <conio.h>
#include <ctime>
#include <windows.h>
#include <string>
//#include <msoftcon.h>
//#include <iomanip>
using namespace std;
//------------------------------------------------------------------------------
// Text Output Functions
//------------------------------------------------------------------------------
void DrawColorString(string szText, int X, int Y, WORD color)
{
HANDLE OutputH; // This will be used for our handle to the output (basically, holds permission to change the output settings)
COORD position = {X, Y}; // Create a COORD and set it's x and y to the X and Y passed in.
OutputH = GetStdHandle(STD_OUTPUT_HANDLE); // Get a OUTPUT handle to our screen.
SetConsoleTextAttribute(OutputH, color); // Set the text attribute to what ever color that was passed in.
// The function SetConsoleTextAttribute takes (the handle to the output, and the color);
SetConsoleCursorPosition(OutputH, position); // Set the cursor position to the desire position passed in.
cout << szText; // Now print out what we wanted to at the position that was passed in.
}
void gotoxy( int x, int y )
{
COORD c;
c.X = x - 1 ;
c.Y = y - 1 ;
SetConsoleCursorPosition( GetStdHandle( STD_OUTPUT_HANDLE ), c ) ;
}
//------------------------------------------------------------------------------
// All the variables and stuff like that
//------------------------------------------------------------------------------
// -- System
void SetSVGA();
void SetText();
void AltEnter();
// -- Setup
void TopBorder();
void introScreen();
void introStory();
void NameCharacter();
void CharacterSelect();
void StatAssign();
void StatBorder();
void introWelcomeOne();
void introWelcomeTwo();
void introWelcomeThree();
void introWelcomeFour();
// -- The Game
void mainGameLoop();
void AtTheInn();
void InTheTemple();
void TempleQuest();
void InTheMagicShop();
void GymnasiumTrain();
void SeekChallenge();
void CityGates();
void OpenFieldOne();
void RockyPassageOne();
void ForestOne();
void DenseWoodOne();
void DenseWoodTwo();
void DenseSmallPassage();
void DensePSGRandom();
void DensePSGFightInit();
void DensePSGFighting();
void DensePSGFightProcess();
void DensePSGFight();
void DenseTheHoleOne();
void AtTheFarm();
void ZombieAttack();
void FightFarm();
void FarmFight();
void FarmFightProcess();
void TheCellar();
void CellarRoomOne();
void CellarRoomTwo();
void CellarRoomQuest();
void NecroAttack();
void FightNecro();
void NecroFight();
void NecroFightProcess();
// -- Magic
void CastSpell();
// -- Raising the Character
void LevelUp();
void StrenghtRaise();
void DexterityRaise();
void HitPointRaise();
void AttackRaise();
void DefenceRaise();
void MagicRaise();
//---- Game Engine Specifics ----
//---- Melee Combat ----
void PlyAttackPct();
void EnemyAttackPct();
//---- Magic Engine ----
void MagicUserMagic();
void ClericMagic();
void MagicMissile();
void AcidRain();
void Fireball();
void DeathRay();
void CureWounds();
void Bless();
void DefensiveAura();
void Rejuvenation();
//---- Outro ----
void TheEnd();
//---- Variables for other stuff ----
int StatStr;
int StatDex;
int StatInt;
int MaxHp;
int MaxDefence;
int MaxMagic;
int PlyHP;
int PlyAttack;
int PlyMagic;
int PlyGold = 5;
int PlyExperience = 0;
int tempGold;
int NumberDay = 1;
int PlyLevel = 1;
int FarmCheck = 0;
int FarmCheckRest = 0;
int EnemyAttack;
int EnemyMaxHP;
int EnemyDef;
int EnemyGold;
int EnemyHP;
int EnemyExp;
int TempleCheck = 0;
int diceRoller(int min_value, int max_value);
int dice;
int diceTwo;
int DamDone;
int PlyATW;
int ExDam;
int ExDef;
int EnemyDamDone;
int EnemyATW;
int TempInt;
int NextLevel = 100;
char NameOfPlayer[50];
char Player;
char Choice;
char Job;
char PlyWeapon;
int main()
{
/* SetSVGA();
SetText();*/
AltEnter();
//init_graphics();
system("cls");
TopBorder();
introScreen();
introStory();
NameCharacter();
CharacterSelect();
StatAssign();
introWelcomeOne();
introWelcomeTwo();
introWelcomeThree();
introWelcomeFour();
mainGameLoop();
TheEnd();
return 0;
}
void TopBorder()
{
DrawColorString("", 0, 1, FOREGROUND_RED|FOREGROUND_GREEN|BACKGROUND_BLUE);
cout <<"\xda\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xbf";
cout <<"\xb3 F.o.r.g.o.t.t.e.n H.e.r.o.e.s V0.3b \xb3";
cout <<"\xc0\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\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d\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcf\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xbe";
gotoxy(74,7);cout << ""<<StatStr<<"";
gotoxy(74,9);cout << ""<<StatDex<<"";
gotoxy(74,11);cout << ""<<StatInt<<"";
gotoxy(10,7);cout <<""<<NameOfPlayer<<"";
gotoxy(16,9);cout <<""<<PlyExperience<<"/"<<NextLevel<<"";
gotoxy(16,11);cout <<""<<PlyAttack<<"";
gotoxy(16,13);cout <<""<<MaxDefence<<" + "<<ExDef<<"";
gotoxy(40,7);cout <<""<<PlyLevel<<"";
gotoxy(40,9);cout <<""<<PlyGold<<"";
gotoxy(40,11);
if (PlyWeapon == 0){cout << "Hands 1d"<<PlyATW<<"+"<<ExDam<<"\n";}
if (PlyWeapon == 1){cout << "Dagger 1d"<<PlyATW<<"+"<<ExDam<<"\n";}
if (PlyWeapon == 2){cout << "Warhammer 1d"<<PlyATW<<"+"<<ExDam<<"\n";}
if (PlyWeapon == 3){cout << "Sword 1d"<<PlyATW<<"+"<<ExDam<<"\n";}
if (PlyWeapon == 4){cout << "Axe 1d"<<PlyATW<<"+"<<ExDam<<"\n";}
if (PlyWeapon == 5){cout << "Halberd 1d"<<PlyATW<<"+"<<ExDam<<"\n";}
gotoxy(40,13);cout <<""<<PlyHP<<"/"<<MaxHp<<"";
gotoxy(54,7);cout <<""<<Job<<"";
gotoxy(54,9);cout <<""<<NumberDay<<"";
if (Job == 'M')
{
gotoxy(68,13);cout <<""<<PlyMagic<<"/"<<MaxMagic<<"";
}
if (Job == 'C')
{
gotoxy(68,13);cout <<""<<PlyMagic<<"/"<<MaxMagic<<"";
}
DrawColorString("Name :", 2, 6, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Day :", 45, 8 , FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Level :", 25, 6, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Class :", 45, 6, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Strenght :", 59, 6, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Dexterity :", 59, 8, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Inteligence :", 59, 10, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Experience :", 2, 8, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Gold :", 25, 8, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Attack :", 2, 10, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Weapon :", 25, 10, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Defence :", 2, 12, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("Hit Points :", 25, 12, FOREGROUND_RED | FOREGROUND_BLUE);
if (Job == 'M')
{
DrawColorString("Mana :", 59,12, FOREGROUND_RED | FOREGROUND_BLUE);
}
if (Job == 'C')
{
DrawColorString("Mana :", 59,12, FOREGROUND_RED | FOREGROUND_BLUE);
}
DrawColorString("", 80, 50, FOREGROUND_RED | FOREGROUND_GREEN);
cout << "\n\n";
}
void introScreen()
{
cout <<"\n\n\n\n\n\n\n\n\n\n THIS GAME IS CASE SENSITIVE - DON'T FORGET TO TURN CAPS ON!\n\n\n\n\n\n\n";
cout <<" This game is V0.3b, which means, it is playable, but many functions are not\n";
cout <<" yet implemented. Magic is not very usable, so it is recomended, NOT to play as\n";
cout <<" a magic-user or cleric yet! Though it's quite enjoyable as a fighter :)\n\n";
cout <<" To exit the game, keep pressing CTRL + C, until it exits....\n";
DrawColorString("\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2", 0, 20, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2", 0, 28, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 0, 21, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 0, 22, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 0, 23, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 0, 24, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 0, 25, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 0, 26, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 0, 27, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 79, 21, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 79, 22, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 79, 23, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 79, 24, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 79, 25, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 79, 26, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("\xb2", 79, 27, FOREGROUND_RED | FOREGROUND_BLUE);
DrawColorString("",80,60, FOREGROUND_BLUE | FOREGROUND_GREEN);
getch();
system("cls");
return;
}
void introStory()
{
TopBorder();
cout <<"\n\n";
cout <<" Welcome to Forgotten Heroes! A game where you set off in hot pursuit of fame\n";
cout <<" and adventure! You, like so many other heroes of today, have been summoned to\n";
cout <<" Crowenburg, in the hope of finding glory and riches, while valiantly defending\n";
cout <<" peace and the forces of good....";
cout <<"\n\n\n\n\n\n\n\n";
getch();
system("cls");
return;
}
//------------------------------------------------------------------------------
// Character Generation
//------------------------------------------------------------------------------
void NameCharacter()
{
TopBorder();
cout <<"\n\n\n\n By which name shall you be known (no spaces allowed)?\n";
cout <<" ?";
cin >> NameOfPlayer;
cout <<"\n\n\n\n\n\n\n\n";
system("cls");
return ;
}
void CharacterSelect()
{
TopBorder();
cout <<"\n\n\n So, "<<NameOfPlayer<<", what profession do you practice?\n\n";
cout <<"--------------------------------------------------------------------------------\n";
cout <<" (F) ighter\n";
cout <<" (R) ogue\n";
cout <<" (M) agic-User\n";
cout <<" (C) leric\n\n\n\n";
cout <<" ?";
cin >> Choice;
switch (Choice)
{
case 'F':
Job = 'F';
break;
case 'R':
Job = 'R';
break;
case 'M':
Job = 'M';
break;
case 'C':
Job = 'C';
break;
default:
CharacterSelect();
break;
}
/*
if (Choice == 'F'){Job = 'F';}
if (Choice == 'R'){Job = 'R';}
if (Choice == 'M'){Job = 'M';}
if (Choice == 'C'){Job = 'C';}
else */
PlyWeapon = 0;
system("cls");
return;
}
//------------------------------------------------------------------------------
// Intro Story
//------------------------------------------------------------------------------
void introWelcomeOne()
{
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" You travelled long and far, and";
gotoxy(3,18);cout <<"reached Crowenburg a little later";
gotoxy(3,19);cout <<"than youexpected. You're now";
gotoxy(3,20);cout <<"standing in the town center, a";
gotoxy(3,21);cout <<"busy place, where people rush back";
gotoxy(3,22);cout <<"and forth, on unknown errands.";
getch();
system("cls");
return;
}
void introWelcomeTwo()
{
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" You are quick to locate an inn";
gotoxy(3,18);cout <<"called 'The Golden Dragon', whose";
gotoxy(3,19);cout <<"name alone,fitted your tastes.";
getch();
system("cls");
return;
}
void introWelcomeThree()
{
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" A sudden rustle in the air, made";
gotoxy(3,18);cout <<"people scream, and they run for it!";
gotoxy(3,19);cout <<"name alone,fitted your tastes.";
gotoxy(3,20);cout <<"A huge reptile with wings, have";
gotoxy(3,21);cout <<"anded on a nearby rooftop, with a";
gotoxy(3,22);cout <<"black-clad rider atop. When the";
gotoxy(3,23);cout <<"panic had settled a bit, the rider";
gotoxy(3,24);cout <<"shouted in an unnatural voice :";
gotoxy(3,26);cout <<"'PEOPLE OF CROWENBURG! YOU HAVE BEEN";
gotoxy(3,27);cout <<"CHALLENGED TO PRODUCE A CHAMPION";
gotoxy(3,28);cout <<"WORTHY TO MEET MY LORD ATHAMOS IN";
gotoxy(3,29);cout <<"OPEN COMBAT! I WILL HAVE YOUR CHOSEN";
gotoxy(3,30);cout <<"HERE. BUT DO NOT WASTE TIME!'";
getch();
system("cls");
return;
}
void introWelcomeFour()
{
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" After shouting his challenge, both";
gotoxy(3,18);cout <<"steed and rider, turns to stone,";
gotoxy(3,19);cout <<"perched on the rooftop, only a red";
gotoxy(3,20);cout <<"shimmering light emitting from the ";
gotoxy(3,21);cout <<"deepset eyes.";
getch();
system("cls");
return;
}
//------------------------------------------------------------------------------
// In the city of Crowenburg
//------------------------------------------------------------------------------
void mainGameLoop()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" Crowenburg Town Center";
gotoxy(3,18);cout <<"";
gotoxy(3,19);cout <<" There's a lot of people walking";
gotoxy(3,20);cout <<"around the place, preoccupied with";
gotoxy(3,21);cout <<"their own businesses.";
gotoxy(3,22);cout <<"";
gotoxy(3,23);cout <<"";
gotoxy(41,17);cout <<"(S)eek Rider (Accept the challenge)";
gotoxy(41,18);cout <<"(I)nn (Rest # 1 Gold)";
gotoxy(41,19);cout <<"(T)emple (Healing # 10 Gold)";
gotoxy(41,20);cout <<"(M)agic shop (Recharge # 25 Gold)";
gotoxy(41,21);cout <<"(G)ymnasium (Train abilities)";
gotoxy(41,22);cout <<"(A)rmoury (NOT IMPLEMENTED YET!)";
gotoxy(41,23);cout <<"(L)eave town";
gotoxy(3,34);cout <<"? ";cin >> Choice;
switch (Choice)
{
case 'S':
SeekChallenge();
break;
case 'I':
AtTheInn();
break;
case 'T':
InTheTemple();
break;
case 'M':
InTheMagicShop();
break;
case 'G':
GymnasiumTrain();
break;
case 'L':
CityGates();
break;
default:
mainGameLoop();
break;
}
/*
if (Choice == 'I'){AtTheInn();}
if (Choice == 'T'){InTheTemple();}
if (Choice == 'M'){InTheMagicShop();}
if (Choice == 'G'){GymnasiumTrain();}
if (Choice == 'L'){CityGates();}
if (Choice == 'S'){SeekChallenge();}
*/
system("cls");
return;
}
void AtTheInn()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" 'The Golden Dragon'";
gotoxy(3,18);cout <<"Around you, people are shouting and ";
gotoxy(3,19);cout <<"drinking. Generally, they seem to be";
gotoxy(3,20);cout <<"having a wonderful time.";
if (FarmCheckRest == 0){
gotoxy(3,22);cout <<" You overhear someone saying, 'I ";
gotoxy(3,23);cout <<"hear the old farmer was killed by";
gotoxy(3,24);cout <<"an evil wizard! One of them ";
gotoxy(3,25);cout <<"necromancer kinda ones!'";}
if (FarmCheckRest == 1){
gotoxy(3,22);cout <<" You sense, that some of the people";
gotoxy(3,23);cout <<"here know, you were the one, who";
gotoxy(3,24);cout <<"avenged the old farmer. Some even";
gotoxy(3,25);cout <<"smile at you!";
FarmCheckRest = 2;}
gotoxy(41,17);cout <<" Do you require rest?";
gotoxy(41,19);cout <<"(Y)es, turn in for the night";
gotoxy(41,20);cout <<"(N)o, I'm not even sleepy yet!\n";
gotoxy(3,34);cout <<" ?";cin >> Choice;
switch (Choice)
{
case 'Y':
{
if(PlyGold < 1)
{
gotoxy(41,34);cout << "Sorry not enough gold!"<<endl;
}
else
{
PlyGold = PlyGold - 1;
PlyHP = PlyHP + (PlyHP / 2);
if (PlyHP >= MaxHp)
{PlyHP = MaxHp;}
PlyMagic++;
if (PlyMagic >= MaxMagic)
{PlyMagic = MaxMagic;}
gotoxy(41,34);cout <<"You sleep securely through the night" <<endl;
NumberDay++;
}
}
break;
case 'N':
{
gotoxy(41,34);cout <<" Ok, we'll keep a bed ready\n\n";
}
break;
default :
AtTheInn();
break;
}
getch();
mainGameLoop();
return;
}
void InTheTemple()
{
system("cls");
TopBorder();
StatBorder();
if (TempleCheck == 0 && FarmCheckRest == 2){TempleQuest();}
gotoxy(3,17);cout <<" Temple of Manag";
gotoxy(3,19);cout <<" Along the walls of the midship, ";
gotoxy(3,20);cout <<"monks and priests, are in deep ";
gotoxy(3,21);cout <<"prayer. At the altar, at the end ";
gotoxy(3,22);cout <<"of the temple, the High Priest ";
gotoxy(3,23);cout <<"Gomgha, is ready toheal the ";
gotoxy(3,24);cout <<"wounds of visitors.";
if (TempleCheck == 1){
gotoxy(3,26);cout <<"'Remember the witch!'";
}
gotoxy(41,17);cout <<"Do you require healing?";
gotoxy(41,19);cout <<"(Y)es, patch me up!";
gotoxy(41,20);cout <<"(N)o, it's only a fleshwound!";
gotoxy(3,34);cout <<" ?";cin >> Choice;
switch(Choice)
{
case 'Y':
{
if(PlyGold < 10)
{
gotoxy(41,34);cout << "Sorry not enough gold!";
}
else
{
PlyGold = PlyGold - 10;
PlyHP = MaxHp;
gotoxy(41,34);cout <<"You feel better already";
}
break;
}
case 'n':
{
gotoxy(41,34);cout <<"Blessings unto you";
}
break;
default:
InTheTemple();
break;
}
getch();
mainGameLoop();
return;
}
void TempleQuest()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" Temple of Manag";
gotoxy(3,19);cout <<" Gomgha turns to you and speaks:";
gotoxy(3,20);cout <<"'Well done dealing with that";
gotoxy(3,21);cout <<"necromancer, he was starting to";
gotoxy(3,22);cout <<"cause unrest. I have a job for";
gotoxy(3,23);cout <<"you, should you chose to accept";
gotoxy(3,24);cout <<"it... in the northern forest,";
gotoxy(3,25);cout <<"there is an evil witch, who have";
gotoxy(3,26);cout <<"poisoned the minds, of some of";
gotoxy(3,27);cout <<"the cityfolk... we of the church";
gotoxy(3,28);cout <<"would like to see an end to that";
getch();
TempleCheck = 1;
InTheTemple();
return;
}
void InTheMagicShop()
{
system("cls");
TopBorder();
StatBorder();
if (Job == 'F')
{
gotoxy(41,34); cout <<"You do not have any magic abilities!";
getch();
mainGameLoop();
}
if (Job == 'R')
{
gotoxy(41,34); cout <<"You do not have any magic abilities!";
getch();
mainGameLoop();
}
gotoxy(3,17);cout <<" Crowenburg Magic Shop";
gotoxy(3,19);cout <<" Strange smells, fill the air around";
gotoxy(3,20);cout <<"you, and lesser spells, fizzle";
gotoxy(3,21);cout <<"harmlessly around your feet. The old";
gotoxy(3,22);cout <<"shopkeeper Kilam, is looking at you ";
gotoxy(3,23);cout <<"from over the edge, of his broken ";
gotoxy(3,24);cout <<"glasses.";
gotoxy(41,17);cout <<"Do you require a recharge?";
gotoxy(41,19);cout <<"(Y)es, fill me up!";
gotoxy(41,20);cout <<"(N)o thanks";
gotoxy(3,34);cout <<" ?";cin >> Choice;
switch (Choice)
{
case 'Y':
{
if(PlyGold < 25)
{
gotoxy(41,34);cout << "Sorry not enough gold!"<<endl;
}
else
{
PlyGold = PlyGold - 25;
PlyHP = MaxHp;
gotoxy(41,34);cout <<"You feel recharged" <<endl;
}
}
break;
case'N':
{
gotoxy(41,34);cout <<"Ok, come back when you need more power";
}
break;
default:
InTheMagicShop();
break;
}
getch();
mainGameLoop();
return;
}
void GymnasiumTrain()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" Crowenburg Gymnasium";
gotoxy(3,19);cout <<" All sorts of wanna-be heroes train";
gotoxy(3,20);cout <<"and hone their skills, either with";
gotoxy(3,21);cout <<"each other or alone, in deep concen-";
gotoxy(3,22);cout <<"tration.";
gotoxy(41,17);cout <<"Do you wish to train?";
gotoxy(41,19);cout <<"(Y)es, I'm ready!";
gotoxy(41,20);cout <<"(N)o thanks";
gotoxy(3,34);cout <<" ?";cin >> Choice;
switch (Choice)
{
case 'Y':
{
if(PlyExperience < NextLevel)
{
gotoxy(41,34);cout << "Sorry not enough experience!";
}
else
{
PlyLevel++;
NextLevel = NextLevel + (100 * PlyLevel);
if (Job == 'F')
{dice = diceRoller(1,6);
MaxHp = MaxHp + dice;
diceTwo = diceRoller(1,100);
if (diceTwo >= 90)
{
dice = diceRoller(1,3);
PlyAttack = PlyAttack + dice;
}
}
if (Job == 'R')
{dice = diceRoller(1,4);
MaxHp = MaxHp + dice;
diceTwo = diceRoller(1,100);
if (diceTwo >= 90)
{
MaxDefence++;
}
}
if (Job == 'C')
{dice = diceRoller(1,4);
MaxHp = MaxHp + dice;
diceTwo = diceRoller(1,100);
if (diceTwo >= 90)
{
dice = diceRoller(1,2);
PlyMagic = PlyMagic + dice;
}
}
if (Job == 'M')
{dice = diceRoller(1,2);
MaxHp = MaxHp + dice;
diceTwo = diceRoller(1,100);
if (diceTwo >= 90)
{
dice = diceRoller(1,4);
PlyMagic = PlyMagic + dice;
}
}
}
LevelUp();
}
break;
case 'N':
{
gotoxy(41,34);cout <<"Come back when you need a lesson";
}
break;
default:
GymnasiumTrain();
break;
}
getch();
mainGameLoop();
return;
}
//------------------------------------------------------------------------------
// Just outside Crowenburg - Crossroad
//------------------------------------------------------------------------------
void CityGates()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" Crowenburg Crossroads";
gotoxy(3,19);cout <<" You are standing a few paces";
gotoxy(3,20);cout <<"outside the city of Crowenburg.";
gotoxy(3,21);cout <<"Nearby, you can see, an open field,";
gotoxy(3,22);cout <<"a rocky passage, a forest and a";
gotoxy(3,23);cout <<"dense wood.";
gotoxy(41,17);cout <<"Where do you want to go from here?";
gotoxy(41,19);cout <<"(C)rowenburg";
gotoxy(41,20);cout <<"(O)pen field";
gotoxy(41,21);cout <<"(R)ocky passage";
gotoxy(41,22);cout <<"(F)orest";
gotoxy(41,23);cout <<"(D)ense wood";
gotoxy(3,34);cout <<" ?";cin >> Choice;
switch (Choice)
{
case 'C':
mainGameLoop();
break;
case 'O':
OpenFieldOne();
break;
case 'R':
RockyPassageOne();
break;
case 'F':
ForestOne();
break;
case 'D':
DenseWoodOne();
break;
default:
CityGates();
break;
}
/*
if (Choice == 'C'){mainGameLoop();}
if (Choice == 'O'){OpenFieldOne();}
if (Choice == 'R'){RockyPassageOne();}
if (Choice == 'F'){ForestOne();}
if (Choice == 'D'){DenseWoodOne();}
*/
system("cls");
return;
getch();
mainGameLoop();
return;
}
//------------------------------------------------------------------------------
// The Road to Ancorheim
//------------------------------------------------------------------------------
void RockyPassageOne()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" Rocky Passage";
gotoxy(3,19);cout <<" You are on a rocky passage leading";
gotoxy(3,20);cout <<"eastward to the city of Anchorheim.";
gotoxy(3,21);cout <<"The cool wind is blowing in from ";
gotoxy(3,22);cout <<"between the huge rocks. You do not";
gotoxy(3,23);cout <<"want to stick around this place for";
gotoxy(3,24);cout <<"too long.";
gotoxy(41,17);cout <<"NO ROAD HERE YET!";
gotoxy(41,18);cout <<"";
gotoxy(3,34);cout <<"? ";cin >> Choice;
getch();
CityGates();
return;
}
//------------------------------------------------------------------------------
// The Forest
//------------------------------------------------------------------------------
void ForestOne()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" The Forest";
gotoxy(3,19);cout <<" You are in the forest to the west";
gotoxy(3,20);cout <<"of Crowenburg. Birds are chirping ";
gotoxy(3,21);cout <<"cheerfully in the trees. The moss under ";
gotoxy(3,22);cout <<"your feet, gives in softly as you walk.";
gotoxy(3,23);cout <<"There's a sweet smell of flowers in the";
gotoxy(3,24);cout <<"air.";
gotoxy(41,17);cout <<"NO ROAD HERE YET!";
gotoxy(41,18);cout <<"";
gotoxy(3,34);cout <<"? ";cin >> Choice;
getch();
CityGates();
return;
}
//------------------------------------------------------------------------------
// The Dense Woods
//------------------------------------------------------------------------------
void DenseWoodOne()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" The Dense Wood";
gotoxy(3,19);cout <<" You are the dense northern woods.";
gotoxy(3,20);cout <<"not much light is passing through ";
gotoxy(3,21);cout <<"the heavy treetops. There is an ";
gotoxy(3,22);cout <<"eerie silence...";
gotoxy(41,17);cout <<"(F)urther North";
gotoxy(41,18);cout <<"(A) small passage";
gotoxy(41,19);cout <<"(O)utside Crowenburg";
gotoxy(3,34);cout <<"? ";cin >> Choice;
switch (Choice)
{
case 'F':
DenseWoodTwo();
break;
case 'A':
DenseSmallPassage();
break;
case 'O':
CityGates();
break;
default:
DenseWoodOne();
break;
}
/*
if (Choice == 'F'){DenseWoodTwo();}
if (Choice == 'A'){DenseSmallPassage();}
if (Choice == 'O'){CityGates();}
*/
return;
}
void DenseWoodTwo()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" In the dark forest";
gotoxy(3,19);cout <<" The air is standing still here, and";
gotoxy(3,20);cout <<"only a few lazy insects are flying";
gotoxy(3,21);cout <<"around, making the place as silent as";
gotoxy(3,22);cout <<"a tomb.";
gotoxy(41,17);cout <<"(F)urther north";
gotoxy(41,17);cout <<"(E)ast towards a clearing";
gotoxy(41,17);cout <<"(W)est";
gotoxy(41,17);cout <<"(B)eginning of the forest";
gotoxy(3,34);cout <<"? ";cin >> Choice;
/* switch(Choice)
{
case 'F':
DenseWoodThree()
break;
case 'E':
DenseClearing()
break;
case 'W':
DenseWestOne()
break;
case 'B':
DenseWoodOne()
break;
default:
DenseWoodTwo()
break;
}*/
getch();
DenseWoodOne();
return;
}
void DenseSmallPassage()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" A passage in the trees";
gotoxy(3,19);cout <<" You make your way through the thick";
gotoxy(3,20);cout <<"underbrush, along the unseen path. A";
gotoxy(3,21);cout <<"heavy smell of animals, assault your";
gotoxy(3,22);cout <<"nostrils. There is a hole in the";
gotoxy(3,23);cout <<"ground, wide enough, for you to ";
gotoxy(3,24);cout <<"squeeze in.";
dice = diceRoller(1, 100);
if (dice <= 20){DensePSGRandom();}
gotoxy(41,17);cout <<"(B)ack to the main road";
gotoxy(41,18);cout <<"(H)ole in the ground";
gotoxy(3,34);cout <<"? ";cin >> Choice;
switch (Choice)
{
case 'B':
DenseWoodOne();
break;
case 'H':
DenseTheHoleOne();
break;
default:
DenseSmallPassage();
break;
}
return;
}
void DensePSGRandom()
{
gotoxy(41,20);cout <<"Suddenly, you encounter a ";
dice = diceRoller(1, 4);
if (dice == 1){cout <<"wild dog\n\n"; getch(); TempInt = 1; DensePSGFightInit();}
if (dice == 2){cout <<"rabid badger\n\n";getch(); TempInt = 2; DensePSGFightInit();}
if (dice == 3){cout <<"lone wolf\n\n";getch(); TempInt = 3; DensePSGFightInit();}
if (dice == 4){cout <<"black bear\n\n";getch(); TempInt = 4; DensePSGFightInit();}
getch();
return;
}
void DenseTheHoleOne()
{
system("cls");
TopBorder();
StatBorder();
cout <<" The hole.";
getch();
return;
}
void DensePSGFightInit()
{
if (TempInt == 1)
{
EnemyAttack = 25;
EnemyMaxHP = 20;
EnemyDef = 1;
EnemyGold = 5;
EnemyHP = EnemyMaxHP;
EnemyExp = 15;
EnemyATW = 4;
}
if (TempInt == 2)
{
EnemyAttack = 20;
EnemyMaxHP = 18;
EnemyDef = 2;
EnemyGold = 5;
EnemyHP = EnemyMaxHP;
EnemyExp = 15;
EnemyATW = 5;
}
if (TempInt == 3)
{
EnemyAttack = 30;
EnemyMaxHP = 25;
EnemyDef = 3;
EnemyGold = 10;
EnemyHP = EnemyMaxHP;
EnemyExp = 20;
EnemyATW = 5;
}
if (TempInt == 4)
{
EnemyAttack = 25;
EnemyMaxHP = 40;
EnemyDef = 1;
EnemyGold = 15;
EnemyHP = EnemyMaxHP;
EnemyExp = 30;
EnemyATW = 6;
}
DensePSGFight();
return;
}
void DensePSGFighting()
{
system("cls");
TopBorder();
StatBorder ();
if(EnemyHP <= 0)
{
gotoxy(41,18);cout <<"You defeated your foe!";
gotoxy(41,20);cout <<"Gained " << EnemyGold << " Gold!";
gotoxy(41,21);cout <<"Gained " << EnemyExp << " Experience!";
PlyGold = PlyGold + EnemyGold;
PlyExperience = PlyExperience + EnemyExp;
EnemyHP = EnemyMaxHP;
getch();
DenseSmallPassage();
}
if(PlyHP <= 0)
{
gotoxy(41,18);cout <<"You were defeated in combat!" ;
gotoxy(41,20);cout <<"You lost gold and experience and";
gotoxy(41,21);cout <<"are back in 'The Golden Dragon'!";
PlyGold = PlyGold - (PlyGold / 3);
PlyExperience = PlyExperience - (PlyExperience / 4);
PlyHP = MaxHp / 2;
getch();
mainGameLoop();
}
DensePSGFight();
return;
}
void DensePSGFightProcess()
{
system("cls");
TopBorder();
StatBorder ();
if (Choice == 'C')
{
cout << "\n\n ";
getch();
gotoxy(41,17);cout << "Your enemy strikes out at you!";
gotoxy(41,18);cout << "And it ";
EnemyAttackPct();
cout << "\n\n\n";
}
else
{
gotoxy(41,17);cout << "You strike out at your enemy!";
gotoxy(41,18);cout << "And you ";
PlyAttackPct();
getch();
gotoxy(41,22);cout << "The enemy strikes out at you!\n";
gotoxy(41,23);cout << "And it ";
EnemyAttackPct();
cout << "\n\n\n";
getch();
DensePSGFighting();
}
return;
}
void DensePSGFight()
{
system("cls");
TopBorder();
StatBorder ();
gotoxy(6,17);cout <<"You are engaged in combat!";
gotoxy(6,19);cout <<"Opponent Hit Points :" << EnemyHP << " / " <<EnemyMaxHP<< "";
gotoxy(41,17);cout <<"(A)ttack";
gotoxy(41,18);cout <<"(F)lee";
if (Job == 'M'){gotoxy(41,21);cout << "(C)ast spell";}
if (Job == 'C'){gotoxy(41,21);cout << "(C)ast spell";}
gotoxy(3,34);cout <<" ?";cin >> Choice;
switch (Choice)
{
case 'F':
PlyExperience = PlyExperience - (PlyExperience / 50);
if (PlyExperience <= 0){PlyExperience = 0;}
DenseWoodOne();
break;
case 'A':
DensePSGFightProcess();
break;
case 'C':
{
if (Job = 'M'||'C')
{
CastSpell();
gotoxy(41,17);cout << "The enemy strikes out at you!";
gotoxy(41,18);cout << " And it ";
EnemyAttackPct();
cout << "\n\n\n";
getch();
DensePSGFighting();
}
else
gotoxy(41,34);cout << "You cannot use magic!";
DensePSGFight();
}
break;
default:
DensePSGFight();
break;
}
}
//------------------------------------------------------------------------------
// The farm, the open field, the Cellar - and the farm subquest
//------------------------------------------------------------------------------
void OpenFieldOne()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" The Open Field";
gotoxy(3,19);cout <<" You are on an open field. In the";
gotoxy(3,20);cout <<"distance you can see an old farm ";
gotoxy(3,21);cout <<"house.";
gotoxy(41,17);cout <<"(F)arm";
gotoxy(41,18);cout <<"(O)utside Crowenburg";
gotoxy(3,34);cout <<"? ";cin >> Choice;
switch (Choice)
{
case 'F':
AtTheFarm();
break;
case 'O':
CityGates();
break;
default:
OpenFieldOne();
break;
}
/*
if (Choice == 'F'){AtTheFarm();}
if (Choice == 'O'){CityGates();}
*/
getch();
CityGates();
return;
}
void AtTheFarm()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" The Farm";
gotoxy(3,19);cout <<" You are in the old farm. Moldy";
gotoxy(3,20);cout <<"boards are barely holding this";
gotoxy(3,21);cout <<"heap of logs together. There is a";
gotoxy(3,22);cout <<"foul odeur here, like that, of a";
gotoxy(3,23);cout <<"rotting corpse.";
getch();
if (FarmCheckRest == 0){
if (FarmCheck == 0){ZombieAttack();}
if (FarmCheck == 1){gotoxy(3,25);cout <<" The corpse of the old farmer is";
gotoxy(3,26);cout <<"lying here.";}
}
if (FarmCheckRest == 1)
{gotoxy(3,25);cout <<" The spirit of the old farmer, has ";
gotoxy(3,26);cout <<"left the house, and has found peace.";}
gotoxy(41,17);cout <<"(T)he cellar";
gotoxy(41,18);cout <<"(O)pen field";
gotoxy(3,34);cout <<"? ";cin >> Choice;
switch (Choice)
{
case 'T':
TheCellar();
break;
case 'O':
OpenFieldOne();
break;
default:
AtTheFarm();
break;
}
/*
if (Choice == 'T'){TheCellar();}
if (Choice == 'O'){OpenFieldOne();}
*/
getch();
}
void ZombieAttack()
{
gotoxy(41,20);cout <<"You are attacked by the reanimated";
gotoxy(41,21);cout <<"corpse of the old farmer!";
if (PlyLevel == 1)
{
EnemyAttack = 25;
EnemyMaxHP = 20;
EnemyDef = 1;
EnemyGold = 5;
EnemyHP = EnemyMaxHP;
EnemyExp = 15;
EnemyATW = 4;
}
if (PlyLevel == 2)
{
EnemyAttack = 25;
EnemyMaxHP = 25;
EnemyDef = 2;
EnemyGold = 5;
EnemyHP = EnemyMaxHP;
EnemyExp = 10;
EnemyATW = 4;
}
if (PlyLevel >= 3)
{
EnemyAttack = 30;
EnemyMaxHP = 30;
EnemyDef = 3;
EnemyGold = 5;
EnemyHP = EnemyMaxHP;
EnemyExp = 5;
EnemyATW = 6;
}
FarmFight();
FarmCheck = 1;
AtTheFarm();
return;
}
void FightFarm()
{
system("cls");
TopBorder();
StatBorder ();
if(EnemyHP <= 0)
{
FarmCheck = 1;
gotoxy(41,18);cout <<"You defeated your foe!";
gotoxy(41,20);cout <<"Gained " << EnemyGold << " Gold!";
gotoxy(41,21);cout <<"Gained " << EnemyExp << " Experience!";
PlyGold = PlyGold + EnemyGold;
PlyExperience = PlyExperience + EnemyExp;
EnemyHP = EnemyMaxHP;
getch();
AtTheFarm();
}
if(PlyHP <= 0)
{
gotoxy(41,18);cout <<"You were defeated in combat!" ;
gotoxy(41,20);cout <<"You lost gold and experience and";
gotoxy(41,21);cout <<"are back in 'The Golden Dragon'!";
PlyGold = PlyGold - (PlyGold / 3);
PlyExperience = PlyExperience - (PlyExperience / 4);
PlyHP = MaxHp / 2;
getch();
mainGameLoop();
}
FarmFight();
return;
}
void FarmFightProcess()
{
system("cls");
TopBorder();
StatBorder ();
if (Choice == 'C')
{
getch();
gotoxy(41,18);cout << "The zombie strikes out at you!";
gotoxy(41,19);cout << "And it ";
EnemyAttackPct();
}
else
{
gotoxy(41,18);cout << "You strike out at the zombie!";
gotoxy(41,19);cout << "And you ";
PlyAttackPct();
getch();
gotoxy(41,22);cout << "The zombie strikes out at you!";
gotoxy(41,23);cout << "And it ";
EnemyAttackPct();
getch();
FightFarm();
}
return;
}
void FarmFight()
{
system("cls");
TopBorder();
StatBorder ();
gotoxy(3,20);cout <<"You are attacked by the reanimated";
gotoxy(3,21);cout <<"corpse of the old farmer!";
gotoxy(3,23);cout <<"Opponent Hit Points : " << EnemyHP << "/" <<EnemyMaxHP<<"";
gotoxy(41,17);cout <<"(A)ttack\n";
gotoxy(41,18);cout <<"(F)lee\n";
if (Job == 'M'){gotoxy(41,19);cout << "(C)ast spell\n";}
if (Job == 'C'){gotoxy(41,19);cout << "(C)ast spell\n";}
gotoxy(3,34);cout <<" ?";cin >> Choice;
switch (Choice)
{
case 'F':
PlyExperience = PlyExperience - (PlyExperience / 50);
if (PlyExperience <= 0){PlyExperience = 0;}
OpenFieldOne();
break;
case 'A':
FarmFightProcess();
break;
case 'C':
{
if (Job = 'M'||'C')
{
CastSpell();
cout << "\n\n\n\n The zombie strikes out at you!\n";
cout << " And it ";
EnemyAttackPct();
cout << "\n\n\n";
getch();
FightFarm();
}
else
cout << "\n\n You cannot use magic!";
FarmFight();
}
break;
default:
FarmFight();
break;
}
}
void TheCellar()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" The Cellar";
gotoxy(3,19);cout <<" You descend the stairs into a damp";
gotoxy(3,20);cout <<"and dark cellar. Light is coming ";
gotoxy(3,21);cout <<"down from cracks in the ceiling";
gotoxy(3,22);cout <<"above. Around you, some crates and";
gotoxy(3,23);cout <<"barrels litter the floor. On the far";
gotoxy(3,24);cout <<"side of the northern wall, is a door";
gotoxy(3,25);cout <<"leading into darkness.";
gotoxy(41,17);cout <<"(F)arm";
gotoxy(41,18);cout <<"(D)escend into darkness";
gotoxy(3,34);cout <<"? ";cin >> Choice;
switch (Choice)
{
case 'D':
CellarRoomOne();
break;
case 'F':
AtTheFarm();
break;
default:
TheCellar();
break;
}
/*
if (Choice == 'D'){CellarRoomOne();}
if (Choice == 'F'){AtTheFarm();}
*/
getch();
AtTheFarm();
return;
}
void CellarRoomOne()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" The Tunnel in The Cellar";
gotoxy(3,19);cout <<" You are in a damp and narrow ";
gotoxy(3,20);cout <<"passageway, leading into the ";
gotoxy(3,21);cout <<"underground beneath the farmhouse.";
gotoxy(3,22);cout <<"Rats squeak and scurry around your ";
gotoxy(3,23);cout <<"feet, and the soft mushy dirt, gives";
gotoxy(3,24);cout <<"in, with a sticky release.";
gotoxy(41,17);cout <<"(F)urther down";
gotoxy(41,18);cout <<"(T)he Cellar";
gotoxy(3,34);cout <<"? ";cin >> Choice;
switch (Choice)
{
case 'F':
CellarRoomTwo();
break;
case 'T':
TheCellar();
break;
default:
CellarRoomOne();
break;
}
return;
}
void CellarRoomTwo()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" The Tunnel in The Cellar";
gotoxy(3,19);cout <<" Light becomes dimmer as you descend";
gotoxy(3,20);cout <<"further down into the earth. Now you";
gotoxy(3,21);cout <<"can barely make out the details of";
gotoxy(3,22);cout <<"the tunnel. In the distance is what";
gotoxy(3,23);cout <<"appears to be a door, with a little";
gotoxy(3,24);cout <<"light coming out under.";
gotoxy(41,17);cout <<"(G)o through";
gotoxy(41,18);cout <<"(B)ack";
gotoxy(3,34);cout <<"? ";cin >> Choice;
switch (Choice)
{
case 'G':
CellarRoomQuest();
break;
case 'B':
CellarRoomOne();
break;
default:
CellarRoomTwo();
break;
}
}
void CellarRoomQuest()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" The Necromancers Room";
gotoxy(3,19);cout <<" You enter a workroom. A crude book-";
gotoxy(3,20);cout <<"shelf is mounted on the wall, the";
gotoxy(3,21);cout <<"titles covered in filth. In the ";
gotoxy(3,22);cout <<"middle of the room, there's a ";
gotoxy(3,23);cout <<"workdesk, with various papers, ";
gotoxy(3,24);cout <<"spread across the surface. You can't";
gotoxy(3,25);cout <<"read any of them.";
if (FarmCheckRest == 0)
{gotoxy(3,27);cout <<"The necromancer is here";getch();NecroAttack();}
gotoxy(41,17);cout <<"(B)ack";
gotoxy(3,34);cout <<"? ";cin >> Choice;
getch();
CellarRoomTwo();
}
void NecroAttack()
{
EnemyAttack = 10;
EnemyMaxHP = 40;
EnemyDef = 2;
EnemyGold = 50;
EnemyHP = EnemyMaxHP;
EnemyExp = 50;
EnemyATW = 4;
NecroFight();
return;
}
void FightNecro()
{
system("cls");
TopBorder();
StatBorder ();
if(EnemyHP <= 0)
{
FarmCheckRest = 1;
gotoxy(41,18);cout <<"You defeated the necromancer!";
gotoxy(41,20);cout <<"Gained " << EnemyGold << " Gold!";
gotoxy(41,21);cout <<"Gained " << EnemyExp << " Experience!";
PlyGold = PlyGold + EnemyGold;
PlyExperience = PlyExperience + EnemyExp;
EnemyHP = EnemyMaxHP;
getch();
CellarRoomQuest();
}
if(PlyHP <= 0)
{
gotoxy(41,18);cout <<"You were defeated in combat!" ;
gotoxy(41,20);cout <<"You lost gold and experience and";
gotoxy(41,21);cout <<"are back in 'The Golden Dragon'!";
PlyGold = PlyGold - (PlyGold / 3);
PlyExperience = PlyExperience - (PlyExperience / 4);
PlyHP = MaxHp / 2;
getch();
mainGameLoop();
}
NecroFight();
return;
}
void NecroFightProcess()
{
system("cls");
TopBorder();
StatBorder ();
if (Choice == 'C')
{
getch();
gotoxy(41,18);cout << "The nectomancer strikes out at you!";
gotoxy(41,19);cout << "And it ";
EnemyAttackPct();
}
else
{
gotoxy(41,18);cout << "You strike out at the necromancer!";
gotoxy(41,19);cout << "And you ";
PlyAttackPct();
getch();
dice = diceRoller(1, 100);
if (dice <=5)
{
diceTwo = diceRoller(1, 4);
PlyHP = PlyHP - diceTwo;
gotoxy(41,25);cout << "The necromancer casts a spell!";
gotoxy(41,26);cout << "Purple rays hit you for "<<diceTwo<<" damage!";
}
gotoxy(41,22);cout << "The necromancer strikes out at you!";
gotoxy(41,23);cout << "And it ";
EnemyAttackPct();
getch();
FightNecro();
}
return;
}
void NecroFight()
{
system("cls");
TopBorder();
StatBorder ();
gotoxy(3,20);cout <<"The Necromancer is here and he wants";
gotoxy(3,21);cout <<"your flesh!";
gotoxy(3,23);cout <<"Opponent Hit Points : " << EnemyHP << "/" <<EnemyMaxHP<<"";
gotoxy(41,17);cout <<"(A)ttack\n";
gotoxy(41,18);cout <<"(F)lee\n";
if (Job == 'M'){gotoxy(41,19);cout << "(C)ast spell\n";}
if (Job == 'C'){gotoxy(41,19);cout << "(C)ast spell\n";}
gotoxy(3,34);cout <<" ?";cin >> Choice;
switch (Choice)
{
case 'F':
PlyExperience = PlyExperience - (PlyExperience / 50);
if (PlyExperience <= 0){PlyExperience = 0;}
CellarRoomOne();
break;
case 'A':
NecroFightProcess();
break;
case 'C':
{
if (Job = 'M'||'C')
{
CastSpell();
cout << "\n\n\n\n The necromancer strikes out at you!\n";
cout << " And it ";
EnemyAttackPct();
cout << "\n\n\n";
getch();
FightNecro();
}
else
cout << "\n\n You cannot use magic!";
NecroFight();
}
break;
default:
NecroFight();
break;
}
}
//------------------------------------------------------------------------------
// The endgame
//------------------------------------------------------------------------------
void SeekChallenge()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<"Nothing happens. The rider is still";
gotoxy(3,18);cout <<"set in stone.";
getch();
mainGameLoop();
return;
}
void TheEnd()
{
TopBorder();
cout <<"\n\n\n\n\n\n\n\n";
cout <<" "<<NameOfPlayer<<".. This is ...\n";
cout <<" The End\n";
cout <<" You finished the game in "<<NumberDay<<" days";
cout <<"\n\n\n\n\n\n";
getch();
system("cls");
return;
}
//------------------------------------------------------------------------------
// Training in the gym (this may change in the future)
//------------------------------------------------------------------------------
void LevelUp()
{
system("cls");
TopBorder();
StatBorder();
gotoxy(3,17);cout <<" Crowenburg Gymnasium";
gotoxy(3,19);cout <<" All sorts of wanna-be heroes train";
gotoxy(3,20);cout <<"and hone their skills, either with";
gotoxy(3,21);cout <<"each other or alone, in deep concen-";
gotoxy(3,22);cout <<"tration.";
gotoxy(41,17);cout <<"What would you like to train?";
gotoxy(41,19);cout <<"(S)trenght 50 Gold";
gotoxy(41,20);cout <<"(D)exterity 50 Gold";
gotoxy(41,21);cout <<"(M)ax Hit Points 500 Gold";
gotoxy(41,22);cout <<"(A)ttack 100 Gold";
gotoxy(41,23);cout <<"D(E)fence 200 Gold";
gotoxy(41,24);cout <<"Ma(X) Magic Points 1000 Gold";
gotoxy(41,26);cout <<"(C)ome back later";
gotoxy(3,34);cout <<" ?";cin >> Choice;
switch (Choice)
{
case 'S':
StrenghtRaise();
break;
case 'D':
DexterityRaise();
break;
case 'M':
HitPointRaise();
break;
case 'A':
AttackRaise();
break;
case 'E':
DefenceRaise();
break;
case 'X':
MagicRaise();
break;
case 'C':
mainGameLoop();
break;
default:
LevelUp();
break;
}
/*
if (Choice == 'S'){StrenghtRaise();}
if (Choice == 'D'){DexterityRaise();}
if (Choice == 'M'){HitPointRaise();}
if (Choice == 'A'){AttackRaise();}
if (Choice == 'E'){DefenceRaise();}
if (Choice == 'X'){MagicRaise();}
*/
mainGameLoop();
return;
}
void StrenghtRaise()
{
if(PlyGold < 50)
{
gotoxy(41,34);cout << "Sorry not enough gold!"<<endl;
}
else
{
StatStr = StatStr + 1;
gotoxy(41,34);cout <<"You feel stronger";
PlyGold = PlyGold - 50;
getch();
}
LevelUp();
return;
}
void DexterityRaise()
{
if(PlyGold < 50)
{
gotoxy(41,34);cout << "Sorry not enough gold!"<<endl;
}
else
{
StatDex = StatDex + 1;
gotoxy(41,34);cout <<"You feel more dextrous";
PlyGold = PlyGold - 50;
getch();
}
LevelUp();
return;
}
void HitPointRaise()
{
if(PlyGold < 500)
{
gotoxy(41,34);cout << "Sorry not enough gold!"<<endl;
}
else
{
MaxHp = MaxHp + (MaxHp / 4);
gotoxy(41,34);cout <<"You can endure more";
PlyGold = PlyGold - 500;
getch();
}
LevelUp();
return;
}
void AttackRaise()
{
if(PlyGold < 100)
{
gotoxy(41,34);cout << "Sorry not enough gold!"<<endl;
}
else
{
dice = diceRoller(1,4);
PlyAttack = PlyAttack + dice;
gotoxy(41,34);cout <<"You can attack more effectively";
PlyGold = PlyGold - 100;
getch();
}
LevelUp();
return;
}
void DefenceRaise()
{
if(PlyGold < 200)
{
gotoxy(41,34);cout << "Sorry not enough gold!"<<endl;
}
else
{
MaxDefence = MaxDefence + 1;
gotoxy(41,34);cout <<"You feel more protected";
PlyGold = PlyGold - 200;
getch();
}
LevelUp();
return;
}
void MagicRaise()
{
if (Job == 'F')
{
system("cls");
TopBorder();
StatBorder();
gotoxy(41,34);cout <<"You do not have any magic abilities!";
getch();
LevelUp();
}
if (Job == 'R')
{
system("cls");
TopBorder();
StatBorder();
gotoxy(41,34);cout <<"You do not have any magic abilities!";
getch();
LevelUp();
}
if(PlyGold < 1000)
{
gotoxy(41,34);cout << "Sorry not enough gold!"<<endl;
}
else
{
PlyMagic = PlyMagic + 10;
gotoxy(41,34);cout <<"You feel more powerful";
PlyGold = PlyGold - 1000;
getch();
}
LevelUp();
return;
}
//------------------------------------------------------------------------------
// Assigning stats to the character. This may change in the future
//------------------------------------------------------------------------------
void StatAssign()
{
if (Job == 'F')
{
StatStr = 18;
StatDex = 14;
StatInt = 8;
MaxHp = 10;
PlyHP = MaxHp;
MaxDefence = 4;
PlyAttack = 50;
MaxMagic = 0;
PlyMagic = MaxMagic;
PlyATW = 6;
ExDam = (StatStr / 2) - 7;
if(ExDam <= 0){ExDam = 0;}
}
if (Job == 'R')
{
StatStr = 14;
StatDex = 18;
StatInt = 10;
MaxHp = 4;
PlyHP = MaxHp;
MaxDefence = 6;
PlyAttack = 35;
MaxMagic = 0;
PlyMagic = MaxMagic;
PlyATW = 4;
ExDef = (StatDex / 2) - 7;
if(ExDef <= 0){ExDef = 0;}
}
if (Job == 'M')
{
StatStr = 8;
StatDex = 10;
StatInt = 18;
MaxHp = 4;
PlyHP = MaxHp;
MaxDefence = 4;
PlyAttack = 10;
MaxMagic = 10;
PlyMagic = MaxMagic;
PlyATW = 2;
}
if (Job == 'C')
{
StatStr = 14;
StatDex = 14;
StatInt = 10;
MaxHp = 8;
PlyHP = MaxHp;
MaxDefence = 4;
PlyAttack = 25;
MaxMagic = 4;
PlyMagic = MaxMagic;
PlyATW = 4;
}
}
//------------------------------------------------------------------------------
// Auto Fullscreen Function (essentially it makes the program press Alt + Enter
// automatically)
//------------------------------------------------------------------------------
void AltEnter()
{
keybd_event(VK_MENU, 0x38, 0, 0);
keybd_event(VK_RETURN, 0x1c, 0, 0);
keybd_event(VK_RETURN, 0x1c, KEYEVENTF_KEYUP, 0);
keybd_event(VK_MENU, 0x38, KEYEVENTF_KEYUP, 0);
return;
}
//------------------------------------------------------------------------------
// The (amazing) diceRoll function
//------------------------------------------------------------------------------
int diceRoller(int min_value, int max_value)
{
int random;
srand ( static_cast <unsigned> (time(0)) );
while(1)
{
random = rand();
if((random >= min_value)&&(random <= max_value))
break;
}
return random;
}
//------------------------------------------------------------------------------
// The hit and miss functions
//------------------------------------------------------------------------------
void PlyAttackPct()
{
ExDam = (StatStr / 2) - 7;
if(ExDam <= 0){ExDam = 0;}
dice = diceRoller(1, 100);
if (dice <= PlyAttack)
{
cout << "HIT! ";
diceTwo = diceRoller(1, PlyATW) + ExDam;
DamDone = diceTwo - EnemyDef;
if (DamDone <= 0){DamDone = 1;}
gotoxy(41,19);cout << "You deal your opponent "<<DamDone<<" damage!\n\n";
EnemyHP = EnemyHP - DamDone;
}
if (dice >= PlyAttack)
{
cout << "miss...";
}
return;
}
void EnemyAttackPct()
{
dice = diceRoller(1, 100);
if (dice <= EnemyAttack)
{
cout << "HIT!";
diceTwo = diceRoller(1, EnemyATW);
ExDef = (StatDex / 2) - 7;
if(ExDef <= 0){ExDef = 0;}
EnemyDamDone = diceTwo - (MaxDefence + ExDef);
if (EnemyDamDone <= 0){EnemyDamDone = 1;}
gotoxy(41,24);cout << "You are struck for "<<EnemyDamDone<<" damage!\n\n";
PlyHP = PlyHP - EnemyDamDone;
}
if (dice >= EnemyAttack)
{
cout << "misses...";
}
return;
}
//------------------------------------------------------------------------------
// The Player Magic System
//------------------------------------------------------------------------------
void CastSpell()
{
system("cls");
TopBorder();
StatBorder();
if (Job == 'M'){MagicUserMagic();}
if (Job == 'C'){ClericMagic();}
return;
}
void MagicUserMagic()
{
system("cls");
TopBorder();
StatBorder();
cout << "\n\n What spell would you like to cast?\n\n";
cout << " (M)agic Missile (MP : 1 Damage : 1d6)\n";
cout << " (A)cid Rain (MP : 2 Damage : 1d6+1)\n";
cout << " (F)ireball (MP : 5 Damage : 1d8+1\n";
cout << " (D)eath Ray (MP : 8 Damage : 1d12\n";
cout << " ?";
cin >> Choice;
switch (Choice)
{
case 'M':
MagicMissile();
break;
case 'A':
AcidRain();
break;
case 'F':
Fireball();
break;
case 'D':
DeathRay();
break;
default:
MagicUserMagic();
break;
}
return;
}
void ClericMagic()
{
system("cls");
TopBorder();
StatBorder();
cout << "\n\n What spell would you like to cast?\n\n";
cout << " (H)eal (MP : 2 Heals 3 HP)\n";
cout << " (B)less (MP : 3 Raises Attack)\n";
cout << " (D)efensive Aura (MP : 3 Raise Defence)\n";
cout << " (R)ejuvenation (MP : 8 Heals 50% HP)\n";
cout << " ?";
cin >> Choice;
switch (Choice)
{
case 'H':
CureWounds();
break;
case 'B':
Bless();
break;
case 'D':
DefensiveAura();
break;
case 'R':
Rejuvenation();
break;
default:
ClericMagic();
break;
}
return;
}
void MagicMissile()
{
system("cls");
TopBorder();
StatBorder();
if(PlyMagic <= 1)
{
cout << "/n Not enough Magic!\n\n"<<endl;
}
else
{
dice = diceRoller(1, 6);
cout << "\n You send missiles of magic at your opponent!\n";
cout << " It is struck for "<<dice<<" points of damage!\n\n";
EnemyHP = EnemyHP - dice;
PlyMagic = PlyMagic - 1;
}
return;
}
void AcidRain()
{
system("cls");
TopBorder();
StatBorder();
if (PlyMagic <2)
{
cout << "/n Not enough Magic!\n\n"<<endl;
}
else
{
dice = (diceRoller(1, 6))+1;
cout << "\n You let corrosive acid, rain on your opponent!\n";
cout << " It is struck for "<<dice<<" points of damage!\n\n";
EnemyHP = EnemyHP - dice;
PlyMagic = PlyMagic - 2;
}
return;
}
void Fireball()
{system("cls");
TopBorder();
StatBorder();
if (PlyMagic <5)
{
cout << "/n Not enough Magic!\n\n"<<endl;
}
else
{
dice = (diceRoller(1, 8)+1);
cout << "\n You fling a scorching ball of fire unto your enemy!\n";
cout << " It is struck for "<<dice<<" points of damage!\n\n";
EnemyHP = EnemyHP - dice;
PlyMagic = PlyMagic - 5;
}
return;
}
void DeathRay()
{
system("cls");
TopBorder();
StatBorder();
if (PlyMagic <8)
{
cout << "/n Not enough Magic!\n\n"<<endl;
}
else
{
dice = diceRoller(1, 12);
cout << "\n You send a deadly ray of death at your enemy!\n";
cout << " It is struck for "<<dice<<" points of damage!\n\n";
EnemyHP = EnemyHP - dice;
PlyMagic = PlyMagic - 8;
}
return;
}
void CureWounds()
{
return;
}
void Bless()
{
return;
}
void DefensiveAura()
{
return;
}
void Rejuvenation()
{
return;
}
//------------------------------------------------------------------------------
// Future implementations
//------------------------------------------------------------------------------
/*
void SetSVGA()
{
_AX = 0x4f02;
_BX = 0x101;
geninterrupt (0x10);
}
void SetText()
{
_AX = 0x0003;
geninterrupt (0x10);
}*/
/* Never mind the following ....
{
srand(static_cast<unsigned>(time(0)));
int random_integer;
for(int index=0; index<10; index++)
{
random_integer = rand();
cout << random_integer << endl;
}
}
*/
Comments
Post a Comment