diff options
Diffstat (limited to 'battle')
-rw-r--r-- | battle/ai/items.asm | 7 | ||||
-rw-r--r-- | battle/ai/scoring.asm | 202 | ||||
-rw-r--r-- | battle/anim_commands.asm | 41 | ||||
-rw-r--r-- | battle/anim_objects.asm | 111 | ||||
-rw-r--r-- | battle/bg_effects.asm | 29 | ||||
-rw-r--r-- | battle/core.asm | 311 | ||||
-rw-r--r-- | battle/effect_commands.asm | 98 | ||||
-rw-r--r-- | battle/hidden_power.asm | 6 | ||||
-rw-r--r-- | battle/magikarp_length.asm | 3 |
9 files changed, 461 insertions, 347 deletions
diff --git a/battle/ai/items.asm b/battle/ai/items.asm index 3a880a00c..5cd3fd7fc 100644 --- a/battle/ai/items.asm +++ b/battle/ai/items.asm @@ -193,9 +193,9 @@ AI_TryItem: ; 38105 jr z, .has_item dec de +rept 3 inc hl - inc hl - inc hl +endr jr .loop .has_item @@ -213,8 +213,9 @@ AI_TryItem: ; 38105 pop de pop hl +rept 2 inc hl - inc hl +endr jr c, .loop .used_item diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm index 425d6911b..101d4e188 100644 --- a/battle/ai/scoring.asm +++ b/battle/ai/scoring.asm @@ -133,16 +133,18 @@ AI_Setup: ; 385e0 call AI_50_50 jr c, .checkmove +rept 2 dec [hl] - dec [hl] +endr jr .checkmove .discourage call Random cp 30 jr c, .checkmove +rept 2 inc [hl] - inc [hl] +endr jr .checkmove ; 38635 @@ -151,7 +153,7 @@ AI_Setup: ; 385e0 AI_Types: ; 38635 ; Dismiss any move that the player is immune to. ; Encourage super-effective moves. -; Discourage not very effective moves unless +; Discourage not very effective moves unless ; all damaging moves are of the same type. ld hl, Buffer1 - 1 @@ -262,8 +264,9 @@ AI_Offensive: ; 386a2 and a jr nz, .checkmove +rept 2 inc [hl] - inc [hl] +endr jr .checkmove ; 386be @@ -417,8 +420,9 @@ AI_Smart_Sleep: ; 387e3 .asm_387f0 call AI_50_50 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; 387f7 @@ -529,8 +533,9 @@ AI_Smart_LockOn: ; 3881d call AI_50_50 ret c +rept 2 dec [hl] - dec [hl] +endr ret .asm_38882 @@ -555,8 +560,9 @@ AI_Smart_LockOn: ; 3881d cp 180 jr nc, .asm_3888b +rept 2 dec [hl] - dec [hl] +endr jr .asm_3888b .asm_388a2 @@ -596,9 +602,9 @@ AI_Smart_Explosion: ; 388a6 ret c .asm_388c6 +rept 3 inc [hl] - inc [hl] - inc [hl] +endr ret ; 388ca @@ -610,9 +616,9 @@ AI_Smart_DreamEater: ; 388ca call Random cp 25 ret c +rept 3 dec [hl] - dec [hl] - dec [hl] +endr ret ; 388d4 @@ -639,8 +645,9 @@ AI_Smart_EvasionUp: ; 388d4 jr nc, .asm_38911 .asm_388ef +rept 2 dec [hl] - dec [hl] +endr ret .asm_388f2 @@ -669,8 +676,9 @@ AI_Smart_EvasionUp: ; 388d4 jr c, .asm_38911 .asm_3890f +rept 2 inc [hl] - inc [hl] +endr ; 30% chance to end up here if enemy's HP is full and player is not badly poisoned. ; 77% chance to end up here if enemy's HP is above 50% but not full. @@ -714,8 +722,9 @@ AI_Smart_EvasionUp: ; 388d4 call Random cp $50 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; Player is seeded. @@ -747,8 +756,9 @@ AI_Smart_AlwaysHit: ; 38947 call AI_80_20 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; 3895b @@ -818,8 +828,9 @@ AI_Smart_AccuracyDown: ; 38985 jr nc, .asm_389bf .asm_3899d +rept 2 dec [hl] - dec [hl] +endr ret .asm_389a0 @@ -848,8 +859,9 @@ AI_Smart_AccuracyDown: ; 38985 jr c, .asm_389bf .asm_389bd +rept 2 inc [hl] - inc [hl] +endr ; We only end up here if the move has not been already encouraged. .asm_389bf @@ -888,8 +900,9 @@ AI_Smart_AccuracyDown: ; 38985 call Random cp $50 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; Player is seeded. @@ -963,9 +976,9 @@ AI_Smart_Bide: ; 38a1e AI_Smart_Whirlwind: ; 38a2a ; Whirlwind, Roar. -; Discourage this move if the player has not shown +; Discourage this move if the player has not shown ; a super-effective move against the enemy. -; Consider player's type(s) if its moves are unknown. +; Consider player's type(s) if its moves are unknown. push hl callab Function3484e @@ -997,8 +1010,9 @@ AI_Smart_Moonlight: ; 38a3a call Random cp $19 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; 38a4e @@ -1079,8 +1093,9 @@ AI_Smart_Bind: ; 38a71 ret nc call AI_50_50 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; 38a9c @@ -1185,8 +1200,9 @@ AI_Smart_SpDefenseUp2: ; 38aed .asm_38b09 call AI_80_20 ret c +rept 2 dec [hl] - dec [hl] +endr ret .asm_38b10 @@ -1208,9 +1224,9 @@ AI_Smart_Fly: ; 38b12 call AICompareSpeed ret nc +rept 3 dec [hl] - dec [hl] - dec [hl] +endr ret ; 38b20 @@ -1231,7 +1247,7 @@ AI_Smart_Paralyze: ; 38b26 call AICheckPlayerQuarterHP jr nc, .asm_38b3a -; 80% chance to greatly encourage this move +; 80% chance to greatly encourage this move ; if enemy is slower than player and its HP is above 25%. call AICompareSpeed ret c @@ -1239,8 +1255,9 @@ AI_Smart_Paralyze: ; 38b26 ret nc call AI_80_20 ret c +rept 2 dec [hl] - dec [hl] +endr ret .asm_38b3a @@ -1272,8 +1289,9 @@ AI_Smart_SpeedDownHit: ; 38b40 call Random cp 30 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; 38b5c @@ -1510,14 +1528,15 @@ AI_Smart_Encore: ; 38c3b call Random cp $46 ret c +rept 2 dec [hl] - dec [hl] +endr ret .asm_38c81 +rept 3 inc [hl] - inc [hl] - inc [hl] +endr ret .EncoreMoves: @@ -1587,15 +1606,15 @@ AI_Smart_SleepTalk: ; 38cba cp $1 jr z, .asm_38cc7 +rept 3 dec [hl] - dec [hl] - dec [hl] +endr ret .asm_38cc7 +rept 3 inc [hl] - inc [hl] - inc [hl] +endr ret ; 38ccb @@ -1607,9 +1626,9 @@ AI_Smart_DefrostOpponent: ; 38ccb ld a, [EnemyMonStatus] and $20 ret z +rept 3 dec [hl] - dec [hl] - dec [hl] +endr ret ; 38cd5 @@ -1666,8 +1685,9 @@ AI_Smart_Spite: ; 38cd5 call Random cp $64 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; 38d16 @@ -1708,9 +1728,9 @@ AI_Smart_HealBell: ; 38d1f jr z, .next ; status +rept 3 dec hl - dec hl - dec hl +endr ld a, [hl] or c ld c, a @@ -1735,8 +1755,9 @@ AI_Smart_HealBell: ; 38d1f ret z call AI_50_50 ret c +rept 2 dec [hl] - dec [hl] +endr ret .no_status @@ -1774,9 +1795,9 @@ AI_Smart_PriorityHit: ; 38d5a ld a, [BattleMonHP] sbc b ret nc +rept 3 dec [hl] - dec [hl] - dec [hl] +endr ret ; 38d93 @@ -1879,7 +1900,7 @@ AI_Smart_MeanLook: ; 38dfb bit SUBSTATUS_TOXIC, a jr nz, .asm_38e26 -; 80% chance to greatly encourage this move if the player is either +; 80% chance to greatly encourage this move if the player is either ; in love, identified, stuck in Rollout, or has a Nightmare. ld a, [PlayerSubStatus1] and 1<<SUBSTATUS_IN_LOVE | 1<<SUBSTATUS_ROLLOUT | 1<<SUBSTATUS_IDENTIFIED | 1<<SUBSTATUS_NIGHTMARE @@ -1900,9 +1921,9 @@ AI_Smart_MeanLook: ; 38dfb .asm_38e26 call AI_80_20 ret c +rept 3 dec [hl] - dec [hl] - dec [hl] +endr ret ; 38e2e @@ -1952,11 +1973,9 @@ AI_Smart_FlameWheel: ; 38e50 ld a, [EnemyMonStatus] bit FRZ, a ret z +rept 5 dec [hl] - dec [hl] - dec [hl] - dec [hl] - dec [hl] +endr ret ; 38e5c @@ -1988,13 +2007,15 @@ AI_Smart_Curse: ; 38e5c ret nc call AI_80_20 ret c +rept 2 dec [hl] - dec [hl] +endr ret .asm_38e90 +rept 2 inc [hl] - inc [hl] +endr .asm_38e92 inc [hl] .asm_38e93 @@ -2044,8 +2065,9 @@ AI_Smart_Curse: ; 38e5c call AI_50_50 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; 38ed2 @@ -2097,8 +2119,9 @@ AI_Smart_Protect: ; 38ed2 call Random cp 20 ret c +rept 2 inc [hl] - inc [hl] +endr ret ; 38f1d @@ -2128,8 +2151,9 @@ AI_Smart_Foresight: ; 38f1d call Random cp 100 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; 38f4a @@ -2235,9 +2259,9 @@ AI_Smart_Endure: ; 38fac call AI_80_20 ret c +rept 3 dec [hl] - dec [hl] - dec [hl] +endr ret .asm_38fcb @@ -2248,8 +2272,9 @@ AI_Smart_Endure: ; 38fac call AI_50_50 ret c +rept 2 dec [hl] - dec [hl] +endr ret .asm_38fd8 @@ -2271,14 +2296,15 @@ AI_Smart_FuryCutter: ; 38fdb cp 2 jr c, .end +rept 2 dec [hl] - dec [hl] +endr cp 3 jr c, .end +rept 3 dec [hl] - dec [hl] - dec [hl] +endr .end @@ -2318,8 +2344,9 @@ AI_Smart_Rollout: ; 38fef call Random cp 200 ret nc +rept 2 dec [hl] - dec [hl] +endr ret .asm_39020 @@ -2379,8 +2406,9 @@ AI_Smart_Earthquake: ; 39044 call AICompareSpeed ret nc +rept 2 dec [hl] - dec [hl] +endr ret .could_dig @@ -2427,8 +2455,9 @@ AI_Smart_Pursuit: ; 39072 .asm_3907d call AI_50_50 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; 39084 @@ -2453,8 +2482,9 @@ AI_Smart_RapidSpin: ; 39084 call AI_80_20 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; 3909e @@ -2581,9 +2611,9 @@ AI_Smart_WeatherMove: ; 3910d ; 3911e AIBadWeatherType: ; 3911e +rept 3 inc [hl] - inc [hl] - inc [hl] +endr ret ; 39122 @@ -2606,8 +2636,9 @@ AIGoodWeatherType: ; 39122 ret nz .good +rept 2 dec [hl] - dec [hl] +endr ret ; 39134 @@ -2702,8 +2733,9 @@ AI_Smart_PsychUp: ; 39152 ret .asm_39188 +rept 2 inc [hl] - inc [hl] +endr ret ; 3918b @@ -2788,8 +2820,9 @@ AI_Smart_Gust: ; 391d5 call AICompareSpeed ret nc +rept 2 dec [hl] - dec [hl] +endr ret ; Try to predict if the player will use Fly this turn. @@ -2816,8 +2849,9 @@ AI_Smart_FutureSight: ; 391f3 and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND ret z +rept 2 dec [hl] - dec [hl] +endr ret ; 39200 @@ -2852,16 +2886,18 @@ AI_Smart_Solarbeam: ; 3920b cp 25 ; 1/10 ret c +rept 2 inc [hl] - inc [hl] +endr ret .asm_3921e call AI_80_20 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; 39225 @@ -2955,8 +2991,9 @@ AICheckPlayerHalfHP: ; 3926e ld c, [hl] sla c rl b +rept 2 inc hl - inc hl +endr ld a, [hld] cp c ld a, [hl] @@ -2976,8 +3013,9 @@ AICheckEnemyHalfHP: ; 39281 ld c, [hl] sla c rl b +rept 2 inc hl - inc hl +endr ld a, [hld] cp c ld a, [hl] @@ -3001,8 +3039,9 @@ AICheckEnemyQuarterHP: ; 39298 rl b sla c rl b +rept 2 inc hl - inc hl +endr ld a, [hld] cp c ld a, [hl] @@ -3024,8 +3063,9 @@ AICheckPlayerQuarterHP: ; 392b3 rl b sla c rl b +rept 2 inc hl - inc hl +endr ld a, [hld] cp c ld a, [hl] @@ -3292,7 +3332,7 @@ AI_Aggressive: ; 39369 call AIGetEnemyMove ; Ignore this move if its power is 0 or 1. -; Moves such as Seismic Toss, Hidden Power, +; Moves such as Seismic Toss, Hidden Power, ; Counter and Fissure have a base power of 1. ld a, [wEnemyMoveStruct + MOVE_POWER] cp 2 @@ -3529,11 +3569,9 @@ AI_Risky: ; 394a9 jr nc, .nextmove pop hl +rept 5 dec [hl] - dec [hl] - dec [hl] - dec [hl] - dec [hl] +endr push hl .nextmove diff --git a/battle/anim_commands.asm b/battle/anim_commands.asm index f5b895d0f..07dece5f7 100644 --- a/battle/anim_commands.asm +++ b/battle/anim_commands.asm @@ -265,9 +265,9 @@ Functioncc23d: ; cc23d ld a, [hl] and $f0 ld [hli], a +rept 3 inc hl - inc hl - inc hl +endr dec c jr nz, .asm_cc249 ret @@ -341,8 +341,9 @@ Functioncc293: ; cc293 ld e, a ld d, 0 ld hl, BattleAnimCommands +rept 2 add hl, de - add hl, de +endr ld a, [hli] ld h, [hl] @@ -488,8 +489,9 @@ BattleAnimCmd_FD: ; cc348 (33:4348) ld e, [hl] inc hl ld d, [hl] +rept 2 inc de - inc de +endr ld [hl], d dec hl ld [hl], e @@ -517,8 +519,9 @@ BattleAnimCmd_EF: ; cc383 (33:4383) ld e, [hl] inc hl ld d, [hl] +rept 2 inc de - inc de +endr ld [hl], d dec hl ld [hl], e @@ -544,8 +547,9 @@ BattleAnimCmd_FB: ; cc3b2 (33:43b2) ld e, [hl] inc hl ld d, [hl] +rept 2 inc de - inc de +endr ld [hl], d dec hl ld [hl], e @@ -572,8 +576,9 @@ BattleAnimCmd_F8: ; cc3d6 (33:43d6) ld e, [hl] inc hl ld d, [hl] +rept 2 inc de - inc de +endr ld [hl], d dec hl ld [hl], e @@ -601,8 +606,9 @@ BattleAnimCmd_EE: ; cc3fa (33:43fa) ld e, [hl] inc hl ld d, [hl] +rept 2 inc de - inc de +endr ld [hl], d dec hl ld [hl], e @@ -700,10 +706,9 @@ BattleAnimCmd_D5: ; cc485 (33:4485) push hl ld l, a ld h, $0 +rept 4 add hl, hl - add hl, hl - add hl, hl - add hl, hl +endr ld de, $8310 add hl, de ld a, [BattleAnimByte] @@ -797,8 +802,9 @@ BattleAnimCmd_D9: ; cc52c (33:452c) ld a, [hl] and a jr z, .asm_cc537 +rept 2 inc hl - inc hl +endr jr .asm_cc52f .asm_cc537 @@ -852,8 +858,9 @@ BattleAnimCmd_DA: ; cc57e (33:457e) ld a, [hl] and a jr z, .asm_cc589 +rept 2 inc hl - inc hl +endr jr .asm_cc581 .asm_cc589 @@ -1243,10 +1250,9 @@ BattleAnimCmd_E1: ; cc807 (33:4807) ld e, a ld d, 0 ld hl, Datacc871 +rept 4 add hl, de - add hl, de - add hl, de - add hl, de +endr ld a, [rSVBK] ; $ff00+$70 push af @@ -1392,8 +1398,9 @@ Functioncc8d3: ; cc8d3 inc hl ld d, [hl] ld hl, BattleAnimations +rept 2 add hl, de - add hl, de +endr call Function3ae1 call BattleAnimAssignPals call BattleAnimDelayFrame diff --git a/battle/anim_objects.asm b/battle/anim_objects.asm index 4f32bd932..5bf3e7c01 100644 --- a/battle/anim_objects.asm +++ b/battle/anim_objects.asm @@ -36,12 +36,9 @@ Functioncc9c4: ; cc9c4 (33:49c4) ld e, a ld d, 0 ld hl, BattleAnimObjects +rept 6 add hl, de - add hl, de - add hl, de - add hl, de - add hl, de - add hl, de +endr ld e, l ld d, h ld hl, $0 @@ -71,8 +68,9 @@ Functioncc9c4: ; cc9c4 (33:49c4) ld a, [BattleAnimTemps + 2] ld [hli], a xor a +rept 2 ld [hli], a - ld [hli], a +endr ld a, [BattleAnimTemps + 3] ld [hli], a xor a @@ -80,8 +78,9 @@ Functioncc9c4: ; cc9c4 (33:49c4) dec a ld [hli], a xor a +rept 2 ld [hli], a - ld [hli], a +endr ld [hl], a ret @@ -516,8 +515,9 @@ Functionccfbe: ; ccfbe ld e, [hl] ld d, 0 ld hl, Jumptable_ccfce +rept 2 add hl, de - add hl, de +endr ld a, [hli] ld h, [hl] ld l, a @@ -670,10 +670,9 @@ Functioncd0a6: ; cd0a6 (33:50a6) ld hl, $f add hl, bc ld a, [hl] +rept 4 inc [hl] - inc [hl] - inc [hl] - inc [hl] +endr ld d, $10 push af push de @@ -937,8 +936,9 @@ Functioncd232: ; cd232 (33:5232) ld [hl], a ld hl, $7 add hl, bc +rept 2 dec [hl] - dec [hl] +endr ret .asm_cd245 call Functioncc9bd @@ -1739,8 +1739,9 @@ Functioncd687: ; cd687 (33:5687) ld [hl], a ld hl, $f add hl, bc +rept 2 inc [hl] - inc [hl] +endr Functioncd6c5: ; cd6c5 (33:56c5) ret @@ -1760,8 +1761,9 @@ Functioncd6d6: ; cd6d6 (33:56d6) call Functioncc9bd ret asm_cd6da: ; cd6da (33:56da) +rept 2 inc a - inc a +endr ld [hl], a sub $10 ret c @@ -2128,8 +2130,9 @@ Functioncd8cc: ; cd8cc (33:58cc) call Functionce7bf ld hl, $f add hl, bc +rept 2 inc [hl] - inc [hl] +endr ld a, [hl] and $1f ret nz @@ -2550,8 +2553,9 @@ Functioncdb28: ; cdb28 (33:5b28) ld a, [hl] cp $98 ret nc +rept 2 inc [hl] - inc [hl] +endr ld hl, $1 add hl, bc set 0, [hl] @@ -2587,8 +2591,9 @@ Functioncdb65: ; cdb65 (33:5b65) ld a, [hl] cp $98 ret nc +rept 2 inc [hl] - inc [hl] +endr ld hl, $f add hl, bc ld a, [hl] @@ -2722,8 +2727,9 @@ Functioncdc27: ; cdc27 (33:5c27) ld hl, $f add hl, bc ld a, [hl] +rept 2 inc [hl] - inc [hl] +endr ld d, $2 call Functionce734 ld hl, $9 @@ -2871,8 +2877,9 @@ Functioncdcfe: ; cdcfe (33:5cfe) ld hl, $10 add hl, bc ld a, [hl] +rept 2 inc [hl] - inc [hl] +endr ld d, $10 call Functionce734 ld d, a @@ -3083,8 +3090,9 @@ Functioncde28: ; cde28 (33:5e28) ld hl, $f add hl, bc ld a, [hl] +rept 2 inc [hl] - inc [hl] +endr ld d, $4 call Functionce734 ld hl, $9 @@ -3112,8 +3120,9 @@ Functioncde54: ; cde54 (33:5e54) ld hl, $f add hl, bc ld a, [hl] +rept 2 dec [hl] - dec [hl] +endr ld d, $10 call Functionce734 ld hl, $a @@ -3353,8 +3362,9 @@ Functioncdf8c: ; cdf8c (33:5f8c) ld [hl], a ld hl, $b add hl, bc +rept 2 inc [hl] - inc [hl] +endr ld a, [hl] and $7 ret nz @@ -3394,8 +3404,9 @@ Functioncdfcb: ; cdfcb (33:5fcb) ld [hl], a ld hl, $b add hl, bc +rept 2 inc [hl] - inc [hl] +endr ld a, [hl] and $3 ret nz @@ -3404,8 +3415,9 @@ Functioncdfcb: ; cdfcb (33:5fcb) ld a, [hl] cp $d0 jr z, .asm_ce007 +rept 2 dec [hl] - dec [hl] +endr ret .asm_ce007 call Functioncc9bd @@ -3930,8 +3942,9 @@ Functionce2cc: ; ce2cc (33:62cc) ld [hl], a ld hl, $10 add hl, bc +rept 2 dec [hl] - dec [hl] +endr ret Functionce2fd: ; ce2fd (33:62fd) @@ -4077,8 +4090,9 @@ Functionce3b4: ; ce3b4 (33:63b4) ld hl, $f add hl, bc ld a, [hl] +rept 2 inc [hl] - inc [hl] +endr push af ld d, $2 call Functionce734 @@ -4317,8 +4331,9 @@ Functionce508: ; ce508 (33:6508) ld a, [hl] cp $10 jr nc, .asm_ce52e +rept 2 inc [hl] - inc [hl] +endr ld d, a ld hl, $b add hl, bc @@ -4428,12 +4443,14 @@ Functionce59a: ; ce59a (33:659a) jr c, .asm_ce5b0 ld hl, $7 add hl, bc +rept 2 dec [hl] - dec [hl] +endr ld hl, $8 add hl, bc +rept 2 inc [hl] - inc [hl] +endr ret .asm_ce5b0 call Functioncc9bd @@ -4446,8 +4463,9 @@ Functionce5b4: ; ce5b4 (33:65b4) ld hl, $b add hl, bc ld a, [hl] +rept 2 inc [hl] - inc [hl] +endr push af push de call Functionce734 @@ -4474,10 +4492,9 @@ Functionce5dc: ; ce5dc (33:65dc) ld a, [hl] cp $d0 jr z, .asm_ce5ea +rept 4 dec [hl] - dec [hl] - dec [hl] - dec [hl] +endr ret .asm_ce5ea call Functioncc9bd @@ -4510,10 +4527,9 @@ Functionce60a: ; ce60a (33:660a) ld a, [hl] cp $4 jr z, Functionce618 +rept 4 inc [hl] - inc [hl] - inc [hl] - inc [hl] +endr ret Functionce618: ; ce618 (33:6618) @@ -4529,10 +4545,9 @@ Functionce622: ; ce622 (33:6622) ld a, [hl] cp $d8 ret z +rept 4 dec [hl] - dec [hl] - dec [hl] - dec [hl] +endr ret Functionce62f: ; ce62f (33:662f) @@ -4567,8 +4582,9 @@ Functionce648: ; ce648 (33:6648) ld [hl], a ld hl, $9 add hl, bc +rept 2 inc [hl] - inc [hl] +endr ret Functionce65c: ; ce65c (33:665c) @@ -4754,8 +4770,9 @@ Functionce749: ; ce749 (33:6749) ld a, d ld d, 0 ld hl, Unknown_ce77f +rept 2 add hl, de - add hl, de +endr ld e, [hl] inc hl ld d, [hl] @@ -4864,8 +4881,9 @@ Functionce7d1: ; ce7d1 ld [hl], a ld hl, $000d add hl, bc +rept 2 dec [hl] - dec [hl] +endr jr .asm_ce7d1 .asm_ce815 @@ -4886,8 +4904,9 @@ Functionce823: ; ce823 ld e, [hl] ld d, 0 ld hl, Unknown_ce85e +rept 2 add hl, de - add hl, de +endr ld e, [hl] inc hl ld d, [hl] @@ -4904,8 +4923,9 @@ Functionce83c: ; ce83c ld l, a ld h, 0 ld de, Unknown_ceeae +rept 2 add hl, hl - add hl, hl +endr add hl, de ret ; ce846 @@ -4915,8 +4935,9 @@ Functionce846: ; ce846 (33:6846) push hl ld l, a ld h, 0 +rept 2 add hl, hl - add hl, hl +endr ld de, AnimObjGFX add hl, de ld c, [hl] diff --git a/battle/bg_effects.asm b/battle/bg_effects.asm index 8dfe30db6..a2fd9f731 100644 --- a/battle/bg_effects.asm +++ b/battle/bg_effects.asm @@ -61,8 +61,9 @@ Functionc804a: ; c804a (32:404a) ld e, [hl] ld d, 0 ld hl, BattleBGEffects +rept 2 add hl, de - add hl, de +endr ld a, [hli] ld h, [hl] ld l, a @@ -708,9 +709,9 @@ Functionc83fa: ; c83fa (32:43fa) ld l, a ld a, [BattleAnimTemps + 2] ld h, a +rept 3 add hl, de - add hl, de - add hl, de +endr ld a, [hl] cp $ff jr z, Functionc8434 @@ -756,8 +757,9 @@ Functionc843b: ; c843b (32:443b) ld e, [hl] ld d, 0 ld hl, Unknown_c849c +rept 2 add hl, de - add hl, de +endr ld a, [hli] ld h, [hl] ld l, a @@ -771,9 +773,9 @@ Functionc8458: ; c8458 (32:4458) ld e, [hl] ld d, 0 ld hl, Unknown_c84a8 +rept 3 add hl, de - add hl, de - add hl, de +endr ld a, [hli] ld b, a and $f @@ -793,8 +795,9 @@ Functionc8458: ; c8458 (32:4458) ld e, [hl] ld d, 0 ld hl, Unknown_c849c +rept 2 add hl, de - add hl, de +endr ld a, [hli] ld h, [hl] ld l, a @@ -1012,8 +1015,9 @@ Functionc85ce: ; c85ce (32:45ce) ld a, [hl] cp $20 jr nc, .asm_c85fc +rept 2 inc [hl] - inc [hl] +endr call Functionc8f9a ret .asm_c85fc @@ -1388,8 +1392,9 @@ Functionc87de: ; c87de (32:47de) call Functionc901b ld hl, $2 add hl, bc +rept 2 inc [hl] - inc [hl] +endr ret Functionc8801: ; c8801 (32:4801) @@ -1792,8 +1797,9 @@ Functionc8a14: ; c8a14 (32:4a14) call Functionc901b ld hl, $3 add hl, bc +rept 2 inc [hl] - inc [hl] +endr ret Functionc8a36: ; c8a36 (32:4a36) @@ -1877,8 +1883,9 @@ Functionc8a9a: ; c8a9a (32:4a9a) ld h, $d2 .asm_c8aa5 ld [hl], e +rept 2 inc hl - inc hl +endr dec a jr nz, .asm_c8aa5 ret diff --git a/battle/core.asm b/battle/core.asm index 0d2f5f6d7..4dd60c891 100644 --- a/battle/core.asm +++ b/battle/core.asm @@ -469,13 +469,13 @@ Function3c314: ; 3c314 cp $2 jr z, .asm_3c341 call BattleRandom - cp $80 + cp 1 + (50 percent) jp c, .asm_3c3f1 jp Function3c3f3 .asm_3c341 call BattleRandom - cp $80 + cp 1 + (50 percent) jp c, Function3c3f3 jp .asm_3c3f1 @@ -555,13 +555,13 @@ Function3c314: ; 3c314 cp $2 jr z, .asm_3c3e9 call BattleRandom - cp $80 + cp 1 + (50 percent) jp c, .asm_3c3f1 jp Function3c3f3 .asm_3c3e9 call BattleRandom - cp $80 + cp 1 + (50 percent) jp c, Function3c3f3 .asm_3c3f1 scf @@ -798,7 +798,7 @@ Function3c543: ; 3c543 call BattleRandom ld b, a - cp $80 + cp 1 + (50 percent) jr nc, .Stay push bc @@ -810,7 +810,7 @@ Function3c543: ; 3c543 jr c, .Flee ld a, b - cp $1a + cp 1 + (10 percent) jr nc, .Stay ld a, [TempEnemyMonSpecies] @@ -1607,7 +1607,7 @@ Function3ca8f: ; 3ca8f and a ret nz call BattleRandom - cp $19 + cp 10 percent ret nc xor a ld [BattleMonStatus], a @@ -1628,7 +1628,7 @@ Function3ca8f: ; 3ca8f and a ret nz call BattleRandom - cp $19 + cp 10 percent ret nc xor a ld [EnemyMonStatus], a @@ -1840,8 +1840,9 @@ HandleWeather: ; 3cb9e dec a ld c, a ld b, 0 +rept 2 add hl, bc - add hl, bc +endr ld a, [hli] ld h, [hl] ld l, a @@ -2452,7 +2453,7 @@ Function3cfa4: ; 3cfa4 and a ld a, b call z, Function3d0ea - callab Function39939 + callab Battle_GetTrainerName ld hl, BattleText_0x809da call StdBattleTextBox call IsMobileBattle @@ -2493,7 +2494,7 @@ Function3cfa4: ; 3cfa4 call DelayFrames call EmptyBattleTextBox ld c, $3 - callba Function11c000 + callba StoreText call Functiona80 ld hl, wPayDayMoney ld a, [hli] @@ -2552,8 +2553,9 @@ Function3d02b: ; 3d02b dec a ld c, a ld b, 0 +rept 2 add hl, bc - add hl, bc +endr ld a, [hli] ld h, [hl] ld l, a @@ -2591,8 +2593,9 @@ Function3d099: ; 3d099 rl [hl] ret nc ld a, $ff +rept 2 ld [hli], a - ld [hli], a +endr ld [hl], a ret ; 3d0ab @@ -2882,7 +2885,7 @@ Function3d227: ; 3d227 call ClearSprites call WhiteBGMap call Function3eda6 - call Function1c07 + call ExitMenu call Function309d call WaitBGMap call ClearSGB @@ -2903,7 +2906,7 @@ Function3d227: ; 3d227 call ClearPalettes call DelayFrame call Function3eda6 - call Function1c17 + call WriteBackup call ClearSGB call Function32f9 call Function3f26d @@ -3100,7 +3103,7 @@ LostBattle: ; 3d38e call EmptyBattleTextBox ld c, 2 - callba Function11c000 + callba StoreText call Functiona80 call ClearTileMap call WhiteBGMap @@ -3644,7 +3647,7 @@ Function3d714: ; 3d714 Function3d74b: ; 3d74b ld a, [CurPartyMon] push af - callab Function39939 + callab Battle_GetTrainerName ld hl, BattleText_0x80aca call StdBattleTextBox lb bc, 1, 7 @@ -3685,7 +3688,7 @@ Function3d74b: ; 3d74b Function3d7a0: ; 3d7a0 xor a ld [hBGMapMode], a - call Function1c07 + call ExitMenu call ClearSprites hlcoord 1, 0 lb bc, 4, 10 @@ -3695,7 +3698,7 @@ Function3d7a0: ; 3d7a0 ; 3d7b8 Function3d7b8: ; 3d7b8 - callab Function39939 + callab Battle_GetTrainerName ld hl, BattleText_0x80af8 call StdBattleTextBox jp WaitBGMap @@ -3756,10 +3759,9 @@ NewEnemyMonStatus: ; 3d834 ld [LastPlayerCounterMove], a ld [LastEnemyMove], a ld hl, EnemySubStatus1 +rept 4 ld [hli], a - ld [hli], a - ld [hli], a - ld [hli], a +endr ld [hl], a ld [EnemyDisableCount], a ld [EnemyFuryCutterCount], a @@ -4033,9 +4035,9 @@ Function3da0d: ; 3da0d ld de, BattleMonDVs ld bc, 2 + NUM_MOVES + 1 ; DVs, PP, happiness ; BattleMonLevel - BattleMonDVs call CopyBytes +rept 3 inc hl - inc hl - inc hl +endr ld de, BattleMonLevel ld bc, 1 + 1 + 1 + 2 + 2 * 6 ; level, status, unused, stats call CopyBytes @@ -4125,9 +4127,9 @@ Function3dabd: ; 3dabd ld de, EnemyMonDVs ld bc, 2 + NUM_MOVES + 1 call CopyBytes +rept 3 inc hl - inc hl - inc hl +endr ld de, EnemyMonLevel ld bc, 1 + 1 + 1 + 2 + 2 * 6 call CopyBytes @@ -4250,15 +4252,14 @@ NewBattleMonStatus: ; 3dbde ld [LastPlayerCounterMove], a ld [LastPlayerMove], a ld hl, PlayerSubStatus1 +rept 4 ld [hli], a - ld [hli], a - ld [hli], a - ld [hli], a +endr ld [hl], a ld hl, PlayerUsedMoves +rept 3 ld [hli], a - ld [hli], a - ld [hli], a +endr ld [hl], a ld [PlayerDisableCount], a ld [PlayerFuryCutterCount], a @@ -4359,7 +4360,7 @@ Function3dc5b: ; 3dc5b jr z, .asm_3dcc0 ld a, [wc71a] - call Function399f + call UpdateBattleMon ld hl, BattleMonHP ld a, [hli] or [hl] @@ -4694,16 +4695,18 @@ Function3deb6: ; 3deb6 ld a, [hli] cp $ff jr z, .asm_3def9 +rept 2 inc hl - inc hl +endr cp b jr nz, .asm_3dec7 pop bc ld a, [bc] ld [wd265], a push bc +rept 2 dec hl - dec hl +endr ld a, [hli] ld h, [hl] ld l, a @@ -5211,7 +5214,7 @@ BattleMenu_Pack: ; 3e1c7 call Function3ed9f call Function3f43d call Function3f47c - call Function1c07 + call ExitMenu call WaitBGMap call Function3ee27 call Function309d @@ -5248,7 +5251,7 @@ Function3e234: ; 3e234 call Function3f47c ld a, $1 ld [wcfa9], a - call Function1c07 + call ExitMenu call Function3df2c call WaitBGMap call Function309d @@ -5272,7 +5275,7 @@ Function3e234: ; 3e234 BattleMenu_PKMN: ; 3e28d call Function1d6e Function3e290: - call Function1c07 + call ExitMenu call Function1d6e call WhiteBGMap Function3e299: @@ -5312,7 +5315,7 @@ Function3e299: call ClearPalettes call DelayFrame call Function3eda6 - call Function1c17 + call WriteBackup call Function309d call ClearSGB call Function32f9 @@ -5395,7 +5398,7 @@ Function3e358: ; 3e358 call DelayFrame call ClearSprites call Function3eda6 - call Function1c17 + call WriteBackup call ClearSGB call Function32f9 ld a, [CurPartyMon] @@ -5411,7 +5414,7 @@ Function3e3ad: ; 3e3ad jr z, .asm_3e3c1 call Function1d6e call Function3e8e4 - call Function1c17 + call WriteBackup .asm_3e3c1 call Function3e7c1 @@ -5769,8 +5772,9 @@ Function3e4bc: ; 3e4bc ld a, [wcfa9] ld b, a ld a, [wd0eb] +rept 2 inc a - inc a +endr cp b jp nz, .asm_3e57a ld a, $1 @@ -5953,8 +5957,9 @@ Function3e75f: ; 3e75f ld bc, $0102 call PrintNum pop hl +rept 2 inc hl - inc hl +endr ld [hl], "/" inc hl ld de, wd265 @@ -6202,25 +6207,25 @@ LoadEnemyMon: ; 3e8eb ld hl, EnemyMonSpecies ld bc, EnemyMonEnd - EnemyMon call ByteFill - + ; We don't need to be here if we're in a link battle ld a, [InLinkBattle] and a jp nz, Function3dabd - + ld a, [wcfc0] ; ???? bit 0, a jp nz, Function3dabd - + ; Make sure everything knows what species we're working with ld a, [TempEnemyMonSpecies] ld [EnemyMonSpecies], a ld [CurSpecies], a ld [CurPartySpecies], a - + ; Grab the BaseData for this species call GetBaseData - + ; Let's get the item: @@ -6228,15 +6233,15 @@ LoadEnemyMon: ; 3e8eb ld a, [IsInBattle] dec a jr z, .WildItem - + ; If we're in a trainer battle, the item is in the party struct ld a, [CurPartyMon] ld hl, OTPartyMon1Item call GetPartyLocation ; bc = PartyMon[CurPartyMon] - PartyMons ld a, [hl] jr .UpdateItem - - + + .WildItem ; In a wild battle, we pull from the item slots in BaseData @@ -6246,7 +6251,7 @@ LoadEnemyMon: ; 3e8eb cp BATTLETYPE_FORCEITEM ld a, [BaseItems] jr z, .UpdateItem - + ; Failing that, it's all up to chance ; Effective chances: ; 75% None @@ -6255,33 +6260,33 @@ LoadEnemyMon: ; 3e8eb ; 25% chance of getting an item call BattleRandom - cp a, $c0 + cp a, 1 + (75 percent) ld a, NO_ITEM jr c, .UpdateItem - + ; From there, an 8% chance for Item2 call BattleRandom - cp a, $14 ; 8% of 25% = 2% Item2 + cp a, 8 percent ; 8% of 25% = 2% Item2 ld a, [BaseItems] jr nc, .UpdateItem ld a, [BaseItems+1] - - + + .UpdateItem ld [EnemyMonItem], a - - + + ; Initialize DVs - + ; If we're in a trainer battle, DVs are predetermined ld a, [IsInBattle] and a jr z, .InitDVs - + ld a, [EnemySubStatus5] bit SUBSTATUS_TRANSFORMED, a jr z, .InitDVs - + ; Unknown ld hl, wc6f2 ld de, EnemyMonDVs @@ -6291,12 +6296,12 @@ LoadEnemyMon: ; 3e8eb ld a, [hl] ld [de], a jp .Happiness - - + + .InitDVs - + ; Trainer DVs - + ; All trainers have preset DVs, determined by class ; See GetTrainerDVs for more on that callba GetTrainerDVs @@ -6304,8 +6309,8 @@ LoadEnemyMon: ; 3e8eb ld a, [IsInBattle] dec a jr nz, .UpdateDVs - - + + ; Wild DVs ; Here's where the fun starts @@ -6314,7 +6319,7 @@ LoadEnemyMon: ; 3e8eb ld a, [BattleType] cp a, BATTLETYPE_ROAMING jr nz, .NotRoaming - + ; Grab HP call GetRoamMonHP ld a, [hl] @@ -6322,7 +6327,7 @@ LoadEnemyMon: ; 3e8eb and a ; We'll do something with the result in a minute push af - + ; Grab DVs call GetRoamMonDVs inc hl @@ -6334,7 +6339,7 @@ LoadEnemyMon: ; 3e8eb pop af ; If the RoamMon struct has already been initialized, we're done jr nz, .UpdateDVs - + ; If it hasn't, we need to initialize the DVs ; (HP is initialized at the end of the battle) call GetRoamMonDVs @@ -6348,7 +6353,7 @@ LoadEnemyMon: ; 3e8eb ; We're done with DVs jr .UpdateDVs - + .NotRoaming ; Register a contains BattleType @@ -6360,36 +6365,36 @@ LoadEnemyMon: ; 3e8eb ld b, ATKDEFDV_SHINY ; $ea ld c, SPDSPCDV_SHINY ; $aa jr .UpdateDVs - + .GenerateDVs ; Generate new random DVs call BattleRandom ld b, a call BattleRandom ld c, a - + .UpdateDVs ; Input DVs in register bc ld hl, EnemyMonDVs ld a, b ld [hli], a ld [hl], c - - + + ; We've still got more to do if we're dealing with a wild monster ld a, [IsInBattle] dec a jr nz, .Happiness - - + + ; Species-specfic: - - + + ; Unown ld a, [TempEnemyMonSpecies] cp a, UNOWN jr nz, .Magikarp - + ; Get letter based on DVs ld hl, EnemyMonDVs predef GetUnownLetter @@ -6397,25 +6402,25 @@ LoadEnemyMon: ; 3e8eb ; If combined with forced shiny battletype, causes an infinite loop call CheckUnownLetter jr c, .GenerateDVs ; try again - - + + .Magikarp ; Skimming this part recommended - + ld a, [TempEnemyMonSpecies] cp a, MAGIKARP jr nz, .Happiness - + ; Get Magikarp's length ld de, EnemyMonDVs ld bc, PlayerID callab CalcMagikarpLength - + ; We're clear if the length is < 1536 ld a, [MagikarpLength] cp a, $06 ; $600 = 1536 jr nz, .CheckMagikarpArea - + ; 5% chance of skipping size checks call Random cp a, $0c ; / $100 @@ -6424,7 +6429,7 @@ LoadEnemyMon: ; 3e8eb ld a, [MagikarpLength + 1] cp a, $50 jr nc, .GenerateDVs - + ; 20% chance of skipping this check call Random cp a, $32 ; / $100 @@ -6433,15 +6438,15 @@ LoadEnemyMon: ; 3e8eb ld a, [MagikarpLength + 1] cp a, $40 jr nc, .GenerateDVs - + .CheckMagikarpArea ; The z checks are supposed to be nz ; Instead, all maps in GROUP_LAKE_OF_RAGE (mahogany area) ; and routes 20 and 44 are treated as Lake of Rage - + ; This also means Lake of Rage Magikarp can be smaller than ones ; caught elsewhere rather than the other way around - + ; Intended behavior enforces a minimum size at Lake of Rage ; The real behavior prevents size flooring in the Lake of Rage area ld a, [MapGroup] @@ -6458,10 +6463,10 @@ LoadEnemyMon: ; 3e8eb ld a, [MagikarpLength] cp a, 1024 >> 8 jr c, .GenerateDVs ; try again - - + + ; Finally done with DVs - + .Happiness ; Set happiness ld a, BASE_HAPPINESS @@ -6474,21 +6479,21 @@ LoadEnemyMon: ; 3e8eb ld b, $00 ld hl, LinkBattleRNs + 7 ; ? predef Functione167 - + ; If we're in a trainer battle, ; get the rest of the parameters from the party struct ld a, [IsInBattle] cp a, TRAINER_BATTLE jr z, .OpponentParty - + ; If we're in a wild battle, check wild-specific stuff and a jr z, .TreeMon - + ld a, [EnemySubStatus5] bit SUBSTATUS_TRANSFORMED, a jp nz, .Moves - + .TreeMon ; If we're headbutting trees, some monsters enter battle asleep call CheckSleepingTreeMon @@ -6496,26 +6501,26 @@ LoadEnemyMon: ; 3e8eb jr c, .UpdateStatus ; Otherwise, no status xor a - + .UpdateStatus ld hl, EnemyMonStatus ld [hli], a - + ; Unused byte xor a ld [hli], a - + ; Full HP... ld a, [EnemyMonMaxHP] ld [hli], a ld a, [EnemyMonMaxHP + 1] ld [hl], a - + ; ...unless it's a RoamMon ld a, [BattleType] cp a, BATTLETYPE_ROAMING jr nz, .Moves - + ; Grab HP call GetRoamMonHP ld a, [hl] @@ -6526,15 +6531,15 @@ LoadEnemyMon: ; 3e8eb ld a, [hl] ld [EnemyMonHP + 1], a jr .Moves - + .InitRoamHP ; HP only uses the lo byte in the RoamMon struct since ; Raikou/Entei/Suicune will have < 256 hp at level 40 ld a, [EnemyMonHP + 1] ld [hl], a jr .Moves - - + + .OpponentParty ; Get HP from the party struct ld hl, (OTPartyMon1HP + 1) @@ -6544,17 +6549,17 @@ LoadEnemyMon: ; 3e8eb ld [EnemyMonHP + 1], a ld a, [hld] ld [EnemyMonHP], a - + ; Make sure everything knows which monster the opponent is using ld a, [CurPartyMon] ld [CurOTMon], a - + ; Get status from the party struct dec hl ld a, [hl] ; OTPartyMonStatus ld [EnemyMonStatus], a - - + + .Moves ld hl, BaseType1 ld de, EnemyMonType1 @@ -6563,7 +6568,7 @@ LoadEnemyMon: ; 3e8eb inc de ld a, [hl] ld [de], a - + ; Get moves ld de, EnemyMonMoves ; Are we in a trainer battle? @@ -6577,33 +6582,33 @@ LoadEnemyMon: ; 3e8eb ld bc, NUM_MOVES call CopyBytes jr .PP - + .WildMoves ; Clear EnemyMonMoves xor a ld h, d ld l, e +rept 3 ld [hli], a - ld [hli], a - ld [hli], a +endr ld [hl], a ; Make sure the predef knows this isn't a partymon ld [MagikarpLength], a ; Fill moves based on level predef FillMoves - + .PP ; Trainer battle? ld a, [IsInBattle] cp a, TRAINER_BATTLE jr z, .TrainerPP - + ; Fill wild PP ld hl, EnemyMonMoves ld de, EnemyMonPP predef FillPP jr .Finish - + .TrainerPP ; Copy PP from the party struct ld hl, OTPartyMon1PP @@ -6612,7 +6617,7 @@ LoadEnemyMon: ; 3e8eb ld de, EnemyMonPP ld bc, NUM_MOVES call CopyBytes - + .Finish ; Only the first five base stats are copied... ld hl, BaseStats @@ -6673,7 +6678,7 @@ CheckSleepingTreeMon: ; 3eb38 ld a, [BattleType] cp a, BATTLETYPE_TREE jr nz, .NotSleeping - + ; Get list for the time of day ld hl, .Morn ld a, [TimeOfDay] @@ -6682,14 +6687,14 @@ CheckSleepingTreeMon: ; 3eb38 ld hl, .Day jr z, .Check ld hl, .Nite - + .Check ld a, [TempEnemyMonSpecies] ld de, 1 ; length of species id call IsInArray ; If it's a match, the opponent is asleep ret c - + .NotSleeping and a ret @@ -6728,24 +6733,24 @@ CheckSleepingTreeMon: ; 3eb38 CheckUnownLetter: ; 3eb75 ; Return carry if the Unown letter hasn't been unlocked yet - + ld a, [UnlockedUnowns] ld c, a ld de, 0 - + .loop - + ; Don't check this set unless it's been unlocked srl c jr nc, .next - + ; Is our letter in the set? ld hl, .LetterSets add hl, de ld a, [hli] ld h, [hl] ld l, a - + push de ld a, [UnownLetter] ld de, 1 @@ -6753,32 +6758,33 @@ CheckUnownLetter: ; 3eb75 call IsInArray pop bc pop de - + jr c, .match - + .next ; Make sure we haven't gone past the end of the table +rept 2 inc e - inc e +endr ld a, e cp a, .Set1 - .LetterSets jr c, .loop - + ; Hasn't been unlocked, or the letter is invalid scf ret - + .match ; Valid letter and a ret - + .LetterSets dw .Set1 dw .Set2 dw .Set3 dw .Set4 - + .Set1 ; A B C D E F G H I J K db 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, $ff @@ -6791,7 +6797,7 @@ CheckUnownLetter: ; 3eb75 .Set4 ; X Y Z db 24, 25, 26, $ff - + ; 3ebc7 @@ -7109,8 +7115,9 @@ BadgeStatBoosts: ; 3ed45 ; Swap badges 3 (PlainBadge) and 5 (MineralBadge). ld d, a and %00000100 +rept 2 add a - add a +endr ld b, a ld a, d and %00010000 @@ -7129,8 +7136,9 @@ BadgeStatBoosts: ; 3ed45 ld a, b srl b call c, BoostStat +rept 2 inc hl - inc hl +endr ; Check every other badge. srl b dec c @@ -7259,8 +7267,9 @@ _BattleRandom:: ; 3edd8 ; a * 5 + 1 ld c, a +rept 2 add a - add a +endr add c inc a @@ -7392,8 +7401,9 @@ Function3ee3b: ; 3ee3b ld [de], a .asm_3eea9 +rept 2 inc de - inc de +endr dec c jr nz, .asm_3ee7c xor a @@ -7468,8 +7478,9 @@ Function3ee3b: ; 3ee3b inc [hl] jr nz, .asm_3ef3d ld a, $ff +rept 2 ld [hli], a - ld [hli], a +endr ld [hl], a .asm_3ef3d @@ -7607,7 +7618,7 @@ Function3ee3b: ; 3ee3b ld [hBGMapMode], a .asm_3f035 - callba Function2709e + callba LevelUpHappinessMod ld a, [CurBattleMon] ld b, a ld a, [CurPartyMon] @@ -7797,8 +7808,9 @@ Function3f136: ; 3f136 inc [hl] jr nz, .asm_3f186 ld a, $ff +rept 2 ld [hli], a - ld [hli], a +endr ld [hl], a .asm_3f186 @@ -8690,8 +8702,9 @@ Function3f71d: ; 3f71d rl [hl] jr nc, .asm_3f73d ld a, $ff +rept 2 ld [hli], a - ld [hli], a +endr ld [hl], a .asm_3f73d @@ -8990,7 +9003,7 @@ Function3f998: ; 3f998 ret nz .asm_3f9ca - callab Function2a30d + callab UpdateRoamMons ret ; 3f9d1 @@ -9083,11 +9096,13 @@ Function3fa42: ; 3fa42 ld d, $5 .asm_3fa62 push hl +rept 2 inc hl - inc hl +endr ld a, [hl] +rept 2 dec hl - dec hl +endr and a jr z, .asm_3fa85 push de @@ -9187,16 +9202,18 @@ Function3fac8: ; 3fac8 ld c, $1 .asm_3faed ld a, b +rept 2 add b - add b +endr ld e, a ld d, $0 ld hl, DefaultFlypoint add hl, de push hl ld a, c +rept 2 add c - add c +endr ld e, a ld d, $0 ld hl, DefaultFlypoint @@ -9455,7 +9472,7 @@ BattleStartMessage: ; 3fc8b ld c, 20 call DelayFrames - callba Function39939 + callba Battle_GetTrainerName ld hl, WantsToBattleText jr .asm_3fd0e diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 7c1fa738a..d162e1c37 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -50,8 +50,9 @@ DoMove: ; 3402c ld c, a ld b, 0 ld hl, MoveEffectsPointers +rept 2 add hl, bc - add hl, bc +endr ld a, BANK(MoveEffectsPointers) call GetFarHalfword @@ -100,8 +101,9 @@ DoMove: ; 3402c ld c, a ld b, 0 ld hl, BattleCommandPointers +rept 2 add hl, bc - add hl, bc +endr pop bc ld a, BANK(BattleCommandPointers) @@ -1062,8 +1064,9 @@ BattleCommand04: ; 34555 jp nz, EndMoveEffect ; SubStatus5 +rept 2 inc de - inc de +endr ld a, [de] bit SUBSTATUS_TRANSFORMED, a @@ -1259,8 +1262,9 @@ BattleCommand05: ; 34631 jr nc, .ScopeLens ; +2 critical level +rept 2 inc c - inc c +endr .ScopeLens push bc @@ -1500,8 +1504,9 @@ BattleCommand07: ; 346d2 pop hl .asm_347b3 +rept 2 inc hl - inc hl +endr jr .asm_34743 .end @@ -1746,11 +1751,9 @@ Function348de: ; 348de jr c, .loop ; neutral +rept 5 inc c - inc c - inc c - inc c - inc c +endr cp 10 jr z, .loop @@ -2239,8 +2242,9 @@ Function34b77: ; 34b77 ld b, [hl] inc hl ld c, [hl] +rept 2 inc hl - inc hl +endr srl c rl b srl c @@ -3344,8 +3348,9 @@ EndMoveEffect: ; 352a3 ld a, [BattleScriptBufferLoc + 1] ld h, a ld a, $ff +rept 2 ld [hli], a - ld [hli], a +endr ld [hl], a ret ; 352b1 @@ -3983,9 +3988,9 @@ Function355dd: ; 355dd sla c rl b .asm_35604 +rept 3 dec hl - dec hl - dec hl +endr ld a, [hli] ld l, [hl] ld h, a @@ -4039,8 +4044,9 @@ BattleCommand62: ; 35612 xor a ld hl, hDividend +rept 2 ld [hli], a - ld [hli], a +endr ld [hl], a ; Level * 2 @@ -4061,8 +4067,9 @@ BattleCommand62: ; 35612 pop bc ; + 2 +rept 2 inc [hl] - inc [hl] +endr ; * bp inc hl @@ -4523,9 +4530,9 @@ BattleCommand41: ; 35864 set SUBSTATUS_ENCORED, [hl] call BattleRandom and $3 +rept 3 inc a - inc a - inc a +endr ld [de], a call Function36abf jr nz, .asm_3591a @@ -4650,8 +4657,9 @@ BattleCommand42: ; 35926 ld [wd1ec], a ld a, [hl] ld [wd1ed], a +rept 2 dec de - dec de +endr ld a, [de] dec de add b @@ -4664,12 +4672,12 @@ BattleCommand42: ; 35926 ld a, [CurDamage + 1] rr a ld [CurDamage + 1], a +rept 3 inc hl - inc hl - inc hl - inc de - inc de +endr +rept 3 inc de +endr ; fallthrough ; 359ac @@ -5142,8 +5150,9 @@ BattleCommand4a: ; 35c0f call GetMoveName call BattleRandom and 3 +rept 2 inc a - inc a +endr ld b, a ld a, [hl] and $3f @@ -6854,8 +6863,9 @@ Function3661d: ; 3661d dec c ld b, 0 ld hl, Table0x364e6 +rept 2 add hl, bc - add hl, bc +endr xor a ld [hMultiplicand], a @@ -7009,8 +7019,9 @@ BattleCommand22: ; 366e5 ld [wEnemyMoveStruct + MOVE_EFFECT], a call BattleRandom and 1 +rept 2 inc a - inc a +endr ld [bc], a ld a, 1 ld [wc689], a @@ -7046,8 +7057,9 @@ BattleCommand3e: ; 3671a set 7, [hl] call BattleRandom and $1 +rept 2 inc a - inc a +endr inc de ld [de], a .asm_3674c @@ -7885,9 +7897,9 @@ BattleCommand3b: ; 36c2d ret nz call BattleRandom and 3 +rept 3 inc a - inc a - inc a +endr ld [hl], a ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar @@ -7899,8 +7911,9 @@ BattleCommand3b: ; 36c2d ld a, [hli] cp b jr z, .asm_36c69 +rept 2 inc hl - inc hl +endr jr .asm_36c61 .asm_36c69 @@ -7981,8 +7994,9 @@ BattleCommand27: ; 36cb2 ld [Buffer2], a ld a, [hl] ld [Buffer1], a +rept 2 dec hl - dec hl +endr ld a, [hl] ld [wd1ec], a sub c @@ -8083,8 +8097,9 @@ Function36d70: ; 36d70 set SUBSTATUS_CONFUSED, [hl] call BattleRandom and 3 +rept 2 inc a - inc a +endr ld [bc], a ld a, BATTLE_VARS_MOVE_EFFECT @@ -8263,8 +8278,9 @@ BattleCommand31: ; 36e7c rr b srl a rr b +rept 2 dec hl - dec hl +endr ld a, b ld [de], a ld a, [hld] @@ -8853,8 +8869,9 @@ BattleCommand2d: ; 371cd ld a, [hli] ld [de], a inc hl +rept 2 inc de - inc de +endr ld bc, NUM_MOVES call CopyBytes ld a, [hBattleTurn] @@ -9655,8 +9672,9 @@ BattleCommand66: ; 37991 ld a, [hli] cp b jr nc, .ok +rept 2 inc hl - inc hl +endr jr .loop .ok ld d, [hl] @@ -9710,7 +9728,7 @@ BattleCommand67: ; 379c9 ; Return to battle scene call ClearPalettes callba Function3ed9f - call Function1c17 + call WriteBackup call ClearSprites hlcoord 1, 0 lb bc, 4, 10 @@ -9779,7 +9797,7 @@ BatonPass_LinkPlayerSwitch: ; 37a67 call Function1d6e ld hl, Function3e8e4 call CallBattleCore - call Function1c17 + call WriteBackup xor a ld [wd0ec], a @@ -9810,7 +9828,7 @@ BatonPass_LinkEnemySwitch: ; 37a82 add NUM_MOVES ld [wBattleAction], a .asm_37aa8 - jp Function1c17 + jp WriteBackup ; 37aab @@ -10045,14 +10063,16 @@ BattleCommand6a6c: ; 37b7e inc c cp WEATHER_SUN jr z, .Heal +rept 2 dec c - dec c +endr .Heal ld b, 0 ld hl, .Multipliers +rept 2 add hl, bc - add hl, bc +endr ld a, [hli] ld h, [hl] diff --git a/battle/hidden_power.asm b/battle/hidden_power.asm index 58e4599dd..7eb720401 100644 --- a/battle/hidden_power.asm +++ b/battle/hidden_power.asm @@ -45,8 +45,9 @@ HiddenPowerDamage: ; fbced ; Multiply by 5 ld b, a +rept 2 add a - add a +endr add b ; Add Special & 3 @@ -74,8 +75,9 @@ HiddenPowerDamage: ; fbced ld a, [hl] and 3 << 4 swap a +rept 2 add a - add a +endr or b ; Skip Normal diff --git a/battle/magikarp_length.asm b/battle/magikarp_length.asm index 160912c53..237450928 100644 --- a/battle/magikarp_length.asm +++ b/battle/magikarp_length.asm @@ -141,8 +141,9 @@ CalcMagikarpLength: ; fbbfc ; hl = de * 10 ld h, d ld l, e +rept 2 add hl, hl - add hl, hl +endr add hl, de add hl, hl |