diff options
Diffstat (limited to 'battle')
-rw-r--r-- | battle/ai/scoring.asm | 78 | ||||
-rw-r--r-- | battle/anim_commands.asm | 12 | ||||
-rw-r--r-- | battle/bg_effects.asm | 18 | ||||
-rw-r--r-- | battle/core.asm | 58 | ||||
-rw-r--r-- | battle/effect_commands.asm | 32 | ||||
-rwxr-xr-x | battle/objects/engine.asm | 2 |
6 files changed, 100 insertions, 100 deletions
diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm index 6391e3b29..44194d6f7 100644 --- a/battle/ai/scoring.asm +++ b/battle/ai/scoring.asm @@ -141,7 +141,7 @@ AI_Setup: ; 385e0 .discourage call Random - cp 30 + cp 12 percent jr c, .checkmove inc [hl] inc [hl] @@ -453,7 +453,7 @@ AI_Smart_LeechHit: ; 387f7 .asm_38815 call Random - cp 100 + cp 39 percent + 1 ret c inc [hl] @@ -594,7 +594,7 @@ AI_Smart_Selfdestruct: ; 388a6 ; If enemy's HP is between 25% and 50%, ; over 90% chance to greatly discourage this move. call Random - cp 20 + cp 9 percent - 2 ret c .asm_388c6 @@ -610,7 +610,7 @@ AI_Smart_DreamEater: ; 388ca ; The AI_Basic layer will make sure that ; Dream Eater is only used against sleeping targets. call Random - cp 25 + cp 10 percent ret c dec [hl] dec [hl] @@ -637,7 +637,7 @@ AI_Smart_EvasionUp: ; 388d4 ; ...70% chance to greatly encourage this move if player is not badly poisoned. call Random - cp $b2 + cp 70 percent jr nc, .asm_38911 .asm_388ef @@ -653,7 +653,7 @@ AI_Smart_EvasionUp: ; 388d4 ; If enemy's HP is above 25% but not full, 4% chance to greatly encourage this move. call Random - cp $a + cp 4 percent jr c, .asm_388ef ; If enemy's HP is between 25% and 50%,... @@ -710,11 +710,11 @@ AI_Smart_EvasionUp: ; 388d4 ret ; Player is badly poisoned. -; 80% chance to greatly encourage this move. +; 70% chance to greatly encourage this move. ; This would counter any previous discouragement. .asm_38938 call Random - cp $50 + cp 31 percent + 1 ret c dec [hl] dec [hl] @@ -791,7 +791,7 @@ AI_Smart_MirrorMove: ; 3895b ret nc call Random - cp $19 + cp 10 percent ret c dec [hl] @@ -816,7 +816,7 @@ AI_Smart_AccuracyDown: ; 38985 ; ...70% chance to greatly encourage this move if player is not badly poisoned. call Random - cp $b2 + cp 70 percent jr nc, .asm_389bf .asm_3899d @@ -832,7 +832,7 @@ AI_Smart_AccuracyDown: ; 38985 ; If player's HP is above 25% but not full, 4% chance to greatly encourage this move. call Random - cp $a + cp 4 percent jr c, .asm_3899d ; If player's HP is between 25% and 50%,... @@ -884,11 +884,11 @@ AI_Smart_AccuracyDown: ; 38985 ret ; Player is badly poisoned. -; 80% chance to greatly encourage this move. +; 70% chance to greatly encourage this move. ; This would counter any previous discouragement. .asm_389e6 call Random - cp $50 + cp 31 percent + 1 ret c dec [hl] dec [hl] @@ -934,7 +934,7 @@ AI_Smart_ResetStats: ; 389f5 .asm_38a12 pop hl call Random - cp $28 + cp 16 percent ret c dec [hl] ret @@ -955,7 +955,7 @@ AI_Smart_Bide: ; 38a1e call AICheckEnemyMaxHP ret c call Random - cp $19 + cp 10 percent ret c inc [hl] ret @@ -997,7 +997,7 @@ AI_Smart_Moonlight: ; 38a3a .asm_38a45 call Random - cp $19 + cp 10 percent ret c dec [hl] dec [hl] @@ -1023,7 +1023,7 @@ AI_Smart_Reflect: ; 38a54 call AICheckEnemyMaxHP ret c call Random - cp $14 + cp 8 percent ret c inc [hl] ret @@ -1126,7 +1126,7 @@ AI_Smart_Unused2B: ; 38a9c .asm_38acd call Random - cp $c8 + cp 79 percent - 1 ret c .asm_38ad3 @@ -1148,7 +1148,7 @@ AI_Smart_Confuse: ; 38adb call AICheckPlayerHalfHP ret c call Random - cp $19 + cp 10 percent jr c, .asm_38ae7 inc [hl] @@ -1272,7 +1272,7 @@ AI_Smart_SpeedDownHit: ; 38b40 call AICompareSpeed ret c call Random - cp 30 + cp 12 percent ret c dec [hl] dec [hl] @@ -1304,7 +1304,7 @@ AI_Smart_HyperBeam: ; 38b63 .asm_38b72 ; If enemy's HP is above 50%, discourage this move at random call Random - cp 40 + cp 16 percent ret c inc [hl] call AI_50_50 @@ -1457,7 +1457,7 @@ AI_Smart_Counter: ; 38bf1 .asm_38c30 call Random - cp $64 + cp 39 percent + 1 jr c, .asm_38c38 dec [hl] @@ -1510,7 +1510,7 @@ AI_Smart_Encore: ; 38c3b .asm_38c78 call Random - cp $46 + cp 28 percent - 1 ret c dec [hl] dec [hl] @@ -1657,7 +1657,7 @@ AI_Smart_Spite: ; 38cd5 jr nc, .asm_38d0b call Random - cp $64 + cp 39 percent + 1 ret nc .asm_38d0b @@ -1666,7 +1666,7 @@ AI_Smart_Spite: ; 38cd5 .asm_38d0d call Random - cp $64 + cp 39 percent + 1 ret c dec [hl] dec [hl] @@ -1827,7 +1827,7 @@ AI_Smart_Conversion2: ; 38d98 .asm_38dc9 call Random - cp 25 + cp 10 percent ret c inc [hl] ret @@ -1848,7 +1848,7 @@ AI_Smart_Disable: ; 38dd1 jr nc, .asm_38dee call Random - cp 100 + cp 39 percent + 1 ret c dec [hl] ret @@ -1860,7 +1860,7 @@ AI_Smart_Disable: ; 38dd1 .asm_38df3 call Random - cp 20 + cp 8 percent ret c inc [hl] ret @@ -2096,7 +2096,7 @@ AI_Smart_Protect: ; 38ed2 .asm_38f14 call Random - cp 20 + cp 8 percent ret c inc [hl] inc [hl] @@ -2120,14 +2120,14 @@ AI_Smart_Foresight: ; 38f1d jr z, .asm_38f41 call Random - cp 20 + cp 8 percent ret c inc [hl] ret .asm_38f41 call Random - cp 100 + cp 39 percent + 1 ret c dec [hl] dec [hl] @@ -2317,7 +2317,7 @@ AI_Smart_Rollout: ; 38fef ; Otherwise, 80% chance to greatly encourage this move. call Random - cp 200 + cp 79 percent - 1 ret nc dec [hl] dec [hl] @@ -2347,7 +2347,7 @@ AI_Smart_Attract: ; 39026 .first_turn call Random - cp 200 + cp 79 percent - 1 ret nc dec [hl] ret @@ -2850,7 +2850,7 @@ AI_Smart_Solarbeam: ; 3920b ret nz call Random - cp 25 ; 1/10 + cp 10 percent ret c inc [hl] @@ -2875,7 +2875,7 @@ AI_Smart_Thunder: ; 39225 ret nz call Random - cp 25 ; 1/10 + cp 10 percent ret c inc [hl] @@ -3387,7 +3387,7 @@ AI_Cautious: ; 39418 jr nc, .asm_39425 call Random - cp 230 + cp 90 percent + 1 ret nc inc [hl] @@ -3513,7 +3513,7 @@ AI_Risky: ; 394a9 ; Else, 80% chance to exclude them. call Random - cp 200 ; 1/5 + cp 79 percent - 1 jr c, .nextmove .checkko @@ -3586,13 +3586,13 @@ AIGetEnemyMove: ; 39508 AI_80_20: ; 39521 call Random - cp 50 ; 1/5 + cp 20 percent - 1 ret ; 39527 AI_50_50: ; 39527 call Random - cp $80 ; 1/2 + cp 50 percent + 1 ret ; 3952d diff --git a/battle/anim_commands.asm b/battle/anim_commands.asm index 510f44d2b..78786f516 100644 --- a/battle/anim_commands.asm +++ b/battle/anim_commands.asm @@ -237,16 +237,16 @@ Functioncc220: ; cc220 ; Appears to be unused. xor a ld [hBGMapMode], a - ld a, (VBGMap0 tile $28) % $100 + ld a, LOW(VBGMap0 tile $28) ld [hBGMapAddress], a - ld a, (VBGMap0 tile $28) / $100 + ld a, HIGH(VBGMap0 tile $28) ld [hBGMapAddress + 1], a call WaitBGMap2 ld a, $60 ld [hWY], a - xor a + xor a ; LOW(VBGMap0) ld [hBGMapAddress], a - ld a, VBGMap0 / $100 + ld a, HIGH(VBGMap0) ld [hBGMapAddress + 1], a call BattleAnimDelayFrame ret @@ -1501,10 +1501,10 @@ BattleAnim_UpdateOAM_All: ; cc96e jr nz, .loop ld a, [wBattleAnimOAMPointerLo] ld l, a - ld h, Sprites / $100 + ld h, HIGH(Sprites) .loop2 ld a, l - cp SpritesEnd % $100 + cp LOW(SpritesEnd) jr nc, .done xor a ld [hli], a diff --git a/battle/bg_effects.asm b/battle/bg_effects.asm index cfd342df7..7799c2cf7 100644 --- a/battle/bg_effects.asm +++ b/battle/bg_effects.asm @@ -1223,7 +1223,7 @@ BattleBGEffect_DoubleTeam: ; c8689 (32:4689) xor $ff inc a ld d, a - ld h, LYOverridesBackup / $100 + ld h, HIGH(LYOverridesBackup) ld a, [hLYOverrideStart] ld l, a ld a, [hLYOverrideEnd] @@ -1264,7 +1264,7 @@ BattleBGEffect_AcidArmor: ; c8709 (32:4709) ld e, [hl] ld d, 2 call Functionc8f2e - ld h, LYOverridesBackup / $100 + ld h, HIGH(LYOverridesBackup) ld a, [hLYOverrideEnd] ld l, a ld [hl], $0 @@ -1275,7 +1275,7 @@ BattleBGEffect_AcidArmor: ; c8709 (32:4709) .one ld a, [hLYOverrideEnd] ld l, a - ld h, LYOverridesBackup / $100 + ld h, HIGH(LYOverridesBackup) ld e, l ld d, h dec de @@ -1554,7 +1554,7 @@ Functionc88a5: ; c88a5 (32:48a5) ld a, [hLYOverrideEnd] sub d ld d, a - ld h, LYOverridesBackup / $100 + ld h, HIGH(LYOverridesBackup) ld a, [hSCY] or a jr nz, .skip1 @@ -1846,7 +1846,7 @@ BattleBGEffect_2a: ; c8a3a (32:4a3a) ld [hLYOverrideEnd], a ld a, [hLYOverrideStart] ld l, a - ld h, LYOverridesBackup / $100 + ld h, HIGH(LYOverridesBackup) .loop ld a, [hLYOverrideEnd] cp l @@ -1900,7 +1900,7 @@ BattleBGEffect_2a: ; c8a3a (32:4a3a) ld a, [hLYOverrideEnd] sub l srl a - ld h, LYOverridesBackup / $100 + ld h, HIGH(LYOverridesBackup) .loop2 ld [hl], e inc hl @@ -2851,7 +2851,7 @@ BattleBGEffect_WavyScreenFX: ; c8fef (32:4fef) ld l, a inc a ld e, a - ld h, LYOverridesBackup / $100 + ld h, HIGH(LYOverridesBackup) ld d, h ld a, [hLYOverrideEnd] sub l @@ -2874,7 +2874,7 @@ BattleBGEffect_WavyScreenFX: ; c8fef (32:4fef) BGEffect_FillLYOverridesBackup: ; c900b (32:500b) push af - ld h, LYOverridesBackup / $100 + ld h, HIGH(LYOverridesBackup) ld a, [hLYOverrideStart] ld l, a ld a, [hLYOverrideEnd] @@ -2897,7 +2897,7 @@ BGEffect_DisplaceLYOverridesBackup: ; c901b (32:501b) sub l sub e ld d, a - ld h, LYOverridesBackup / $100 + ld h, HIGH(LYOverridesBackup) ld a, [hLYOverrideStart] ld l, a ld a, $90 diff --git a/battle/core.asm b/battle/core.asm index 9cae539c3..3a6d7ac9e 100644 --- a/battle/core.asm +++ b/battle/core.asm @@ -2573,11 +2573,11 @@ WinTrainerBattle: ; 3cfa4 .CheckMaxedOutMomMoney: ; 3d0b1 ld hl, wMomsMoney + 2 ld a, [hld] - cp MAX_MONEY % $100 + cp LOW(MAX_MONEY) ld a, [hld] - sbc MAX_MONEY / $100 % $100 + sbc HIGH(MAX_MONEY) ; mid ld a, [hl] - sbc MAX_MONEY / $10000 % $100 + sbc HIGH(MAX_MONEY >> 8) ret ; 3d0be @@ -2602,17 +2602,17 @@ AddBattleMoneyToAccount: ; 3d0be jr nz, .loop pop hl ld a, [hld] - cp MAX_MONEY % $100 + cp LOW(MAX_MONEY) ld a, [hld] - sbc MAX_MONEY / $100 % $100 + sbc HIGH(MAX_MONEY) ; mid ld a, [hl] - sbc MAX_MONEY / $10000 % $100 + sbc HIGH(MAX_MONEY >> 8) ret c - ld [hl], MAX_MONEY / $10000 % $100 + ld [hl], HIGH(MAX_MONEY >> 8) inc hl - ld [hl], MAX_MONEY / $100 % $100 + ld [hl], HIGH(MAX_MONEY) ; mid inc hl - ld [hl], MAX_MONEY % $100 + ld [hl], LOW(MAX_MONEY) ret ; 3d0ea @@ -6384,25 +6384,25 @@ LoadEnemyMon: ; 3e8eb ; We're clear if the length is < 1536 ld a, [wMagikarpLength] - cp $06 ; $600 = 1536 + cp HIGH(1536) jr nz, .CheckMagikarpArea -; 5% chance of skipping size checks +; 5% chance of skipping both size checks call Random - cp $0c ; / $100 + cp 5 percent jr c, .CheckMagikarpArea ; Try again if > 1614 ld a, [wMagikarpLength + 1] - cp $50 + cp LOW(1614) + 2 jr nc, .GenerateDVs ; 20% chance of skipping this check call Random - cp $32 ; / $100 + cp 20 percent - 1 jr c, .CheckMagikarpArea ; Try again if > 1598 ld a, [wMagikarpLength + 1] - cp $40 + cp LOW(1598) + 2 jr nc, .GenerateDVs .CheckMagikarpArea: @@ -6423,11 +6423,11 @@ LoadEnemyMon: ; 3e8eb jr z, .Happiness ; 40% chance of not flooring call Random - cp $64 ; / $100 + cp 40 percent - 2 jr c, .Happiness ; Floor at length 1024 ld a, [wMagikarpLength] - cp 1024 >> 8 + cp HIGH(1024) jr c, .GenerateDVs ; try again ; Finally done with DVs @@ -6462,7 +6462,7 @@ LoadEnemyMon: ; 3e8eb .TreeMon: ; If we're headbutting trees, some monsters enter battle asleep call CheckSleepingTreeMon - ld a, SLP ; Asleep for 7 turns + ld a, TREEMON_SLEEP_TURNS jr c, .UpdateStatus ; Otherwise, no status xor a @@ -7009,14 +7009,14 @@ ApplyStatLevelMultiplier: ; 3ecb7 ; Cap at 999. ld a, [hQuotient + 2] - sub MAX_STAT_VALUE % $100 + sub LOW(MAX_STAT_VALUE) ld a, [hQuotient + 1] - sbc MAX_STAT_VALUE / $100 + sbc HIGH(MAX_STAT_VALUE) jp c, .okay3 - ld a, MAX_STAT_VALUE / $100 + ld a, HIGH(MAX_STAT_VALUE) ld [hQuotient + 1], a - ld a, MAX_STAT_VALUE % $100 + ld a, LOW(MAX_STAT_VALUE) ld [hQuotient + 2], a .okay3 @@ -7132,13 +7132,13 @@ BoostStat: ; 3ed7c ; Cap at 999. ld a, [hld] - sub MAX_STAT_VALUE % $100 + sub LOW(MAX_STAT_VALUE) ld a, [hl] - sbc MAX_STAT_VALUE / $100 + sbc HIGH(MAX_STAT_VALUE) ret c - ld a, MAX_STAT_VALUE / $100 + ld a, HIGH(MAX_STAT_VALUE) ld [hli], a - ld a, MAX_STAT_VALUE % $100 + ld a, LOW(MAX_STAT_VALUE) ld [hld], a ret ; 3ed9f @@ -7217,7 +7217,7 @@ _BattleRandom:: ; 3edd8 ld b, 10 ; number of seeds ; Generate next number in the sequence for each seed -; The algorithm takes the form *5 + 1 % 256 +; a[n+1] = (a[n] * 5 + 1) % 256 .loop ; get last # ld a, [hl] @@ -9135,10 +9135,10 @@ AddLastMobileBattleToLinkRecord: ; 3fa42 dec hl ld a, [hl] inc hl - cp MAX_LINK_RECORD / $100 + cp HIGH(MAX_LINK_RECORD) ret c ld a, [hl] - cp MAX_LINK_RECORD % $100 + cp LOW(MAX_LINK_RECORD) ret ; 3fac8 diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 86b8cc080..f2c6b5d77 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -3576,14 +3576,14 @@ BattleCommand_DamageCalc: ; 35612 jr nz, .Cap ld a, [hProduct + 2] - cp 998 / $100 + cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) jr c, .dont_cap_2 - cp 998 / $100 + 1 + cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) + 1 jr nc, .Cap ld a, [hProduct + 3] - cp 998 % $100 + cp LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) jr nc, .Cap .dont_cap_2 @@ -3601,21 +3601,21 @@ BattleCommand_DamageCalc: ; 35612 jr c, .Cap ld a, [hl] - cp 998 / $100 + cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) jr c, .dont_cap_3 - cp 998 / $100 + 1 + cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) + 1 jr nc, .Cap inc hl ld a, [hld] - cp 998 % $100 + cp LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) jr c, .dont_cap_3 .Cap: - ld a, 997 / $100 + ld a, HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE) ld [hli], a - ld a, 997 % $100 + ld a, LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE) ld [hld], a @@ -3623,7 +3623,7 @@ BattleCommand_DamageCalc: ; 35612 ; Minimum neutral damage is 2 (bringing the cap to 999). inc hl ld a, [hl] - add 2 + add MIN_NEUTRAL_DAMAGE ld [hld], a jr nc, .dont_floor inc [hl] @@ -5651,10 +5651,10 @@ CheckIfStatCanBeRaised: ; 361ef .no_carry pop bc ld a, [hld] - sub MAX_STAT_VALUE % $100 + sub LOW(MAX_STAT_VALUE) jr nz, .not_already_max ld a, [hl] - sbc MAX_STAT_VALUE / $100 + sbc HIGH(MAX_STAT_VALUE) jp z, .stats_already_max .not_already_max ld a, [hBattleTurn] @@ -6417,14 +6417,14 @@ CalcStats: ; 3661d .check_maxed_out ld a, [hQuotient + 2] - cp MAX_STAT_VALUE % $100 + cp LOW(MAX_STAT_VALUE) ld a, b - sbc MAX_STAT_VALUE / $100 + sbc HIGH(MAX_STAT_VALUE) jr c, .not_maxed_out - ld a, MAX_STAT_VALUE % $100 + ld a, LOW(MAX_STAT_VALUE) ld [hQuotient + 2], a - ld a, MAX_STAT_VALUE / $100 + ld a, HIGH(MAX_STAT_VALUE) ld [hQuotient + 1], a .not_maxed_out @@ -8367,7 +8367,7 @@ BattleCommand_Heal: ; 3713e call GetBattleVarAddr ld a, [hl] and a - ld [hl], REST_TURNS + 1 + ld [hl], REST_SLEEP_TURNS + 1 ld hl, WentToSleepText jr z, .no_status_to_heal ld hl, RestedText diff --git a/battle/objects/engine.asm b/battle/objects/engine.asm index 6a4f86902..ae3bdde28 100755 --- a/battle/objects/engine.asm +++ b/battle/objects/engine.asm @@ -106,7 +106,7 @@ BattleAnimOAMUpdate: ; cca09 ld l, a ld a, [wBattleAnimOAMPointerLo] ld e, a - ld d, Sprites / $100 + ld d, HIGH(Sprites) .loop ld a, [wBattleAnimTempYCoord] ld b, a |