1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
|
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
#include <windows.h>// for the Sleep() function (not sleep)
using namespace std;
// GLOBAL VARIABLES
string charname;
//ENEMY CLASS
class enemy
{
public:
int attack;
int defense;
int luck;
int speed;
int hp;
int energy;
// class member functions
void INIT(int navatk, int navdef, int navspd, int navhpo, int navluk, int navepo);
void display();
void battle();
};
// global helper functions
void intro();
string choice(enemy & e );
void stage1();
string allGood();
//*** main ***
int main(){
enemy dummy;// an instance of enemy to work with
intro();
while( choice(dummy) == "no") cout<< "let me show you them again" << endl;// replaces goto scheme
stage1();
while( allGood() == "no");// replaces goto scheme
cout<<"in that case, INITIATE BATTLE SIMULATION GO!"<<endl;
dummy.battle();
return 0;
}// end of main()
// definitions of enemy class member functions
void enemy::INIT(int navatk, int navdef, int navspd, int navhpo, int navluk, int navepo)
{
attack = navatk;
defense = navdef;
speed = navspd;
hp = navhpo;
luck = navluk;
energy = navepo;
}
void enemy::display()
{
cout<<"attack: "<< attack <<endl;
cout<<"defense: "<< defense <<endl;
cout<<"speed: "<< speed <<endl;
cout<<"health points: "<< hp <<endl;
cout<<"luck: "<< luck <<endl;
cout<<"energy points: "<< energy <<endl;
}
void enemy::battle()
{
cout << attack;
}
// definitions of helper functions
void intro()
{
cout<<"what's your name again?"<<endl;
cin>>charname;
cout<<"hello, "<<charname<<endl;
Sleep(2);
cout<<"welcome to the pentagon"<<endl;
Sleep(1);
cout<<"year: 4056 C.E." << endl;
Sleep(1);
cout<<"you have been nominated to control a 'navigator.' a digital fighting warrior that we use to fight the rebellion."<<endl;
Sleep(1);
cout<<"..."<<endl;
Sleep(1);
cout<<"what's this? you've never heard of the rebellion before?"<<endl;
Sleep(1);
cout<<"the year was 2015, when the citizens of the united states of america rose up against the government. little did they know, the governmet had installed a top-secret project called 'SEVEN' (or s.ecretly e.liminate v.iolent e.lectronic n.ews) into the world wide web . they used this successfully to break up riots by intercepting internet-bound messages. soon after, the rebellion's top scientists figured out the programs weak-spots, and created viruses 'bugs' to destroy said program."<<endl;
Sleep(12);
cout<<"that's where you come in." << endl;
Sleep(1);
cout<<"we've created an elite squad of web 'navigators' to destroy any viruses we encounter." <<endl;
Sleep(1);
cout<<"you will be tasked with controlling one of these 'navigators' to end the rebellion once and for all."<<endl;
Sleep(1);
cout<<"let me show you them"<<endl;
}
string choice(enemy & e )
{
Sleep(1);
cout<<"..."<<endl;
Sleep(1);
cout<<"bladenav: a well balanced navigator that can wield a multitude of de-bugging weapons"<<endl;
cout<<"arrownav: a speed-oriented navigator that can attack stealthily from far range"<<endl;
cout<<"fistsnav: an attack-heavy navigator with low speed but with a variety of high-power weapons"<<endl;
cout<<"shellnav: an extremely high defense navigator with low speed and attack "<<endl;
cout<<"golemnav: a high attack, high defense navigator with low speed, and a narrow range of attacks "<< endl;
cout<<"flamenav: a navigator with flame-based attacks with relatively large luck"<<endl;
cout<<"aqueonav: a navigator with aqua-based attacks with relatively large luck"<<endl;
cout<<"plantnav: a navigator with plant-based attacks with relatively large luck"<<endl;
cout<<"psychnav: a high hit points navigator with indirect attacking abilities"<<endl;
cout<<"chicknav: a navigator with terrible stats all around and no redeeming qualities whatsoever except for it's 100% luck stat."<<endl;
Sleep(3);
cout<<"you may choose one and only one to control. pick wisely"<<endl;
string navchoice;
cin>> navchoice;
//STAT SETTING
if (navchoice == "bladenav") e.INIT(50, 50, 50, 100, 10, 40);
else if (navchoice =="arrownav") e.INIT(55, 30, 65, 100, 10, 40);
else if (navchoice =="fistsnav") e.INIT(80, 55, 10, 115, 10, 30);
else if (navchoice =="shellnav") e.INIT(25, 80, 25, 120, 10, 40);
else if (navchoice =="golemnav") e.INIT(70, 70, 10, 100, 10, 40);
else if (navchoice =="flamenav") e.INIT(50, 50, 40, 100, 15, 45);
else if (navchoice =="aqueonav") e.INIT(50, 50, 40, 100, 15, 45);
else if (navchoice =="plantnav") e.INIT(50, 50, 40, 100, 15, 45);
else if (navchoice =="psychnav") e.INIT(20, 30, 30, 150, 10, 50);
else if (navchoice =="chicknav") e.INIT(20, 20, 20, 100, 100, 40);
Sleep(1);
e.display();
Sleep(1);
cout<<"is this you're final selection, "<< charname <<"?"<<endl;
string yesno;
cin >> yesno;
return yesno;
}
void stage1()
{
cout<<"now that you've chosen your navigator, you should probably learn how to use it."<<endl;
Sleep(1);
cout<<"..."<<endl;
Sleep(1);
cout<<"when you find an enemy 'bug', battle mode is initiated."<<endl;
Sleep(1);
cout<<" ______________________________________________________"<<endl;
cout<<"|ATTACK| WEAPONS | ITEMS | FLEE | CHECK STATS | DEFEND |"<<endl;
cout<<"|______|_________|_______|______|_____________|________|"<<endl;
Sleep(1);
cout<<"then you select an option. choosing 'attack' attacks the opponent. The damage you deal is equal to the weapon's power added to your attack, then subtracted by the enemy's defense. 'weapons' accesses your de-bugging arsenal, 'items' allows you to view and use your one-use items, 'check stats' checks both your and the enemy's health points and stats, and 'defend' doubles your defense for the next turn, but takes up a turn. activating 'flee' will end the encounter unless your speed is lower than the 'bug's'."<<endl;
Sleep(10);
cout<<"then, after your turn is over, your oppenent will either attack or defend."<< endl;
}
string allGood()
{
Sleep(5);
cout<< "all good?" <<endl;
string yesno;
cin >> yesno;
return yesno;
}
|