shithub: pokecrystal

Download patch

ref: c8055c17f2d97a8efaea4b0618408fdfefa10425
parent: 1fcc69e4953db7e3090101b8ecea8d97367babfa
author: yenatch <[email protected]>
date: Sun May 4 23:30:51 EDT 2014

Fix static farcalls in AI scoring.

--- a/battle/ai/scoring.asm
+++ b/battle/ai/scoring.asm
@@ -22,9 +22,7 @@
 	push hl
 	push de
 	push bc
-	ld a, $b
-	ld hl, $441a
-	rst FarCall
+	callba Function2c41a
 	pop bc
 	pop de
 	pop hl
@@ -494,10 +492,9 @@
 	ld [hBattleTurn], a
 	push hl
 	push bc
-	ld a, $d
-	ld hl, $47c8
-	rst FarCall
 
+	callba Function347c8
+
 	ld a, [$d265]
 	cp $a
 	pop bc
@@ -1105,7 +1102,7 @@
 
 AIScoring_Fly: ; 38b12
 	ld a, [PlayerSubStatus3]
-	and 1<<SUBSTATUS_FLYING | 1<<SUBSTATUS_UNDERGROUND
+	and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
 	ret z
 	call AICompareSpeed
 	ret nc
@@ -1244,9 +1241,7 @@
 
 	ld a, $1
 	ld [hBattleTurn], a
-	ld hl, $47c8
-	ld a, $d
-	rst FarCall
+	callab Function347c8
 
 	ld a, [$d265]
 	cp $a
@@ -1444,7 +1439,7 @@
 	ld c, [hl]
 	sla c
 	rl b
-	ld hl, $c63d
+	ld hl, BattleMonHP + 1
 	ld a, [hld]
 	cp c
 	ld a, [hl]
@@ -1622,30 +1617,21 @@
 
 	ret c
 	ld a, [PlayerSubStatus3]
-	and $60
+	and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
 	jp nz, AIDiscourageMove
 
 	ld a, $1
 	ld [hBattleTurn], a
 	push hl
-	ld hl, $53f6
-	ld a, $d
-	rst FarCall
-
-	ld hl, $5612
-	ld a, $d
-	rst FarCall
-
-	ld hl, $46d2
-	ld a, $d
-	rst FarCall
-
+	callab EnemyAttackDamage
+	callab BattleCommand62
+	callab BattleCommand07
 	pop hl
-	ld a, [$d257]
+	ld a, [CurDamage + 1]
 	ld c, a
 	ld a, [CurDamage]
 	ld b, a
-	ld a, [$c63d]
+	ld a, [BattleMonHP + 1]
 	cp c
 	ld a, [BattleMonHP]
 	sbc b
@@ -1683,9 +1669,7 @@
 	xor a
 	ld [hBattleTurn], a
 
-	ld hl, $47c8
-	ld a, $d
-	rst FarCall
+	callab Function347c8
 
 	ld a, [$d265]
 	cp $a
@@ -2296,9 +2280,7 @@
 	push hl
 	ld a, 1
 	ld [hBattleTurn], a
-	ld hl, $7ced
-	ld a, $3e
-	rst FarCall
+	callab HiddenPowerDamage
 	callab Function347c8
 	pop hl
 
@@ -2604,7 +2586,7 @@
 	ret nc
 
 	ld a, [PlayerSubStatus3]
-	and 1<<SUBSTATUS_FLYING | 1<<SUBSTATUS_UNDERGROUND
+	and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
 	ret z
 
 	dec [hl]