Skip to content

Commit

Permalink
Merge pull request #2219 from aarant/battle_engine
Browse files Browse the repository at this point in the history
Fixed Gen5+ multihit odds.
  • Loading branch information
AsparagusEduardo authored Aug 24, 2022
2 parents eb0cc91 + 9a0a759 commit 33e1562
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -10565,19 +10565,20 @@ static void Cmd_setmultihitcounter(void)
}
else if (B_MULTI_HIT_CHANCE >= GEN_5)
{
// 2 and 3 hits: 33.3%
// 4 and 5 hits: 16.7%
gMultiHitCounter = Random() % 4;
if (gMultiHitCounter > 2)
{
gMultiHitCounter = (Random() % 3);
if (gMultiHitCounter < 2)
gMultiHitCounter = 2;
else
gMultiHitCounter = 3;
}
// Based on Gen 5's odds
// 35% for 2 hits
// 35% for 3 hits
// 15% for 4 hits
// 15% for 5 hits
gMultiHitCounter = Random() % 100;
if (gMultiHitCounter < 35)
gMultiHitCounter = 2;
else if (gMultiHitCounter < 35 + 35)
gMultiHitCounter = 3;
else if (gMultiHitCounter < 35 + 35 + 15)
gMultiHitCounter = 4;
else
gMultiHitCounter += 3;
gMultiHitCounter = 5;
}
else
{
Expand Down

0 comments on commit 33e1562

Please sign in to comment.