Note that I round down at each step (which is noted below in red). I'm not having problems with that, it seems.
(1) Level * 2 / 5
(2) (1) + 2
(3) (2) *
BasePower *
[Sp]Atk / 50
BasePower = HH * BP * IM * Ch * MS * WS * OAM * FAM
HH= Helping Hand (being 1,5 if yes, else 1)
BP= Looks at the actual base power of a move (combined variating and moves don't don't variate)
IM= Item Multiplier (includes Muscle Band, Wise Glasses, Adamant Orb, Lustrous Orb, Griseous Orb and Type Gems)
Ch= Charge being used, then an Electric Type Attack being used (2 if yes, else 1)
MS= Mudsport (0,5 or 1)
WS= Watersport (0,5 or 1)
OAM= Own Ability Multiplier (There's a lot in here, not gonna write it all down lol)
FAM= Foes Ability Multiplier (Same here. Lot going on in here as well)
[Sp]Atk = If Foul Play -> uses Attack of opponent. If not Foul Play -> Looks for the Final Atk or Final SpAtk (depending on the move being used)
Final Atk: Looks at opponent having Unaware, your stat boosts and the ability Simple being into play. Some abilities and items (Huge Power, Pure Power, Flower Gift, Guts, Toxic Boost, Hustle, Burned without Guts, Choice Band, Light Club, Thick Club and Defeatist)
Final SpAtk: Same thing but with following abilities and items: Solar Power, Flare Boost, Choice Specs, Light Ball, Soul Dew, DeepSeaTooth
(4) (3) /
[Sp]Def
[Sp]Def = If Psyshock, Psystrike or Secret Sword it uses Defense, else it looks at the type of move, and checks the Final Def or Final SpDef.
Final Def: Same as with the Attacking stats, but with following abilities and items: Metal Powder, Marvel Scale, Eviolite
Final SpDef: Same again with abilities and items: (Sandstorm + Rock Type), Soul Dew, Metal Powder, DeepSeaScale, Flower Gift, Eviolite, Assault Vest
(5) (4) *
Mod1
Mod1= RL * MB * SR * FF
RL= Reflect and Light Screen being up with the necessary abilities.
MB= Multiplayer Battle. In a 2vs2 or 3vs3 some moves have different options.
SR= Sun or Rain Multiplier
FF= Flash Fire Boost
(6) (5) + 2
(7) (6) *
CH
CH= Critical Hit, being decided if the move used was Frost Breath or Storm Throw, and if the user has Sniper as an ability.
(8) (7) *
Mod2
Mod2= Life Orb * Metronome * Me First
(9) (8) * RANDOM
We have a split of 2 right here. RANDOM being 85 or 100 respectively
(10) (9) / 100
(11) (10) *
STAB
STAB= 2, if Adaptability and right typing. 1,5 if right typing and no Adaptability. Else 1.
(12) (11) *
Type
Type= Effectiveness, making a choice between 0, 0.25, 0.5, 1, 2, 4
(13) (12) *
Mod3
Mod3= Multiscale * (Solid Rock or Filter) * Expert Belt * Tinted Lens * Attack Reducing Berry * Immunity
At this point you get 2 values (because at the RANDOM it gets split up. These 2 values are the Min and Max amount of HP infliction. With a simple calculation you got to %.
Though somewhere along these lines, I mess a bit up, cause I'm off by 1-2 HP sometimes.
(This has happened mostly when I use a Life Orb. It could be that I misplaced that somewhere, along with some other things)
I hope this was clear enough. Here's also a Screenshot of how the excel file (the calcing part) looks right now.
http://i.imgur.com/BG9ScDc.png