📄 poa.cpp
字号:
mana = manaMax;
counter = 13;
break;
case 'S':
centerText("+2 Energy", 8);
centerText("+5 Max Hitpoints", 9);
centerText("+10 Max Mana", 10);
energy += 2;
hpMax += 5;
manaMax += 10;
hp = hpMax;
mana = manaMax;
counter = 12;
break;
case 'E':
centerText("+2 Dexterity", 8);
centerText("+7 Max Hitpoints", 9);
centerText("+8 Max Mana", 10);
dex += 2;
hpMax += 7;
manaMax += 8;
hp = hpMax;
mana = manaMax;
counter = 12;
break;
default:
Error("Error: CCharacter::addexp: Character Class Not Recongnized");
}
clrnon_border(1, 1, 0, 0, 1);
displayinfo(1, 0, 0, 1);
centerText("You have 5 new stat points!", counter++);
newstats = 5;
while(newstats > 0){
clrselection(counter, counter + 5, 1, COLSIZE - 1);
centerText("Where do you want to add the next stat (", counter++, 0, COLSIZE, 7, 2, IntStr(newstats).str, " remaining)?");
nextstat = menu(counter, 0, 4, "Strength", "Dexterity", "Vitality", "Energy");
switch(nextstat){
case 1:
str++;
break;
case 2:
dex++;
break;
case 3:
vit++;
hpMax += 2;
hp = hpMax;
break;
case 4:
energy++;
manaMax += 2;
mana = manaMax;
break;
default:
Error("Error: CCharacter::addexp: nextstat Contains an Invalid int");
}
clrnon_border(1, 1, 0, 0, 1);
displayinfo(1, 0, 0, 1);
counter--;
newstats--;
}
}
newtop("You have gained ", 4, IntStr(amt).str, " Experience Points and you looted ", IntStr(lootedMoney).str, " Gold");
}
}
void CCharacter::displayinfo(int name, int left, int middle, int right){
int gotoctr;
if(name == 0){
centerText("Character Name: ", 30, 0, 80, GREEN, 1, getname());
}
if(left == 0){
gotoxy(34, 8);
displayClass();
gotoxy(36, 13);
cout<<getexp()<<"/"<<exptonLvl()<<flush;
gotoxy(38, 12);
cout<<getlvl()<<flush;
gotoxy(40, 12);
cout<<getgold()<<flush;
gotoxy(42, 12);
cout<<gethp()<<"/"<<gethpMax()<<flush;
gotoxy(44, 12);
cout<<getmana()<<"/"<<getmanaMax()<<flush;
gotoxy(46, 16);
cout<<calctotaldef()<<flush;
gotoxy(48, 11);
cout<<gettileY()<<","<<gettileX()<<flush;
}
if(middle == 0){
gotoxy(33, 40);
cout<<getstr()<<flush;
gotoxy(34, 40);
cout<<getdex()<<flush;
gotoxy(35, 40);
cout<<getvit()<<flush;
gotoxy(36, 40);
cout<<getenergy()<<flush;
gotoxy(39, 29);
displaywepname();
gotoxy(40, 29);
displayhelmname();
gotoxy(41, 29);
displayarmorname();
gotoxy(42, 29);
displayshieldname();
gotoctr = 45;
for(int indexItems = 0; indexItems < MAXITEMSPERINV; indexItems++){
centerText(getinv(indexItems).getname(), gotoctr++, 20, 50);
}
}
if(right == 0){
gotoctr = 33;
for(int indexSpells = 0; indexSpells < MAXSPELLS; indexSpells++){
centerText(getspells(indexSpells).getname(), gotoctr++, 50, 80);
}
gotoctr++;gotoctr++;
for(int indexPotions = 0; indexPotions < MAXPOTS; indexPotions++){
centerText(getpots(indexPotions).getname(), gotoctr++, 50, 80);
}
}
}
int CCharacter::calctotaldef(){
int temp = 0;
int indexBonuses;
if(weapon.getsid() == 1){
temp = armor.getdefense() + shield.getdefense() + helm.getdefense();
for(indexBonuses = 0; indexBonuses < MAXBONUSESPERITEM; indexBonuses++){
temp += shield.getbonuses(indexBonuses).getdefense();
}
}
else{
temp = armor.getdefense() + helm.getdefense();
}
for(indexBonuses = 0; indexBonuses < MAXBONUSESPERITEM; indexBonuses++){
temp += weapon.getbonuses(indexBonuses).getdefense();
}
for(indexBonuses = 0; indexBonuses < MAXBONUSESPERITEM; indexBonuses++){
temp += helm.getbonuses(indexBonuses).getdefense();
}
for(indexBonuses = 0; indexBonuses < MAXBONUSESPERITEM; indexBonuses++){
temp += armor.getbonuses(indexBonuses).getdefense();
}
temp += dex;
return(temp);
}
void CCharacter::calctotalmeleedamage(int *minDamage, int *maxDamage){
*minDamage = 0;
*maxDamage = 0;
*minDamage += (int)(str * .15) + getwep().getminDamage() + gethelm().getminDamage() + getarmor().getminDamage();
*maxDamage += (int)(str * .15) + getwep().getmaxDamage() + gethelm().getmaxDamage() + getarmor().getmaxDamage();
for(int indexBonuses = 0; indexBonuses < MAXBONUSESPERITEM; indexBonuses++){
*minDamage += getwep().getbonuses(indexBonuses).getdamage();
*maxDamage += getwep().getbonuses(indexBonuses).getdamage();
}
for(int indexBonuses = 0; indexBonuses < MAXBONUSESPERITEM; indexBonuses++){
*minDamage += gethelm().getbonuses(indexBonuses).getdamage();
*maxDamage += gethelm().getbonuses(indexBonuses).getdamage();
}
for(int indexBonuses = 0; indexBonuses < MAXBONUSESPERITEM; indexBonuses++){
*minDamage += getarmor().getbonuses(indexBonuses).getdamage();
*maxDamage += getarmor().getbonuses(indexBonuses).getdamage();
}
if(getwep().getsid() == 1){
*minDamage += getshield().getminDamage();
*maxDamage += getshield().getmaxDamage();
for(int indexBonuses = 0; indexBonuses < MAXBONUSESPERITEM; indexBonuses++){
*minDamage += getshield().getbonuses(indexBonuses).getdamage();
*maxDamage += getshield().getbonuses(indexBonuses).getdamage();
}
}
if(strcmp(characterClass, "Barbarian") == 0 && strcmp(getwep().getclass(), "axe") == 0){
*minDamage += (int)(str * .15);
*maxDamage += (int)(str * .15);
}
else if(strcmp(characterClass, "Knight") == 0 && strcmp(getwep().getclass(), "sword") == 0){
*minDamage += (int)(str * .15);
*maxDamage += (int)(str * .15);
}
else if(strcmp(characterClass, "Sorcerer") == 0 && strcmp(getwep().getclass(), "staff") == 0){
*minDamage += (int)(str * .15);
*maxDamage += (int)(str * .15);
}
else if(strcmp(characterClass, "Elf") == 0 && strcmp(getwep().getclass(), "bow") == 0){
*minDamage += (int)(str * .15);
*maxDamage += (int)(str * .15);
}
}
void CCharacter::calctotalmeleedamage(int *minDamage, int *maxDamage, CItem wep){
*minDamage = 0;
*maxDamage = 0;
*minDamage += (int)(str * .15) + wep.getminDamage() + gethelm().getminDamage() + getarmor().getminDamage();
*maxDamage += (int)(str * .15) + wep.getmaxDamage() + gethelm().getmaxDamage() + getarmor().getmaxDamage();
for(int indexBonuses = 0; indexBonuses < MAXBONUSESPERITEM; indexBonuses++){
*minDamage += wep.getbonuses(indexBonuses).getdamage();
*maxDamage += wep.getbonuses(indexBonuses).getdamage();
}
for(int indexBonuses = 0; indexBonuses < MAXBONUSESPERITEM; indexBonuses++){
*minDamage += gethelm().getbonuses(indexBonuses).getdamage();
*maxDamage += gethelm().getbonuses(indexBonuses).getdamage();
}
for(int indexBonuses = 0; indexBonuses < MAXBONUSESPERITEM; indexBonuses++){
*minDamage += getarmor().getbonuses(indexBonuses).getdamage();
*maxDamage += getarmor().getbonuses(indexBonuses).getdamage();
}
if(getwep().getsid() == 1){
*minDamage += getshield().getminDamage();
*maxDamage += getshield().getmaxDamage();
for(int indexBonuses = 0; indexBonuses < MAXBONUSESPERITEM; indexBonuses++){
*minDamage += getshield().getbonuses(indexBonuses).getdamage();
*maxDamage += getshield().getbonuses(indexBonuses).getdamage();
}
}
if(strcmp(characterClass, "Barbarian") == 0 && strcmp(wep.getclass(), "axe") == 0){
*minDamage += (int)(str * .15);
*maxDamage += (int)(str * .15);
}
else if(strcmp(characterClass, "Knight") == 0 && strcmp(wep.getclass(), "sword") == 0){
*minDamage += (int)(str * .15);
*maxDamage += (int)(str * .15);
}
else if(strcmp(characterClass, "Sorcerer") == 0 && strcmp(wep.getclass(), "staff") == 0){
*minDamage += (int)(str * .15);
*maxDamage += (int)(str * .15);
}
else if(strcmp(characterClass, "Elf") == 0 && strcmp(wep.getclass(), "bow") == 0){
*minDamage += (int)(str * .15);
*maxDamage += (int)(str * .15);
}
}
void CCharacter::calctotalspelldamage(int *minDamage, int *maxDamage, int spellminD, int spellmaxD){
*minDamage = 0;
*maxDamage = 0;
*minDamage += (int)(energy * .15) + spellminD;
*maxDamage += (int)(energy * .15) + spellmaxD;
if(strcmp(characterClass, "Sorcerer") == 0){
*minDamage += (int)(energy * .15);
*maxDamage += (int)(energy * .15);
}
}
int CCharacter::exptonLvl(){
int exptonLvl;
exptonLvl = allLevels[lvl + 1] - exp;
return(exptonLvl);
}
/******************************Map Class Function Definitions*****************************/
CMap::CMap(){ //sets the whole map to " " for initialization
for(int a = 0; a < MAPROWSIZE; a++)
for(int b = 0;b < COLSIZE; b++)
map[a][b] = grass;
for(int a = MAPROWSIZE + 1; a < TOTALROW; a++)
for(int b = 0;b < COLSIZE; b++)
map[a][b] = ' ';
int z; //temp variable
for(z = 0; z < TOTALROW; z++)
changemap(z, 0, vertwall); // left wall
for(z = 0; z < TOTALROW; z++)
changemap(z, COLSIZE - 1, vertwall); // right wall
for(z = 0; z < COLSIZE - 1; z++)
changemap(0, z, horwall); // top wall
for(z = 0; z < COLSIZE - 1; z++)
changemap(TOTALROW - 1, z, horwall); // bottom wall
for(z = 0; z < COLSIZE - 1; z++)
changemap(2, z, horwall);
for(z = 0; z < COLSIZE - 1; z++)
changemap(MAPROWSIZE - 1, z, horwall); // Divider of map and stats
for(z = 0; z < COLSIZE - 1; z++)
changemap(MAPROWSIZE + 1, z, horwall);
for(z = MAPROWSIZE + 1; z < TOTALROW; z++)
changemap(z, 20, vertwall);
for(z = MAPROWSIZE + 1; z < TOTALROW; z++)
changemap(z, 50, vertwall);
for(z = 0; z < 20; z++)
changemap(33, z, horwall);
for(z = 0; z < 20; z++)
changemap(35, z, horwall);
for(z = 0; z < 50; z++)
changemap(37, z, horwall);
for(z = 0; z < 20; z++)
changemap(39, z, horwall);
for(z = 0; z < 20; z++)
changemap(41, z, horwall);
for(z = 0; z < 50; z++)
changemap(43, z, horwall);
for(z = 0; z < 20; z++)
changemap(45, z, horwall);
for(z = 0; z < 20; z++)
changemap(47, z, horwall);
for(z = 50; z < 80; z++)
changemap(38, z, horwall);
for(int index = MAPROWSIZE - 1; index < TOTALROW - 1; index+=2)
changemap(index, 0, lefttee);
changemap(38, 50, lefttee);
for(int index = MAPROWSIZE + 1; index < TOTALROW - 1; index+=2)
changemap(index, 20, righttee);
changemap(2, 0, lefttee);
changemap(2, COLSIZE - 1, righttee);
changemap(38, COLSIZE - 1, righttee);
changemap(31, COLSIZE - 1, righttee);
changemap(37, 50, righttee);
changemap(43, 50, righttee);
changemap(MAPROWSIZE - 1, COLSIZE - 1, righttee);
changemap(TOTALROW - 1, 20, tee);
changemap(TOTALROW - 1, 50, tee);
changemap(31, 20, fliptee);
changemap(31, 50, fliptee);
changemap(37, 20, cross);
changemap(43, 20, cross);
changemap(0, 0, tlc); // top left corner
changemap(0, COLSIZE - 1, trc); // top right corner
changemap(TOTALROW - 1, 0, blc); // bottom left corner
changemap(TOTALROW - 1, COLSIZE - 1, brc); // bottom right corner
x = STARTLOCX;
y = STARTLOCY;
}
void CMap::move(int movement){
int arrowmove;
switch(movement){
case 104: // h pressed (help)
helpMenu();
clrnon_border();
color(GRASSCOLOR);
for(int a = 3; a < MAPROWSIZE - 1; a++){
for(int b = 1; b < COLSIZE - 1; b++){
gotoxy(a, b); cout<<grass<<flush;
}
}
color(7);
tiles[mainchar.gettileY()][mainchar.gettileX()].printmap(3, MAPROWSIZE - 1, 1, COLSIZE - 1);
break;
case 107: // k pressed (Map Key)
clrselection(3, MAPROWSIZE - 1, COLSIZE - 40, COLSIZE - 1);
for(int a = 3; a < MAPROWSIZE - 1; a++){
gotoxy(a, COLSIZE - 40); cout<<vertwall<<flush;
}
gotoxy(2, COLSIZE - 40); cout<<fliptee<<flush;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -