• The moderator of this forum is jetou.
  • Welcome to Smogon! Take a moment to read the Introduction to Smogon for a run-down on everything Smogon, and make sure you take some time to read the global rules.

i made a calculator for determining your opponents attack and defence

Cancel cult

murkrow guy
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;}

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.
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.
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.
 
Last edited:
Defense
Here is the code. This is still in C++.


#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<<
"\nYour opponent's maximum possible defence is about "<<defence2;return 0;}

For the most part, the same rules apply. However, there is something more you will need to use. In order for this to work, you need to know the exact amount of HP you did to your opponent. Fortunately, I have made a tool for this, which you can find here.
 
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
 
alright, my attack calculator was once again not working. I have fixed it, and now I think it is pretty accurate, however I have decided to change my policy. I will continue to edit my original two posts whenever I update it, however I will no longer post the updates in this thread, so I don't flood the notifications of people who don't care, and I am not perpetually on the front page of this subforum. instead, I will post them on my profile. if you wish to be updated when I change things, comment on that profile thread to be updated. also, if you are tired of me failing at this, you can give me advice on how to not fail, or just do my job for me if you want. just please notify me if you do that, so I can stop pushing the boulder.
 
actually, one more thing before i stop. I have found out how to link to an actual site that will run it for you, instead of making you paste this in on your own.
 
Back
Top