diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-06-29 12:25:46 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-06-29 12:25:46 -0400 |
commit | 416255bea47756eefb365f32c996100d5c88c9c3 (patch) | |
tree | 2231adbe5e15cdee222f00c9234ea6ef903e22b5 | |
parent | 152efaadc014b3095e087a5375c76be1fb1a9da0 (diff) |
Identify more unnamed labels
-rw-r--r-- | audio/cries.asm | 105 | ||||
-rw-r--r-- | audio/sfx.asm | 26 | ||||
-rw-r--r-- | constants/pokemon_data_constants.asm | 4 | ||||
-rw-r--r-- | engine/battle/ai/items.asm | 4 | ||||
-rw-r--r-- | engine/battle/ai/move.asm | 4 | ||||
-rw-r--r-- | engine/battle/ai/scoring.asm | 346 | ||||
-rw-r--r-- | engine/battle/core.asm | 2 | ||||
-rw-r--r-- | engine/events/daycare.asm | 4 | ||||
-rw-r--r-- | macros/wram.asm | 5 |
9 files changed, 248 insertions, 252 deletions
diff --git a/audio/cries.asm b/audio/cries.asm index f7aef295..352ce321 100644 --- a/audio/cries.asm +++ b/audio/cries.asm @@ -221,9 +221,9 @@ Cry_Magcargo_Ch6: Cry_Magcargo_Ch8: noise_note 2, 14, 8, 59 -Cry_Magcargo_branch_f2eb5: +.loop: noise_note 1, 15, 1, 78 - sound_loop 5, Cry_Magcargo_branch_f2eb5 + sound_loop 5, .loop noise_note 2, 13, 8, 63 noise_note 20, 12, 2, 95 sound_ret @@ -348,7 +348,6 @@ Cry_Marill_Ch8: Cry_Togepi_Ch5: pitch_offset 2 Cry_Togepi_Ch6: -Cry_Togetic_branch_f2fe2: duty_cycle_pattern 1, 1, 0, 2 square_note 4, 15, 1, 1942 square_note 4, 15, 1, 1837 @@ -359,7 +358,7 @@ Cry_Togetic_branch_f2fe2: Cry_Togetic_Ch5: pitch_offset 2 Cry_Togetic_Ch6: - sound_call Cry_Togetic_branch_f2fe2 + sound_call Cry_Togepi_Ch6 sound_loop 2, Cry_Togetic_Ch6 square_note 14, 0, 0, 0 square_note 8, 15, 2, 1986 @@ -436,12 +435,12 @@ Cry_Hoothoot_Ch5: Cry_Hoothoot_Ch6: duty_cycle_pattern 0, 2, 0, 2 -Cry_Hoothoot_branch_f30bb: +.loop1: square_note 2, 10, 1, 1536 - sound_loop 3, Cry_Hoothoot_branch_f30bb -Cry_Hoothoot_branch_f30c3: + sound_loop 3, .loop1 +.loop2: square_note 2, 10, 1, 1584 - sound_loop 4, Cry_Hoothoot_branch_f30c3 + sound_loop 4, .loop2 square_note 4, 10, 2, 1588 square_note 4, 9, 1, 1592 sound_ret @@ -456,11 +455,11 @@ Cry_Hoothoot_Ch8: Cry_Sentret_Ch5: pitch_offset 32 duty_cycle 0 - sound_jump Cry_Sentret_branch_f30eb + sound_jump Cry_Sentret_Ch6.body Cry_Sentret_Ch6: duty_cycle_pattern 0, 1, 2, 3 -Cry_Sentret_branch_f30eb: +.body: square_note 8, 3, -1, 1837 square_note 8, 15, 1, 1824 sound_ret @@ -473,12 +472,11 @@ Cry_Sentret_Ch8: Cry_Mareep_Ch5: pitch_offset 32 duty_cycle 0 - sound_jump Cry_Mareep_branch_f3105 + sound_jump Cry_Mareep_Ch6.body Cry_Mareep_Ch6: duty_cycle_pattern 0, 0, 0, 1 -Cry_Mareep_branch_f3105: -Cry_Gligar_branch_f3105: +.body: square_note 4, 3, -2, 1853 square_note 6, 15, 8, 1890 square_note 6, 15, 8, 1888 @@ -490,14 +488,14 @@ Cry_Cyndaquil_Ch5: Cry_Cyndaquil_Ch6: duty_cycle 2 square_note 8, 2, -7, 263 -Cry_Cyndaquil_branch_f311f: +.loop1: square_note 0, 14, 1, 1155 square_note 0, 5, 1, 1102 - sound_loop 4, Cry_Cyndaquil_branch_f311f -Cry_Cyndaquil_branch_f312b: + sound_loop 4, .loop1 +.loop2: square_note 0, 14, 1, 986 square_note 1, 5, 1, 786 - sound_loop 4, Cry_Cyndaquil_branch_f312b + sound_loop 4, .loop2 sound_ret Cry_Gligar_Ch8: @@ -524,16 +522,16 @@ Cry_Chikorita_Ch8: Cry_Gligar_Ch5: duty_cycle_pattern 2, 2, 0, 2 - sound_jump Cry_Gligar_branch_f3105 + sound_jump Cry_Mareep_Ch6.body Cry_Girafarig_Ch5: duty_cycle 1 pitch_offset 4 - sound_jump Cry_Girafarig_branch_f316f + sound_jump Cry_Girafarig_Ch6.body Cry_Girafarig_Ch6: duty_cycle_pattern 1, 0, 0, 1 -Cry_Girafarig_branch_f316f: +.body: square_note 4, 6, 8, 1880 square_note 2, 14, 8, 1888 square_note 2, 14, 8, 1895 @@ -568,11 +566,11 @@ Cry_Slugma_Ch8: Cry_Ledyba_Ch5: pitch_offset 2 duty_cycle 2 - sound_jump Cry_Ledyba_branch_f31c2 + sound_jump Cry_Ledyba_Ch6.body Cry_Ledyba_Ch6: duty_cycle_pattern 0, 0, 0, 1 -Cry_Ledyba_branch_f31c2: +.body: square_note 3, 15, 8, 1937 square_note 3, 13, 8, 1933 square_note 2, 0, 0, 0 @@ -631,24 +629,24 @@ Cry_Donphan_Ch8: Cry_Teddiursa_Ch5: Cry_Typhlosion_Ch5: duty_cycle_pattern 0, 1, 0, 2 -Cry_Teddiursa_branch_f3246: +.loop1: square_note 3, 12, 1, 1937 - sound_loop 3, Cry_Teddiursa_branch_f3246 -Cry_Teddiursa_branch_f324e: + sound_loop 3, .loop1 +.loop2: square_note 3, 13, 1, 1201 - sound_loop 6, Cry_Teddiursa_branch_f324e -Cry_Teddiursa_branch_f3256: + sound_loop 6, .loop2 +.loop3: square_note 1, 13, 1, 1169 square_note 1, 11, 1, 1105 - sound_loop 6, Cry_Teddiursa_branch_f3256 -Cry_Teddiursa_branch_f3262: + sound_loop 6, .loop3 +.loop4: square_note 1, 10, 3, 1137 square_note 1, 8, 1, 1089 - sound_loop 6, Cry_Teddiursa_branch_f3262 -Cry_Teddiursa_branch_f326e: + sound_loop 6, .loop4 +.loop5: square_note 1, 4, 1, 1057 square_note 1, 2, 1, 1025 - sound_loop 4, Cry_Teddiursa_branch_f326e + sound_loop 4, .loop5 sound_ret Cry_Teddiursa_Ch6: @@ -672,12 +670,11 @@ Cry_Typhlosion_Ch8: Cry_Natu_Ch5: duty_cycle_pattern 3, 1, 3, 2 -Cry_Mantine_branch_f32a9: -Cry_Sunflora_branch_f32a9: +.body1: square_note 4, 15, 8, 1969 square_note 4, 15, 8, 1968 square_note 4, 4, 8, 1967 -Cry_Mantine_branch_f32b5: +.body2: square_note 4, 15, 8, 1970 square_note 4, 15, 8, 1971 square_note 4, 4, 8, 1972 @@ -685,12 +682,12 @@ Cry_Mantine_branch_f32b5: Cry_Natu_Ch6: Cry_Sunflora_Ch6: -Cry_Mantine_branch_f32c2: +.body1: duty_cycle_pattern 3, 3, 0, 2 square_note 4, 15, 8, 1970 square_note 4, 15, 8, 1969 square_note 4, 2, 8, 1968 -Cry_Mantine_branch_f32d0: +.body2: square_note 4, 15, 8, 1972 square_note 4, 15, 8, 1974 square_note 4, 4, 8, 1976 @@ -698,11 +695,11 @@ Cry_Mantine_branch_f32d0: Cry_Natu_Ch8: Cry_Sunflora_Ch8: -Cry_Mantine_branch_f32dd: +.body1: noise_note 4, 8, 8, 5 noise_note 4, 8, 8, 4 noise_note 4, 3, 8, 3 -Cry_Mantine_branch_f32e6: +.body2: noise_note 4, 8, 8, 5 noise_note 4, 8, 8, 4 noise_note 4, 8, 7, 4 @@ -715,30 +712,30 @@ Cry_Teddiursa_Ch8: Cry_Sunflora_Ch5: duty_cycle 0 - sound_jump Cry_Sunflora_branch_f32a9 + sound_jump Cry_Natu_Ch5.body1 Cry_Mantine_Ch5: duty_cycle 0 - sound_call Cry_Mantine_branch_f32a9 - sound_call Cry_Mantine_branch_f32b5 + sound_call Cry_Natu_Ch5.body1 + sound_call Cry_Natu_Ch5.body2 sound_ret Cry_Mantine_Ch6: - sound_call Cry_Mantine_branch_f32c2 - sound_call Cry_Mantine_branch_f32d0 + sound_call Cry_Sunflora_Ch6.body1 + sound_call Cry_Sunflora_Ch6.body2 sound_ret Cry_Mantine_Ch8: - sound_call Cry_Mantine_branch_f32dd - sound_call Cry_Mantine_branch_f32e6 + sound_call Cry_Sunflora_Ch8.body1 + sound_call Cry_Sunflora_Ch8.body2 sound_ret Cry_Ampharos_Ch5: duty_cycle_pattern 3, 1, 3, 2 -Cry_Ampharos_branch_f3315: +.loop: square_note 1, 12, 1, 1312 square_note 1, 10, 1, 1056 - sound_loop 4, Cry_Ampharos_branch_f3315 + sound_loop 4, .loop duty_cycle 0 square_note 4, 7, 8, 1888 square_note 4, 7, 8, 1840 @@ -833,15 +830,15 @@ Cry_Aipom_Ch5: Cry_Aipom_Ch6: duty_cycle_pattern 0, 2, 1, 3 -Cry_Aipom_branch_f3403: +.loop1: square_note 1, 15, 1, 1972 - sound_loop 8, Cry_Aipom_branch_f3403 -Cry_Aipom_branch_f340b: + sound_loop 8, .loop1 +.loop2: square_note 1, 12, 1, 1936 - sound_loop 3, Cry_Aipom_branch_f340b -Cry_Aipom_branch_f3413: + sound_loop 3, .loop2 +.loop3: square_note 1, 11, 1, 1933 - sound_loop 2, Cry_Aipom_branch_f3413 + sound_loop 2, .loop3 square_note 16, 9, 2, 1941 sound_ret diff --git a/audio/sfx.asm b/audio/sfx.asm index 0e51eb1b..5955d283 100644 --- a/audio/sfx.asm +++ b/audio/sfx.asm @@ -4492,18 +4492,18 @@ Sfx_Thunder_Ch8: Sfx_Supersonic_Ch5: duty_cycle 2 square_note 15, 3, -7, 1984 -Sfx_Supersonic_branch_f21ec: +.loop: square_note 15, 13, -7, 1984 - sound_loop 4, Sfx_Supersonic_branch_f21ec + sound_loop 4, .loop square_note 15, 13, 1, 1984 sound_ret Sfx_Supersonic_Ch6: duty_cycle_pattern 2, 3, 0, 3 square_note 15, 2, -7, 1992 -Sfx_Supersonic_branch_f21ff: +.loop: square_note 15, 12, -7, 1991 - sound_loop 4, Sfx_Supersonic_branch_f21ff + sound_loop 4, .loop square_note 15, 12, 1, 1992 sound_ret @@ -4835,10 +4835,10 @@ Sfx_HyperBeam_Ch5: square_note 2, 15, 1, 1984 square_note 2, 15, 1, 1792 square_note 2, 15, 1, 2000 -Sfx_HyperBeam_branch_f24f5: +.loop: square_note 2, 15, 1, 1792 square_note 2, 15, 1, 2016 - sound_loop 12, Sfx_HyperBeam_branch_f24f5 + sound_loop 12, .loop square_note 15, 15, 1, 1792 sound_ret @@ -4855,10 +4855,10 @@ Sfx_HyperBeam_Ch6: square_note 2, 15, 1, 1985 square_note 2, 15, 1, 1793 square_note 2, 15, 1, 2001 -Sfx_HyperBeam_branch_f2534: +.loop: square_note 2, 15, 1, 1793 square_note 2, 15, 1, 2017 - sound_loop 12, Sfx_HyperBeam_branch_f2534 + sound_loop 12, .loop square_note 15, 15, 1, 1793 sound_ret @@ -4949,17 +4949,17 @@ Sfx_Metronome_Ch5: sound_ret Sfx_Unknown5F_Ch5: -Sfx_Unknown5F_branch_f25f5: +.loop: square_note 2, 15, 7, 1537 square_note 2, 15, 7, 1793 - sound_loop 8, Sfx_Unknown5F_Ch5 + sound_loop 8, .loop sound_ret Sfx_Unknown5F_Ch6: square_note 1, 15, 7, 65535 square_note 2, 15, 7, 1538 square_note 2, 15, 7, 1794 - sound_loop 8, Sfx_Unknown5F_branch_f25f5 + sound_loop 8, Sfx_Unknown5F_Ch5.loop sound_ret Sfx_Fanfare2_Ch5: @@ -5143,9 +5143,9 @@ Sfx_Sandstorm_Ch8: Sfx_Elevator_Ch5: duty_cycle 2 pitch_sweep 5, -2 -Sfx_Elevator_branch_f2704: +.loop: square_note 2, 15, 1, 768 - sound_loop 48, Sfx_Elevator_branch_f2704 + sound_loop 48, .loop pitch_sweep 0, 8 duty_cycle 2 square_note 15, 15, 3, 1840 diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm index 20b31395..7729161e 100644 --- a/constants/pokemon_data_constants.asm +++ b/constants/pokemon_data_constants.asm @@ -91,8 +91,8 @@ MON_DEF EQUS "(wPartyMon1Defense - wPartyMon1)" MON_SPD EQUS "(wPartyMon1Speed - wPartyMon1)" MON_SAT EQUS "(wPartyMon1SpclAtk - wPartyMon1)" MON_SDF EQUS "(wPartyMon1SpclDef - wPartyMon1)" -BOXMON_STRUCT_LENGTH EQUS "(wPartyMon1End - wPartyMon1)" -PARTYMON_STRUCT_LENGTH EQUS "(wPartyMon1StatsEnd - wPartyMon1)" +BOXMON_STRUCT_LENGTH EQUS "(wPartyMon1BoxEnd - wPartyMon1)" +PARTYMON_STRUCT_LENGTH EQUS "(wPartyMon1StructEnd - wPartyMon1)" NICKNAMED_MON_STRUCT_LENGTH EQUS "(PARTYMON_STRUCT_LENGTH + MON_NAME_LENGTH)" REDMON_STRUCT_LENGTH EQU 44 diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm index 0f30199e..7b4f2f47 100644 --- a/engine/battle/ai/items.asm +++ b/engine/battle/ai/items.asm @@ -699,7 +699,7 @@ EnemyWithdrewText: text_far _EnemyWithdrewText text_end -Function384c7: ; This appears to be unused +EnemyUsedFullHealRed: ; unreferenced call AIUsedItemSound call AI_HealStatus ld a, FULL_HEAL_RED ; X_SPEED @@ -746,7 +746,7 @@ EnemyUsedDireHit: ld a, DIRE_HIT jp PrintText_UsedItemOn_AND_AIUpdateHUD -Function38510: ; This appears to be unused +Function38510: ; unreferenced ldh [hDivisor], a ld hl, wEnemyMonMaxHP ld a, [hli] diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm index 060761a0..cb9289d5 100644 --- a/engine/battle/ai/move.asm +++ b/engine/battle/ai/move.asm @@ -50,7 +50,7 @@ AIChooseMove: .CheckMovePP: inc b ld a, b - cp wEnemyMonMovesEnd - wEnemyMonMoves + 1 + cp NUM_MOVES + 1 jr z, .ApplyLayers inc hl ld a, [de] @@ -110,7 +110,7 @@ AIChooseMove: .DecrementScores: ld hl, wBuffer1 ld de, wEnemyMonMoves - ld c, wEnemyMonMovesEnd - wEnemyMonMoves + ld c, NUM_MOVES .DecrementNextScore: ; If the enemy has no moves, this will infinite. diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm index bfb9c282..7e4a5495 100644 --- a/engine/battle/ai/scoring.asm +++ b/engine/battle/ai/scoring.asm @@ -8,7 +8,7 @@ AI_Basic: ld hl, wBuffer1 - 1 ld de, wEnemyMonMoves - ld b, wEnemyMonMovesEnd - wEnemyMonMoves + 1 + ld b, NUM_MOVES + 1 .checkmove dec b ret z @@ -75,7 +75,7 @@ AI_Setup: ld hl, wBuffer1 - 1 ld de, wEnemyMonMoves - ld b, wEnemyMonMovesEnd - wEnemyMonMoves + 1 + ld b, NUM_MOVES + 1 .checkmove dec b ret z @@ -149,7 +149,7 @@ AI_Types: ld hl, wBuffer1 - 1 ld de, wEnemyMonMoves - ld b, wEnemyMonMovesEnd - wEnemyMonMoves + 1 + ld b, NUM_MOVES + 1 .checkmove dec b ret z @@ -195,15 +195,15 @@ AI_Types: ld a, [wEnemyMoveStruct + MOVE_TYPE] ld d, a ld hl, wEnemyMonMoves - ld b, wEnemyMonMovesEnd - wEnemyMonMoves + 1 + ld b, NUM_MOVES + 1 ld c, 0 .checkmove2 dec b - jr z, .asm_38685 + jr z, .movesdone ld a, [hli] and a - jr z, .asm_38685 + jr z, .movesdone call AIGetEnemyMove ld a, [wEnemyMoveStruct + MOVE_TYPE] @@ -211,12 +211,12 @@ AI_Types: jr z, .checkmove2 ld a, [wEnemyMoveStruct + MOVE_POWER] and a - jr nz, .asm_38684 + jr nz, .damaging jr .checkmove2 -.asm_38684 +.damaging ld c, a -.asm_38685 +.movesdone ld a, c pop bc pop de @@ -236,7 +236,7 @@ AI_Offensive: ld hl, wBuffer1 - 1 ld de, wEnemyMonMoves - ld b, wEnemyMonMovesEnd - wEnemyMonMoves + 1 + ld b, NUM_MOVES + 1 .checkmove dec b ret z @@ -263,7 +263,7 @@ AI_Smart: ld hl, wBuffer1 ld de, wEnemyMonMoves - ld b, wEnemyMonMovesEnd - wEnemyMonMoves + 1 + ld b, NUM_MOVES + 1 .checkmove dec b ret z @@ -279,7 +279,7 @@ AI_Smart: call AIGetEnemyMove ld a, [wEnemyMoveStruct + MOVE_EFFECT] - ld hl, .table_386e4 + ld hl, AI_Smart_EffectHandlers ld de, 3 call IsInArray @@ -306,7 +306,7 @@ AI_Smart: inc hl jr .checkmove -.table_386e4 +AI_Smart_EffectHandlers: dbw EFFECT_SLEEP, AI_Smart_Sleep dbw EFFECT_LEECH_HIT, AI_Smart_LeechHit dbw EFFECT_SELFDESTRUCT, AI_Smart_Selfdestruct @@ -395,13 +395,13 @@ AI_Smart_Sleep: ld b, EFFECT_DREAM_EATER call AIHasMoveEffect - jr c, .asm_387e2 + jr c, .encourage ld b, EFFECT_NIGHTMARE call AIHasMoveEffect ret nc -.asm_387e2 +.encourage call AI_50_50 ret c dec [hl] @@ -418,7 +418,7 @@ AI_Smart_LeechHit: ; 60% chance to discourage this move if not very effective. ld a, [wTypeMatchup] cp EFFECTIVE - jr c, .asm_38807 + jr c, .discourage ; Do nothing if effectiveness is neutral. ret z @@ -434,7 +434,7 @@ AI_Smart_LeechHit: dec [hl] ret -.asm_38807 +.discourage call Random cp 39 percent + 1 ret c @@ -471,7 +471,7 @@ AI_Smart_LockOn: jr c, .asm_38867 ld hl, wEnemyMonMoves - ld c, wEnemyMonMovesEnd - wEnemyMonMoves + 1 + ld c, NUM_MOVES + 1 .asm_38841 dec c jr z, .asm_38869 @@ -520,7 +520,7 @@ AI_Smart_LockOn: push hl ld hl, wBuffer1 - 1 ld de, wEnemyMonMoves - ld c, wEnemyMonMovesEnd - wEnemyMonMoves + 1 + ld c, NUM_MOVES + 1 .asm_3887d inc hl @@ -551,7 +551,7 @@ AI_Smart_Selfdestruct: ; Greatly discourage this move if enemy's HP is above 50%. call AICheckEnemyHalfHP - jr c, .asm_388a7 + jr c, .discourage ; Do nothing if enemy's HP is below 25%. call AICheckEnemyQuarterHP @@ -563,7 +563,7 @@ AI_Smart_Selfdestruct: cp 8 percent ret c -.asm_388a7 +.discourage inc [hl] inc [hl] inc [hl] @@ -594,14 +594,14 @@ AI_Smart_EvasionUp: ; ...greatly encourage this move if player is badly poisoned. ld a, [wPlayerSubStatus5] bit SUBSTATUS_TOXIC, a - jr nz, .asm_388d0 + jr nz, .encourage ; ...70% chance to greatly encourage this move if player is not badly poisoned. call Random cp 70 percent jr nc, .asm_388f2 -.asm_388d0 +.encourage dec [hl] dec [hl] ret @@ -615,7 +615,7 @@ AI_Smart_EvasionUp: ; If enemy's HP is above 25% but not full, 4% chance to greatly encourage this move. call Random cp 4 percent - jr c, .asm_388d0 + jr c, .encourage ; If enemy's HP is between 25% and 50%,... call AICheckEnemyHalfHP @@ -623,7 +623,7 @@ AI_Smart_EvasionUp: ; If enemy's HP is above 50% but not full, 20% chance to greatly encourage this move. call AI_80_20 - jr c, .asm_388d0 + jr c, .encourage jr .asm_388f2 .asm_388eb @@ -659,11 +659,11 @@ AI_Smart_EvasionUp: ; Greatly encourage this move if the player is in the middle of Fury Cutter or Rollout. ld a, [wPlayerFuryCutterCount] and a - jr nz, .asm_388d0 + jr nz, .encourage ld a, [wPlayerSubStatus1] bit SUBSTATUS_ROLLOUT, a - jr nz, .asm_388d0 + jr nz, .encourage .asm_38917 inc [hl] @@ -696,14 +696,14 @@ AI_Smart_AlwaysHit: ; ...enemy's accuracy level has been lowered three or more stages ld a, [wEnemyAccLevel] cp BASE_STAT_LEVEL - 2 - jr c, .asm_38935 + jr c, .encourage ; ...or player's evasion level has been raised three or more stages. ld a, [wPlayerEvaLevel] cp BASE_STAT_LEVEL + 3 ret c -.asm_38935 +.encourage call AI_80_20 ret c @@ -715,7 +715,7 @@ AI_Smart_MirrorMove: ; If the player did not use any move last turn... ld a, [wLastPlayerCounterMove] and a - jr nz, .asm_38949 + jr nz, .usedmove ; ...do nothing if enemy is slower than player call AICompareSpeed @@ -725,7 +725,7 @@ AI_Smart_MirrorMove: jp AIDiscourageMove ; If the player did use a move last turn... -.asm_38949 +.usedmove push hl ld hl, UsefulMoves ld de, 1 @@ -764,14 +764,14 @@ AI_Smart_AccuracyDown: ; ...greatly encourage this move if player is badly poisoned. ld a, [wPlayerSubStatus5] bit SUBSTATUS_TOXIC, a - jr nz, .asm_3897e + jr nz, .encourage ; ...70% chance to greatly encourage this move if player is not badly poisoned. call Random cp 70 percent jr nc, .asm_389a0 -.asm_3897e +.encourage dec [hl] dec [hl] ret @@ -785,7 +785,7 @@ AI_Smart_AccuracyDown: ; If player's HP is above 25% but not full, 4% chance to greatly encourage this move. call Random cp 4 percent - jr c, .asm_3897e + jr c, .encourage ; If player's HP is between 25% and 50%,... call AICheckPlayerHalfHP @@ -793,7 +793,7 @@ AI_Smart_AccuracyDown: ; If player's HP is above 50% but not full, 20% chance to greatly encourage this move. call AI_80_20 - jr c, .asm_3897e + jr c, .encourage jr .asm_389a0 ; ...50% chance to greatly discourage this move. @@ -825,11 +825,11 @@ AI_Smart_AccuracyDown: ; Greatly encourage this move if the player is in the middle of Fury Cutter or Rollout. ld a, [wPlayerFuryCutterCount] and a - jr nz, .asm_3897e + jr nz, .encourage ld a, [wPlayerSubStatus1] bit SUBSTATUS_ROLLOUT, a - jr nz, .asm_3897e + jr nz, .encourage .asm_389c5 inc [hl] @@ -861,26 +861,26 @@ AI_Smart_ResetStats: push hl ld hl, wEnemyAtkLevel ld c, NUM_LEVEL_STATS -.asm_389dc +.enemystatsloop dec c - jr z, .asm_389e6 + jr z, .enemystatsdone ld a, [hli] cp BASE_STAT_LEVEL - 2 - jr c, .asm_389f3 - jr .asm_389dc + jr c, .encourage + jr .enemystatsloop ; 85% chance to encourage this move if any of player's stat levels is higher than +2. -.asm_389e6 +.enemystatsdone ld hl, wPlayerAtkLevel - ld c, $8 -.asm_389eb + ld c, NUM_LEVEL_STATS +.playerstatsloop dec c - jr z, .asm_389fc + jr z, .discourage ld a, [hli] cp BASE_STAT_LEVEL + 3 - jr c, .asm_389eb + jr c, .playerstatsloop -.asm_389f3 +.encourage pop hl call Random cp 16 percent @@ -891,7 +891,7 @@ AI_Smart_ResetStats: ; Discourage this move if neither: ; Any of enemy's stat levels is lower than -2. ; Any of player's stat levels is higher than +2. -.asm_389fc +.discourage pop hl inc [hl] ret @@ -932,13 +932,13 @@ AI_Smart_Moonlight: ; Do nothing otherwise. call AICheckEnemyQuarterHP - jr nc, .asm_38a26 + jr nc, .encourage call AICheckEnemyHalfHP ret nc inc [hl] ret -.asm_38a26 +.encourage call Random cp 10 percent ret c @@ -987,31 +987,31 @@ AI_Smart_TrapTarget: ; 50% chance to discourage this move if the player is already trapped. ld a, [wPlayerWrapCount] and a - jr nz, .asm_38a6c + jr nz, .discourage ; 50% chance to greatly encourage this move if player is either ; badly poisoned, in love, identified, stuck in Rollout, or has a Nightmare. ld a, [wPlayerSubStatus5] bit SUBSTATUS_TOXIC, a - jr nz, .asm_38a72 + jr nz, .encourage ld a, [wPlayerSubStatus1] and 1 << SUBSTATUS_IN_LOVE | 1 << SUBSTATUS_ROLLOUT | 1 << SUBSTATUS_IDENTIFIED | 1 << SUBSTATUS_NIGHTMARE - jr nz, .asm_38a72 + jr nz, .encourage ; Else, 50% chance to greatly encourage this move if it's the player's Pokemon first turn. ld a, [wPlayerTurnsTaken] and a - jr z, .asm_38a72 + jr z, .encourage ; 50% chance to discourage this move otherwise. -.asm_38a6c +.discourage call AI_50_50 ret c inc [hl] ret -.asm_38a72 +.encourage call AICheckEnemyQuarterHP ret nc call AI_50_50 @@ -1079,10 +1079,10 @@ AI_Smart_Confuse: ret c call Random cp 10 percent - jr c, .asm_38ac8 + jr c, .skipdiscourage inc [hl] -.asm_38ac8 +.skipdiscourage ; Discourage again if player's HP is below 25%. call AICheckPlayerQuarterHP ret c @@ -1092,12 +1092,12 @@ AI_Smart_Confuse: AI_Smart_SpDefenseUp2: ; Discourage this move if enemy's HP is lower than 50%. call AICheckEnemyHalfHP - jr nc, .asm_38af1 + jr nc, .discourage ; Discourage this move if enemy's special defense level is higher than +3. ld a, [wEnemySDefLevel] cp BASE_STAT_LEVEL + 4 - jr nc, .asm_38af1 + jr nc, .discourage ; 80% chance to greatly encourage this move if ; enemy's Special Defense level is lower than +2, and the player is of a special type. @@ -1106,19 +1106,19 @@ AI_Smart_SpDefenseUp2: ld a, [wBattleMonType1] cp SPECIAL - jr nc, .asm_38aea + jr nc, .encourage ld a, [wBattleMonType2] cp SPECIAL ret c -.asm_38aea +.encourage call AI_80_20 ret c dec [hl] dec [hl] ret -.asm_38af1 +.discourage inc [hl] ret @@ -1151,7 +1151,7 @@ AI_Smart_SuperFang: AI_Smart_Paralyze: ; 50% chance to discourage this move if player's HP is below 25%. call AICheckPlayerQuarterHP - jr nc, .asm_38b1b + jr nc, .discourage ; 80% chance to greatly encourage this move ; if enemy is slower than player and its HP is above 25%. @@ -1165,7 +1165,7 @@ AI_Smart_Paralyze: dec [hl] ret -.asm_38b1b +.discourage call AI_50_50 ret c inc [hl] @@ -1205,7 +1205,7 @@ AI_Smart_Substitute: AI_Smart_HyperBeam: call AICheckEnemyHalfHP - jr c, .asm_38b53 + jr c, .discourage ; 50% chance to encourage this move if enemy's HP is below 25%. call AICheckEnemyQuarterHP @@ -1215,7 +1215,7 @@ AI_Smart_HyperBeam: dec [hl] ret -.asm_38b53 +.discourage ; If enemy's HP is above 50%, discourage this move at random call Random cp 35 percent + 1 @@ -1229,16 +1229,16 @@ AI_Smart_HyperBeam: AI_Smart_Rage: ld a, [wEnemySubStatus4] bit SUBSTATUS_RAGE, a - jr z, .asm_38b7c + jr z, .notbuilding ; If enemy's Rage is building, 50% chance to encourage this move. call AI_50_50 - jr c, .asm_38b6d + jr c, .skipencourage dec [hl] ; Encourage this move based on Rage's counter. -.asm_38b6d +.skipencourage ld a, [wEnemyRageCounter] cp 2 ret c @@ -1249,10 +1249,10 @@ AI_Smart_Rage: dec [hl] ret -.asm_38b7c +.notbuilding ; If enemy's Rage is not building, discourage this move if enemy's HP is below 50%. call AICheckEnemyHalfHP - jr nc, .asm_38b87 + jr nc, .discourage ; 50% chance to encourage this move otherwise. call AI_80_20 @@ -1260,7 +1260,7 @@ AI_Smart_Rage: dec [hl] ret -.asm_38b87 +.discourage inc [hl] ret @@ -1319,66 +1319,66 @@ AI_Smart_Counter: ld c, NUM_MOVES ld b, 0 -.asm_38bda +.playermoveloop ld a, [hli] and a - jr z, .asm_38c0e + jr z, .skipmove call AIGetEnemyMove ld a, [wEnemyMoveStruct + MOVE_POWER] and a - jr z, .asm_38c0e + jr z, .skipmove ld a, [wEnemyMoveStruct + MOVE_TYPE] cp SPECIAL - jr nc, .asm_38c0e + jr nc, .skipmove inc b -.asm_38c0e +.skipmove dec c - jr nz, .asm_38bda + jr nz, .playermoveloop pop hl ld a, b and a - jr z, .asm_38c1a + jr z, .discourage - cp $3 - jr nc, .asm_38c11 + cp 3 + jr nc, .encourage ld a, [wLastPlayerCounterMove] and a - jr z, .asm_38c19 + jr z, .done call AIGetEnemyMove ld a, [wEnemyMoveStruct + MOVE_POWER] and a - jr z, .asm_38c19 + jr z, .done ld a, [wEnemyMoveStruct + MOVE_TYPE] cp SPECIAL - jr nc, .asm_38c19 + jr nc, .done -.asm_38c11 +.encourage call Random cp 39 percent + 1 - jr c, .asm_38c19 + jr c, .done dec [hl] -.asm_38c19 +.done ret -.asm_38c1a +.discourage inc [hl] ret AI_Smart_Encore: call AICompareSpeed - jr nc, .asm_38c62 + jr nc, .discourage ld a, [wLastPlayerMove] and a @@ -1388,7 +1388,7 @@ AI_Smart_Encore: ld a, [wEnemyMoveStruct + MOVE_POWER] and a - jr z, .asm_38c49 + jr z, .weakmove push hl ld a, [wEnemyMoveStruct + MOVE_TYPE] @@ -1398,22 +1398,22 @@ AI_Smart_Encore: pop hl ld a, [wTypeMatchup] cp EFFECTIVE - jr nc, .asm_38c49 + jr nc, .weakmove and a ret nz - jr .asm_38c59 + jr .encourage -.asm_38c49 +.weakmove push hl ld a, [wLastPlayerCounterMove] ld hl, EncoreMoves ld de, 1 call IsInArray pop hl - jr nc, .asm_38c62 + jr nc, .discourage -.asm_38c59 +.encourage call Random cp 28 percent - 1 ret c @@ -1421,7 +1421,7 @@ AI_Smart_Encore: dec [hl] ret -.asm_38c62 +.discourage inc [hl] inc [hl] inc [hl] @@ -1457,14 +1457,14 @@ AI_Smart_SleepTalk: ld a, [wEnemyMonStatus] and SLP cp 1 - jr z, .asm_38ca8 + jr z, .discourage dec [hl] dec [hl] dec [hl] ret -.asm_38ca8 +.discourage inc [hl] inc [hl] inc [hl] @@ -1485,7 +1485,7 @@ AI_Smart_DefrostOpponent: AI_Smart_Spite: ld a, [wLastPlayerCounterMove] and a - jr nz, .asm_38cc8 + jr nz, .usedmove call AICompareSpeed jp c, AIDiscourageMove @@ -1495,42 +1495,42 @@ AI_Smart_Spite: inc [hl] ret -.asm_38cc8 +.usedmove push hl ld b, a ld c, NUM_MOVES ld hl, wBattleMonMoves ld de, wBattleMonPP -.asm_38cd2 +.moveloop ld a, [hli] cp b - jr z, .asm_38cdc + jr z, .foundmove inc de dec c - jr nz, .asm_38cd2 + jr nz, .moveloop pop hl ret -.asm_38cdc +.foundmove pop hl ld a, [de] cp 6 - jr c, .asm_38cee + jr c, .encourage cp 15 - jr nc, .asm_38cec + jr nc, .discourage call Random cp 39 percent + 1 ret nc -.asm_38cec +.discourage inc [hl] ret -.asm_38cee +.encourage call Random cp 39 percent + 1 ret c @@ -1538,7 +1538,7 @@ AI_Smart_Spite: dec [hl] ret -Function_0x38cf7: +CallAIDiscourageMove: ; unreferenced jp AIDiscourageMove AI_Smart_DestinyBond: @@ -1650,7 +1650,7 @@ AI_Smart_Thief: AI_Smart_Conversion2: ld a, [wLastPlayerMove] and a - jr nz, .asm_38daa + jr nz, .discourage push hl dec a @@ -1670,7 +1670,7 @@ AI_Smart_Conversion2: ld a, [wTypeMatchup] cp EFFECTIVE pop hl - jr c, .asm_38daa + jr c, .discourage ret z call AI_50_50 @@ -1679,7 +1679,7 @@ AI_Smart_Conversion2: dec [hl] ret -.asm_38daa +.discourage call Random cp 10 percent ret c @@ -1688,7 +1688,7 @@ AI_Smart_Conversion2: AI_Smart_Disable: call AICompareSpeed - jr nc, .asm_38dd4 + jr nc, .discourage push hl ld a, [wLastPlayerCounterMove] @@ -1697,7 +1697,7 @@ AI_Smart_Disable: call IsInArray pop hl - jr nc, .asm_38dcf + jr nc, .notencourage call Random cp 39 percent + 1 @@ -1705,12 +1705,12 @@ AI_Smart_Disable: dec [hl] ret -.asm_38dcf +.notencourage ld a, [wEnemyMoveStruct + MOVE_POWER] and a ret nz -.asm_38dd4 +.discourage call Random cp 8 percent ret c @@ -1719,7 +1719,7 @@ AI_Smart_Disable: AI_Smart_MeanLook: call AICheckEnemyHalfHP - jr nc, .asm_38e05 + jr nc, .discourage push hl call AICheckLastPlayerMon @@ -1730,13 +1730,13 @@ AI_Smart_MeanLook: ; Should check wPlayerSubStatus5 instead. ld a, [wEnemySubStatus5] bit SUBSTATUS_TOXIC, a - jr nz, .asm_38e07 + jr nz, .encourage ; 80% chance to greatly encourage this move if the player is either ; in love, identified, stuck in Rollout, or has a Nightmare. ld a, [wPlayerSubStatus1] and 1 << SUBSTATUS_IN_LOVE | 1 << SUBSTATUS_ROLLOUT | 1 << SUBSTATUS_IDENTIFIED | 1 << SUBSTATUS_NIGHTMARE - jr nz, .asm_38e07 + jr nz, .encourage ; Otherwise, discourage this move unless the player only has not very effective moves against the enemy. push hl @@ -1746,11 +1746,11 @@ AI_Smart_MeanLook: pop hl ret nc -.asm_38e05 +.discourage inc [hl] ret -.asm_38e07 +.encourage call AI_80_20 ret c dec [hl] @@ -1768,14 +1768,14 @@ AICheckLastPlayerMon: .loop ld a, [wCurBattleMon] cp c - jr z, .asm_38e25 + jr z, .skip ld a, [hli] or [hl] ret nz dec hl -.asm_38e25 +.skip add hl, de inc c dec b @@ -2207,13 +2207,13 @@ AI_Smart_Pursuit: ; 80% chance to discourage this move otherwise. call AICheckPlayerQuarterHP - jr nc, .asm_3903e + jr nc, .encourage call AI_80_20 ret c inc [hl] ret -.asm_3903e +.encourage call AI_50_50 ret c dec [hl] @@ -2226,17 +2226,17 @@ AI_Smart_RapidSpin: ld a, [wEnemyWrapCount] and a - jr nz, .asm_39058 + jr nz, .encourage ld a, [wEnemySubStatus4] bit SUBSTATUS_LEECH_SEED, a - jr nz, .asm_39058 + jr nz, .encourage ld a, [wEnemyScreens] bit SCREENS_SPIKES, a ret z -.asm_39058 +.encourage call AI_80_20 ret c @@ -2380,7 +2380,7 @@ AI_Smart_BellyDrum: ld a, [wEnemyAtkLevel] cp BASE_STAT_LEVEL + 3 - jr nc, .asm_3910e + jr nc, .discourage call AICheckEnemyMaxHP ret c @@ -2390,9 +2390,9 @@ AI_Smart_BellyDrum: call AICheckEnemyHalfHP ret c -.asm_3910e +.discourage ld a, [hl] - add $5 + add 5 ld [hl], a ret @@ -2462,59 +2462,59 @@ AI_Smart_MirrorCoat: ld c, NUM_MOVES ld b, 0 -.asm_39159 +.playermoveloop ld a, [hli] and a - jr z, .asm_3916e + jr z, .skipmove call AIGetEnemyMove ld a, [wEnemyMoveStruct + MOVE_POWER] and a - jr z, .asm_3916e + jr z, .skipmove ld a, [wEnemyMoveStruct + MOVE_TYPE] cp SPECIAL - jr c, .asm_3916e + jr c, .skipmove inc b -.asm_3916e +.skipmove dec c - jr nz, .asm_39159 + jr nz, .playermoveloop pop hl ld a, b and a - jr z, .asm_39199 + jr z, .discourage - cp $3 - jr nc, .asm_39190 + cp 3 + jr nc, .encourage ld a, [wLastPlayerCounterMove] and a - jr z, .asm_39198 + jr z, .done call AIGetEnemyMove ld a, [wEnemyMoveStruct + MOVE_POWER] and a - jr z, .asm_39198 + jr z, .done ld a, [wEnemyMoveStruct + MOVE_TYPE] cp SPECIAL - jr c, .asm_39198 + jr c, .done -.asm_39190 +.encourage call Random - cp 100 - jr c, .asm_39198 + cp 39 percent + 1 + jr c, .done dec [hl] -.asm_39198 +.done ret -.asm_39199 +.discourage inc [hl] ret @@ -2581,7 +2581,7 @@ AI_Smart_Solarbeam: ld a, [wBattleWeather] cp WEATHER_SUN - jr z, .asm_391e4 + jr z, .encourage cp WEATHER_RAIN ret nz @@ -2594,7 +2594,7 @@ AI_Smart_Solarbeam: inc [hl] ret -.asm_391e4 +.encourage call AI_80_20 ret c @@ -2653,12 +2653,12 @@ AICheckMaxHP: ld a, [de] inc de cp [hl] - jr nz, .asm_3922f + jr nz, .not_max inc hl ld a, [de] cp [hl] - jr nz, .asm_3922f + jr nz, .not_max pop bc pop de @@ -2666,7 +2666,7 @@ AICheckMaxHP: scf ret -.asm_3922f +.not_max pop bc pop de pop hl @@ -2758,7 +2758,7 @@ AIHasMoveEffect: push hl ld hl, wEnemyMonMoves - ld c, wEnemyMonMovesEnd - wEnemyMonMoves + ld c, NUM_MOVES .checkmove ld a, [hli] @@ -2793,11 +2793,11 @@ AIHasMoveInArray: .next ld a, [hli] - cp $ff + cp -1 jr z, .done ld b, a - ld c, wEnemyMonMovesEnd - wEnemyMonMoves + 1 + ld c, NUM_MOVES + 1 ld de, wEnemyMonMoves .check @@ -2828,25 +2828,25 @@ AI_Opportunist: ; Discourage stall moves if enemy's HP is below 25%. call AICheckEnemyQuarterHP - jr nc, .asm_392e8 + jr nc, .lowhp ; 50% chance to discourage stall moves if enemy's HP is between 25% and 50%. call AI_50_50 ret c -.asm_392e8 +.lowhp ld hl, wBuffer1 - 1 ld de, wEnemyMonMoves - ld c, wEnemyMonMovesEnd - wEnemyMonMoves + 1 + ld c, NUM_MOVES + 1 .checkmove inc hl dec c - jr z, .asm_3930d + jr z, .done ld a, [de] inc de and a - jr z, .asm_3930d + jr z, .done push hl push de @@ -2863,7 +2863,7 @@ AI_Opportunist: inc [hl] jr .checkmove -.asm_3930d +.done ret INCLUDE "data/battle/ai/stall_moves.asm" @@ -2883,7 +2883,7 @@ AI_Aggressive: .checkmove inc b ld a, b - cp wEnemyMonMovesEnd - wEnemyMonMoves + 1 + cp NUM_MOVES + 1 jr z, .gotstrongestmove ld a, [hli] @@ -2935,7 +2935,7 @@ AI_Aggressive: .checkmove2 inc b ld a, b - cp wEnemyMonMovesEnd - wEnemyMonMoves + 1 + cp NUM_MOVES + 1 jr z, .done ; Ignore this move if it is the highest damaging one. @@ -2983,11 +2983,11 @@ AIDamageCalc: ld de, 1 ld hl, ConstantDamageEffects call IsInArray - jr nc, .asm_393c6 + jr nc, .notconstant callfar BattleCommand_ConstantDamage ret -.asm_393c6 +.notconstant callfar EnemyAttackDamage callfar BattleCommand_DamageCalc callfar BattleCommand_Stab @@ -3004,8 +3004,8 @@ AI_Cautious: ld hl, wBuffer1 - 1 ld de, wEnemyMonMoves - ld c, wEnemyMonMovesEnd - wEnemyMonMoves + 1 -.asm_393eb + ld c, NUM_MOVES + 1 +.loop inc hl dec c ret z @@ -3025,14 +3025,14 @@ AI_Cautious: pop bc pop de pop hl - jr nc, .asm_393eb + jr nc, .loop call Random cp 90 percent + 1 ret nc inc [hl] - jr .asm_393eb + jr .loop INCLUDE "data/battle/ai/residual_moves.asm" @@ -3042,7 +3042,7 @@ AI_Status: ld hl, wBuffer1 - 1 ld de, wEnemyMonMoves - ld b, wEnemyMonMovesEnd - wEnemyMonMoves + 1 + ld b, NUM_MOVES + 1 .checkmove dec b ret z @@ -3105,7 +3105,7 @@ AI_Risky: ld hl, wBuffer1 - 1 ld de, wEnemyMonMoves - ld c, wEnemyMonMovesEnd - wEnemyMonMoves + 1 + ld c, NUM_MOVES + 1 .checkmove inc hl dec c diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 5e9c802b..9fcf1f38 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -6178,7 +6178,7 @@ LoadEnemyMon: ld hl, wEnemyMonStats ld de, wEnemyStats - ld bc, wEnemyMonStatsEnd - wEnemyMonStats + ld bc, NUM_EXP_STATS * 2 call CopyBytes ret diff --git a/engine/events/daycare.asm b/engine/events/daycare.asm index 2cc6c12a..2edf2def 100644 --- a/engine/events/daycare.asm +++ b/engine/events/daycare.asm @@ -474,7 +474,7 @@ DayCare_GiveEgg: ld bc, PARTYMON_STRUCT_LENGTH call DayCare_GetCurrentPartyMember ld hl, wEggMon - ld bc, wEggMonEnd - wEggMon + ld bc, BOXMON_STRUCT_LENGTH call CopyBytes call GetBaseData @@ -542,7 +542,7 @@ DayCare_InitBreeding: .UselessJump: xor a ld hl, wEggMon - ld bc, wEggMonEnd - wEggMon + ld bc, BOXMON_STRUCT_LENGTH call ByteFill ld hl, wEggNick ld bc, MON_NAME_LENGTH diff --git a/macros/wram.asm b/macros/wram.asm index 9c7a39ed..a6ad35b9 100644 --- a/macros/wram.asm +++ b/macros/wram.asm @@ -23,7 +23,7 @@ box_struct: MACRO \1Unused1:: db \1Unused2:: db \1Level:: db -\1End:: +\1BoxEnd:: ENDM party_struct: MACRO @@ -38,7 +38,7 @@ party_struct: MACRO \1Speed:: dw \1SpclAtk:: dw \1SpclDef:: dw -\1StatsEnd:: +\1StructEnd:: ENDM red_box_struct: MACRO @@ -91,7 +91,6 @@ battle_struct: MACRO \1Speed:: dw \1SpclAtk:: dw \1SpclDef:: dw -\1StatsEnd:: \1Type:: \1Type1:: db \1Type2:: db |