From 9f5396eff6bd7b8cded83cc450ea7ded8b6c0f9f Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 6 May 2013 02:39:01 -0400 Subject: [PATCH] clean up ai scoring --- battle/ai/scoring.asm | 959 +++++++++++++++++++++++++++--------------- main.asm | 3 + 2 files changed, 627 insertions(+), 335 deletions(-) diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm index e020c5b28..b65557bed 100644 --- a/battle/ai/scoring.asm +++ b/battle/ai/scoring.asm @@ -12,7 +12,7 @@ Function_0x38591: ; 38591 ret z inc de - call $5508 + call Function_0x39508 ld a, [EnemyMoveEffect] ld c, a @@ -50,7 +50,7 @@ Function_0x38591: ; 38591 jr z, .asm_38599 .asm_385d6 - call $5503 + call Function_0x39503 jr .asm_38599 ; 385db @@ -79,7 +79,7 @@ Function_0x385e0: ; 385e0 ret z inc de - call $5508 + call Function_0x39508 ld a, [EnemyMoveEffect] @@ -118,7 +118,7 @@ Function_0x385e0: ; 385e0 jr nz, .asm_3862a .asm_38621 - call $5527 + call Function_0x39527 jr c, .next @@ -153,7 +153,7 @@ Function_0x38635: ; 38635 ret z inc de - call $5508 + call Function_0x39508 push hl push bc @@ -200,7 +200,7 @@ Function_0x38635: ; 38635 and a jr z, .asm_38693 - call $5508 + call Function_0x39508 ld a, [EnemyMoveType] cp d @@ -226,7 +226,7 @@ Function_0x38635: ; 38635 jr .asm_3863d .asm_3869d - call $5503 + call Function_0x39503 jr .asm_3863d ; 386a2 @@ -247,7 +247,7 @@ Function_0x386a2: ; 386a2 ret z inc de - call $5508 + call Function_0x39508 ld a, [EnemyMovePower] and a @@ -276,7 +276,7 @@ Function_0x386be: ; 386be push de push bc push hl - call $5508 + call Function_0x39508 ld a, [EnemyMoveEffect] ld hl, .table_386f2 @@ -391,17 +391,17 @@ Function_0x386be: ; 386be AIScoring_Sleep: ; 387e3 ld b, $8 - call $52ca + call Function_0x392ca jr c, .asm_387f0 ld b, $6b - call $52ca + call Function_0x392ca ret nc .asm_387f0 - call $5527 + call Function_0x39527 ret c dec [hl] @@ -424,10 +424,10 @@ AIScoring_LeechHit: ; 387f7 jr c, .asm_38815 ret z - call $5251 + call Function_0x39251 ret c - call $5521 + call Function_0x39521 ret c dec [hl] @@ -449,15 +449,15 @@ AIScoring_LockOn: ; 3881d jr nz, .asm_38882 push hl - call $5298 + call Function_0x39298 jr nc, .asm_38877 - call $5281 + call Function_0x39281 jr c, .asm_38834 - call $5233 + call Function_0x39233 jr nc, .asm_38877 @@ -477,8 +477,8 @@ AIScoring_LockOn: ; 3881d cp $7 jr c, .asm_38875 - ld hl, EnemyMonMove1 - ld c, $5 + ld hl, EnemyMonMoves + ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 .asm_3884f dec c @@ -488,7 +488,7 @@ AIScoring_LockOn: ; 3881d and a jr z, .asm_38877 - call $5508 + call Function_0x39508 ld a, [EnemyMoveAccuracy] cp $b4 @@ -520,7 +520,7 @@ AIScoring_LockOn: ; 3881d .asm_3887a pop hl - call $5527 + call Function_0x39527 ret c dec [hl] @@ -529,9 +529,9 @@ AIScoring_LockOn: ; 3881d .asm_38882 push hl - ld hl, $d1e9 - ld de, EnemyMonMove1 - ld c, $5 + ld hl, Buffer1 - 1 + ld de, EnemyMonMoves + ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 .asm_3888b inc hl @@ -543,7 +543,7 @@ AIScoring_LockOn: ; 3881d jr z, .asm_388a2 inc de - call $5508 + call Function_0x39508 ld a, [EnemyMoveAccuracy] cp $b4 @@ -556,7 +556,7 @@ AIScoring_LockOn: ; 3881d .asm_388a2 pop hl - jp $5503 + jp Function_0x39503 ; 388a6 @@ -571,18 +571,18 @@ AIScoring_Explosion: ; 388a6 jr nc, .asm_388b7 push hl - call $4e2e + call Function_0x38e2e pop hl jr nz, .asm_388c6 .asm_388b7 - call $5281 + call Function_0x39281 jr c, .asm_388c6 - call $5298 + call Function_0x39298 ret nc call RNG @@ -613,9 +613,9 @@ AIScoring_DreamEater: ; 388ca AIScoring_EvasionUp: ; 388d4 ld a, [EnemyEvaLevel] cp $d - jp nc, $5503 + jp nc, Function_0x39503 - call $5251 + call Function_0x39251 jr nc, .asm_388f2 @@ -635,7 +635,7 @@ AIScoring_EvasionUp: ; 388d4 ret .asm_388f2 - call $5298 + call Function_0x39298 jr nc, .asm_3890f @@ -644,11 +644,11 @@ AIScoring_EvasionUp: ; 388d4 cp $a jr c, .asm_388ef - call $5281 + call Function_0x39281 jr nc, .asm_3890a - call $5521 + call Function_0x39521 jr c, .asm_388ef @@ -656,7 +656,7 @@ AIScoring_EvasionUp: ; 388d4 .asm_3890a - call $5527 + call Function_0x39527 jr c, .asm_38911 @@ -695,7 +695,6 @@ AIScoring_EvasionUp: ; 388d4 .asm_38938 call RNG - cp $50 ret c dec [hl] @@ -703,7 +702,7 @@ AIScoring_EvasionUp: ; 388d4 ret .asm_38941 - call $5527 + call Function_0x39527 ret c dec [hl] @@ -721,7 +720,7 @@ AIScoring_AlwaysHit: ; 38947 ret c .asm_38954 - call $5521 + call Function_0x39521 ret c dec [hl] @@ -735,25 +734,25 @@ AIScoring_MirrorMove: ; 3895b and a jr nz, .asm_38968 - call $5233 + call Function_0x39233 ret nc - jp $5503 + jp Function_0x39503 .asm_38968 push hl - ld hl, $5301 - ld de, $0001 + ld hl, Table_0x39301 + ld de, 1 call IsInArray pop hl ret nc - call $5527 + call Function_0x39527 ret c dec [hl] - call $5233 + call Function_0x39233 ret nc call RNG @@ -766,11 +765,11 @@ AIScoring_MirrorMove: ; 3895b AIScoring_AccuracyDown: ; 38985 - call $5246 + call Function_0x39246 jr nc, .asm_389a0 - call $5281 + call Function_0x39281 jr nc, .asm_389a0 @@ -790,7 +789,7 @@ AIScoring_AccuracyDown: ; 38985 ret .asm_389a0 - call $52b3 + call Function_0x392b3 jr nc, .asm_389bd @@ -799,11 +798,11 @@ AIScoring_AccuracyDown: ; 38985 cp $a jr c, .asm_3899d - call $526e + call Function_0x3926e jr nc, .asm_389b8 - call $5521 + call Function_0x39521 jr c, .asm_3899d @@ -811,7 +810,7 @@ AIScoring_AccuracyDown: ; 38985 .asm_389b8 - call $5527 + call Function_0x39527 jr c, .asm_389bf @@ -850,7 +849,6 @@ AIScoring_AccuracyDown: ; 38985 .asm_389e6 call RNG - cp $50 ret c dec [hl] @@ -858,7 +856,7 @@ AIScoring_AccuracyDown: ; 38985 ret .asm_389ef - call $5527 + call Function_0x39527 ret c dec [hl] @@ -870,35 +868,28 @@ AIScoring_Haze: ; 389f5 push hl ld hl, EnemyAtkLevel ld c, $8 - .asm_389fb dec c jr z, .asm_38a05 - ld a, [hli] cp $5 jr c, .asm_38a12 - jr .asm_389fb .asm_38a05 ld hl, PlayerAtkLevel ld c, $8 - .asm_38a0a dec c jr z, .asm_38a1b - ld a, [hli] cp $a jr c, .asm_38a0a - .asm_38a12 pop hl call RNG - cp $28 ret c dec [hl] @@ -912,11 +903,9 @@ AIScoring_Haze: ; 389f5 AIScoring_Bide: ; 38a1e - call $5251 - + call Function_0x39251 ret c call RNG - cp $19 ret c inc [hl] @@ -929,7 +918,6 @@ AIScoring_Whirlwind: ; 38a2a ld hl, $484e ld a, $d rst FarCall - ld a, [$c716] cp $a pop hl @@ -943,19 +931,15 @@ AIScoring_Heal: AIScoring_MorningSun: AIScoring_Synthesis: AIScoring_Moonlight: ; 38a3a - call $5298 - + call Function_0x39298 jr nc, .asm_38a45 - - call $5281 - + call Function_0x39281 ret nc inc [hl] ret .asm_38a45 call RNG - cp $19 ret c dec [hl] @@ -966,8 +950,7 @@ AIScoring_Moonlight: ; 38a3a AIScoring_Toxic: AIScoring_LeechSeed: ; 38a4e - call $526e - + call Function_0x3926e ret c inc [hl] ret @@ -976,11 +959,9 @@ AIScoring_LeechSeed: ; 38a4e AIScoring_LightScreen: AIScoring_Reflect: ; 38a54 - call $5251 - + call Function_0x39251 ret c call RNG - cp $14 ret c inc [hl] @@ -993,10 +974,8 @@ AIScoring_Ohko: ; 38a60 ld b, a ld a, [EnemyMonLevel] cp b - jp c, $5503 - - call $526e - + jp c, Function_0x39503 + call Function_0x3926e ret c inc [hl] ret @@ -1009,31 +988,27 @@ AIScoring_Bind: ; 38a71 jr nz, .asm_38a8b ld a, [PlayerSubStatus5] - bit 0, a + bit SUBSTATUS_TOXIC, a jr nz, .asm_38a91 ld a, [PlayerSubStatus1] - and $c9 + and 1<