Changelog 28.11.2020
Coded Simple.
Magic Guard prevents Iron Barbs, Rough Skin and Rocky Helmet damage now.
Fixed a bug that Fake Out fails after both Pokemon fainted.
The trainer name will be displayed in the battle text now.
Rocky Helmet won't be activated if Seismic Toss failed due to immunity anymore.
Paralyze will halve the speed value in the damage calculation and running away chance calculation now. The base power of Gyro Ball will be higher now when Ferrothorn gets paralyzed.
Aftermath will not be activated if a Pokémon with Damp is on the field anymore.
Fixed a visual bug with Weak Armor.
Fixed an off-by-one-error in the secondary effect chance code. This decrease the chance for a secondary effect of 1%. For example, the chance of freezing the target with Ice Beam is now 10% instead of 11%.
Cleaned up the critical hit chance code. Changed the critical hit chance from 5.167% to 4.167% (1/24).
Cleaned up the Hazard code. Hazards will be activated in the right order after both Pokemon fainted now.
Reworked the fainted code and should work like in the original games now. In general, the player that fainted last wins the battle now.
If the player’s final Pokemon used Selfdestruct, Explosion, Destiny Bond, or Final Gambit, and both players’ final Pokemon faint as a result, the player who used the move loses that game.
if a player’s final Pokemon used Double‐Edge, Volt Tackle, Flare Blitz, Take Down, Submission, Brave Bird, Wood Hammer, Head Smash, Struggle, Head Charge, or Wild Charge, or was holding Life Orb, and both players’ final Pokémon faint as a result, the player who used the move wins that game.
if both players’ final Pokemon faint due to a weather condition, such as Hail or Sandstorm, the player whose Pokemon faints last wins the game. This includes the effects of Perish Song.