📄 poa.hpp
字号:
// Header File for Proverbs of Apocrypha
#include <iostream>
#include <windows.h>
#include <conio.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <fstream>
using namespace std;
/******************************Global Constants*****************************/
const int STARTLOCX = 1;
const int STARTLOCY = 3;
const int MAXSTRING = 25;
const int MAXARRAY = 50;
const int MAXPOTS = 6;
const int MAXSPELLS = 5;
const int MAXSPELLSPERMONSTER = 2;
const int MAXBONUSESPERITEM = 3;
const int MAXSPELLSPERBONUS = 1;
const int MAXITEMSPERINV = 4;
const int MAXNEWSTATS = 5;
int TOTALITEMS = 0;
int TOTALSPELLS = 0;
int TOTALBONUSES = 0;
int TOTALMONSTERS = 0;
int TOTALPOTIONS = 0;
int TOTALLEVELS = 0;
int MAXMONSTERLVL = 0;
int MAXITEMLVL = 0;
int MAXSPELLLVL = 0;
const char FILEITEMS[] = "items.poa";
const char FILESPELLS[] = "spells.poa";
const char FILEBONUSES[] = "bonuses.poa";
const char FILEMONSTERS[] = "monsters.poa";
const char FILEPOTIONS[] = "potions.poa";
const char FILELEVELS[] = "levels.poa";
const int MAPROWSIZE = 30;
const int TOTALROW = 50;
const int COLSIZE = 80;
const int MENUBOXWIDTH = 30; // From left
const int MAPTILEROWS = 3;
const int MAPTILECOLS = 3;
const int ATTACKNUMBER = 30;
const int TILEOFTOWN1 = 1;
const int TILEOFTOWN2 = 3;
const int TILEOFTOWN3 = 8;
const int TILEOFTOWN4 = 9;
const int GREY = 7;
const int GOLD = 6;
const int BRIGHTBLUE = 9;
const int BLUE = 1;
const int GREEN = 2;
const int RED = 4;
const int YELLOW = 14;
const int BRIGHTGREEN = 10;
const int GRASSCOLOR = 170; // bright green, bright green background
const int TREECOLOR = 162; // dark green, bright green background
const int MOUNTAINCOLOR = 166; // brown, bright green background
const int ARROWSCOLOR = 172; // bright red, bright green background
const int HERODISPLAYCOLOR = 160; // black, bright green background
const int WATERCOLOR = 145; // dark blue, bright blue background
const int TITLECOLOR = 1; // color of the title (blue)
const char heroDisplay = (char)1; // Hero Display on Map
const char tlc = (char)218; // Top Left Corner
const char trc = (char)191; // Top Right Corner
const char blc = (char)192; // Bottom Left Corner
const char brc = (char)217; // Bottom Right Corner
const char horwall = (char)196; // Horizontal Wall
const char vertwall = (char)179; // Vertical Wall
const char tee = (char)193; // tee (like upside down T)
const char fliptee = (char)194; // Similar to T
const char lefttee = (char)195; // Left tee
const char righttee = (char)180; // Right tee
const char cross = (char)197; // A Four Corners Piece, t
const char mapTown = (char)177; // piece that represents a town on the map
const char tree = (char)6; // A Tree on the Map
const char water = (char)15; // Water on the Map
const char mountain = (char)30; // A Rock on the Map
const char rightMap = (char)16; // Move Right 1 Tile
const char leftMap = (char)17; // Move Left 1 Tile
const char upMap = (char)24; // Move Up 1 Tile
const char downMap = (char)25; // Move Down 1 Tile
const char grass = (char)227; // Won't Be Seen Anyways
// Global Variable needed in Classes
int allLevels[MAXARRAY];
// Function Prototypes Used in Classes
void Error(char *text, int numoftext = 0, ...);
void gotoxy(int y, int x);
int searchforid(char search[], int find);
void clrselection(int top, int bot, int left, int right);
void clrline(int y, int left, int right);
void clrnon_border(int top = 0, int name = 1, int bottomL = 1, int bottomM = 1, int bottomR = 1);
void centerText(char* text, int y, int min = 0, int max = COLSIZE, int Color = GREY, int nummoretext = 0,...);
void newtop(char* text, int nummoretext = 0, ...);
void color(int color){SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),color);}//7=normal
/******************************Spell Class*****************************/
class CSpell{
public:
// Constructors/Deconstructors
CSpell(){}
~CSpell(){}
// Get
int getid()const{return id;}
int getlvl()const{return lvl;}
int getmanaCost()const{return manaCost;}
int getminDamage()const{return minDamage;}
int getmaxDamage()const{return maxDamage;}
int getminLife()const{return minLife;}
int getmaxLife()const{return maxLife;}
int getprice()const{return price;}
char* getname(){return spellName;}
// Assign
void assignAll(char tempName[], int tempid, int templvl, int tempmanaCost, int tempminDamage, int tempmaxDamage, int tempminLife, int tempmaxLife, int tempprice);
// Display
void displayName()const{cout<<spellName<<flush;}
void displayinfo();
void displaybattleinfo();
protected:
char spellName[MAXSTRING];
int id;
int lvl;
int manaCost;
int minDamage;
int maxDamage;
int minLife;
int maxLife;
int price;
};
/******************************Bonus Class*****************************/
class CBonus{
public:
// Constructors/Deconstructors
CBonus(){}
~CBonus(){}
// Get
int getid()const{return id;}
int gethp()const{return hp;}
int getdefense()const{return defense;}
int getmana()const{return mana;}
int getstr()const{return str;}
int getdex()const{return dex;}
int getvit()const{return vit;}
int getenergy()const{return energy;}
CSpell getspells(int x)const{return spells[x];}
char* getname(){return bonusName;}
int getdamage(){return damage;} // Not implemented yet...will be soon
// Assign
void assignAll(char tempName[], int tempid, int temphp, int tempdamage, int tempdefense, int tempmana, int tempstr, int tempdex, int tempvit, int tempenergy);
CSpell* editspell(int index){return &spells[index];}
void assignSpell(int index, int searchid);
// Display
void displayName()const{cout<<bonusName<<flush;}
protected:
char bonusName[MAXSTRING];
int id;
int hp;
int damage;
int defense;
int mana;
int str;
int dex;
int vit;
int energy;
CSpell spells[MAXSPELLSPERBONUS];
};
/******************************Item Class*****************************/
class CItem{
public:
// Constructors/Deconstructors
CItem(){}
~CItem(){}
// Get
int getid()const{return id;}
int getlvl()const{return lvl;}
int getwepid()const{return wepid;}
int getsid()const{return sid;}
int getminDamage()const{return minDamage;}
int getmaxDamage()const{return maxDamage;}
int getdefense()const{return defense;}
int getprice()const{return price;}
CBonus getbonuses(int x)const{return bonuses[x];}
char* getname(){return itemName;}
char* getclass(){return itemClass;}
// Assign
void assignAll(char tempName[], char tempClass[], int tempid, int templvl, int tempwepid, int tempsid, int tempminD, int tempmaxD, int tempdef, int tempprice);
CBonus* editBonus(int index){return &bonuses[index];}
// Display
void displayName()const{cout<<itemName<<flush;}
void displayClass()const{cout<<itemClass<<flush;}
void displayinfo();
protected:
char itemName[MAXSTRING];
char itemClass[MAXSTRING];
int id;
int lvl;
//wepid = 1 -> item is a weapon
//wepid = 2 -> item is shield, armor, or helm
int wepid;
//sid = 1 -> can use shield
//sid = 2 -> cannot use shield
int sid;
int minDamage;
int maxDamage;
int defense;
int price;
CBonus bonuses[MAXBONUSESPERITEM];
};
/******************************Potion Class*****************************/
class CPotion{
public:
// Constructors/Deconstructors
CPotion(){}
~CPotion(){}
// Get
int getid()const{return id;}
int gethealormana()const{return healormana;}
int gethpRestore()const{return hpRestore;}
int getmanaRestore()const{return manaRestore;}
int getprice()const{return price;}
char* getname(){return potionName;}
// Assign
void assignAll(char tempName[], int tempid, int temphealormana, int temphpRestore, int tempmanaRestore, int tempprice);
// Display
void displayName()const{cout<<potionName<<flush;}
void displaybattleinfo();
protected:
char potionName[MAXSTRING];
int id;
// healormana = 1 -> heal
// healormana = 2 -> mana
int healormana;
int hpRestore;
int manaRestore;
int price;
};
/******************************Monster Class*****************************/
class CMonster{
public:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -