diff options
author | yenatch <yenatch@gmail.com> | 2013-12-30 23:32:37 -0500 |
---|---|---|
committer | yenatch <yenatch@gmail.com> | 2013-12-30 23:32:37 -0500 |
commit | a10ee4e9f1ee3d671b67e2e68531b1f851661000 (patch) | |
tree | fc4bb5cccf2527a4ac23d7035db549615b906ab3 | |
parent | bfaad924e7f0ebad59da85830211b9b0c8d2afa8 (diff) |
comment move priority functions
-rw-r--r-- | battle/core.asm | 32 | ||||
-rw-r--r-- | battle/effect_commands.asm | 6 |
2 files changed, 24 insertions, 14 deletions
diff --git a/battle/core.asm b/battle/core.asm index 9650a9323..e014d80e2 100644 --- a/battle/core.asm +++ b/battle/core.asm @@ -475,7 +475,7 @@ Function3c314: ; 3c314 ld a, [$d0ec] and a jp nz, .asm_3c3f1 - call Function3c5b4 + call CompareMovePriority jr z, .asm_3c36d jp c, .asm_3c3f1 jp Function3c3f3 @@ -848,7 +848,10 @@ AlwaysFleeMons: ; 3c5b1 ; 3c5b4 -Function3c5b4: ; 3c5b4 +CompareMovePriority: ; 3c5b4 +; Compare the priority of the player and enemy's moves. +; Return carry if the player goes first, or z if they match. + ld a, [CurPlayerMove] call GetMovePriority ld b, a @@ -861,39 +864,45 @@ Function3c5b4: ; 3c5b4 ; 3c5c5 GetMovePriority: ; 3c5c5 +; Return the priority (0-3) of move a. + ld b, a + + ; Vital throw goes last. cp VITAL_THROW ld a, 0 ret z - call Function3c5ec - ld hl, .data_3c5df + + call GetMoveEffect + ld hl, MoveEffectPriorities .loop ld a, [hli] cp b - jr z, .asm_3c5dd + jr z, .done inc hl - cp $ff + cp -1 jr nz, .loop + ld a, 1 ret -.asm_3c5dd +.done ld a, [hl] ret ; 3c5df -.data_3c5df +MoveEffectPriorities: ; 3c5df db EFFECT_PROTECT, 3 db EFFECT_ENDURE, 3 db EFFECT_PRIORITY_HIT, 2 db EFFECT_WHIRLWIND, 0 db EFFECT_COUNTER, 0 db EFFECT_MIRROR_COAT, 0 - db $ff + db -1 ; 3c5ec -Function3c5ec: ; 3c5ec +GetMoveEffect: ; 3c5ec ld a, b dec a ld hl, Moves + MOVE_EFFECT @@ -905,6 +914,7 @@ Function3c5ec: ; 3c5ec ret ; 3c5fe + Function3c5fe: ; 3c5fe call Function309d call Function3c543 @@ -4282,7 +4292,7 @@ Function3dc5b: ; 3dc5b ld a, $10 call GetBattleVar ld b, a - call Function3c5ec + call GetMoveEffect ld a, b cp $80 jr nz, .asm_3dce4 diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 24eaf4288..666a75ef7 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -4469,7 +4469,7 @@ BattleCommand40: ; 35813 ret z ld b, a - callab Function3c5ec + callab GetMoveEffect ld a, b cp $59 @@ -5095,7 +5095,7 @@ BattleCommand48: ; 35b33 push bc ld b, a - callab Function3c5ec + callab GetMoveEffect ld a, b pop bc @@ -10181,7 +10181,7 @@ BattleCommand9a: ; 37c95 and a ret z ld b, a - callab Function3c5ec + callab GetMoveEffect ld a, b cp $90 ret z |