From 148fd299f99a55109fdedbe8bd6b976263f9f77b Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sun, 24 Dec 2017 19:49:57 -0500 Subject: [PATCH] Add more constants for some maximum values --- battle/core.asm | 20 ++++++++++---------- battle/effect_commands.asm | 12 ++++++------ constants/battle_constants.asm | 2 ++ constants/misc_constants.asm | 2 ++ engine/item_effects.asm | 4 ++-- engine/move_mon.asm | 4 ++-- maps/CeladonGameCorner.asm | 2 +- maps/Route43Gate.asm | 14 ++++++++------ 8 files changed, 33 insertions(+), 27 deletions(-) diff --git a/battle/core.asm b/battle/core.asm index 7a1d9bf73..9cae539c3 100644 --- a/battle/core.asm +++ b/battle/core.asm @@ -7009,14 +7009,14 @@ ApplyStatLevelMultiplier: ; 3ecb7 ; Cap at 999. ld a, [hQuotient + 2] - sub 999 % $100 + sub MAX_STAT_VALUE % $100 ld a, [hQuotient + 1] - sbc 999 / $100 + sbc MAX_STAT_VALUE / $100 jp c, .okay3 - ld a, 999 / $100 + ld a, MAX_STAT_VALUE / $100 ld [hQuotient + 1], a - ld a, 999 % $100 + ld a, MAX_STAT_VALUE % $100 ld [hQuotient + 2], a .okay3 @@ -7132,13 +7132,13 @@ BoostStat: ; 3ed7c ; Cap at 999. ld a, [hld] - sub 999 % $100 + sub MAX_STAT_VALUE % $100 ld a, [hl] - sbc 999 / $100 + sbc MAX_STAT_VALUE / $100 ret c - ld a, 999 / $100 + ld a, MAX_STAT_VALUE / $100 ld [hli], a - ld a, 999 % $100 + ld a, MAX_STAT_VALUE % $100 ld [hld], a ret ; 3ed9f @@ -9135,10 +9135,10 @@ AddLastMobileBattleToLinkRecord: ; 3fa42 dec hl ld a, [hl] inc hl - cp 9999 / $100 + cp MAX_LINK_RECORD / $100 ret c ld a, [hl] - cp 9999 % $100 + cp MAX_LINK_RECORD % $100 ret ; 3fac8 diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 66788bd6a..86b8cc080 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -5651,10 +5651,10 @@ CheckIfStatCanBeRaised: ; 361ef .no_carry pop bc ld a, [hld] - sub 999 % $100 + sub MAX_STAT_VALUE % $100 jr nz, .not_already_max ld a, [hl] - sbc 999 / $100 + sbc MAX_STAT_VALUE / $100 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 999 % $100 + cp MAX_STAT_VALUE % $100 ld a, b - sbc 999 / $100 + sbc MAX_STAT_VALUE / $100 jr c, .not_maxed_out - ld a, 999 % $100 + ld a, MAX_STAT_VALUE % $100 ld [hQuotient + 2], a - ld a, 999 / $100 + ld a, MAX_STAT_VALUE / $100 ld [hQuotient + 1], a .not_maxed_out diff --git a/constants/battle_constants.asm b/constants/battle_constants.asm index 64e3ec4f8..f86cd0873 100644 --- a/constants/battle_constants.asm +++ b/constants/battle_constants.asm @@ -54,6 +54,8 @@ NUM_STATS EQU const_value STAT_MIN_NORMAL EQU 5 STAT_MIN_HP EQU 10 +MAX_STAT_VALUE EQU 999 + ; shiny dvs ATKDEFDV_SHINY EQU $EA SPDSPCDV_SHINY EQU $AA diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index 70b97a21d..64c625933 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -89,6 +89,8 @@ HOF_MON_LENGTH = 1 + 2 + 2 + 1 + (PKMN_NAME_LENGTH +- 1) ; species, id, dvs, lev HOF_LENGTH = 1 + HOF_MON_LENGTH * PARTY_LENGTH + 1 ; win count, party, terminator NUM_HOF_TEAMS = 30 +MAX_LINK_RECORD EQU 9999 + ; significant money values START_MONEY EQU 3000 diff --git a/engine/item_effects.asm b/engine/item_effects.asm index 7fd2b7196..4db1f3b7d 100644 --- a/engine/item_effects.asm +++ b/engine/item_effects.asm @@ -2147,8 +2147,8 @@ GetHealingItemAmount: ; f395 (3:7395) dbw HYPER_POTION, 200 dbw SUPER_POTION, 50 dbw POTION, 20 - dbw MAX_POTION, 999 - dbw FULL_RESTORE, 999 + dbw MAX_POTION, MAX_STAT_VALUE + dbw FULL_RESTORE, MAX_STAT_VALUE dbw MOOMOO_MILK, 100 dbw BERRY, 10 dbw GOLD_BERRY, 30 diff --git a/engine/move_mon.asm b/engine/move_mon.asm index 2225a80ab..4ee283e3e 100755 --- a/engine/move_mon.asm +++ b/engine/move_mon.asm @@ -1579,9 +1579,9 @@ CalcPkmnStatC: ; e17b jr c, .stat_value_okay .max_stat - ld a, 999 / $100 + ld a, MAX_STAT_VALUE / $100 ld [hMultiplicand + 1], a - ld a, 999 % $100 + ld a, MAX_STAT_VALUE % $100 ld [hMultiplicand + 2], a .stat_value_okay diff --git a/maps/CeladonGameCorner.asm b/maps/CeladonGameCorner.asm index 5bd122023..d5e17050b 100644 --- a/maps/CeladonGameCorner.asm +++ b/maps/CeladonGameCorner.asm @@ -58,7 +58,7 @@ CeladonGameCornerFisherScript: buttonsound checkitem COIN_CASE iffalse .NoCoinCase - checkcoins 9998 + checkcoins MAX_COINS - 1 if_equal $0, .FullCoinCase stringtotext .coinname, $1 scall .GiveCoins diff --git a/maps/Route43Gate.asm b/maps/Route43Gate.asm index 7140528d6..04542679b 100644 --- a/maps/Route43Gate.asm +++ b/maps/Route43Gate.asm @@ -1,3 +1,5 @@ +ROUTE43GATE_TOLL EQU 1000 + const_value set 2 const ROUTE43GATE_OFFICER const ROUTE43GATE_ROCKET1 @@ -48,17 +50,17 @@ RocketScript_Southbound: opentext writetext RocketText_TollFee buttonsound - checkmoney $0, 999 + checkmoney $0, ROUTE43GATE_TOLL - 1 if_equal $0, RocketScript_TollSouth jump RocketScript_YoureBrokeSouth RocketScript_TollSouth: - takemoney $0, 1000 + takemoney $0, ROUTE43GATE_TOLL writetext RocketText_ThankYou jump RocketScript_ShakeDownSouth RocketScript_YoureBrokeSouth: - takemoney $0, 1000 + takemoney $0, ROUTE43GATE_TOLL writetext RocketText_AllYouGot jump RocketScript_ShakeDownSouth @@ -80,17 +82,17 @@ RocketScript_Northbound: opentext writetext RocketText_TollFee buttonsound - checkmoney $0, 999 + checkmoney $0, ROUTE43GATE_TOLL - 1 if_equal $0, RocketScript_TollNorth jump RocketScript_YoureBrokeNorth RocketScript_TollNorth: - takemoney $0, 1000 + takemoney $0, ROUTE43GATE_TOLL writetext RocketText_ThankYou jump RocketScript_ShakeDownNorth RocketScript_YoureBrokeNorth: - takemoney $0, 1000 + takemoney $0, ROUTE43GATE_TOLL writetext RocketText_AllYouGot jump RocketScript_ShakeDownNorth