summaryrefslogtreecommitdiff
path: root/battle
diff options
context:
space:
mode:
Diffstat (limited to 'battle')
-rw-r--r--battle/ai/items.asm43
-rw-r--r--battle/core.asm33
2 files changed, 43 insertions, 33 deletions
diff --git a/battle/ai/items.asm b/battle/ai/items.asm
index 5cd3fd7fc..8898fdff5 100644
--- a/battle/ai/items.asm
+++ b/battle/ai/items.asm
@@ -1,4 +1,4 @@
-Function38000: ; 38000
+AI_SwitchOrTryItem: ; 38000
and a
ld a, [IsInBattle]
@@ -73,6 +73,7 @@ SwitchOften: ; 38045
ld a, [wc717]
and $f
inc a
+ ; In register 'a' is the number (1-6) of the Pkmn to switch to
ld [wc718], a
jp AI_TrySwitch
; 38083
@@ -148,7 +149,7 @@ SwitchSometimes: ; 380c1
; 380ff
-Function380ff: ; 380ff
+CheckSubstatusCantRun: ; 380ff
ld a, [EnemySubStatus5]
bit SUBSTATUS_CANT_RUN, a
ret
@@ -565,7 +566,7 @@ Function383a3: ; 383a3 (e:43a3)
call AIUsedItemSound
call AI_HealStatus
ld a, FULL_HEAL
- jp Function38568
+ jp PrintText_UsedItemOn_AND_AIUpdateHUD
Function383ae: ; 383ae (e:43ae)
ld a, MAX_POTION
@@ -658,7 +659,7 @@ Function383f8: ; 383f8
.asm_38436
Function38436: ; 38436
- call Function38571
+ call PrintText_UsedItemOn
hlcoord 2, 2
xor a
ld [wd10a], a
@@ -715,7 +716,7 @@ AI_Switch: ; 3846c
call CopyBytes
pop af
jr c, .asm_384a3
- ld hl, UnknownText_0x384d0
+ ld hl, TextJump_EnemyWithdrew
call PrintText
.asm_384a3
ld a, $1
@@ -735,8 +736,8 @@ AI_Switch: ; 3846c
ret
; 384d0
-UnknownText_0x384d0: ; 384d0
- text_jump UnknownText_0x1bcf9c
+TextJump_EnemyWithdrew: ; 384d0
+ text_jump Text_EnemyWithdrew
db "@"
; 384d5
@@ -744,7 +745,7 @@ Function384d5: ; 384d5
call AIUsedItemSound
call AI_HealStatus
ld a, FULL_HEAL_RED
- jp Function38568
+ jp PrintText_UsedItemOn_AND_AIUpdateHUD
; 384e0
AI_HealStatus: ; 384e0
@@ -765,7 +766,7 @@ Function384f7: ; 384f7
ld hl, EnemySubStatus4
set SUBSTATUS_X_ACCURACY, [hl]
ld a, X_ACCURACY
- jp Function38568
+ jp PrintText_UsedItemOn_AND_AIUpdateHUD
; 38504
Function38504: ; 38504
@@ -773,7 +774,7 @@ Function38504: ; 38504
ld hl, EnemySubStatus4
set SUBSTATUS_MIST, [hl]
ld a, GUARD_SPEC
- jp Function38568
+ jp PrintText_UsedItemOn_AND_AIUpdateHUD
; 38511
Function38511: ; 38511
@@ -781,7 +782,7 @@ Function38511: ; 38511
ld hl, EnemySubStatus4
set SUBSTATUS_FOCUS_ENERGY, [hl]
ld a, DIRE_HIT
- jp Function38568
+ jp PrintText_UsedItemOn_AND_AIUpdateHUD
; 3851e
Function3851e: ; 3851e
@@ -832,23 +833,29 @@ Function38553: ; 38553
ld b, SP_ATTACK
ld a, X_SPECIAL
+
+; Parameter
+; a = ITEM_CONSTANT
+; b = BATTLE_CONSTANT (ATTACK, DEFENSE, SPEED, SP_ATTACK, SP_DEFENSE, ACCURACY, EVASION)
Function38557:
ld [wd1f1], a
push bc
- call Function38571
+ call PrintText_UsedItemOn
pop bc
callba Function361ef
jp AIUpdateHUD
; 38568
-Function38568: ; 38568
+; Parameter
+; a = ITEM_CONSTANT
+PrintText_UsedItemOn_AND_AIUpdateHUD: ; 38568
ld [wd1f1], a
- call Function38571
+ call PrintText_UsedItemOn
jp AIUpdateHUD
; 38571
-Function38571: ; 38571
+PrintText_UsedItemOn: ; 38571
ld a, [wd1f1]
ld [wd265], a
call GetItemName
@@ -856,11 +863,11 @@ Function38571: ; 38571
ld de, wd050
ld bc, ITEM_NAME_LENGTH
call CopyBytes
- ld hl, UnknownText_0x3858c
+ ld hl, TextJump_EnemyUsedOn
jp PrintText
; 3858c
-UnknownText_0x3858c: ; 3858c
- text_jump UnknownText_0x1bcfaf
+TextJump_EnemyUsedOn: ; 3858c
+ text_jump Text_EnemyUsedOn
db "@"
; 38591
diff --git a/battle/core.asm b/battle/core.asm
index 56587ca75..3696b2bb5 100644
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -129,18 +129,18 @@ Function3c0e5: ; 3c0e5
ld [wd0ee], a
ld a, [InLinkBattle]
and a
- ld hl, BattleText_0x807bd
+ ld hl, BattleText_WildFled
jr z, .asm_3c115
ld a, [wd0ee]
and $c0
ld [wd0ee], a
- ld hl, BattleText_0x807cf
+ ld hl, BattleText_EnemyFled
call Function3d2e0
jr nc, .asm_3c115
ld hl, wcd2a
bit 4, [hl]
jr nz, .asm_3c118
- ld hl, BattleText_0x81863
+ ld hl, BattleText_LinkErrorBattleCanceled
.asm_3c115
call StdBattleTextBox
@@ -160,6 +160,7 @@ Function3c0e5: ; 3c0e5
ret
; 3c12f
+
Function3c12f: ; 3c12f
.loop
call Function3c1bf
@@ -939,7 +940,7 @@ Function3c5fe: ; 3c5fe
call SetEnemyTurn
ld a, $1
ld [wc70f], a
- callab Function38000
+ callab AI_SwitchOrTryItem
jr c, .asm_3c62f
call Function3c6de
call Function3d2e0
@@ -980,7 +981,7 @@ Function3c664: ; 3c664
xor a
ld [wc70f], a
call SetEnemyTurn
- callab Function38000
+ callab AI_SwitchOrTryItem
push af
call Function3c6cf
pop bc
@@ -3280,7 +3281,7 @@ Function3d4c3: ; 3d4c3
call Function3d7a0
call NewEnemyMonStatus
call ResetEnemyStatLevels
- call Function3d7c7
+ call Function_SetEnemyPkmnAndSendOutAnimation
call BreakAttraction
call Function3d57a
ret
@@ -3299,8 +3300,8 @@ Function3d4e1: ; 3d4e1
call Function3d74b
push af
call Function3d7a0
- call Function3d7b8
- call Function3d7c7
+ call Function_BattleTextEnemySentOut
+ call Function_SetEnemyPkmnAndSendOutAnimation
pop af
ret c
xor a
@@ -3323,8 +3324,8 @@ Function3d517: ; 3d517
ld a, 1
ld [wEnemyIsSwitching], a
call Function3d7a0
- call Function3d7b8
- jp Function3d7c7
+ call Function_BattleTextEnemySentOut
+ jp Function_SetEnemyPkmnAndSendOutAnimation
; 3d533
Function3d533: ; 3d533
@@ -3697,14 +3698,14 @@ Function3d7a0: ; 3d7a0
jp Function3ee27
; 3d7b8
-Function3d7b8: ; 3d7b8
+Function_BattleTextEnemySentOut: ; 3d7b8
callab Battle_GetTrainerName
- ld hl, BattleText_0x80af8
+ ld hl, BattleText_EnemySentOut
call StdBattleTextBox
jp WaitBGMap
; 3d7c7
-Function3d7c7: ; 3d7c7
+Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7
ld a, [TempEnemyMonSpecies]
ld [CurPartySpecies], a
ld [CurSpecies], a
@@ -4013,7 +4014,7 @@ Function3d8b3: ; 3d8b3
ld hl, wcd2a
bit 4, [hl]
jr nz, .asm_3da05
- ld hl, BattleText_0x81863
+ ld hl, BattleText_LinkErrorBattleCanceled
call StdBattleTextBox
.asm_3da05
@@ -5160,7 +5161,7 @@ LoadBattleMenu2: ; 3e19b
ld hl, wcd2a
bit 4, [hl]
jr nz, .error
- ld hl, BattleText_0x81863
+ ld hl, BattleText_LinkErrorBattleCanceled
call StdBattleTextBox
ld c, 60
call DelayFrames
@@ -7327,9 +7328,11 @@ Function3ee3b: ; 3ee3b
ld a, [InLinkBattle]
and a
ret nz
+
ld a, [wcfc0]
bit 0, a
ret nz
+
call Function3f0d4
xor a
ld [CurPartyMon], a