Fixing comments in BattleCommand_Teleport
This commit is contained in:
@@ -1250,11 +1250,13 @@ As Pryce's dialog ("That BADGE will raise the SPECIAL stats of POKéMON.") impli
|
|||||||
call BattleRandom
|
call BattleRandom
|
||||||
cp c
|
cp c
|
||||||
jr nc, .loop_enemy
|
jr nc, .loop_enemy
|
||||||
|
; b = player level / 4
|
||||||
srl b
|
srl b
|
||||||
srl b
|
srl b
|
||||||
cp b
|
- ; This should be "jr c, .failed"
|
||||||
- ; This should be jr c, .failed
|
|
||||||
- ; As written, it makes enemy use of Teleport always succeed if able
|
- ; As written, it makes enemy use of Teleport always succeed if able
|
||||||
|
+ ; If the random number >= player level / 4, Teleport will succeed
|
||||||
|
cp b
|
||||||
- jr nc, .run_away
|
- jr nc, .run_away
|
||||||
+ jr c, .failed
|
+ jr c, .failed
|
||||||
```
|
```
|
||||||
|
@@ -15,31 +15,34 @@ BattleCommand_Teleport:
|
|||||||
call GetBattleVar
|
call GetBattleVar
|
||||||
bit SUBSTATUS_CANT_RUN, a
|
bit SUBSTATUS_CANT_RUN, a
|
||||||
jr nz, .failed
|
jr nz, .failed
|
||||||
; Only need to check these next things if it's your turn
|
|
||||||
ldh a, [hBattleTurn]
|
ldh a, [hBattleTurn]
|
||||||
and a
|
and a
|
||||||
jr nz, .enemy_turn
|
jr nz, .enemy_turn
|
||||||
|
|
||||||
; Can't teleport from a trainer battle
|
; Can't teleport from a trainer battle
|
||||||
ld a, [wBattleMode]
|
ld a, [wBattleMode]
|
||||||
dec a
|
dec a
|
||||||
jr nz, .failed
|
jr nz, .failed
|
||||||
; If your level is greater than the opponent's, you run without fail.
|
; b = player level
|
||||||
ld a, [wCurPartyLevel]
|
ld a, [wCurPartyLevel]
|
||||||
ld b, a
|
ld b, a
|
||||||
|
; If player level >= enemy level, Teleport will succeed
|
||||||
ld a, [wBattleMonLevel]
|
ld a, [wBattleMonLevel]
|
||||||
cp b
|
cp b
|
||||||
jr nc, .run_away
|
jr nc, .run_away
|
||||||
; Generate a number between 0 and (YourLevel + TheirLevel).
|
; c = player level + enemy level + 1
|
||||||
add b
|
add b
|
||||||
ld c, a
|
ld c, a
|
||||||
inc c
|
inc c
|
||||||
|
; Generate a number less than c
|
||||||
.loop_player
|
.loop_player
|
||||||
call BattleRandom
|
call BattleRandom
|
||||||
cp c
|
cp c
|
||||||
jr nc, .loop_player
|
jr nc, .loop_player
|
||||||
; If that number is greater than 4 times your level, run away.
|
; b = enemy level / 4
|
||||||
srl b
|
srl b
|
||||||
srl b
|
srl b
|
||||||
|
; If the random number >= enemy level / 4, Teleport will succeed
|
||||||
cp b
|
cp b
|
||||||
jr nc, .run_away
|
jr nc, .run_away
|
||||||
|
|
||||||
@@ -48,27 +51,34 @@ BattleCommand_Teleport:
|
|||||||
jp PrintButItFailed
|
jp PrintButItFailed
|
||||||
|
|
||||||
.enemy_turn
|
.enemy_turn
|
||||||
|
; Can't teleport from a trainer battle
|
||||||
ld a, [wBattleMode]
|
ld a, [wBattleMode]
|
||||||
dec a
|
dec a
|
||||||
jr nz, .failed
|
jr nz, .failed
|
||||||
|
; b = enemy level
|
||||||
ld a, [wBattleMonLevel]
|
ld a, [wBattleMonLevel]
|
||||||
ld b, a
|
ld b, a
|
||||||
|
; If enemy level >= player level, Teleport will succeed
|
||||||
ld a, [wCurPartyLevel]
|
ld a, [wCurPartyLevel]
|
||||||
cp b
|
cp b
|
||||||
jr nc, .run_away
|
jr nc, .run_away
|
||||||
|
; c = enemy level + player level + 1
|
||||||
add b
|
add b
|
||||||
ld c, a
|
ld c, a
|
||||||
inc c
|
inc c
|
||||||
|
; Generate a number less than c
|
||||||
.loop_enemy
|
.loop_enemy
|
||||||
call BattleRandom
|
call BattleRandom
|
||||||
cp c
|
cp c
|
||||||
jr nc, .loop_enemy
|
jr nc, .loop_enemy
|
||||||
|
; b = player level / 4
|
||||||
srl b
|
srl b
|
||||||
srl b
|
srl b
|
||||||
cp b
|
; This should be "jr c, .failed"
|
||||||
; This should be jr c, .failed
|
|
||||||
; As written, it makes enemy use of Teleport always succeed if able
|
; As written, it makes enemy use of Teleport always succeed if able
|
||||||
|
cp b
|
||||||
jr nc, .run_away
|
jr nc, .run_away
|
||||||
|
|
||||||
.run_away
|
.run_away
|
||||||
call UpdateBattleMonInParty
|
call UpdateBattleMonInParty
|
||||||
xor a
|
xor a
|
||||||
|
Reference in New Issue
Block a user