Still more battle command labels

This commit is contained in:
PikalaxALT 2015-11-06 22:36:06 -05:00
parent d8aa438644
commit 929d0aa081
10 changed files with 351 additions and 344 deletions

View File

@ -1158,7 +1158,7 @@ ResidualDamage: ; 3c716
call SubtractHPFromUser call SubtractHPFromUser
ld a, $1 ld a, $1
ld [hBGMapMode], a ld [hBGMapMode], a
call Function3ccef call RestoreHP
ld hl, LeechSeedSapsText ld hl, LeechSeedSapsText
call StdBattleTextBox call StdBattleTextBox
.asm_3c7a1 .asm_3c7a1
@ -1394,7 +1394,7 @@ Function3c8eb: ; 3c8eb
.asm_3c92d .asm_3c92d
call GetSixteenthMaxHP call GetSixteenthMaxHP
call SwitchTurnCore call SwitchTurnCore
call Function3ccef call RestoreHP
ld hl, BattleText_0x80880 ld hl, BattleText_0x80880
jp StdBattleTextBox jp StdBattleTextBox
; 3c93c ; 3c93c
@ -1531,7 +1531,7 @@ Function3c93c: ; 3c93c
.asm_3ca14 .asm_3ca14
call GetItemName call GetItemName
call SwitchTurnCore call SwitchTurnCore
call Function3ddc8 call ItemRecoveryAnim
call SwitchTurnCore call SwitchTurnCore
ld hl, BattleText_UserRecoveredPPUsing ld hl, BattleText_UserRecoveredPPUsing
jp StdBattleTextBox jp StdBattleTextBox
@ -2032,7 +2032,7 @@ Function3ccde: ; 3ccde
; 3ccef ; 3ccef
Function3ccef: ; 3ccef RestoreHP ; 3ccef
ld hl, EnemyMonMaxHP ld hl, EnemyMonMaxHP
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
@ -4461,21 +4461,21 @@ Function3dcf9: ; 3dcf9
jr z, .player_1 jr z, .player_1
call SetPlayerTurn call SetPlayerTurn
call Function3dd2f call Function3dd2f
call Function3dde9 call UseHeldStatusHealingItem
call Function3de51 call Function3de51
call SetEnemyTurn call SetEnemyTurn
call Function3dd2f call Function3dd2f
call Function3dde9 call UseHeldStatusHealingItem
jp Function3de51 jp Function3de51
.player_1 .player_1
call SetEnemyTurn call SetEnemyTurn
call Function3dd2f call Function3dd2f
call Function3dde9 call UseHeldStatusHealingItem
call Function3de51 call Function3de51
call SetPlayerTurn call SetPlayerTurn
call Function3dd2f call Function3dd2f
call Function3dde9 call UseHeldStatusHealingItem
jp Function3de51 jp Function3de51
; 3dd2f ; 3dd2f
@ -4519,7 +4519,7 @@ Function3dd2f: ; 3dd2f
ret nc ret nc
.asm_3dd66 .asm_3dd66
call Function3ddc8 call ItemRecoveryAnim
ld a, [hli] ld a, [hli]
ld [Buffer2], a ld [Buffer2], a
ld a, [hl] ld a, [hl]
@ -4559,7 +4559,7 @@ Function3dd2f: ; 3dd2f
.asm_3dda4 .asm_3dda4
ld [wd10a], a ld [wd10a], a
predef Functionc6e0 predef Functionc6e0
Function3ddac: UseOpponentItem:
call RefreshBattleHuds call RefreshBattleHuds
callab GetOpponentItem callab GetOpponentItem
ld a, [hl] ld a, [hl]
@ -4571,7 +4571,7 @@ Function3ddac:
; 3ddc8 ; 3ddc8
Function3ddc8: ; 3ddc8 ItemRecoveryAnim: ; 3ddc8
push hl push hl
push de push de
push bc push bc
@ -4590,16 +4590,16 @@ Function3ddc8: ; 3ddc8
ret ret
; 3dde9 ; 3dde9
Function3dde9: ; 3dde9 UseHeldStatusHealingItem: ; 3dde9
callab GetOpponentItem callab GetOpponentItem
ld hl, .Statuses ld hl, .Statuses
.asm_3ddf2 .loop
ld a, [hli] ld a, [hli]
cp $ff cp $ff
ret z ret z
inc hl inc hl
cp b cp b
jr nz, .asm_3ddf2 jr nz, .loop
dec hl dec hl
ld b, [hl] ld b, [hl]
ld a, BATTLE_VARS_STATUS_OPP ld a, BATTLE_VARS_STATUS_OPP
@ -4620,26 +4620,26 @@ Function3dde9: ; 3dde9
and [hl] and [hl]
res SUBSTATUS_NIGHTMARE, [hl] res SUBSTATUS_NIGHTMARE, [hl]
ld a, b ld a, b
cp $7f cp 1 << PSN | 1 << FRZ | 1 << BRN | SLP | 1 << PAR
jr nz, .asm_3de26 jr nz, .skip_confuse
ld a, BATTLE_VARS_SUBSTATUS3_OPP ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVarAddr call GetBattleVarAddr
res SUBSTATUS_CONFUSED, [hl] res SUBSTATUS_CONFUSED, [hl]
.asm_3de26 .skip_confuse
ld hl, CalcEnemyStats ld hl, CalcEnemyStats
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_3de31 jr z, .got_pointer
ld hl, CalcPlayerStats ld hl, CalcPlayerStats
.asm_3de31 .got_pointer
call SwitchTurnCore call SwitchTurnCore
ld a, BANK(CalcEnemyStats) ld a, BANK(CalcEnemyStats)
rst FarCall rst FarCall
call SwitchTurnCore call SwitchTurnCore
call Function3ddc8 call ItemRecoveryAnim
call Function3ddac call UseOpponentItem
ld a, $1 ld a, $1
and a and a
ret ret
@ -4675,7 +4675,7 @@ Function3de51: ; 3de51
call GetBattleVarAddr call GetBattleVarAddr
res SUBSTATUS_CONFUSED, [hl] res SUBSTATUS_CONFUSED, [hl]
call GetItemName call GetItemName
call Function3ddc8 call ItemRecoveryAnim
ld hl, BattleText_0x80dab ld hl, BattleText_0x80dab
call StdBattleTextBox call StdBattleTextBox
ld a, [hBattleTurn] ld a, [hBattleTurn]

View File

@ -166,8 +166,8 @@ BattleCommandPointers: ; 3fd28
dw BattleCommanda3 ; 34833 dw BattleCommanda3 ; 34833
dw BattleCommand_AllStatsUp ; 36500 dw BattleCommand_AllStatsUp ; 36500
dw BattleCommanda5 ; 35165 dw BattleCommanda5 ; 35165
dw BattleCommanda6 ; 365af dw BattleCommand_RaiseSubNoAnim ; 365af
dw BattleCommanda7 ; 365c3 dw BattleCommand_LowerSubNoAnim ; 365c3
dw BattleCommanda8 ; 355b5 dw BattleCommanda8 ; 355b5
dw BattleCommand_ClearMissDamage ; 355d5 - a9 dw BattleCommand_ClearMissDamage ; 355d5 - a9
dw BattleCommand_MoveDelay ; 37e80 dw BattleCommand_MoveDelay ; 37e80

View File

@ -371,12 +371,12 @@ CantMove: ; 341f0
ld a, BATTLE_VARS_MOVE_ANIM ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar call GetBattleVar
cp FLY cp FLY
jr z, .asm_3420f jr z, .fly_dig
cp DIG cp DIG
ret nz ret nz
.asm_3420f .fly_dig
res SUBSTATUS_UNDERGROUND, [hl] res SUBSTATUS_UNDERGROUND, [hl]
res SUBSTATUS_FLYING, [hl] res SUBSTATUS_FLYING, [hl]
jp Function37ece jp Function37ece
@ -384,7 +384,7 @@ CantMove: ; 341f0
Function34216: ; 34216 OpponentCantMove: ; 34216
call BattleCommand_SwitchTurn call BattleCommand_SwitchTurn
call CantMove call CantMove
jp BattleCommand_SwitchTurn jp BattleCommand_SwitchTurn
@ -2726,8 +2726,8 @@ BattleCommand_LowerSub: ; 34eee
ret nz ret nz
.charge_turn .charge_turn
call Function37ed5 call _CheckBattleScene
jr c, .asm_34f36 jr c, .skip_anims
xor a xor a
ld [wcfca], a ld [wcfca], a
@ -2737,8 +2737,8 @@ BattleCommand_LowerSub: ; 34eee
ld a, SUBSTITUTE ld a, SUBSTITUTE
jp PlayMoveAnim_KeepHiID jp PlayMoveAnim_KeepHiID
.asm_34f36 .skip_anims
call BattleCommanda7 call BattleCommand_LowerSubNoAnim
jp BattleCommand_MoveDelay jp BattleCommand_MoveDelay
.Rampage .Rampage
@ -2893,8 +2893,8 @@ BattleCommand_RaiseSub: ; 35004
bit SUBSTATUS_SUBSTITUTE, a bit SUBSTATUS_SUBSTITUTE, a
ret z ret z
call Function37ed5 call _CheckBattleScene
jp c, BattleCommanda6 jp c, BattleCommand_RaiseSubNoAnim
xor a xor a
ld [wcfca], a ld [wcfca], a
@ -5463,7 +5463,7 @@ Function35de0: ; 35de0
call StdBattleTextBox call StdBattleTextBox
call BattleCommand_SwitchTurn call BattleCommand_SwitchTurn
call BattleCommanda7 call BattleCommand_LowerSubNoAnim
ld a, BATTLE_VARS_SUBSTATUS3 ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVar call GetBattleVar
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
@ -5516,15 +5516,15 @@ BattleCommand_SleepTarget: ; 35e5c
call GetOpponentItem call GetOpponentItem
ld a, b ld a, b
cp HELD_PREVENT_SLEEP cp HELD_PREVENT_SLEEP
jr nz, .asm_35e70 jr nz, .not_protected_by_item
ld a, [hl] ld a, [hl]
ld [wNamedObjectIndexBuffer], a ld [wNamedObjectIndexBuffer], a
call GetItemName call GetItemName
ld hl, ProtectedByText ld hl, ProtectedByText
jr .asm_35ec6 jr .fail
.asm_35e70 .not_protected_by_item
ld a, BATTLE_VARS_STATUS_OPP ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarAddr call GetBattleVarAddr
ld d, h ld d, h
@ -5532,36 +5532,36 @@ BattleCommand_SleepTarget: ; 35e5c
ld a, [de] ld a, [de]
and SLP and SLP
ld hl, AlreadyAsleepText ld hl, AlreadyAsleepText
jr nz, .asm_35ec6 jr nz, .fail
ld a, [AttackMissed] ld a, [AttackMissed]
and a and a
jp nz, PrintDidntAffect2 jp nz, PrintDidntAffect2
ld hl, DidntAffect1Text ld hl, DidntAffect1Text
call Function35ece call .CheckAIRandomFail
jr c, .asm_35ec6 jr c, .fail
ld a, [de] ld a, [de]
and a and a
jr nz, .asm_35ec6 jr nz, .fail
call CheckSubstituteOpp call CheckSubstituteOpp
jr nz, .asm_35ec6 jr nz, .fail
call AnimateCurrentMove call AnimateCurrentMove
ld b, $7 ld b, $7
ld a, [InBattleTowerBattle] ld a, [InBattleTowerBattle]
and a and a
jr z, .asm_35ea4 jr z, .random_loop
ld b, $3 ld b, $3
.asm_35ea4 .random_loop
call BattleRandom call BattleRandom
and b and b
jr z, .asm_35ea4 jr z, .random_loop
cp 7 cp 7
jr z, .asm_35ea4 jr z, .random_loop
inc a inc a
ld [de], a ld [de], a
call UpdateOpponentInParty call UpdateOpponentInParty
@ -5570,12 +5570,12 @@ BattleCommand_SleepTarget: ; 35e5c
ld hl, FellAsleepText ld hl, FellAsleepText
call StdBattleTextBox call StdBattleTextBox
callba Function3dde9 callba UseHeldStatusHealingItem
jp z, Function34216 jp z, OpponentCantMove
ret ret
.asm_35ec6 .fail
push hl push hl
call AnimateFailedMove call AnimateFailedMove
pop hl pop hl
@ -5583,31 +5583,31 @@ BattleCommand_SleepTarget: ; 35e5c
; 35ece ; 35ece
Function35ece: ; 35ece .CheckAIRandomFail: ; 35ece
; Enemy turn ; Enemy turn
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_35eec jr z, .dont_fail
; Not in link battle ; Not in link battle
ld a, [wLinkMode] ld a, [wLinkMode]
and a and a
jr nz, .asm_35eec jr nz, .dont_fail
ld a, [InBattleTowerBattle] ld a, [InBattleTowerBattle]
and a and a
jr nz, .asm_35eec jr nz, .dont_fail
; Not locked-on by the enemy ; Not locked-on by the enemy
ld a, [PlayerSubStatus5] ld a, [PlayerSubStatus5]
bit SUBSTATUS_LOCK_ON, a bit SUBSTATUS_LOCK_ON, a
jr nz, .asm_35eec jr nz, .dont_fail
call BattleRandom call BattleRandom
cp $40 cp $40 ; 25%
ret c ret c
.asm_35eec .dont_fail
xor a xor a
ret ret
; 35eee ; 35eee
@ -5625,7 +5625,7 @@ BattleCommand_PoisonTarget: ; 35eee
ld a, [TypeModifier] ld a, [TypeModifier]
and $7f and $7f
ret z ret z
call Function35fe1 call CheckIfTargetIsPoisonType
ret z ret z
call GetOpponentItem call GetOpponentItem
ld a, b ld a, b
@ -5634,9 +5634,10 @@ BattleCommand_PoisonTarget: ; 35eee
ld a, [EffectFailed] ld a, [EffectFailed]
and a and a
ret nz ret nz
call Function37962 call SafeCheckSafeguard
ret nz ret nz
call Function35ff5
call PoisonOpponent
ld de, ANIM_PSN ld de, ANIM_PSN
call PlayOpponentBattleAnim call PlayOpponentBattleAnim
call RefreshBattleHuds call RefreshBattleHuds
@ -5644,7 +5645,7 @@ BattleCommand_PoisonTarget: ; 35eee
ld hl, WasPoisonedText ld hl, WasPoisonedText
call StdBattleTextBox call StdBattleTextBox
callba Function3dde9 callba UseHeldStatusHealingItem
ret ret
; 35f2c ; 35f2c
@ -5655,83 +5656,83 @@ BattleCommand_Poison: ; 35f2c
ld hl, DoesntAffectText ld hl, DoesntAffectText
ld a, [TypeModifier] ld a, [TypeModifier]
and $7f and $7f
jp z, .asm_35fb8 jp z, .failed
call Function35fe1 call CheckIfTargetIsPoisonType
jp z, .asm_35fb8 jp z, .failed
ld a, BATTLE_VARS_STATUS_OPP ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVar call GetBattleVar
ld b, a ld b, a
ld hl, AlreadyPoisonedText ld hl, AlreadyPoisonedText
and 1 << PSN and 1 << PSN
jp nz, .asm_35fb8 jp nz, .failed
call GetOpponentItem call GetOpponentItem
ld a, b ld a, b
cp HELD_PREVENT_POISON cp HELD_PREVENT_POISON
jr nz, .asm_35f5f jr nz, .do_poison
ld a, [hl] ld a, [hl]
ld [wNamedObjectIndexBuffer], a ld [wNamedObjectIndexBuffer], a
call GetItemName call GetItemName
ld hl, ProtectedByText ld hl, ProtectedByText
jr .asm_35fb8 jr .failed
.asm_35f5f .do_poison
ld hl, DidntAffect1Text ld hl, DidntAffect1Text
ld a, BATTLE_VARS_STATUS_OPP ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVar call GetBattleVar
and a and a
jr nz, .asm_35fb8 jr nz, .failed
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_35f89 jr z, .skip_random
ld a, [wLinkMode] ld a, [wLinkMode]
and a and a
jr nz, .asm_35f89 jr nz, .skip_random
ld a, [InBattleTowerBattle] ld a, [InBattleTowerBattle]
and a and a
jr nz, .asm_35f89 jr nz, .skip_random
ld a, [PlayerSubStatus5] ld a, [PlayerSubStatus5]
bit SUBSTATUS_LOCK_ON, a bit SUBSTATUS_LOCK_ON, a
jr nz, .asm_35f89 jr nz, .skip_random
call BattleRandom call BattleRandom
cp $40 cp $40 ; 25% chance AI fails
jr c, .asm_35fb8 jr c, .failed
.asm_35f89 .skip_random
call CheckSubstituteOpp call CheckSubstituteOpp
jr nz, .asm_35fb8 jr nz, .failed
ld a, [AttackMissed] ld a, [AttackMissed]
and a and a
jr nz, .asm_35fb8 jr nz, .failed
call Function35fc9 call .check_toxic
jr z, .asm_35fa4 jr z, .toxic
call Function35fc0 call .apply_poison
ld hl, WasPoisonedText ld hl, WasPoisonedText
call StdBattleTextBox call StdBattleTextBox
jr .asm_35fb1 jr .finished
.asm_35fa4 .toxic
set SUBSTATUS_TOXIC, [hl] set SUBSTATUS_TOXIC, [hl]
xor a xor a
ld [de], a ld [de], a
call Function35fc0 call .apply_poison
ld hl, BadlyPoisonedText ld hl, BadlyPoisonedText
call StdBattleTextBox call StdBattleTextBox
.asm_35fb1 .finished
callba Function3dde9 callba UseHeldStatusHealingItem
ret ret
.asm_35fb8 .failed
push hl push hl
call AnimateFailedMove call AnimateFailedMove
pop hl pop hl
@ -5739,14 +5740,14 @@ BattleCommand_Poison: ; 35f2c
; 35fc0 ; 35fc0
Function35fc0: ; 35fc0 .apply_poison: ; 35fc0
call AnimateCurrentMove call AnimateCurrentMove
call Function35ff5 call PoisonOpponent
jp RefreshBattleHuds jp RefreshBattleHuds
; 35fc9 ; 35fc9
Function35fc9: ; 35fc9 .check_toxic: ; 35fc9
ld a, BATTLE_VARS_SUBSTATUS5_OPP ld a, BATTLE_VARS_SUBSTATUS5_OPP
call GetBattleVarAddr call GetBattleVarAddr
ld a, [hBattleTurn] ld a, [hBattleTurn]
@ -5762,7 +5763,7 @@ Function35fc9: ; 35fc9
; 35fe1 ; 35fe1
Function35fe1: ; 35fe1 CheckIfTargetIsPoisonType: ; 35fe1
ld de, EnemyMonType1 ld de, EnemyMonType1
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
@ -5779,7 +5780,7 @@ Function35fe1: ; 35fe1
; 35ff5 ; 35ff5
Function35ff5: ; 35ff5 PoisonOpponent: ; 35ff5
ld a, BATTLE_VARS_STATUS_OPP ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarAddr call GetBattleVarAddr
set PSN, [hl] set PSN, [hl]
@ -5789,7 +5790,7 @@ Function35ff5: ; 35ff5
BattleCommand_DrainTarget: ; 35fff BattleCommand_DrainTarget: ; 35fff
; draintarget ; draintarget
call Function36011 call SapHealth
ld hl, SuckedHealthText ld hl, SuckedHealthText
jp StdBattleTextBox jp StdBattleTextBox
; 36008 ; 36008
@ -5797,34 +5798,34 @@ BattleCommand_DrainTarget: ; 35fff
BattleCommand_EatDream: ; 36008 BattleCommand_EatDream: ; 36008
; eatdream ; eatdream
call Function36011 call SapHealth
ld hl, DreamEatenText ld hl, DreamEatenText
jp StdBattleTextBox jp StdBattleTextBox
; 36011 ; 36011
Function36011: ; 36011 SapHealth: ; 36011
ld hl, CurDamage ld hl, CurDamage
ld a, [hli] ld a, [hli]
srl a srl a
ld [$ffb3], a ld [hDividend], a
ld b, a ld b, a
ld a, [hl] ld a, [hl]
rr a rr a
ld [$ffb4], a ld [hDividend + 1], a
or b or b
jr nz, .asm_36026 ; 0x36020 $4 jr nz, .ok1 ; 0x36020 $4
ld a, $1 ld a, $1
ld [$ffb4], a ld [hDividend + 1], a
.asm_36026 .ok1
ld hl, BattleMonHP ld hl, BattleMonHP
ld de, BattleMonMaxHP ld de, BattleMonMaxHP
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_36037 ; 0x3602f $6 jr z, .battlemonhp ; 0x3602f $6
ld hl, EnemyMonHP ld hl, EnemyMonHP
ld de, EnemyMonMaxHP ld de, EnemyMonMaxHP
.asm_36037 .battlemonhp
ld bc, wd1ed ld bc, wd1ed
ld a, [hli] ld a, [hli]
ld [bc], a ld [bc], a
@ -5838,17 +5839,17 @@ Function36011: ; 36011
ld a, [de] ld a, [de]
dec bc dec bc
ld [bc], a ld [bc], a
ld a, [$ffb4] ld a, [hDividend + 1]
ld b, [hl] ld b, [hl]
add b add b
ld [hld], a ld [hld], a
ld [wd1ee], a ld [wd1ee], a
ld a, [$ffb3] ld a, [hDividend]
ld b, [hl] ld b, [hl]
adc b adc b
ld [hli], a ld [hli], a
ld [wd1ef], a ld [wd1ef], a
jr c, .asm_36064 ; 0x36056 $c jr c, .okay2 ; 0x36056 $c
ld a, [hld] ld a, [hld]
ld b, a ld b, a
ld a, [de] ld a, [de]
@ -5859,8 +5860,8 @@ Function36011: ; 36011
ld a, [de] ld a, [de]
inc de inc de
sbc b sbc b
jr nc, .asm_36070 ; 0x36062 $c jr nc, .okay3 ; 0x36062 $c
.asm_36064 .okay2
ld a, [de] ld a, [de]
ld [hld], a ld [hld], a
ld [wd1ee], a ld [wd1ee], a
@ -5869,15 +5870,15 @@ Function36011: ; 36011
ld [hli], a ld [hli], a
ld [wd1ef], a ld [wd1ef], a
inc de inc de
.asm_36070 .okay3
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
hlcoord 10, 9 hlcoord 10, 9
ld a, $1 ld a, $1
jr z, .asm_3607e ; 0x36078 $4 jr z, .hp_bar ; 0x36078 $4
hlcoord 2, 2 hlcoord 2, 2
xor a xor a
.asm_3607e .hp_bar
ld [wd10a], a ld [wd10a], a
predef Functionc6e0 predef Functionc6e0
call RefreshBattleHuds call RefreshBattleHuds
@ -5908,7 +5909,7 @@ BattleCommand_BurnTarget: ; 3608c
ld a, [EffectFailed] ld a, [EffectFailed]
and a and a
ret nz ret nz
call Function37962 call SafeCheckSafeguard
ret nz ret nz
ld a, BATTLE_VARS_STATUS_OPP ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarAddr call GetBattleVarAddr
@ -5923,7 +5924,7 @@ BattleCommand_BurnTarget: ; 3608c
ld hl, WasBurnedText ld hl, WasBurnedText
call StdBattleTextBox call StdBattleTextBox
callba Function3dde9 callba UseHeldStatusHealingItem
ret ret
; 360dd ; 360dd
@ -5981,7 +5982,7 @@ BattleCommand_FreezeTarget: ; 36102
ld a, [EffectFailed] ld a, [EffectFailed]
and a and a
ret nz ret nz
call Function37962 call SafeCheckSafeguard
ret nz ret nz
ld a, BATTLE_VARS_STATUS_OPP ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarAddr call GetBattleVarAddr
@ -5994,16 +5995,16 @@ BattleCommand_FreezeTarget: ; 36102
ld hl, WasFrozenText ld hl, WasFrozenText
call StdBattleTextBox call StdBattleTextBox
callba Function3dde9 callba UseHeldStatusHealingItem
ret nz ret nz
call Function34216 call OpponentCantMove
call EndRechargeOpp call EndRechargeOpp
ld hl, wc740 ld hl, wc740
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_36162 jr z, .finish
ld hl, wc73f ld hl, wc73f
.asm_36162 .finish
ld [hl], $1 ld [hl], $1
ret ret
; 36165 ; 36165
@ -6030,7 +6031,7 @@ BattleCommand_ParalyzeTarget: ; 36165
ld a, [EffectFailed] ld a, [EffectFailed]
and a and a
ret nz ret nz
call Function37962 call SafeCheckSafeguard
ret nz ret nz
ld a, BATTLE_VARS_STATUS_OPP ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarAddr call GetBattleVarAddr
@ -6042,7 +6043,7 @@ BattleCommand_ParalyzeTarget: ; 36165
call PlayOpponentBattleAnim call PlayOpponentBattleAnim
call RefreshBattleHuds call RefreshBattleHuds
call PrintParalyze call PrintParalyze
ld hl, Function3dde9 ld hl, UseHeldStatusHealingItem
jp CallBattleCore jp CallBattleCore
; 361ac ; 361ac
@ -6232,7 +6233,7 @@ Function36281: ; 36281
ld a, $1 ld a, $1
ld [bc], a ld [bc], a
call Function37ed5 call _CheckBattleScene
ret nc ret nc
xor a xor a
@ -6793,7 +6794,7 @@ BattleCommand_Curl: ; 365a7
; 365af ; 365af
BattleCommanda6: ; 365af BattleCommand_RaiseSubNoAnim: ; 365af
ld hl, GetMonBackpic ld hl, GetMonBackpic
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
@ -6807,7 +6808,7 @@ BattleCommanda6: ; 365af
; 365c3 ; 365c3
BattleCommanda7: ; 365c3 BattleCommand_LowerSubNoAnim: ; 365c3
ld hl, Function3f447 ld hl, Function3f447
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
@ -7062,7 +7063,7 @@ BattleCommand_CheckRampage: ; 3671a
res SUBSTATUS_RAMPAGE, [hl] res SUBSTATUS_RAMPAGE, [hl]
call BattleCommand_SwitchTurn call BattleCommand_SwitchTurn
call Function37962 call SafeCheckSafeguard
push af push af
call BattleCommand_SwitchTurn call BattleCommand_SwitchTurn
pop af pop af
@ -8061,7 +8062,7 @@ BattleCommand_ConfuseTarget: ; 36d1d
ld a, [EffectFailed] ld a, [EffectFailed]
and a and a
ret nz ret nz
call Function37962 call SafeCheckSafeguard
ret nz ret nz
call CheckSubstituteOpp call CheckSubstituteOpp
ret nz ret nz
@ -8228,7 +8229,7 @@ BattleCommand_Paralyze: ; 36dc7
call CallBattleCore call CallBattleCore
call UpdateBattleHuds call UpdateBattleHuds
call PrintParalyze call PrintParalyze
ld hl, Function3dde9 ld hl, UseHeldStatusHealingItem
jp CallBattleCore jp CallBattleCore
.asm_36e49 .asm_36e49
call AnimateFailedMove call AnimateFailedMove
@ -8338,7 +8339,7 @@ endr
xor a xor a
ld [hl], a ld [hl], a
ld [de], a ld [de], a
call Function37ed5 call _CheckBattleScene
jr c, .mobile jr c, .mobile
xor a xor a
@ -8350,7 +8351,7 @@ endr
jr .finish jr .finish
.mobile .mobile
call BattleCommanda6 call BattleCommand_RaiseSubNoAnim
.finish .finish
ld hl, MadeSubstituteText ld hl, MadeSubstituteText
call StdBattleTextBox call StdBattleTextBox
@ -8836,7 +8837,7 @@ BattleCommand_Heal: ; 3713e
.asm_371a9 .asm_371a9
call AnimateCurrentMove call AnimateCurrentMove
call BattleCommand_SwitchTurn call BattleCommand_SwitchTurn
ld hl, Function3ccef ld hl, RestoreHP
call CallBattleCore call CallBattleCore
call BattleCommand_SwitchTurn call BattleCommand_SwitchTurn
call UpdateUserInParty call UpdateUserInParty
@ -8870,12 +8871,12 @@ BattleCommand_Transform: ; 371cd
call GetBattleVarAddr call GetBattleVarAddr
bit SUBSTATUS_SUBSTITUTE, [hl] bit SUBSTATUS_SUBSTITUTE, [hl]
push af push af
jr z, .asm_37200 jr z, .skip_substitute
call Function34548 call Function34548
jr nz, .asm_37200 jr nz, .skip_substitute
ld a, SUBSTITUTE ld a, SUBSTITUTE
call PlayMoveAnim_KeepHiID call PlayMoveAnim_KeepHiID
.asm_37200 .skip_substitute
ld a, BATTLE_VARS_SUBSTATUS5 ld a, BATTLE_VARS_SUBSTATUS5
call GetBattleVarAddr call GetBattleVarAddr
set SUBSTATUS_TRANSFORMED, [hl] set SUBSTATUS_TRANSFORMED, [hl]
@ -8884,12 +8885,12 @@ BattleCommand_Transform: ; 371cd
ld de, EnemyMonSpecies ld de, EnemyMonSpecies
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr nz, .asm_3721f jr nz, .got_mon_species
ld hl, EnemyMonSpecies ld hl, EnemyMonSpecies
ld de, BattleMonSpecies ld de, BattleMonSpecies
xor a xor a
ld [CurMoveNum], a ld [CurMoveNum], a
.asm_3721f .got_mon_species
push hl push hl
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
@ -8901,21 +8902,23 @@ endr
call CopyBytes call CopyBytes
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_3723a jr z, .skip_enemy_backup
ld a, [de] ld a, [de]
ld [wc6f2], a ld [wEnemyBackupDVs], a
inc de inc de
ld a, [de] ld a, [de]
ld [wc6f2 + 1], a ld [wEnemyBackupDVs + 1], a
dec de dec de
.asm_3723a .skip_enemy_backup
; copy DVs
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
inc de inc de
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
inc de inc de
ld bc, $000c ; move pointer to stats
ld bc, BattleMonStats - BattleMonPP
add hl, bc add hl, bc
push hl push hl
ld h, d ld h, d
@ -8924,30 +8927,31 @@ endr
ld d, h ld d, h
ld e, l ld e, l
pop hl pop hl
ld bc, $000c ld bc, BattleMonStructEnd - BattleMonStats
call CopyBytes call CopyBytes
ld bc, $ffe2 ; init the power points
ld bc, BattleMonMoves - BattleMonStructEnd
add hl, bc add hl, bc
push de push de
ld d, h ld d, h
ld e, l ld e, l
pop hl pop hl
ld bc, $ffe8 ld bc, BattleMonPP - BattleMonStructEnd
add hl, bc add hl, bc
ld b, NUM_MOVES ld b, NUM_MOVES
.asm_3725f .pp_loop
ld a, [de] ld a, [de]
inc de inc de
and a and a
jr z, .asm_3726c jr z, .done_move
cp SKETCH cp SKETCH
ld a, 1 ld a, 1
jr z, .asm_3726c jr z, .done_move
ld a, 5 ld a, 5
.asm_3726c .done_move
ld [hli], a ld [hli], a
dec b dec b
jr nz, .asm_3725f jr nz, .pp_loop
pop hl pop hl
ld a, [hl] ld a, [hl]
ld [wNamedObjectIndexBuffer], a ld [wNamedObjectIndexBuffer], a
@ -8960,22 +8964,22 @@ endr
ld de, PlayerStatLevels ld de, PlayerStatLevels
ld bc, 8 ld bc, 8
call BattleSideCopy call BattleSideCopy
call Function37ed5 call _CheckBattleScene
jr c, .asm_372a8 jr c, .skip_anims
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
ld a, [wc6fe] ld a, [wc6fe]
jr z, .asm_372a0 jr z, .got_byte
ld a, [wc6fa] ld a, [wc6fa]
.asm_372a0 .got_byte
and a and a
jr nz, .asm_372a8 jr nz, .skip_anims
call PlayPlayerMoveAnim_ClearHiID call PlayPlayerMoveAnim_ClearHiID
jr .asm_372ae jr .after_anim
.asm_372a8 .skip_anims
call BattleCommand_MoveDelay call BattleCommand_MoveDelay
call BattleCommanda6 call BattleCommand_RaiseSubNoAnim
.asm_372ae .after_anim
xor a xor a
ld [wcfca], a ld [wcfca], a
ld [FXAnimIDHi], a ld [FXAnimIDHi], a
@ -9186,7 +9190,7 @@ BattleCommand_SelfDestruct: ; 37380
ld a, BATTLE_VARS_SUBSTATUS5_OPP ld a, BATTLE_VARS_SUBSTATUS5_OPP
call GetBattleVarAddr call GetBattleVarAddr
res SUBSTATUS_DESTINY_BOND, [hl] res SUBSTATUS_DESTINY_BOND, [hl]
call Function37ed5 call _CheckBattleScene
ret nc ret nc
callba DrawPlayerHUD callba DrawPlayerHUD
callba DrawEnemyHUD callba DrawEnemyHUD
@ -9393,86 +9397,7 @@ ResetFuryCutterCount: ; 377be
; 377ce ; 377ce
BattleCommand_Attract: ; 377ce INCLUDE "battle/effects/attract.asm"
; attract
ld a, [AttackMissed]
and a
jr nz, .failed
call Function377f5
jr c, .failed
call CheckHiddenOpponent
jr nz, .failed
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call GetBattleVarAddr
bit SUBSTATUS_IN_LOVE, [hl]
jr nz, .failed
set SUBSTATUS_IN_LOVE, [hl]
call AnimateCurrentMove
; 'fell in love!'
ld hl, FellInLoveText
jp StdBattleTextBox
.failed
jp Function37354
; 377f5
Function377f5: ; 377f5
ld a, MON_SPECIES
call BattlePartyAttr
ld a, [hl]
ld [CurPartySpecies], a
ld a, [CurBattleMon]
ld [CurPartyMon], a
xor a
ld [MonType], a
callba GetGender
jr c, .asm_37849
ld b, 1
jr nz, .asm_37815
dec b
.asm_37815
push bc
ld a, [TempEnemyMonSpecies]
ld [CurPartySpecies], a
ld hl, EnemyMonDVs
ld a, [EnemySubStatus5]
bit SUBSTATUS_TRANSFORMED, a
jr z, .asm_37829
ld hl, wc6f2
.asm_37829
ld a, [hli]
ld [TempMonDVs], a
ld a, [hl]
ld [TempMonDVs + 1], a
ld a, 3
ld [MonType], a
callba GetGender
pop bc
jr c, .asm_37849
ld a, 1
jr nz, .asm_37844
dec a
.asm_37844
xor b
jr z, .asm_37849
and a
ret
.asm_37849
scf
ret
; 3784b
BattleCommand_HappinessPower: ; 3784b BattleCommand_HappinessPower: ; 3784b
; happinesspower ; happinesspower
@ -9502,100 +9427,7 @@ BattleCommand_HappinessPower: ; 3784b
; 37874 ; 37874
BattleCommand_Present: ; 37874 INCLUDE "battle/effects/present.asm"
; present
ld a, [wLinkMode]
cp $3
jr z, .asm_3787d
push bc
push de
.asm_3787d
call BattleCommand_Stab
ld a, [wLinkMode]
cp $3
jr z, .asm_37889
pop de
pop bc
.asm_37889
ld a, [wTypeMatchup]
and a
jp z, AnimateFailedMove
ld a, [AttackMissed]
and a
jp nz, AnimateFailedMove
push bc
call BattleRandom
ld b, a
ld hl, .table_37907
ld c, 0
.asm_378a1
ld a, [hli]
cp $ff
jr z, .asm_378b7 ; 378a4 $11
cp b
jr nc, .asm_378ad ; 378a7 $4
inc c
inc hl
jr .asm_378a1 ; 378ab $f4
.asm_378ad
ld a, c
ld [wKickCounter], a
call AnimateCurrentMoveEitherSide
ld d, [hl]
pop bc
ret
.asm_378b7
pop bc
ld a, $3
ld [wKickCounter], a
call AnimateCurrentMove
call BattleCommand_SwitchTurn
ld hl, AICheckPlayerMaxHP
ld a, [hBattleTurn]
and a
jr z, .asm_378ce ; 378c9 $3
ld hl, AICheckEnemyMaxHP
.asm_378ce
ld a, BANK(AICheckPlayerMaxHP)
rst FarCall
jr c, .asm_378f3 ; 378d1 $20
ld hl, GetQuarterMaxHP
call CallBattleCore
call BattleCommand_SwitchTurn
ld hl, Function3ccef
call CallBattleCore
call BattleCommand_SwitchTurn
ld hl, RegainedHealthText
call StdBattleTextBox
call BattleCommand_SwitchTurn
call UpdateOpponentInParty
jr .asm_37904 ; 378f1 $11
.asm_378f3
call BattleCommand_SwitchTurn
call Function37ed5
jr nc, .asm_37904 ; 378f9 $9
call AnimateFailedMove
ld hl, RefusedGiftText
call StdBattleTextBox
.asm_37904
jp EndMoveEffect
.table_37907
db 40 percent, 40
db 70 percent + 1, 80
db 80 percent, 120
db $ff
; 3790e
BattleCommand_FrustrationPower: ; 3790e BattleCommand_FrustrationPower: ; 3790e
; frustrationpower ; frustrationpower
@ -9652,15 +9484,15 @@ BattleCommand_Safeguard: ; 37939
; 37962 ; 37962
Function37962: ; 37962 SafeCheckSafeguard: ; 37962
push hl push hl
ld hl, EnemyScreens ld hl, EnemyScreens
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_3796e jr z, .got_turn
ld hl, PlayerScreens ld hl, PlayerScreens
.asm_3796e .got_turn
bit SCREENS_SAFEGUARD, [hl] bit SCREENS_SAFEGUARD, [hl]
pop hl pop hl
ret ret
@ -9672,9 +9504,9 @@ BattleCommand_CheckSafeguard: ; 37972
ld hl, EnemyScreens ld hl, EnemyScreens
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_3797d ; 37978 $3 jr z, .got_turn ; 37978 $3
ld hl, PlayerScreens ld hl, PlayerScreens
.asm_3797d .got_turn
bit SCREENS_SAFEGUARD, [hl] bit SCREENS_SAFEGUARD, [hl]
ret z ret z
ld a, 1 ld a, 1
@ -10108,7 +9940,7 @@ endr
call AnimateCurrentMove call AnimateCurrentMove
call BattleCommand_SwitchTurn call BattleCommand_SwitchTurn
callab Function3ccef callab RestoreHP
call BattleCommand_SwitchTurn call BattleCommand_SwitchTurn
call UpdateUserInParty call UpdateUserInParty
@ -10717,8 +10549,8 @@ Function37ece: ; 37ece
; 37ed5 ; 37ed5
Function37ed5: ; 37ed5 _CheckBattleScene: ; 37ed5
; Related to mobile link battles. ; Checks the options. Returns carry if battle animations are disabled.
push hl push hl
push de push de
push bc push bc

79
battle/effects/attract.asm Executable file
View File

@ -0,0 +1,79 @@
BattleCommand_Attract: ; 377ce
; attract
ld a, [AttackMissed]
and a
jr nz, .failed
call CheckOppositeGender
jr c, .failed
call CheckHiddenOpponent
jr nz, .failed
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call GetBattleVarAddr
bit SUBSTATUS_IN_LOVE, [hl]
jr nz, .failed
set SUBSTATUS_IN_LOVE, [hl]
call AnimateCurrentMove
; 'fell in love!'
ld hl, FellInLoveText
jp StdBattleTextBox
.failed
jp Function37354
; 377f5
CheckOppositeGender: ; 377f5
ld a, MON_SPECIES
call BattlePartyAttr
ld a, [hl]
ld [CurPartySpecies], a
ld a, [CurBattleMon]
ld [CurPartyMon], a
xor a
ld [MonType], a
callba GetGender
jr c, .genderless_samegender
ld b, 1
jr nz, .got_gender
dec b
.got_gender
push bc
ld a, [TempEnemyMonSpecies]
ld [CurPartySpecies], a
ld hl, EnemyMonDVs
ld a, [EnemySubStatus5]
bit SUBSTATUS_TRANSFORMED, a
jr z, .not_transformed
ld hl, wEnemyBackupDVs
.not_transformed
ld a, [hli]
ld [TempMonDVs], a
ld a, [hl]
ld [TempMonDVs + 1], a
ld a, 3
ld [MonType], a
callba GetGender
pop bc
jr c, .genderless_samegender
ld a, 1
jr nz, .got_enemy_gender
dec a
.got_enemy_gender
xor b
jr z, .genderless_samegender
and a
ret
.genderless_samegender
scf
ret
; 3784b

93
battle/effects/present.asm Executable file
View File

@ -0,0 +1,93 @@
BattleCommand_Present: ; 37874
; present
ld a, [wLinkMode]
cp LINK_COLOSSEUM
jr z, .colosseum_skippush
push bc
push de
.colosseum_skippush
call BattleCommand_Stab
ld a, [wLinkMode]
cp LINK_COLOSSEUM
jr z, .colosseum_skippop
pop de
pop bc
.colosseum_skippop
ld a, [wTypeMatchup]
and a
jp z, AnimateFailedMove
ld a, [AttackMissed]
and a
jp nz, AnimateFailedMove
push bc
call BattleRandom
ld b, a
ld hl, .PresentPower
ld c, 0
.next
ld a, [hli]
cp $ff
jr z, .heal_effect ; 378a4 $11
cp b
jr nc, .got_power ; 378a7 $4
inc c
inc hl
jr .next ; 378ab $f4
.got_power
ld a, c
ld [wPresentPower], a
call AnimateCurrentMoveEitherSide
ld d, [hl]
pop bc
ret
.heal_effect
pop bc
ld a, $3
ld [wPresentPower], a
call AnimateCurrentMove
call BattleCommand_SwitchTurn
ld hl, AICheckPlayerMaxHP
ld a, [hBattleTurn]
and a
jr z, .got_hp_fn_pointer ; 378c9 $3
ld hl, AICheckEnemyMaxHP
.got_hp_fn_pointer
ld a, BANK(AICheckPlayerMaxHP)
rst FarCall
jr c, .already_fully_healed ; 378d1 $20
ld hl, GetQuarterMaxHP
call CallBattleCore
call BattleCommand_SwitchTurn
ld hl, RestoreHP
call CallBattleCore
call BattleCommand_SwitchTurn
ld hl, RegainedHealthText
call StdBattleTextBox
call BattleCommand_SwitchTurn
call UpdateOpponentInParty
jr .do_animation ; 378f1 $11
.already_fully_healed
call BattleCommand_SwitchTurn
call _CheckBattleScene
jr nc, .do_animation ; 378f9 $9
call AnimateFailedMove
ld hl, RefusedGiftText
call StdBattleTextBox
.do_animation
jp EndMoveEffect
.PresentPower
db 40 percent, 40
db 70 percent + 1, 80
db 80 percent, 120
db $ff
; 3790e

View File

@ -13,11 +13,11 @@ Functionfbd54: ; fbd54
jr Functionfbd91 jr Functionfbd91
Functionfbd69: ; fbd69 (3e:7d69) Functionfbd69: ; fbd69 (3e:7d69)
callba BattleCommanda6 callba BattleCommand_RaiseSubNoAnim
jr Functionfbd77 jr Functionfbd77
Functionfbd71: ; fbd71 (3e:7d71) Functionfbd71: ; fbd71 (3e:7d71)
callba BattleCommanda7 callba BattleCommand_LowerSubNoAnim
Functionfbd77: ; fbd77 (3e:7d77) Functionfbd77: ; fbd77 (3e:7d77)
xor a xor a

View File

@ -331,7 +331,7 @@ EvasionUp:
lowersub lowersub
evasionup evasionup
statupanim statupanim
effect0xa7 lowersubnoanim
raisesub raisesub
statupmessage statupmessage
statupfailtext statupfailtext

View File

@ -170,8 +170,8 @@ endm
command effect0xa3 command effect0xa3
command allstatsup command allstatsup
command effect0xa5 command effect0xa5
command effect0xa6 command raisesubnoanim
command effect0xa7 command lowersubnoanim
command effect0xa8 command effect0xa8
command clearmissdamage command clearmissdamage
command movedelay command movedelay

View File

@ -31025,7 +31025,7 @@ AI_Redundant: ; 2c41a
jr .NotRedundant jr .NotRedundant
.Attract: ; 2c4fe .Attract: ; 2c4fe
callba Function377f5 callba CheckOppositeGender
jr c, .Redundant jr c, .Redundant
ld a, [PlayerSubStatus1] ld a, [PlayerSubStatus1]
bit SUBSTATUS_IN_LOVE, a bit SUBSTATUS_IN_LOVE, a

View File

@ -66,6 +66,7 @@ battle_struct: MACRO
\1Type:: \1Type::
\1Type1:: db \1Type1:: db
\1Type2:: db \1Type2:: db
\1StructEnd::
ENDM ENDM
box: MACRO box: MACRO
@ -600,7 +601,8 @@ EnemyDamageTaken:: ; c684
wc686:: ds 2 wc686:: ds 2
wc688:: ds 1 wc688:: ds 1
wKickCounter:: ds 1 wKickCounter::
wPresentPower:: ds 1
wc68a:: wc68a::
BattleScriptBuffer:: ; c68a BattleScriptBuffer:: ; c68a
ds 40 ds 40
@ -703,6 +705,7 @@ wPayDayMoney:: ds 3 ; c6ec
ds 1 ds 1
wc6f0:: ds 2 wc6f0:: ds 2
wEnemyBackupDVs:: ; used when enemy is transformed
wc6f2:: ds 2 wc6f2:: ds 2
AlreadyDisobeyed:: ; c6f4 AlreadyDisobeyed:: ; c6f4
ds 1 ds 1