Attack
Here is the code. This is in C++.
#include"util.h"
int main(){int defence=readDouble("Your defence:");
double power=readDouble("Opponent's move power:");
double mod=readDouble("Opponent's modifiers:");
double damage=readDouble("Damage dealt:");
int atk1=(damage-2)/mod,atk2=(damage-2)/mod/.85;
double atk=(50*defence/power/42);int attack1=atk1*atk,attack2=atk2*atk;
cout<<"Your opponents minimum possible attack is about "<<attack1<<
"\nYour opponents maximum possible attack is about "<<attack2;return 0;}
Here is the code. This is in C++.
#include"util.h"
int main(){int defence=readDouble("Your defence:");
double power=readDouble("Opponent's move power:");
double mod=readDouble("Opponent's modifiers:");
double damage=readDouble("Damage dealt:");
int atk1=(damage-2)/mod,atk2=(damage-2)/mod/.85;
double atk=(50*defence/power/42);int attack1=atk1*atk,attack2=atk2*atk;
cout<<"Your opponents minimum possible attack is about "<<attack1<<
"\nYour opponents maximum possible attack is about "<<attack2;return 0;}
Now, while I made this pretty easy to just pick up and use, there are a few things that could help you use this. First of all, I recommend adding five to the maximum number and subtracting five from the minimum number when you do the calculations as an added safety net. Now, while you can easily use it without doing this, I recommend reading the part on the current generation's damage formula on this Bulbapedia article. Below is the list of modifiers that are a part of the Opponent's Modifiers section. Presume that anything not there should not go in this part of the calculator.
Keep in mind that you must multiply all relevant modifiers with each other, and enter in the product. Now, there are a few things to note about this calculator. The damage formula is directly tied to the level of the user, however I have skipped that part. As such, the calculation assumes you are at level 100. If your pokemon is not level 100, this equation will not work. Another thing is that if the move used KOd your pokemon, this won't work, for obvious reasons. Additionally, this calculates the attack stat used in the calculation, which means it factors in things like stat stages and Choice Band. If you want to know your opponent's attack without these modifiers, I am afraid you will have to do math. This also applies to things that affect the Base Power of a move.
Damage reduction from spread moves in double battles, Parental Bond, Weather, Glaive Rush, Critical Hits, STAB, Type Matchups, Burn, damage reduction to Z-Moves and Max Moves when used on Protect, damage Behemoth Blade, Behemoth Bash, Dynamax Cannon, damage multiplier for moves like Stomp when used on a Minimized pokemon, damage increase for Surf and Whirlpool when used on a pokemon using Dive, and likewise for Dig, Screens, Electro Drift, Collision Course, Multiscale, Shadow Shield, damage reduction on contact moves against a pokemon with Fluffy, Increase in power to Fire moves when used on a pokemon with Fluffy, Punk Rock defensively, Ice Scales, Friend Guard, Filter, Prism Armor, Solid Rock, Neuroforce, Sniper, Tinted Lens, Type Resistant Berries, Expert Belt, Life Orb, and the Metronome Item.
Last edited: