Correct comments on SwitchAndTeleportEffect

The comments in the SwitchAndTeleportEffect section incorrectly stated
that the random number was generated in the
half-open interval [0, playerLevel + enemyLevel),
instead of the closed interval [0, playerLevel + enemyLevel].
This commit is contained in:
SnorlaxMonster 2021-06-14 21:47:19 +10:00
parent 9c93fb0b75
commit 319c29c751

View file

@ -819,14 +819,14 @@ SwitchAndTeleportEffect:
jr nc, .playerMoveWasSuccessful ; if so, teleport will always succeed jr nc, .playerMoveWasSuccessful ; if so, teleport will always succeed
add b add b
ld c, a ld c, a
inc c ; c = sum of player level and enemy level inc c ; c = playerLevel + enemyLevel + 1
.rejectionSampleLoop1 .rejectionSampleLoop1
call BattleRandom call BattleRandom
cp c ; get a random number between 0 and c cp c ; get a random number between 0 and c
jr nc, .rejectionSampleLoop1 jr nc, .rejectionSampleLoop1
srl b srl b
srl b ; b = enemyLevel / 4 srl b ; b = enemyLevel / 4
cp b ; is rand[0, playerLevel + enemyLevel) >= (enemyLevel / 4)? cp b ; is rand[0, playerLevel + enemyLevel] >= (enemyLevel / 4)?
jr nc, .playerMoveWasSuccessful ; if so, allow teleporting jr nc, .playerMoveWasSuccessful ; if so, allow teleporting
ld c, 50 ld c, 50
call DelayFrames call DelayFrames