Hey, all. I'm pretty much fairly new to the C++ scene, and just starting to learn most of the ropes. The program I'm making is for an RPG on a forum board we play. It's to help out the GMs/including myself, figure out the chance of a character missing, or evading an attack.
Basically. You're either attacking or defending. So I wanted it to ask you if you're going to att/def.
If you pick att or def, it doesn't matter. It'll say press any key to continue and just stop there. THen it closes out.
At the moment, it's supposed to use the main formula to get a number, which I can't really turn into an actual percentage.. so it's basically up to us for now to figure out what it would be.
Also. If you get 100%+, the program is supposed to tell you that you've gotten 99%, because in the game you can't ever have a perfect 100 or more, there's always a 1% chance you might miss, or not evade.
Here's the current source code.
Code:
// Program to determine chance of missing.
// It can also determine the chance of evading.
#include <cstdio>
#include <cstdlib>
#include <iostream>
// AGI / DEX = sum converted to % / 2 = final result
// 3 AGI, 1 DEX: 3 / 1 = 3(300%) / 2 = 150% chance to miss, cut down to 99%
// DEX/AGI is attacking.
// AGI/DEX is defending.
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
cout
<<"***************************\n"
<<"***Parma III Stat Roller***\n"
<<"***************************\n\n"
<<"This Program was created by the Android Hunter\n"
<<"Cyrus. It's used to quickly determine your chance\n"
<<"of missing. Enjoy!\n\n";
bool quit = false;
while(!quit)
{
double bam;
double att;
cout<<"Are you Attacking/Defending? (att/def) ";
cin>>bam;
if(bam == att)
if(true)
{
double DEX;
cout << "Enter Defender's DEX:";
cin >> DEX;
// Now we have to get the ATP!
double AGI;
cout << "Enter Attacker's AGI:";
cin >> AGI;
// Now we'll figure out the chance of missing.
double thelastone;
thelastone = (AGI/DEX)/2 * 100;
//This will give the player 99% if it's above 100%
if (thelastone >= 100)
cout<<"Your chance of missing is: 99%"<<endl;
cout << "Your chance of missing is: ";
cout << thelastone << "%\n" << endl;
system("Pause");
return 0;
}
else {
double block;
cout << "Enter Defender's DEX:";
cin >> block;
// Now for the Attacker.
double slam;
cout << "Enter the Attackers AGI:";
cin >> slam;
double thefirstone;
thefirstone = (block/slam)/2 * 100;
//This will give the player 99% if it's above 100%.
if (thefirstone >= 100)
cout<<"Your chance of evading is: 99%"<<endl;
cout << "Your chance of evading is: ";
cout << thefirstone << "%/n" <<endl;
}
system("Pause");
return 0;
}
}
Thanks.