shithub: pokecrystal

Download patch

ref: 148fd299f99a55109fdedbe8bd6b976263f9f77b
parent: 7d4486e6a34a5163575400f21e806471be496e3d
author: Remy Oukaour <remy.oukaour@gmail.com>
date: Sun Dec 24 14:49:57 EST 2017

Add more constants for some maximum values

--- a/battle/core.asm
+++ b/battle/core.asm
@@ -7009,14 +7009,14 @@
 
 ; 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 @@
 
 ; 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 @@
 	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
 
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -5651,10 +5651,10 @@
 .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 @@
 
 .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
--- a/constants/battle_constants.asm
+++ b/constants/battle_constants.asm
@@ -54,6 +54,8 @@
 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
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -89,6 +89,8 @@
 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
--- a/engine/item_effects.asm
+++ b/engine/item_effects.asm
@@ -2147,8 +2147,8 @@
 	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
--- a/engine/move_mon.asm
+++ b/engine/move_mon.asm
@@ -1579,9 +1579,9 @@
 	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
--- a/maps/CeladonGameCorner.asm
+++ b/maps/CeladonGameCorner.asm
@@ -58,7 +58,7 @@
 	buttonsound
 	checkitem COIN_CASE
 	iffalse .NoCoinCase
-	checkcoins 9998
+	checkcoins MAX_COINS - 1
 	if_equal $0, .FullCoinCase
 	stringtotext .coinname, $1
 	scall .GiveCoins
--- 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 @@
 	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 @@
 	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