i made a calculator for determining your opponents attack and defence

this determines your opponents attack
this is on c++, and it has to have util.h. paste this code in.


#include "util.h"
int main(){
int defence=readDouble("Your defence: ");
double power=readDouble("Oponent's move power: ");
double mod=readDouble("Oponent's modifiers: ");
double damage=readDouble("Damage dealt: ");
double attack2=(42/power*50+2)*mod*defence/damage;
double attack1=(42/power*50*0.85+2)*mod*defence/damage;
cout<<"Your opponents minimum possible attack is about "<<attack1<<endl;
cout<<"Your opponents maximum possible attack is about "<<attack2;
return 0;}


the first number is the lowest possible attack, and the second number is the highest possible attack. i probobly could remove the decimals, but i dont feel like it.
 
Last edited:
i made one for defence too


#include "util.h"
int main(){
int attack=readDouble("Your attack: ");
double power=readDouble("Your move power: ");
double mod=readDouble("Your modifiers: ");
double damage1=readDouble("Minimum possible damage dealt: ");
double damage2=readDouble("Maximum possible damage dealt: ");
double defence1=42*power*attack/(50*(damage2/.85/mod-2));
double defence2=42*power*attack/(50*(damage1/mod-2));
cout<<"Your opponent's minimum possible defence is about "<<defence1<<endl;
cout<<"Your opponent's maximum possible defence is about "<<defence2;
return 0;}


same rules apply. also, while neither are perfectly accurate, i think this one is a bit less accurate.
also, this needs the hp graph i made for an earlier project. for some reason, i cant intigrate this into the code at this moment, so keep that on hand if you plan to use this. a special thanks to my computer programing teacher for helping me with this one.
 
Last edited:
I would like to clarify that anyone is more than welcome to use this. although, it is not quite perfect. I would always add five to the maximum stat and subtract 5 from the minimum stat as a safeguard. still, this is very useful, quick, and easy.
 
the defence one also had problems, albeit, less so than the attack one, so I fixed it too. do they get the exact numbers now? no, but they are close. I recomend a safety net of 10
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top