2013-03-26 17:39:44 -07:00
|
|
|
DoPlayerTurn: ; 34000
|
|
|
|
call SetPlayerTurn
|
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd0ec]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
jr DoTurn
|
|
|
|
; 3400a
|
|
|
|
|
|
|
|
|
|
|
|
DoEnemyTurn: ; 3400a
|
|
|
|
call SetEnemyTurn
|
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
jr z, DoTurn
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
ld a, [wBattleAction]
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $e
|
|
|
|
jr z, DoTurn
|
2014-06-13 21:18:14 -07:00
|
|
|
cp NUM_MOVES
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nc
|
|
|
|
|
|
|
|
; fallthrough
|
|
|
|
; 3401d
|
|
|
|
|
|
|
|
|
|
|
|
DoTurn: ; 3401d
|
|
|
|
; Read in and execute the user's move effects for this turn.
|
|
|
|
|
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc6b4], a
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; Effect command checkturn is called for every move.
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckTurn
|
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc6b4]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
call UpdateMoveData
|
|
|
|
; 3402c
|
|
|
|
|
|
|
|
|
|
|
|
DoMove: ; 3402c
|
|
|
|
; Get the user's move effect.
|
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
|
|
|
ld hl, MoveEffectsPointers
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BANK(MoveEffectsPointers)
|
|
|
|
call GetFarHalfword
|
|
|
|
|
|
|
|
ld de, BattleScriptBuffer
|
|
|
|
|
|
|
|
.GetMoveEffect
|
|
|
|
ld a, BANK(MoveEffects)
|
|
|
|
call GetFarByte
|
|
|
|
inc hl
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
cp $ff
|
|
|
|
jr nz, .GetMoveEffect
|
|
|
|
|
|
|
|
; Start at the first command.
|
|
|
|
ld hl, BattleScriptBuffer
|
|
|
|
ld a, l
|
|
|
|
ld [BattleScriptBufferLoc], a
|
|
|
|
ld a, h
|
|
|
|
ld [BattleScriptBufferLoc + 1], a
|
|
|
|
|
|
|
|
.ReadMoveEffectCommand
|
|
|
|
|
|
|
|
; ld a, [BattleScriptBufferLoc++]
|
|
|
|
ld a, [BattleScriptBufferLoc]
|
|
|
|
ld l, a
|
|
|
|
ld a, [BattleScriptBufferLoc + 1]
|
|
|
|
ld h, a
|
|
|
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
|
|
|
push af
|
|
|
|
ld a, l
|
|
|
|
ld [BattleScriptBufferLoc], a
|
|
|
|
ld a, h
|
|
|
|
ld [BattleScriptBufferLoc + 1], a
|
|
|
|
pop af
|
|
|
|
|
2015-04-13 21:39:54 -07:00
|
|
|
; endturn_command (-2) is used to terminate branches without ending the read cycle.
|
|
|
|
cp endturn_command
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nc
|
|
|
|
|
|
|
|
; The rest of the commands (01-af) are read from BattleCommandPointers.
|
|
|
|
push bc
|
|
|
|
dec a
|
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
|
|
|
ld hl, BattleCommandPointers
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
pop bc
|
|
|
|
|
|
|
|
ld a, BANK(BattleCommandPointers)
|
|
|
|
call GetFarHalfword
|
|
|
|
|
|
|
|
call .DoMoveEffectCommand
|
|
|
|
|
|
|
|
jr .ReadMoveEffectCommand
|
|
|
|
|
|
|
|
.DoMoveEffectCommand
|
|
|
|
jp [hl]
|
|
|
|
; 34084
|
|
|
|
|
|
|
|
|
|
|
|
CheckTurn:
|
|
|
|
BattleCommand01: ; 34084
|
|
|
|
; checkturn
|
|
|
|
|
|
|
|
; Repurposed as hardcoded turn handling. Useless as a command.
|
|
|
|
|
|
|
|
; Move $ff immediately ends the turn.
|
|
|
|
ld a, BATTLE_VARS_MOVE
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
inc a
|
2013-12-31 01:10:49 -08:00
|
|
|
jp z, Function34385
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
xor a
|
|
|
|
ld [AttackMissed], a
|
2013-06-13 13:10:39 -07:00
|
|
|
ld [EffectFailed], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [AlreadyDisobeyed], a
|
2013-03-27 15:50:10 -07:00
|
|
|
ld [AlreadyFailed], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc73e], a
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, 10 ; 1.0
|
|
|
|
ld [TypeModifier], a
|
|
|
|
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jp nz, CheckEnemyTurn
|
|
|
|
|
|
|
|
|
|
|
|
CheckPlayerTurn:
|
|
|
|
|
|
|
|
ld hl, PlayerSubStatus4
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SUBSTATUS_RECHARGE, [hl]
|
|
|
|
jr z, .no_recharge
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
res SUBSTATUS_RECHARGE, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, MustRechargeText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
call CantMove
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function34385
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.no_recharge
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, BattleMonStatus
|
|
|
|
ld a, [hl]
|
2014-06-13 21:18:14 -07:00
|
|
|
and SLP
|
|
|
|
jr z, .not_asleep
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
|
|
|
ld [BattleMonStatus], a
|
2014-06-13 21:18:14 -07:00
|
|
|
and SLP
|
|
|
|
jr z, .woke_up
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-12-19 01:47:39 -08:00
|
|
|
ld de, ANIM_SLP
|
2013-03-26 17:39:44 -07:00
|
|
|
call FarPlayBattleAnimation
|
2014-06-13 21:18:14 -07:00
|
|
|
jr .fast_asleep
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.woke_up
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, WokeUpText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
call CantMove
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateBattleMonInParty
|
2014-06-16 22:52:59 -07:00
|
|
|
ld hl, UpdatePlayerHUD
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $1
|
|
|
|
ld [$ffd4], a
|
|
|
|
ld hl, PlayerSubStatus1
|
2014-06-13 21:18:14 -07:00
|
|
|
res SUBSTATUS_NIGHTMARE, [hl]
|
|
|
|
jr .not_asleep
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.fast_asleep
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, FastAsleepText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; Snore and Sleep Talk bypass sleep.
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [CurPlayerMove]
|
|
|
|
cp SNORE
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .not_asleep
|
2013-03-26 17:39:44 -07:00
|
|
|
cp SLEEP_TALK
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .not_asleep
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
call CantMove
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function34385
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.not_asleep
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, BattleMonStatus
|
2014-06-13 21:18:14 -07:00
|
|
|
bit FRZ, [hl]
|
|
|
|
jr z, .not_frozen
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; Flame Wheel and Sacred Fire thaw the user.
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [CurPlayerMove]
|
|
|
|
cp FLAME_WHEEL
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .not_frozen
|
2013-03-26 17:39:44 -07:00
|
|
|
cp SACRED_FIRE
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .not_frozen
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, FrozenSolidText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
call CantMove
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function34385
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.not_frozen
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
ld hl, PlayerSubStatus3
|
|
|
|
bit SUBSTATUS_FLINCHED, [hl]
|
|
|
|
jr z, .not_flinched
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
res SUBSTATUS_FLINCHED, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, FlinchedText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
call CantMove
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function34385
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.not_flinched
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, PlayerDisableCount
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .not_disabled
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
|
|
|
ld [hl], a
|
|
|
|
and $f
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .not_disabled
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], a
|
|
|
|
ld [DisabledMove], a
|
|
|
|
ld hl, DisabledNoMoreText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.not_disabled
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, [PlayerSubStatus3]
|
|
|
|
add a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nc, .not_confused
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, PlayerConfuseCount
|
|
|
|
dec [hl]
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .confused
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, PlayerSubStatus3
|
2014-06-13 21:18:14 -07:00
|
|
|
res SUBSTATUS_CONFUSED, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, ConfusedNoMoreText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2014-06-13 21:18:14 -07:00
|
|
|
jr .not_confused
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.confused
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, IsConfusedText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld de, ANIM_CONFUSED
|
|
|
|
call FarPlayBattleAnimation
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; 50% chance of hitting itself
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $80
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nc, .not_confused
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2015-09-09 14:05:19 -07:00
|
|
|
; clear confusion-dependent substatus
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, PlayerSubStatus3
|
|
|
|
ld a, [hl]
|
2014-06-13 21:18:14 -07:00
|
|
|
and 1 << SUBSTATUS_CONFUSED
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], a
|
|
|
|
|
|
|
|
call HitConfusion
|
|
|
|
call CantMove
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function34385
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.not_confused
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, [PlayerSubStatus1]
|
2014-06-13 21:18:14 -07:00
|
|
|
add a ; bit SUBSTATUS_ATTRACT
|
|
|
|
jr nc, .not_infatuated
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, InLoveWithText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-12-19 01:47:39 -08:00
|
|
|
ld de, ANIM_IN_LOVE
|
2013-03-26 17:39:44 -07:00
|
|
|
call FarPlayBattleAnimation
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; 50% chance of infatuation
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $80
|
2014-06-13 21:18:14 -07:00
|
|
|
jr c, .not_infatuated
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, InfatuationText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
call CantMove
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function34385
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.not_infatuated
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
|
|
|
|
; We can't disable a move that doesn't exist.
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [DisabledMove]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .no_disabled_move
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; Are we using the disabled move?
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CurPlayerMove
|
|
|
|
cp [hl]
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .no_disabled_move
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
call MoveDisabled
|
|
|
|
call CantMove
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function34385
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.no_disabled_move
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, BattleMonStatus
|
2014-06-13 21:18:14 -07:00
|
|
|
bit PAR, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; 25% chance to be fully paralyzed
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $3f
|
|
|
|
ret nc
|
|
|
|
|
|
|
|
ld hl, FullyParalyzedText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
call CantMove
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function34385
|
2013-03-26 17:39:44 -07:00
|
|
|
; 341f0
|
|
|
|
|
|
|
|
|
|
|
|
CantMove: ; 341f0
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS1
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-17 12:52:32 -07:00
|
|
|
res SUBSTATUS_ROLLOUT, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2014-06-17 12:52:32 -07:00
|
|
|
and $ff ^ (1<<SUBSTATUS_BIDE + 1<<SUBSTATUS_RAMPAGE + 1<<SUBSTATUS_CHARGED)
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], a
|
|
|
|
|
2013-04-19 00:50:45 -07:00
|
|
|
call ResetFuryCutterCount
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
cp FLY
|
|
|
|
jr z, .asm_3420f
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
cp DIG
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
|
|
|
|
.asm_3420f
|
2014-06-13 21:18:14 -07:00
|
|
|
res SUBSTATUS_UNDERGROUND, [hl]
|
|
|
|
res SUBSTATUS_FLYING, [hl]
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function37ece
|
2013-03-26 17:39:44 -07:00
|
|
|
; 34216
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function34216: ; 34216
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-03-26 17:39:44 -07:00
|
|
|
call CantMove
|
2015-10-10 04:45:39 -07:00
|
|
|
jp BattleCommand_SwitchTurn
|
2013-03-26 17:39:44 -07:00
|
|
|
; 3421f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CheckEnemyTurn: ; 3421f
|
|
|
|
|
|
|
|
ld hl, EnemySubStatus4
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SUBSTATUS_RECHARGE, [hl]
|
|
|
|
jr z, .no_recharge
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
res SUBSTATUS_RECHARGE, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, MustRechargeText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
call CantMove
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function34385
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.no_recharge
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, EnemyMonStatus
|
|
|
|
ld a, [hl]
|
2014-06-13 21:18:14 -07:00
|
|
|
and SLP
|
|
|
|
jr z, .not_asleep
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
|
|
|
ld [EnemyMonStatus], a
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .woke_up
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, FastAsleepText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-12-19 01:47:39 -08:00
|
|
|
ld de, ANIM_SLP
|
2013-03-26 17:39:44 -07:00
|
|
|
call FarPlayBattleAnimation
|
2014-06-13 21:18:14 -07:00
|
|
|
jr .fast_asleep
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.woke_up
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, WokeUpText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
call CantMove
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateEnemyMonInParty
|
2014-06-16 22:52:59 -07:00
|
|
|
ld hl, UpdateEnemyHUD
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $1
|
|
|
|
ld [$ffd4], a
|
|
|
|
ld hl, EnemySubStatus1
|
2014-06-13 21:18:14 -07:00
|
|
|
res SUBSTATUS_NIGHTMARE, [hl]
|
|
|
|
jr .not_asleep
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.fast_asleep
|
|
|
|
; Snore and Sleep Talk bypass sleep.
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [CurEnemyMove]
|
|
|
|
cp SNORE
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .not_asleep
|
2013-03-26 17:39:44 -07:00
|
|
|
cp SLEEP_TALK
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .not_asleep
|
2013-03-26 17:39:44 -07:00
|
|
|
call CantMove
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function34385
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.not_asleep
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, EnemyMonStatus
|
2014-06-13 21:18:14 -07:00
|
|
|
bit FRZ, [hl]
|
|
|
|
jr z, .not_frozen
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [CurEnemyMove]
|
2014-06-13 21:18:14 -07:00
|
|
|
cp FLAME_WHEEL
|
|
|
|
jr z, .not_frozen
|
|
|
|
cp SACRED_FIRE
|
|
|
|
jr z, .not_frozen
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, FrozenSolidText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
call CantMove
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function34385
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.not_frozen
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
ld hl, EnemySubStatus3
|
|
|
|
bit SUBSTATUS_FLINCHED, [hl]
|
|
|
|
jr z, .not_flinched
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
res SUBSTATUS_FLINCHED, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, FlinchedText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
call CantMove
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function34385
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.not_flinched
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-05-02 22:29:57 -07:00
|
|
|
ld hl, EnemyDisableCount
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .not_disabled
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
dec a
|
|
|
|
ld [hl], a
|
|
|
|
and $f
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .not_disabled
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld [hl], a
|
2013-05-03 18:04:34 -07:00
|
|
|
ld [EnemyDisabledMove], a
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, DisabledNoMoreText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.not_disabled
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, [EnemySubStatus3]
|
2014-06-13 21:18:14 -07:00
|
|
|
add a ; bit SUBSTATUS_CONFUSED
|
|
|
|
jr nc, .not_confused
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, EnemyConfuseCount
|
2013-03-26 17:39:44 -07:00
|
|
|
dec [hl]
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .confused
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, EnemySubStatus3
|
2014-06-13 21:18:14 -07:00
|
|
|
res SUBSTATUS_CONFUSED, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, ConfusedNoMoreText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2014-06-13 21:18:14 -07:00
|
|
|
jr .not_confused
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.confused
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, IsConfusedText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld de, ANIM_CONFUSED
|
|
|
|
call FarPlayBattleAnimation
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; 50% chance of hitting itself
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $80
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nc, .not_confused
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; clear confusion-dependent substatus
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EnemySubStatus3
|
|
|
|
ld a, [hl]
|
2014-06-13 21:18:14 -07:00
|
|
|
and 1 << SUBSTATUS_CONFUSED
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], a
|
|
|
|
|
|
|
|
ld hl, HurtItselfText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function355dd
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_DamageCalcWithStats
|
2013-03-26 17:39:44 -07:00
|
|
|
call BattleCommand0a
|
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; Flicker the monster pic unless flying or underground.
|
|
|
|
ld de, ANIM_HIT_CONFUSION
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-13 21:18:14 -07:00
|
|
|
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
|
2013-03-26 17:39:44 -07:00
|
|
|
call z, PlayFXAnimID
|
|
|
|
|
|
|
|
ld c, $1
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function35d1c
|
2013-03-27 13:19:51 -07:00
|
|
|
call BattleCommand0c
|
2013-03-26 17:39:44 -07:00
|
|
|
call CantMove
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function34385
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.not_confused
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, [EnemySubStatus1]
|
2014-06-13 21:18:14 -07:00
|
|
|
add a ; bit SUBSTATUS_ATTRACT
|
|
|
|
jr nc, .not_infatuated
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, InLoveWithText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-12-19 01:47:39 -08:00
|
|
|
ld de, ANIM_IN_LOVE
|
2013-03-26 17:39:44 -07:00
|
|
|
call FarPlayBattleAnimation
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; 50% chance of infatuation
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $80
|
2014-06-13 21:18:14 -07:00
|
|
|
jr c, .not_infatuated
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, InfatuationText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
call CantMove
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function34385
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.not_infatuated
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; We can't disable a move that doesn't exist.
|
2013-05-03 18:04:34 -07:00
|
|
|
ld a, [EnemyDisabledMove]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .no_disabled_move
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; Are we using the disabled move?
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CurEnemyMove
|
|
|
|
cp [hl]
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .no_disabled_move
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
call MoveDisabled
|
|
|
|
|
|
|
|
call CantMove
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function34385
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.no_disabled_move
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, EnemyMonStatus
|
2014-06-13 21:18:14 -07:00
|
|
|
bit PAR, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; 25% chance to be fully paralyzed
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $3f
|
|
|
|
ret nc
|
|
|
|
|
|
|
|
ld hl, FullyParalyzedText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
call CantMove
|
|
|
|
|
|
|
|
; fallthrough
|
|
|
|
; 34385
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function34385: ; 34385
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $1
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc6b4], a
|
2013-03-26 17:39:44 -07:00
|
|
|
jp ResetDamage
|
|
|
|
; 3438d
|
|
|
|
|
|
|
|
|
|
|
|
MoveDisabled: ; 3438d
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; Make sure any charged moves fail
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-13 21:18:14 -07:00
|
|
|
res SUBSTATUS_CHARGED, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-05-02 23:43:44 -07:00
|
|
|
call GetMoveName
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, DisabledMoveText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 343a5
|
|
|
|
|
|
|
|
|
|
|
|
HitConfusion: ; 343a5
|
|
|
|
|
|
|
|
ld hl, HurtItselfText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
xor a
|
|
|
|
ld [CriticalHit], a
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function355dd
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_DamageCalcWithStats
|
2013-03-26 17:39:44 -07:00
|
|
|
call BattleCommand0a
|
|
|
|
|
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; Flicker the monster pic unless flying or underground.
|
|
|
|
ld de, ANIM_HIT_CONFUSION
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-13 21:18:14 -07:00
|
|
|
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
|
2013-03-26 17:39:44 -07:00
|
|
|
call z, PlayFXAnimID
|
|
|
|
|
2014-06-16 22:52:59 -07:00
|
|
|
ld hl, UpdatePlayerHUD
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $1
|
|
|
|
ld [$ffd4], a
|
|
|
|
ld c, $1
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function35d7e
|
2013-03-27 13:19:51 -07:00
|
|
|
jp BattleCommand0c
|
2013-03-26 17:39:44 -07:00
|
|
|
; 343db
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand02: ; 343db
|
|
|
|
; checkobedience
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; Enemy can't disobey
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34548
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; If we've already checked this turn
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AlreadyDisobeyed]
|
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
xor a
|
|
|
|
ld [AlreadyDisobeyed], a
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; No obedience in link battles
|
|
|
|
; (since no handling exists for enemy)
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
|
2015-09-04 13:30:40 -07:00
|
|
|
ld a, [InBattleTowerBattle]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; If the monster's id doesn't match the player's,
|
|
|
|
; some conditions need to be met.
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, PartyMon1ID - PartyMon1
|
|
|
|
call BattlePartyAttr
|
|
|
|
|
|
|
|
ld a, [PlayerID]
|
|
|
|
cp [hl]
|
|
|
|
jr nz, .obeylevel
|
|
|
|
inc hl
|
|
|
|
ld a, [PlayerID + 1]
|
|
|
|
cp [hl]
|
|
|
|
ret z
|
|
|
|
|
|
|
|
|
|
|
|
.obeylevel
|
2014-06-13 21:18:14 -07:00
|
|
|
; The maximum obedience level is constrained by owned badges:
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, JohtoBadges
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; risingbadge
|
2013-03-26 17:39:44 -07:00
|
|
|
bit 7, [hl]
|
2014-06-13 21:18:14 -07:00
|
|
|
ld a, MAX_LEVEL + 1
|
2013-03-26 17:39:44 -07:00
|
|
|
jr nz, .getlevel
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; stormbadge
|
2013-03-26 17:39:44 -07:00
|
|
|
bit 5, [hl]
|
|
|
|
ld a, 70
|
|
|
|
jr nz, .getlevel
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; fogbadge
|
2013-03-26 17:39:44 -07:00
|
|
|
bit 3, [hl]
|
|
|
|
ld a, 50
|
|
|
|
jr nz, .getlevel
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; hivebadge
|
2013-03-26 17:39:44 -07:00
|
|
|
bit 1, [hl]
|
|
|
|
ld a, 30
|
|
|
|
jr nz, .getlevel
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; no badges
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, 10
|
|
|
|
|
|
|
|
|
|
|
|
.getlevel
|
|
|
|
; c = obedience level
|
|
|
|
; d = monster level
|
|
|
|
; b = c + d
|
|
|
|
|
|
|
|
ld b, a
|
|
|
|
ld c, a
|
|
|
|
|
|
|
|
ld a, [BattleMonLevel]
|
|
|
|
ld d, a
|
|
|
|
|
|
|
|
add b
|
|
|
|
ld b, a
|
|
|
|
|
|
|
|
; No overflow (this should never happen)
|
|
|
|
jr nc, .checklevel
|
|
|
|
ld b, $ff
|
|
|
|
|
|
|
|
|
|
|
|
.checklevel
|
|
|
|
; If the monster's level is lower than the obedience level, it will obey.
|
|
|
|
ld a, c
|
|
|
|
cp d
|
|
|
|
ret nc
|
|
|
|
|
|
|
|
|
|
|
|
; Random number from 0 to obedience level + monster level
|
|
|
|
.rand1
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
swap a
|
|
|
|
cp b
|
|
|
|
jr nc, .rand1
|
|
|
|
|
|
|
|
; The higher above the obedience level the monster is,
|
|
|
|
; the more likely it is to disobey.
|
|
|
|
cp c
|
|
|
|
ret c
|
|
|
|
|
|
|
|
; Sleep-only moves have separate handling, and a higher chance of
|
|
|
|
; being ignored. Lazy monsters like their sleep.
|
|
|
|
call IgnoreSleepOnly
|
|
|
|
ret c
|
|
|
|
|
|
|
|
|
|
|
|
; Another random number from 0 to obedience level + monster level
|
|
|
|
.rand2
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp b
|
|
|
|
jr nc, .rand2
|
|
|
|
|
|
|
|
; A second chance.
|
|
|
|
cp c
|
|
|
|
jr c, .UseInstead
|
|
|
|
|
|
|
|
|
|
|
|
; No hope of using a move now.
|
|
|
|
|
|
|
|
; b = number of levels the monster is above the obedience level
|
|
|
|
ld a, d
|
|
|
|
sub c
|
|
|
|
ld b, a
|
|
|
|
|
|
|
|
; The chance of napping is the difference out of 256.
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
swap a
|
|
|
|
sub b
|
|
|
|
jr c, .Nap
|
|
|
|
|
|
|
|
; The chance of not hitting itself is the same.
|
|
|
|
cp b
|
|
|
|
jr nc, .DoNothing
|
|
|
|
|
|
|
|
ld hl, WontObeyText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
call HitConfusion
|
2014-06-17 12:52:32 -07:00
|
|
|
jp .asm_3450c
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
.Nap
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
add a
|
|
|
|
swap a
|
2014-06-13 21:18:14 -07:00
|
|
|
and SLP
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .Nap
|
|
|
|
|
|
|
|
ld [BattleMonStatus], a
|
|
|
|
|
|
|
|
ld hl, BeganToNapText
|
|
|
|
jr .Print
|
|
|
|
|
|
|
|
|
|
|
|
.DoNothing
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
and 3
|
|
|
|
|
|
|
|
ld hl, LoafingAroundText
|
|
|
|
and a
|
|
|
|
jr z, .Print
|
|
|
|
|
|
|
|
ld hl, WontObeyText
|
|
|
|
dec a
|
|
|
|
jr z, .Print
|
|
|
|
|
|
|
|
ld hl, TurnedAwayText
|
|
|
|
dec a
|
|
|
|
jr z, .Print
|
|
|
|
|
|
|
|
ld hl, IgnoredOrdersText
|
|
|
|
|
|
|
|
.Print
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2014-06-17 12:52:32 -07:00
|
|
|
jp .asm_3450c
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
.UseInstead
|
|
|
|
|
|
|
|
; Can't use another move if the monster only has one!
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, [BattleMonMoves + 1]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
jr z, .DoNothing
|
|
|
|
|
|
|
|
; Don't bother trying to handle Disable.
|
|
|
|
ld a, [DisabledMove]
|
|
|
|
and a
|
|
|
|
jr nz, .DoNothing
|
|
|
|
|
|
|
|
|
|
|
|
ld hl, BattleMonPP
|
|
|
|
ld de, BattleMonMoves
|
|
|
|
ld b, 0
|
|
|
|
ld c, NUM_MOVES
|
|
|
|
|
|
|
|
.GetTotalPP
|
|
|
|
ld a, [hli]
|
|
|
|
and $3f ; exclude pp up
|
|
|
|
add b
|
|
|
|
ld b, a
|
|
|
|
|
|
|
|
dec c
|
|
|
|
jr z, .CheckMovePP
|
|
|
|
|
|
|
|
; Stop at undefined moves.
|
|
|
|
inc de
|
|
|
|
ld a, [de]
|
|
|
|
and a
|
|
|
|
jr nz, .GetTotalPP
|
|
|
|
|
|
|
|
|
|
|
|
.CheckMovePP
|
|
|
|
ld hl, BattleMonPP
|
|
|
|
ld a, [CurMoveNum]
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
|
|
|
|
|
|
|
; Can't use another move if only one move has PP.
|
|
|
|
ld a, [hl]
|
|
|
|
and $3f
|
|
|
|
cp b
|
|
|
|
jr z, .DoNothing
|
|
|
|
|
|
|
|
|
|
|
|
; Make sure we can actually use the move once we get there.
|
|
|
|
ld a, 1
|
|
|
|
ld [AlreadyDisobeyed], a
|
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wcfa3]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
|
|
|
|
; Save the move we originally picked for afterward.
|
|
|
|
ld a, [CurMoveNum]
|
|
|
|
ld c, a
|
|
|
|
push af
|
|
|
|
|
|
|
|
|
|
|
|
.RandomMove
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2014-06-13 21:18:14 -07:00
|
|
|
and 3 ; TODO NUM_MOVES
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
cp b
|
|
|
|
jr nc, .RandomMove
|
|
|
|
|
|
|
|
; Not the move we were trying to use.
|
|
|
|
cp c
|
|
|
|
jr z, .RandomMove
|
|
|
|
|
|
|
|
; Make sure it has PP.
|
|
|
|
ld [CurMoveNum], a
|
|
|
|
ld hl, BattleMonPP
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
and $3f
|
|
|
|
jr z, .RandomMove
|
|
|
|
|
|
|
|
|
|
|
|
; Use it.
|
|
|
|
ld a, [CurMoveNum]
|
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
|
|
|
ld hl, BattleMonMoves
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
ld [CurPlayerMove], a
|
|
|
|
|
|
|
|
call SetPlayerTurn
|
|
|
|
call UpdateMoveData
|
|
|
|
call DoMove
|
|
|
|
|
|
|
|
|
|
|
|
; Restore original move choice.
|
|
|
|
pop af
|
|
|
|
ld [CurMoveNum], a
|
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
|
2014-06-17 12:52:32 -07:00
|
|
|
.asm_3450c
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [LastPlayerMove], a
|
|
|
|
ld [LastEnemyCounterMove], a
|
|
|
|
|
2014-06-17 12:52:32 -07:00
|
|
|
; Break Encore too.
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, PlayerSubStatus5
|
2014-06-17 12:52:32 -07:00
|
|
|
res SUBSTATUS_ENCORED, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [PlayerEncoreCount], a
|
|
|
|
|
|
|
|
jp EndMoveEffect
|
|
|
|
; 3451f
|
|
|
|
|
|
|
|
|
|
|
|
IgnoreSleepOnly: ; 3451f
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
cp SNORE
|
|
|
|
jr z, .CheckSleep
|
|
|
|
cp SLEEP_TALK
|
|
|
|
jr z, .CheckSleep
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.CheckSleep
|
|
|
|
ld a, BATTLE_VARS_STATUS
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-17 12:52:32 -07:00
|
|
|
and SLP
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
|
|
|
|
|
|
|
; 'ignored orders…sleeping!'
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, IgnoredSleepingText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
call EndMoveEffect
|
|
|
|
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 34541
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand03: ; 34541
|
|
|
|
; usedmovetext
|
|
|
|
callba DisplayUsedMoveText
|
|
|
|
ret
|
|
|
|
; 34548
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function34548: ; 34548
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc732] ; player
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .end
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc733] ; enemy
|
2013-03-26 17:39:44 -07:00
|
|
|
.end
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; 34555
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand04: ; 34555
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34548
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
|
|
|
|
ld hl, BattleMonPP
|
|
|
|
ld de, PlayerSubStatus3
|
|
|
|
ld bc, PlayerTurnsTaken
|
|
|
|
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2015-10-07 18:27:32 -07:00
|
|
|
jr z, .proceed
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, EnemyMonPP
|
|
|
|
ld de, EnemySubStatus3
|
|
|
|
ld bc, EnemyTurnsTaken
|
|
|
|
|
2015-10-07 18:27:32 -07:00
|
|
|
.proceed
|
2014-08-13 19:44:56 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
; If we've gotten this far, this counts as a turn.
|
|
|
|
ld a, [bc]
|
|
|
|
inc a
|
|
|
|
ld [bc], a
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
cp STRUGGLE
|
|
|
|
ret z
|
|
|
|
|
|
|
|
ld a, [de]
|
2014-08-13 19:44:56 -07:00
|
|
|
and 1 << SUBSTATUS_IN_LOOP | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_BIDE
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
|
|
|
|
call .asm_345ad
|
|
|
|
ld a, b
|
|
|
|
and a
|
|
|
|
jp nz, EndMoveEffect
|
|
|
|
|
2014-08-13 19:44:56 -07:00
|
|
|
; SubStatus5
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
inc de
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, [de]
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SUBSTATUS_TRANSFORMED, a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
|
|
|
|
ld hl, PartyMon1PP
|
|
|
|
ld a, [CurBattleMon]
|
|
|
|
jr z, .asm_345a4
|
|
|
|
|
|
|
|
; skip this part entirely if wildbattle
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
|
|
|
jr z, .asm_345c5
|
|
|
|
|
|
|
|
ld hl, OTPartyMon1PP
|
|
|
|
ld a, [CurOTMon]
|
|
|
|
|
|
|
|
.asm_345a4
|
|
|
|
call GetPartyLocation
|
|
|
|
push hl
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function3460b
|
2013-03-26 17:39:44 -07:00
|
|
|
pop hl
|
|
|
|
ret c
|
|
|
|
|
|
|
|
.asm_345ad
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
ld a, [CurMoveNum]
|
|
|
|
jr z, .asm_345b8
|
|
|
|
ld a, [CurEnemyMoveNum]
|
|
|
|
|
|
|
|
.asm_345b8
|
|
|
|
ld c, a
|
2014-06-13 21:18:14 -07:00
|
|
|
ld b, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and $3f
|
|
|
|
jr z, .asm_345e3
|
|
|
|
dec [hl]
|
2014-06-13 21:18:14 -07:00
|
|
|
ld b, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_345c5
|
|
|
|
ld hl, EnemyMonMoves
|
|
|
|
ld a, [CurEnemyMoveNum]
|
|
|
|
ld c, a
|
2014-06-13 21:18:14 -07:00
|
|
|
ld b, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
cp MIMIC
|
|
|
|
jr z, .asm_345dc
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc735
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
cp MIMIC
|
|
|
|
ret z
|
|
|
|
|
|
|
|
.asm_345dc
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc739
|
2013-03-26 17:39:44 -07:00
|
|
|
call .asm_345ad
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_345e3
|
2013-03-27 13:19:51 -07:00
|
|
|
call BattleCommandaa
|
2013-03-26 17:39:44 -07:00
|
|
|
; get move effect
|
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
; continuous?
|
|
|
|
ld hl, .continuousmoves
|
2013-03-27 13:19:51 -07:00
|
|
|
ld de, 1
|
2013-03-26 17:39:44 -07:00
|
|
|
call IsInArray
|
|
|
|
|
|
|
|
; 'has no pp left for [move]'
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, HasNoPPLeftText
|
2013-03-26 17:39:44 -07:00
|
|
|
jr c, .print
|
|
|
|
; 'but no pp is left for the move'
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, NoPPLeftText
|
2013-03-26 17:39:44 -07:00
|
|
|
.print
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-04-27 14:12:23 -07:00
|
|
|
ld b, 1
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 34602
|
|
|
|
|
|
|
|
.continuousmoves ; 34602
|
2013-04-27 14:12:23 -07:00
|
|
|
db EFFECT_RAZOR_WIND
|
|
|
|
db EFFECT_SKY_ATTACK
|
|
|
|
db EFFECT_SKULL_BASH
|
|
|
|
db EFFECT_SOLARBEAM
|
|
|
|
db EFFECT_FLY
|
|
|
|
db EFFECT_ROLLOUT
|
|
|
|
db EFFECT_BIDE
|
|
|
|
db EFFECT_RAMPAGE
|
|
|
|
db $ff
|
2013-03-26 17:39:44 -07:00
|
|
|
; 3460b
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function3460b: ; 3460b
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
ld a, [CurMoveNum]
|
|
|
|
jr z, .asm_34616
|
|
|
|
ld a, [CurEnemyMoveNum]
|
|
|
|
|
|
|
|
.asm_34616
|
|
|
|
ld c, a
|
|
|
|
ld a, 2
|
2013-05-02 23:43:44 -07:00
|
|
|
call UserPartyAttr
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
cp MIMIC
|
|
|
|
jr z, .asm_3462f
|
|
|
|
|
|
|
|
ld b, 0
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
cp MIMIC
|
|
|
|
jr nz, .asm_3462f
|
|
|
|
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_3462f
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; 34631
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand05: ; 34631
|
|
|
|
; critical
|
|
|
|
|
|
|
|
; Determine whether this attack's hit will be critical.
|
|
|
|
|
|
|
|
xor a
|
|
|
|
ld [CriticalHit], a
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_POWER
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
ld hl, EnemyMonItem
|
|
|
|
ld a, [EnemyMonSpecies]
|
|
|
|
jr nz, .Item
|
|
|
|
ld hl, BattleMonItem
|
|
|
|
ld a, [BattleMonSpecies]
|
|
|
|
|
|
|
|
.Item
|
|
|
|
ld c, 0
|
|
|
|
|
|
|
|
cp CHANSEY
|
|
|
|
jr nz, .Farfetchd
|
|
|
|
ld a, [hl]
|
|
|
|
cp LUCKY_PUNCH
|
|
|
|
jr nz, .FocusEnergy
|
|
|
|
|
|
|
|
; +2 critical level
|
|
|
|
ld c, 2
|
|
|
|
jr .Tally
|
|
|
|
|
|
|
|
.Farfetchd
|
|
|
|
cp FARFETCH_D
|
|
|
|
jr nz, .FocusEnergy
|
|
|
|
ld a, [hl]
|
|
|
|
cp STICK
|
|
|
|
jr nz, .FocusEnergy
|
|
|
|
|
|
|
|
; +2 critical level
|
|
|
|
ld c, 2
|
|
|
|
jr .Tally
|
|
|
|
|
|
|
|
.FocusEnergy
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-23 12:47:07 -07:00
|
|
|
bit SUBSTATUS_FOCUS_ENERGY, a
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .CheckCritical
|
|
|
|
|
|
|
|
; +1 critical level
|
|
|
|
inc c
|
|
|
|
|
|
|
|
.CheckCritical
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
ld de, 1
|
|
|
|
ld hl, .Criticals
|
|
|
|
push bc
|
|
|
|
call IsInArray
|
|
|
|
pop bc
|
|
|
|
jr nc, .ScopeLens
|
|
|
|
|
|
|
|
; +2 critical level
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
inc c
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.ScopeLens
|
|
|
|
push bc
|
|
|
|
call GetUserItem
|
|
|
|
ld a, b
|
2014-01-19 21:07:51 -08:00
|
|
|
cp HELD_CRITICAL_UP ; Increased critical chance. Only Scope Lens has this.
|
2013-03-26 17:39:44 -07:00
|
|
|
pop bc
|
|
|
|
jr nz, .Tally
|
|
|
|
|
|
|
|
; +1 critical level
|
|
|
|
inc c
|
|
|
|
|
|
|
|
.Tally
|
|
|
|
ld hl, .Chances
|
|
|
|
ld b, 0
|
|
|
|
add hl, bc
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp [hl]
|
|
|
|
ret nc
|
|
|
|
ld a, 1
|
|
|
|
ld [CriticalHit], a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.Criticals
|
|
|
|
db KARATE_CHOP, RAZOR_WIND, RAZOR_LEAF, CRABHAMMER, SLASH, AEROBLAST, CROSS_CHOP, $ff
|
|
|
|
.Chances
|
|
|
|
; 6.25% 12.1% 24.6% 33.2% 49.6% 49.6% 49.6%
|
|
|
|
db $11, $20, $40, $55, $80, $80, $80
|
|
|
|
; 0 1 2 3 4 5 6
|
|
|
|
; 346b2
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand4e: ; 346b2
|
2013-03-26 22:52:04 -07:00
|
|
|
; triplekick
|
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc689]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
inc b
|
|
|
|
ld hl, CurDamage + 1
|
|
|
|
ld a, [hld]
|
|
|
|
ld e, a
|
|
|
|
ld a, [hli]
|
|
|
|
ld d, a
|
|
|
|
.asm_346be
|
|
|
|
dec b
|
|
|
|
ret z
|
|
|
|
ld a, [hl]
|
|
|
|
add e
|
|
|
|
ld [hld], a
|
|
|
|
ld a, [hl]
|
|
|
|
adc d
|
|
|
|
ld [hli], a
|
2013-03-26 22:52:04 -07:00
|
|
|
|
|
|
|
; No overflow.
|
|
|
|
jr nc, .asm_346be
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $ff
|
|
|
|
ld [hld], a
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 346cd
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand4f: ; 346cd
|
2013-03-26 22:52:04 -07:00
|
|
|
; kickcounter
|
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc689
|
2013-03-26 17:39:44 -07:00
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
; 346d2
|
|
|
|
|
|
|
|
|
2015-10-10 04:45:39 -07:00
|
|
|
BattleCommand_CalcDamageTypeMultiplier: ; 346d2
|
2015-09-09 16:27:07 -07:00
|
|
|
; STAB = Same Type Attack Bonus
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
cp STRUGGLE
|
|
|
|
ret z
|
|
|
|
|
|
|
|
ld hl, BattleMonType1
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld c, [hl]
|
|
|
|
ld hl, EnemyMonType1
|
|
|
|
ld a, [hli]
|
|
|
|
ld d, a
|
|
|
|
ld e, [hl]
|
2013-04-19 00:50:45 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2015-09-09 16:27:07 -07:00
|
|
|
jr z, .go ; Who Attacks and who Defends
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, EnemyMonType1
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld c, [hl]
|
|
|
|
ld hl, BattleMonType1
|
|
|
|
ld a, [hli]
|
|
|
|
ld d, a
|
|
|
|
ld e, [hl]
|
|
|
|
|
2013-04-19 00:50:45 -07:00
|
|
|
.go
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_TYPE
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2013-04-19 00:50:45 -07:00
|
|
|
callba DoWeatherModifiers
|
2013-03-26 17:39:44 -07:00
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
push de
|
|
|
|
push bc
|
2013-04-19 00:50:45 -07:00
|
|
|
callba DoBadgeTypeBoosts
|
2013-03-26 17:39:44 -07:00
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd265]
|
2013-03-26 17:39:44 -07:00
|
|
|
cp b
|
2013-04-19 00:50:45 -07:00
|
|
|
jr z, .stab
|
2013-03-26 17:39:44 -07:00
|
|
|
cp c
|
2013-04-19 00:50:45 -07:00
|
|
|
jr z, .stab
|
|
|
|
|
2015-10-07 10:19:41 -07:00
|
|
|
jr .SkipStab
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-04-19 00:50:45 -07:00
|
|
|
.stab
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CurDamage + 1
|
|
|
|
ld a, [hld]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2013-04-19 00:50:45 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
srl b
|
|
|
|
rr c
|
|
|
|
add hl, bc
|
2013-04-19 00:50:45 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, h
|
|
|
|
ld [CurDamage], a
|
|
|
|
ld a, l
|
|
|
|
ld [CurDamage + 1], a
|
2013-04-19 00:50:45 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, TypeModifier
|
|
|
|
set 7, [hl]
|
2013-04-19 00:50:45 -07:00
|
|
|
|
2015-10-07 10:19:41 -07:00
|
|
|
.SkipStab
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_TYPE
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
ld hl, TypeMatchup
|
2013-04-19 00:50:45 -07:00
|
|
|
|
2015-10-07 10:19:41 -07:00
|
|
|
.TypesLoop
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
2013-04-19 00:50:45 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $ff
|
2013-04-19 00:50:45 -07:00
|
|
|
jr z, .end
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; foresight
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $fe
|
2015-10-07 10:19:41 -07:00
|
|
|
jr nz, .SkipForesightCheck
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS1_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SUBSTATUS_IDENTIFIED, a
|
2013-04-19 00:50:45 -07:00
|
|
|
jr nz, .end
|
|
|
|
|
2015-10-07 10:19:41 -07:00
|
|
|
jr .TypesLoop
|
2013-04-19 00:50:45 -07:00
|
|
|
|
2015-10-07 10:19:41 -07:00
|
|
|
.SkipForesightCheck
|
2013-03-26 17:39:44 -07:00
|
|
|
cp b
|
2015-10-07 10:19:41 -07:00
|
|
|
jr nz, .SkipType
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
cp d
|
2015-10-07 10:19:41 -07:00
|
|
|
jr z, .GotMatchup
|
2013-03-26 17:39:44 -07:00
|
|
|
cp e
|
2015-10-07 10:19:41 -07:00
|
|
|
jr z, .GotMatchup
|
|
|
|
jr .SkipType
|
2013-04-19 00:50:45 -07:00
|
|
|
|
2015-10-07 10:19:41 -07:00
|
|
|
.GotMatchup
|
2013-03-26 17:39:44 -07:00
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
inc hl
|
|
|
|
ld a, [TypeModifier]
|
|
|
|
and %10000000
|
|
|
|
ld b, a
|
2015-10-07 10:19:41 -07:00
|
|
|
; If the target is immune to the move, treat it as a miss and calculate the damage as 0
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-10-07 10:19:41 -07:00
|
|
|
jr nz, .NotImmune
|
2013-03-26 17:39:44 -07:00
|
|
|
inc a
|
|
|
|
ld [AttackMissed], a
|
|
|
|
xor a
|
2015-10-07 10:19:41 -07:00
|
|
|
.NotImmune
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplier], a
|
2013-03-26 17:39:44 -07:00
|
|
|
add b
|
|
|
|
ld [TypeModifier], a
|
2013-04-19 00:50:45 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplicand + 0], a
|
2013-04-19 00:50:45 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CurDamage
|
|
|
|
ld a, [hli]
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplicand + 1], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hld]
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplicand + 2], a
|
2013-04-19 00:50:45 -07:00
|
|
|
|
2013-05-02 23:43:44 -07:00
|
|
|
call Multiply
|
2013-04-19 00:50:45 -07:00
|
|
|
|
2015-09-06 14:38:01 -07:00
|
|
|
ld a, [hProduct + 1]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
2015-09-06 14:38:01 -07:00
|
|
|
ld a, [hProduct + 2]
|
2013-03-26 17:39:44 -07:00
|
|
|
or b
|
|
|
|
ld b, a
|
2015-09-06 14:38:01 -07:00
|
|
|
ld a, [hProduct + 3]
|
2013-03-26 17:39:44 -07:00
|
|
|
or b
|
2015-10-07 10:19:41 -07:00
|
|
|
jr z, .ok ; This is a very convoluted way to get back that we've essentially dealt no damage.
|
2013-04-19 00:50:45 -07:00
|
|
|
|
2015-10-07 10:19:41 -07:00
|
|
|
; Take the product and divide it by 10.
|
|
|
|
ld a, 10
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hDivisor], a
|
2015-10-07 10:19:41 -07:00
|
|
|
ld b, 4
|
2013-05-02 23:43:44 -07:00
|
|
|
call Divide
|
2015-09-06 14:38:01 -07:00
|
|
|
ld a, [hQuotient + 1]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
2015-09-06 14:38:01 -07:00
|
|
|
ld a, [hQuotient + 2]
|
2013-03-26 17:39:44 -07:00
|
|
|
or b
|
2015-10-07 10:19:41 -07:00
|
|
|
jr nz, .ok
|
2013-04-19 00:50:45 -07:00
|
|
|
|
2015-10-07 10:19:41 -07:00
|
|
|
ld a, 1
|
|
|
|
ld [hMultiplicand + 2], a
|
2013-04-19 00:50:45 -07:00
|
|
|
|
2015-10-07 10:19:41 -07:00
|
|
|
.ok
|
|
|
|
ld a, [hMultiplicand + 1]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hli], a
|
2015-10-07 10:19:41 -07:00
|
|
|
ld a, [hMultiplicand + 2]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], a
|
|
|
|
pop bc
|
|
|
|
pop hl
|
2013-04-19 00:50:45 -07:00
|
|
|
|
2015-10-07 10:19:41 -07:00
|
|
|
.SkipType
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
inc hl
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2015-10-07 10:19:41 -07:00
|
|
|
jr .TypesLoop
|
2013-04-19 00:50:45 -07:00
|
|
|
|
|
|
|
.end
|
2015-09-11 19:21:00 -07:00
|
|
|
call HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd265]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
ld a, [TypeModifier]
|
|
|
|
and $80
|
|
|
|
or b
|
|
|
|
ld [TypeModifier], a
|
|
|
|
ret
|
|
|
|
; 347c8
|
|
|
|
|
|
|
|
|
2015-09-11 19:21:00 -07:00
|
|
|
HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn: ; 347c8
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EnemyMonType1
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-12-31 01:10:49 -08:00
|
|
|
jr z, Function347d3
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BattleMonType1
|
2013-03-27 15:50:10 -07:00
|
|
|
|
|
|
|
; fallthrough
|
|
|
|
; 347d3
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function347d3: ; 347d3
|
2013-03-26 17:39:44 -07:00
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2013-05-02 23:43:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_TYPE
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, a
|
|
|
|
ld b, [hl]
|
|
|
|
inc hl
|
|
|
|
ld c, [hl]
|
2014-06-18 00:55:44 -07:00
|
|
|
ld a, 10 ; 1.0
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, TypeMatchup
|
2015-10-07 10:19:41 -07:00
|
|
|
.TypesLoop
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
cp $ff
|
2015-10-07 10:19:41 -07:00
|
|
|
jr z, .End
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $fe
|
2015-10-07 10:19:41 -07:00
|
|
|
jr nz, .Next
|
2013-05-02 23:43:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS1_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
bit SUBSTATUS_IDENTIFIED, a
|
2015-10-07 10:19:41 -07:00
|
|
|
jr nz, .End
|
|
|
|
jr .TypesLoop
|
|
|
|
.Next
|
2013-03-26 17:39:44 -07:00
|
|
|
cp d
|
2015-10-07 10:19:41 -07:00
|
|
|
jr nz, .Nope
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
2015-10-07 10:19:41 -07:00
|
|
|
jr z, .Yup
|
2013-03-26 17:39:44 -07:00
|
|
|
cp c
|
2015-10-07 10:19:41 -07:00
|
|
|
jr z, .Yup
|
|
|
|
jr .Nope2
|
|
|
|
.Nope
|
2013-03-26 17:39:44 -07:00
|
|
|
inc hl
|
2015-10-07 10:19:41 -07:00
|
|
|
.Nope2
|
2013-03-26 17:39:44 -07:00
|
|
|
inc hl
|
2015-10-07 10:19:41 -07:00
|
|
|
jr .TypesLoop
|
|
|
|
.Yup
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hDividend + 0], a
|
|
|
|
ld [hMultiplicand + 0], a
|
|
|
|
ld [hMultiplicand + 1], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplicand + 2], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd265]
|
2014-08-13 19:44:56 -07:00
|
|
|
ld [hMultiplier], a
|
2013-03-26 17:39:44 -07:00
|
|
|
call Multiply
|
2014-08-13 19:44:56 -07:00
|
|
|
ld a, 10
|
|
|
|
ld [hDivisor], a
|
2013-03-26 17:39:44 -07:00
|
|
|
push bc
|
2014-08-13 19:44:56 -07:00
|
|
|
ld b, 4
|
2013-03-26 17:39:44 -07:00
|
|
|
call Divide
|
|
|
|
pop bc
|
2015-09-06 14:38:01 -07:00
|
|
|
ld a, [hQuotient + 2]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2015-10-07 10:19:41 -07:00
|
|
|
jr .TypesLoop
|
2014-08-13 19:44:56 -07:00
|
|
|
|
2015-10-07 10:19:41 -07:00
|
|
|
.End
|
2013-03-26 17:39:44 -07:00
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 34833
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommanda3: ; 34833
|
2015-09-11 19:21:00 -07:00
|
|
|
call HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd265]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2014-06-23 12:47:07 -07:00
|
|
|
ld a, 10 ; 1.0
|
2015-10-07 10:19:41 -07:00
|
|
|
jr nz, .skip
|
2013-03-26 17:39:44 -07:00
|
|
|
call ResetDamage
|
|
|
|
xor a
|
|
|
|
ld [TypeModifier], a
|
|
|
|
inc a
|
|
|
|
ld [AttackMissed], a
|
|
|
|
ret
|
2015-10-07 10:19:41 -07:00
|
|
|
.skip
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 3484e
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function3484e: ; 3484e
|
2013-03-26 17:39:44 -07:00
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2014-08-13 19:44:56 -07:00
|
|
|
ld a, 10
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc716], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, PlayerUsedMoves
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2014-06-23 12:47:07 -07:00
|
|
|
jr z, .unknown_moves
|
|
|
|
|
|
|
|
ld d, NUM_MOVES
|
|
|
|
ld e, 0
|
|
|
|
.loop
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
and a
|
2014-06-23 12:47:07 -07:00
|
|
|
jr z, .exit
|
2013-03-26 17:39:44 -07:00
|
|
|
push hl
|
|
|
|
dec a
|
2014-06-10 23:23:55 -07:00
|
|
|
ld hl, Moves + MOVE_POWER
|
2013-03-27 13:19:51 -07:00
|
|
|
call GetMoveAttr
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2014-06-23 12:47:07 -07:00
|
|
|
jr z, .next
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
inc hl
|
2013-03-27 13:19:51 -07:00
|
|
|
call GetMoveByte
|
2014-06-23 12:47:07 -07:00
|
|
|
ld hl, EnemyMonType
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function347d3
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd265]
|
2014-06-23 12:47:07 -07:00
|
|
|
cp 10 + 1 ; 1.0 + 0.1
|
|
|
|
jr nc, .super_effective
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2014-06-23 12:47:07 -07:00
|
|
|
jr z, .next
|
|
|
|
cp 10 ; 1.0
|
|
|
|
jr nc, .neutral
|
|
|
|
|
|
|
|
.not_very_effective
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, e
|
2014-06-23 12:47:07 -07:00
|
|
|
cp 1 ; 0.1
|
|
|
|
jr nc, .next
|
|
|
|
ld e, 1
|
|
|
|
jr .next
|
|
|
|
|
|
|
|
.neutral
|
|
|
|
ld e, 2
|
|
|
|
jr .next
|
|
|
|
|
|
|
|
.super_effective
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34931
|
2013-03-26 17:39:44 -07:00
|
|
|
pop hl
|
2014-06-23 12:47:07 -07:00
|
|
|
jr .done
|
|
|
|
|
|
|
|
.next
|
2013-03-26 17:39:44 -07:00
|
|
|
pop hl
|
|
|
|
dec d
|
2014-06-23 12:47:07 -07:00
|
|
|
jr nz, .loop
|
|
|
|
|
|
|
|
.exit
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, e
|
2014-06-23 12:47:07 -07:00
|
|
|
cp 2
|
|
|
|
jr z, .done
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34939
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, e
|
|
|
|
and a
|
2014-06-23 12:47:07 -07:00
|
|
|
jr nz, .done
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34939
|
2014-06-23 12:47:07 -07:00
|
|
|
jr .done
|
|
|
|
|
|
|
|
.unknown_moves
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [BattleMonType1]
|
|
|
|
ld b, a
|
|
|
|
ld hl, EnemyMonType1
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function347d3
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd265]
|
2014-06-23 12:47:07 -07:00
|
|
|
cp 10 + 1 ; 1.0 + 0.1
|
|
|
|
jr c, .ok
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34931
|
2014-06-23 12:47:07 -07:00
|
|
|
.ok
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [BattleMonType2]
|
|
|
|
cp b
|
2014-06-23 12:47:07 -07:00
|
|
|
jr z, .ok2
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function347d3
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd265]
|
2014-06-23 12:47:07 -07:00
|
|
|
cp 10 + 1 ; 1.0 + 0.1
|
|
|
|
jr c, .ok2
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34931
|
2014-06-23 12:47:07 -07:00
|
|
|
.ok2
|
|
|
|
|
|
|
|
.done
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function348de
|
2013-03-26 17:39:44 -07:00
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 348de
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function348de: ; 348de
|
2014-06-10 23:08:07 -07:00
|
|
|
ld de, EnemyMonMoves
|
|
|
|
ld b, NUM_MOVES + 1
|
2013-03-26 17:39:44 -07:00
|
|
|
ld c, 0
|
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd265]
|
2013-03-26 17:39:44 -07:00
|
|
|
push af
|
|
|
|
.loop
|
|
|
|
dec b
|
|
|
|
jr z, .exit
|
|
|
|
|
|
|
|
ld a, [de]
|
|
|
|
and a
|
|
|
|
jr z, .exit
|
|
|
|
|
|
|
|
inc de
|
|
|
|
dec a
|
2014-06-10 23:23:55 -07:00
|
|
|
ld hl, Moves + MOVE_POWER
|
2013-03-27 13:19:51 -07:00
|
|
|
call GetMoveAttr
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
jr z, .loop
|
|
|
|
|
|
|
|
inc hl
|
2013-03-27 13:19:51 -07:00
|
|
|
call GetMoveByte
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BattleMonType1
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function347d3
|
2014-06-23 12:47:07 -07:00
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd265]
|
2014-06-23 12:47:07 -07:00
|
|
|
; immune
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
jr z, .loop
|
|
|
|
|
2014-06-23 12:47:07 -07:00
|
|
|
; not very effective
|
2013-03-26 17:39:44 -07:00
|
|
|
inc c
|
2014-06-10 23:08:07 -07:00
|
|
|
cp 10
|
2013-03-26 17:39:44 -07:00
|
|
|
jr c, .loop
|
|
|
|
|
2014-06-23 12:47:07 -07:00
|
|
|
; neutral
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 5
|
2013-03-26 17:39:44 -07:00
|
|
|
inc c
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2014-06-10 23:08:07 -07:00
|
|
|
cp 10
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .loop
|
|
|
|
|
2014-06-23 12:47:07 -07:00
|
|
|
; super effective
|
2014-06-10 23:08:07 -07:00
|
|
|
ld c, 100
|
2013-03-26 17:39:44 -07:00
|
|
|
jr .loop
|
|
|
|
|
2014-06-23 12:47:07 -07:00
|
|
|
.exit
|
2013-03-26 17:39:44 -07:00
|
|
|
pop af
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, c
|
|
|
|
and a
|
2013-03-27 15:50:10 -07:00
|
|
|
jr z, .doubledown ; double down
|
2014-06-10 23:08:07 -07:00
|
|
|
cp 5
|
2013-12-31 01:10:49 -08:00
|
|
|
jr c, Function34931 ; down
|
2014-06-10 23:08:07 -07:00
|
|
|
cp 100
|
2013-03-26 17:39:44 -07:00
|
|
|
ret c
|
2013-12-31 01:10:49 -08:00
|
|
|
jr Function34939 ; up
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.doubledown
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34931
|
2013-03-27 15:50:10 -07:00
|
|
|
|
|
|
|
; fallthrough
|
|
|
|
; 34931
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function34931: ; 34931
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc716]
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc716], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
2013-03-27 15:50:10 -07:00
|
|
|
; 34939
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function34939: ; 34939
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc716]
|
2013-03-26 17:39:44 -07:00
|
|
|
inc a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc716], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 34941
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function34941: ; 34941
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc717], a
|
2014-08-13 19:44:56 -07:00
|
|
|
call CountEnemyAliveMons
|
2013-03-26 17:39:44 -07:00
|
|
|
ret c
|
|
|
|
|
|
|
|
ld a, [EnemySubStatus1]
|
2014-06-10 23:08:07 -07:00
|
|
|
bit SUBSTATUS_PERISH, a
|
2014-08-13 19:44:56 -07:00
|
|
|
jr z, .no_perish
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, [EnemyPerishCount]
|
|
|
|
cp 1
|
2014-08-13 19:44:56 -07:00
|
|
|
jr nz, .no_perish
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-08-13 19:44:56 -07:00
|
|
|
; Perish count is 1
|
|
|
|
|
|
|
|
call CountEnemyAliveMons
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34b77
|
|
|
|
call Function34b20
|
|
|
|
call Function34a85
|
2013-03-27 15:50:10 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, e
|
2014-08-13 19:44:56 -07:00
|
|
|
cp 2
|
2013-03-26 17:39:44 -07:00
|
|
|
jr nz, .asm_34971
|
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc716]
|
2013-03-26 17:39:44 -07:00
|
|
|
add $30
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc717], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_34971
|
2014-08-13 19:44:56 -07:00
|
|
|
call CountEnemyAliveMons
|
2013-03-26 17:39:44 -07:00
|
|
|
sla c
|
|
|
|
sla c
|
|
|
|
ld b, $ff
|
|
|
|
|
|
|
|
.asm_3497a
|
|
|
|
inc b
|
|
|
|
sla c
|
|
|
|
jr nc, .asm_3497a
|
|
|
|
|
|
|
|
ld a, b
|
|
|
|
add $30
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc717], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
|
2014-08-13 19:44:56 -07:00
|
|
|
.no_perish
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function3484e
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc716]
|
2014-08-13 19:44:56 -07:00
|
|
|
cp 11
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nc
|
|
|
|
|
|
|
|
ld a, [LastEnemyCounterMove]
|
|
|
|
and a
|
|
|
|
jr z, .asm_349d2
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34a2a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc716]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
jr z, .asm_349d2
|
|
|
|
|
|
|
|
ld c, a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34aa7
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc716]
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $ff
|
|
|
|
ret z
|
|
|
|
|
|
|
|
ld b, a
|
|
|
|
ld a, e
|
2014-08-13 19:44:56 -07:00
|
|
|
cp 2
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_349be
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function3484e
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc716]
|
2014-08-13 19:44:56 -07:00
|
|
|
cp 10
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nc
|
|
|
|
|
|
|
|
ld a, b
|
|
|
|
add $10
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc717], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_349be
|
|
|
|
ld c, $10
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function3484e
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc716]
|
2014-08-13 19:44:56 -07:00
|
|
|
cp 10
|
2013-03-26 17:39:44 -07:00
|
|
|
jr nc, .asm_349cc
|
|
|
|
ld c, $20
|
|
|
|
|
|
|
|
.asm_349cc
|
|
|
|
ld a, b
|
|
|
|
add c
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc717], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_349d2
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function3484e
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc716]
|
2014-08-13 19:44:56 -07:00
|
|
|
cp 10
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nc
|
|
|
|
|
2014-08-13 19:44:56 -07:00
|
|
|
call CountEnemyAliveMons
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34b77
|
|
|
|
call Function34b20
|
|
|
|
call Function34a85
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, e
|
|
|
|
cp $2
|
|
|
|
ret nz
|
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc716]
|
2013-03-26 17:39:44 -07:00
|
|
|
add $10
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc717], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 349f4
|
|
|
|
|
|
|
|
|
2014-08-13 19:44:56 -07:00
|
|
|
CountEnemyAliveMons: ; 349f4
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [OTPartyCount]
|
2013-03-27 15:50:10 -07:00
|
|
|
cp 2
|
2014-06-23 12:47:07 -07:00
|
|
|
jr c, .only_one
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld d, a
|
2013-03-27 15:50:10 -07:00
|
|
|
ld e, 0
|
2014-06-23 12:47:07 -07:00
|
|
|
ld b, 1 << (PARTY_LENGTH - 1)
|
2013-03-27 15:50:10 -07:00
|
|
|
ld c, 0
|
2014-02-22 21:37:09 -08:00
|
|
|
ld hl, OTPartyMon1HP
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-23 12:47:07 -07:00
|
|
|
.loop
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [CurOTMon]
|
|
|
|
cp e
|
2014-06-23 12:47:07 -07:00
|
|
|
jr z, .next
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
push bc
|
|
|
|
ld b, [hl]
|
|
|
|
inc hl
|
|
|
|
ld a, [hld]
|
|
|
|
or b
|
|
|
|
pop bc
|
2014-06-23 12:47:07 -07:00
|
|
|
jr z, .next
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, c
|
|
|
|
or b
|
|
|
|
ld c, a
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2014-06-23 12:47:07 -07:00
|
|
|
.next
|
2013-03-26 17:39:44 -07:00
|
|
|
srl b
|
|
|
|
push bc
|
2014-06-10 23:08:07 -07:00
|
|
|
ld bc, PartyMon2 - PartyMon1
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
inc e
|
|
|
|
dec d
|
2014-06-23 12:47:07 -07:00
|
|
|
jr nz, .loop
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, c
|
|
|
|
and a
|
2014-06-23 12:47:07 -07:00
|
|
|
jr nz, .more_than_one
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-23 12:47:07 -07:00
|
|
|
.only_one
|
2013-03-26 17:39:44 -07:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2014-06-23 12:47:07 -07:00
|
|
|
.more_than_one
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; 34a2a
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function34a2a: ; 34a2a
|
2013-04-07 23:15:08 -07:00
|
|
|
ld hl, OTPartyMon1
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [OTPartyCount]
|
|
|
|
ld b, a
|
2014-08-13 19:44:56 -07:00
|
|
|
ld c, 1 << (PARTY_LENGTH - 1)
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, 0
|
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc716], a
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_34a39
|
|
|
|
ld a, [CurOTMon]
|
|
|
|
cp d
|
|
|
|
push hl
|
|
|
|
jr z, .asm_34a77
|
|
|
|
|
|
|
|
push hl
|
|
|
|
push bc
|
2014-06-10 23:08:07 -07:00
|
|
|
ld bc, PartyMon1HP - PartyMon1
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
ld a, [hli]
|
|
|
|
or [hl]
|
|
|
|
pop hl
|
|
|
|
jr z, .asm_34a77
|
|
|
|
|
|
|
|
ld a, [hl]
|
|
|
|
ld [CurSpecies], a
|
2013-04-29 12:08:13 -07:00
|
|
|
call GetBaseData
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [LastEnemyCounterMove]
|
|
|
|
dec a
|
2014-06-10 23:23:55 -07:00
|
|
|
ld hl, Moves + MOVE_POWER
|
2013-03-27 13:19:51 -07:00
|
|
|
call GetMoveAttr
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
jr z, .asm_34a77
|
|
|
|
|
|
|
|
inc hl
|
2013-03-27 13:19:51 -07:00
|
|
|
call GetMoveByte
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, BaseType
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function347d3
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd265]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
jr nz, .asm_34a77
|
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc716]
|
2013-03-26 17:39:44 -07:00
|
|
|
or c
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc716], a
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_34a77
|
|
|
|
pop hl
|
|
|
|
dec b
|
|
|
|
ret z
|
|
|
|
|
|
|
|
push bc
|
2014-06-10 23:08:07 -07:00
|
|
|
ld bc, PartyMon2 - PartyMon1
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
|
|
|
|
inc d
|
|
|
|
srl c
|
|
|
|
jr .asm_34a39
|
2013-03-27 15:50:10 -07:00
|
|
|
; 34a85
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function34a85: ; 34a85
|
2013-03-26 17:39:44 -07:00
|
|
|
push bc
|
|
|
|
ld a, [OTPartyCount]
|
|
|
|
ld e, a
|
2014-02-22 21:37:09 -08:00
|
|
|
ld hl, OTPartyMon1HP
|
2014-08-13 19:44:56 -07:00
|
|
|
ld b, 1 << (PARTY_LENGTH - 1)
|
|
|
|
ld c, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_34a91
|
|
|
|
ld a, [hli]
|
|
|
|
or [hl]
|
|
|
|
jr z, .asm_34a98
|
|
|
|
|
|
|
|
ld a, b
|
|
|
|
or c
|
|
|
|
ld c, a
|
2013-03-27 15:50:10 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_34a98
|
|
|
|
srl b
|
|
|
|
push bc
|
2014-06-10 23:08:07 -07:00
|
|
|
ld bc, PartyMon2HP - (PartyMon1HP + 1)
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec e
|
|
|
|
jr nz, .asm_34a91
|
|
|
|
|
|
|
|
ld a, c
|
|
|
|
pop bc
|
|
|
|
|
|
|
|
and c
|
|
|
|
ld c, a
|
2013-03-27 15:50:10 -07:00
|
|
|
|
|
|
|
; fallthrough
|
|
|
|
; 34aa7
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function34aa7: ; 34aa7
|
2013-03-27 15:50:10 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $ff
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc716], a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld hl, OTPartyMon1Moves
|
2014-08-13 19:44:56 -07:00
|
|
|
ld b, 1 << (PARTY_LENGTH - 1)
|
|
|
|
ld d, 0
|
|
|
|
ld e, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_34ab5
|
|
|
|
ld a, b
|
|
|
|
and c
|
|
|
|
jr z, .asm_34b00
|
|
|
|
|
|
|
|
push hl
|
|
|
|
push bc
|
2014-06-10 23:08:07 -07:00
|
|
|
ld b, NUM_MOVES
|
2014-08-13 19:44:56 -07:00
|
|
|
ld c, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_34abf
|
|
|
|
ld a, [hli]
|
|
|
|
and a
|
|
|
|
push hl
|
|
|
|
jr z, .asm_34aef
|
|
|
|
|
|
|
|
dec a
|
2014-06-10 23:23:55 -07:00
|
|
|
ld hl, Moves + MOVE_POWER
|
2013-03-27 13:19:51 -07:00
|
|
|
call GetMoveAttr
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
jr z, .asm_34ae9
|
|
|
|
|
|
|
|
inc hl
|
2013-03-27 13:19:51 -07:00
|
|
|
call GetMoveByte
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BattleMonType1
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function347d3
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd265]
|
2014-08-13 19:44:56 -07:00
|
|
|
cp 10
|
2013-03-26 17:39:44 -07:00
|
|
|
jr c, .asm_34ae9
|
|
|
|
|
2014-08-13 19:44:56 -07:00
|
|
|
ld e, 1
|
|
|
|
cp 11
|
2013-03-26 17:39:44 -07:00
|
|
|
jr c, .asm_34ae9
|
|
|
|
|
2014-08-13 19:44:56 -07:00
|
|
|
ld e, 2
|
2013-03-26 17:39:44 -07:00
|
|
|
jr .asm_34aef
|
|
|
|
|
|
|
|
.asm_34ae9
|
|
|
|
pop hl
|
|
|
|
dec b
|
|
|
|
jr nz, .asm_34abf
|
|
|
|
|
|
|
|
jr .asm_34af0
|
|
|
|
|
|
|
|
.asm_34aef
|
|
|
|
pop hl
|
|
|
|
.asm_34af0
|
|
|
|
ld a, e
|
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
cp $2
|
|
|
|
jr z, .asm_34b0e
|
|
|
|
|
|
|
|
cp $1
|
|
|
|
jr nz, .asm_34b00
|
|
|
|
|
|
|
|
ld a, d
|
|
|
|
or b
|
|
|
|
ld d, a
|
|
|
|
jr .asm_34b00
|
|
|
|
|
|
|
|
.asm_34b00
|
|
|
|
push bc
|
2014-06-10 23:08:07 -07:00
|
|
|
ld bc, PartyMon2 - PartyMon1
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
srl b
|
|
|
|
jr nc, .asm_34ab5
|
|
|
|
|
|
|
|
ld a, d
|
|
|
|
ld b, a
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
|
|
|
.asm_34b0e
|
|
|
|
push bc
|
|
|
|
sla b
|
|
|
|
sla b
|
|
|
|
ld c, $ff
|
|
|
|
.asm_34b15
|
|
|
|
inc c
|
|
|
|
sla b
|
|
|
|
jr nc, .asm_34b15
|
|
|
|
|
|
|
|
ld a, c
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc716], a
|
2013-03-26 17:39:44 -07:00
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
; 34b20
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function34b20: ; 34b20
|
2013-03-26 17:39:44 -07:00
|
|
|
push bc
|
|
|
|
ld hl, OTPartySpecies
|
2014-08-13 19:44:56 -07:00
|
|
|
ld b, 1 << (PARTY_LENGTH - 1)
|
|
|
|
ld c, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_34b28
|
|
|
|
ld a, [hli]
|
|
|
|
cp $ff
|
|
|
|
jr z, .asm_34b72
|
|
|
|
|
|
|
|
push hl
|
|
|
|
ld [CurSpecies], a
|
2013-04-29 12:08:13 -07:00
|
|
|
call GetBaseData
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [LastEnemyCounterMove]
|
|
|
|
and a
|
|
|
|
jr z, .asm_34b4a
|
|
|
|
|
|
|
|
dec a
|
2014-06-10 23:23:55 -07:00
|
|
|
ld hl, Moves + MOVE_POWER
|
2013-03-27 13:19:51 -07:00
|
|
|
call GetMoveAttr
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
jr z, .asm_34b4a
|
|
|
|
|
|
|
|
inc hl
|
2013-03-27 13:19:51 -07:00
|
|
|
call GetMoveByte
|
2013-03-26 17:39:44 -07:00
|
|
|
jr .asm_34b5d
|
|
|
|
|
|
|
|
.asm_34b4a
|
|
|
|
ld a, [BattleMonType1]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, BaseType
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function347d3
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd265]
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $b
|
|
|
|
jr nc, .asm_34b6d
|
|
|
|
ld a, [BattleMonType2]
|
|
|
|
|
|
|
|
.asm_34b5d
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, BaseType
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function347d3
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd265]
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $b
|
|
|
|
jr nc, .asm_34b6d
|
|
|
|
|
|
|
|
ld a, b
|
|
|
|
or c
|
|
|
|
ld c, a
|
|
|
|
|
|
|
|
.asm_34b6d
|
|
|
|
srl b
|
|
|
|
pop hl
|
|
|
|
jr .asm_34b28
|
|
|
|
|
|
|
|
.asm_34b72
|
|
|
|
ld a, c
|
|
|
|
pop bc
|
|
|
|
and c
|
|
|
|
ld c, a
|
|
|
|
ret
|
|
|
|
; 34b77
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function34b77: ; 34b77
|
2013-03-26 17:39:44 -07:00
|
|
|
push bc
|
|
|
|
ld de, OTPartySpecies
|
2014-06-23 12:47:07 -07:00
|
|
|
ld b, 1 << (PARTY_LENGTH - 1)
|
2013-03-27 15:50:10 -07:00
|
|
|
ld c, 0
|
2014-02-22 21:37:09 -08:00
|
|
|
ld hl, OTPartyMon1HP
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-23 12:47:07 -07:00
|
|
|
.loop
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
cp $ff
|
2014-06-23 12:47:07 -07:00
|
|
|
jr z, .done
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld b, [hl]
|
|
|
|
inc hl
|
|
|
|
ld c, [hl]
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
inc hl
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
srl c
|
|
|
|
rl b
|
|
|
|
srl c
|
|
|
|
rl b
|
|
|
|
ld a, [hld]
|
|
|
|
cp c
|
|
|
|
ld a, [hl]
|
|
|
|
sbc b
|
|
|
|
pop bc
|
2014-06-23 12:47:07 -07:00
|
|
|
jr nc, .next
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, b
|
|
|
|
or c
|
|
|
|
ld c, a
|
|
|
|
|
2014-06-23 12:47:07 -07:00
|
|
|
.next
|
2013-03-26 17:39:44 -07:00
|
|
|
srl b
|
|
|
|
pop hl
|
|
|
|
push bc
|
2014-06-10 23:08:07 -07:00
|
|
|
ld bc, PartyMon2 - PartyMon1
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
2014-06-23 12:47:07 -07:00
|
|
|
jr .loop
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-23 12:47:07 -07:00
|
|
|
.done
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, c
|
|
|
|
pop bc
|
|
|
|
and c
|
|
|
|
ld c, a
|
|
|
|
ret
|
|
|
|
; 34bb1
|
|
|
|
|
|
|
|
|
|
|
|
TypeMatchup: ; 34bb1
|
|
|
|
INCLUDE "battle/type_matchup.asm"
|
|
|
|
; 34cfd
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand08: ; 34cfd
|
|
|
|
; damagevariation
|
|
|
|
|
|
|
|
; Modify the damage spread between 85% and 100%.
|
|
|
|
|
|
|
|
; Because of the method of division the probability distribution
|
|
|
|
; is not consistent. This makes the highest damage multipliers
|
|
|
|
; rarer than normal.
|
|
|
|
|
|
|
|
|
|
|
|
; No point in reducing 1 or 0 damage.
|
|
|
|
ld hl, CurDamage
|
|
|
|
ld a, [hli]
|
|
|
|
and a
|
|
|
|
jr nz, .go
|
|
|
|
ld a, [hl]
|
|
|
|
cp 2
|
|
|
|
ret c
|
|
|
|
|
|
|
|
.go
|
|
|
|
; Start with the maximum damage.
|
|
|
|
xor a
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplicand + 0], a
|
2013-03-26 17:39:44 -07:00
|
|
|
dec hl
|
|
|
|
ld a, [hli]
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplicand + 1], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplicand + 2], a
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
; Multiply by 85-100%...
|
|
|
|
.loop
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
rrca
|
|
|
|
cp $d9 ; 85%
|
|
|
|
jr c, .loop
|
|
|
|
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplier], a
|
2013-03-26 17:39:44 -07:00
|
|
|
call Multiply
|
|
|
|
|
|
|
|
; ...divide by 100%...
|
|
|
|
ld a, $ff ; 100%
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hDivisor], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, $4
|
|
|
|
call Divide
|
|
|
|
|
|
|
|
; ...to get .85-1.00x damage.
|
2015-09-06 14:38:01 -07:00
|
|
|
ld a, [hQuotient + 1]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CurDamage
|
|
|
|
ld [hli], a
|
2015-09-06 14:38:01 -07:00
|
|
|
ld a, [hQuotient + 2]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 34d32
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand09: ; 34d32
|
|
|
|
; checkhit
|
|
|
|
|
|
|
|
call .DreamEater
|
|
|
|
jp z, .Miss
|
|
|
|
|
|
|
|
call .Protect
|
|
|
|
jp nz, .Miss
|
|
|
|
|
|
|
|
call .DrainSub
|
|
|
|
jp z, .Miss
|
|
|
|
|
|
|
|
call .LockOn
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
call .FlyDigMoves
|
|
|
|
jp nz, .Miss
|
|
|
|
|
|
|
|
call .ThunderRain
|
|
|
|
ret z
|
|
|
|
|
2014-08-13 19:44:56 -07:00
|
|
|
call .XAccuracy
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
|
2014-06-23 12:47:07 -07:00
|
|
|
; Perfect-accuracy moves
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
cp EFFECT_ALWAYS_HIT
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
|
|
|
|
|
|
|
call .StatModifiers
|
|
|
|
|
2014-06-12 18:32:42 -07:00
|
|
|
ld a, [wPlayerMoveStruct + MOVE_ACC]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .BrightPowder
|
2014-06-12 18:32:42 -07:00
|
|
|
ld a, [wEnemyMoveStruct + MOVE_ACC]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
|
|
|
|
.BrightPowder
|
|
|
|
push bc
|
|
|
|
call GetOpponentItem
|
|
|
|
ld a, b
|
2013-05-02 22:29:57 -07:00
|
|
|
cp HELD_BRIGHTPOWDER
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, c ; % miss
|
|
|
|
pop bc
|
|
|
|
jr nz, .asm_34d81
|
|
|
|
|
|
|
|
ld c, a
|
|
|
|
ld a, b
|
|
|
|
sub c
|
|
|
|
ld b, a
|
|
|
|
jr nc, .asm_34d81
|
|
|
|
ld b, 0
|
|
|
|
|
|
|
|
.asm_34d81
|
|
|
|
ld a, b
|
|
|
|
cp $ff
|
|
|
|
jr z, .Hit
|
|
|
|
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp b
|
|
|
|
jr nc, .Miss
|
|
|
|
|
|
|
|
.Hit
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
.Miss
|
|
|
|
; Keep the damage value intact if we're using (Hi) Jump Kick.
|
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
cp EFFECT_JUMP_KICK
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .Missed
|
|
|
|
call ResetDamage
|
|
|
|
|
|
|
|
.Missed
|
|
|
|
ld a, 1
|
|
|
|
ld [AttackMissed], a
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
.DreamEater
|
|
|
|
; Return z if we're trying to eat the dream of
|
|
|
|
; a monster that isn't sleeping.
|
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
cp EFFECT_DREAM_EATER
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
and SLP
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
.Protect
|
|
|
|
; Return nz if the opponent is protected.
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS1_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
bit SUBSTATUS_PROTECT, a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
|
|
|
|
|
|
|
ld c, 40
|
|
|
|
call DelayFrames
|
|
|
|
|
|
|
|
; 'protecting itself!'
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, ProtectingItselfText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld c, 40
|
|
|
|
call DelayFrames
|
|
|
|
|
|
|
|
ld a, 1
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
.LockOn
|
|
|
|
; Return nz if we are locked-on and aren't trying to use Earthquake,
|
|
|
|
; Fissure or Magnitude on a monster that is flying.
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS5_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-05-02 23:43:44 -07:00
|
|
|
bit SUBSTATUS_LOCK_ON, [hl]
|
|
|
|
res SUBSTATUS_LOCK_ON, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
bit SUBSTATUS_FLYING, a
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .LockedOn
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
cp EARTHQUAKE
|
|
|
|
ret z
|
|
|
|
cp FISSURE
|
|
|
|
ret z
|
|
|
|
cp MAGNITUDE
|
|
|
|
ret z
|
|
|
|
|
|
|
|
.LockedOn
|
|
|
|
ld a, 1
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
.DrainSub
|
|
|
|
; Return z if using an HP drain move on a substitute.
|
2013-05-02 23:43:44 -07:00
|
|
|
call CheckSubstituteOpp
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_34e00
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-05-02 23:43:44 -07:00
|
|
|
cp EFFECT_LEECH_HIT
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2013-05-02 23:43:44 -07:00
|
|
|
cp EFFECT_DREAM_EATER
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
|
|
|
|
|
|
|
.asm_34e00
|
|
|
|
ld a, 1
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
.FlyDigMoves
|
|
|
|
; Check for moves that can hit underground/flying opponents.
|
|
|
|
; Return z if the current move can hit the opponent.
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
|
|
|
|
2013-05-02 23:43:44 -07:00
|
|
|
bit SUBSTATUS_FLYING, a
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .DigMoves
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
cp GUST
|
|
|
|
ret z
|
|
|
|
cp WHIRLWIND
|
|
|
|
ret z
|
|
|
|
cp THUNDER
|
|
|
|
ret z
|
|
|
|
cp TWISTER
|
|
|
|
ret
|
|
|
|
|
|
|
|
.DigMoves
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
cp EARTHQUAKE
|
|
|
|
ret z
|
|
|
|
cp FISSURE
|
|
|
|
ret z
|
|
|
|
cp MAGNITUDE
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
.ThunderRain
|
|
|
|
; Return z if the current move always hits in rain, and it is raining.
|
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
cp EFFECT_THUNDER
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
|
|
|
|
ld a, [Weather]
|
|
|
|
cp WEATHER_RAIN
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
2014-08-13 19:44:56 -07:00
|
|
|
.XAccuracy
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-08-13 19:44:56 -07:00
|
|
|
bit SUBSTATUS_X_ACCURACY, a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
.StatModifiers
|
|
|
|
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, wPlayerMoveStruct + MOVE_ACC
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [PlayerAccLevel]
|
|
|
|
ld b, a
|
|
|
|
ld a, [EnemyEvaLevel]
|
|
|
|
ld c, a
|
|
|
|
|
|
|
|
jr z, .asm_34e60
|
|
|
|
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, wEnemyMoveStruct + MOVE_ACC
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [EnemyAccLevel]
|
|
|
|
ld b, a
|
|
|
|
ld a, [PlayerEvaLevel]
|
|
|
|
ld c, a
|
|
|
|
|
|
|
|
.asm_34e60
|
|
|
|
cp b
|
|
|
|
jr c, .asm_34e6b
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS1_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
bit SUBSTATUS_IDENTIFIED, a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
|
|
|
|
.asm_34e6b
|
|
|
|
ld a, $e
|
|
|
|
sub c
|
|
|
|
ld c, a
|
|
|
|
xor a
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplicand + 0], a
|
|
|
|
ld [hMultiplicand + 1], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplicand + 2], a
|
2013-03-26 17:39:44 -07:00
|
|
|
push hl
|
|
|
|
ld d, $2
|
|
|
|
|
|
|
|
.asm_34e7a
|
|
|
|
push bc
|
|
|
|
ld hl, .AccProb
|
|
|
|
dec b
|
|
|
|
sla b
|
|
|
|
ld c, b
|
|
|
|
ld b, 0
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
ld a, [hli]
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplier], a
|
2013-03-26 17:39:44 -07:00
|
|
|
call Multiply
|
|
|
|
ld a, [hl]
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hDivisor], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, $4
|
|
|
|
call Divide
|
2015-09-06 14:38:01 -07:00
|
|
|
ld a, [hQuotient + 2]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
2015-09-06 14:38:01 -07:00
|
|
|
ld a, [hQuotient + 1]
|
2013-03-26 17:39:44 -07:00
|
|
|
or b
|
|
|
|
jr nz, .asm_34ea2
|
|
|
|
ld [$ffb5], a
|
|
|
|
ld a, $1
|
|
|
|
ld [$ffb6], a
|
|
|
|
|
|
|
|
.asm_34ea2
|
|
|
|
ld b, c
|
|
|
|
dec d
|
|
|
|
jr nz, .asm_34e7a
|
|
|
|
|
|
|
|
ld a, [$ffb5]
|
|
|
|
and a
|
|
|
|
ld a, [$ffb6]
|
|
|
|
jr z, .asm_34eaf
|
|
|
|
ld a, $ff
|
|
|
|
|
|
|
|
.asm_34eaf
|
|
|
|
pop hl
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.AccProb
|
|
|
|
db 33, 100 ; 33% -6
|
|
|
|
db 36, 100 ; 36% -5
|
|
|
|
db 43, 100 ; 43% -4
|
|
|
|
db 50, 100 ; 50% -3
|
|
|
|
db 60, 100 ; 60% -2
|
|
|
|
db 75, 100 ; 75% -1
|
|
|
|
db 1, 1 ; 100% 0
|
|
|
|
db 133, 100 ; 133% +1
|
|
|
|
db 166, 100 ; 166% +2
|
|
|
|
db 2, 1 ; 200% +3
|
|
|
|
db 233, 100 ; 233% +4
|
|
|
|
db 133, 50 ; 266% +5
|
|
|
|
db 3, 1 ; 300% +6
|
|
|
|
|
|
|
|
; 34ecc
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand90: ; 34ecc
|
2013-03-26 22:52:04 -07:00
|
|
|
; effectchance
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2013-06-13 13:10:39 -07:00
|
|
|
ld [EffectFailed], a
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckSubstituteOpp
|
2013-03-26 22:52:04 -07:00
|
|
|
jr nz, .failed
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
push hl
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, wPlayerMoveStruct + MOVE_CHANCE
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-03-26 22:52:04 -07:00
|
|
|
jr z, .asm_34ee1
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, wEnemyMoveStruct + MOVE_CHANCE
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_34ee1
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp [hl]
|
|
|
|
pop hl
|
|
|
|
ret c
|
2013-03-26 22:52:04 -07:00
|
|
|
|
|
|
|
.failed
|
|
|
|
ld a, 1
|
2013-06-13 13:10:39 -07:00
|
|
|
ld [EffectFailed], a
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; 34eee
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand0a: ; 34eee
|
2014-01-01 05:09:15 -08:00
|
|
|
; lowersub
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
bit SUBSTATUS_SUBSTITUTE, a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
bit SUBSTATUS_CHARGED, a
|
2013-03-26 17:39:44 -07:00
|
|
|
jr nz, .asm_34f18
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_RAZOR_WIND
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_34f21
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_SKY_ATTACK
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_34f21
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_SKULL_BASH
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_34f21
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_SOLARBEAM
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_34f21
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_FLY
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_34f21
|
|
|
|
|
|
|
|
.asm_34f18
|
|
|
|
call .Rampage
|
|
|
|
jr z, .asm_34f21
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34548
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
|
|
|
|
.asm_34f21
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37ed5
|
2013-03-26 17:39:44 -07:00
|
|
|
jr c, .asm_34f36
|
|
|
|
|
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [FXAnimIDHi], a
|
|
|
|
inc a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2014-01-01 05:09:15 -08:00
|
|
|
ld a, SUBSTITUTE
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function37e44
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_34f36
|
2013-03-27 15:50:10 -07:00
|
|
|
call BattleCommanda7
|
2013-03-27 13:19:51 -07:00
|
|
|
jp BattleCommandaa
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.Rampage
|
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_ROLLOUT
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_34f4d
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_RAMPAGE
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_34f4d
|
|
|
|
|
|
|
|
ld a, 1
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_34f4d
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc73e]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ld a, 0
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc73e], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 34f57
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommandab: ; 34f57
|
|
|
|
; hittarget
|
|
|
|
call BattleCommand0a
|
|
|
|
call BattleCommand0b
|
|
|
|
jp BattleCommand0c
|
|
|
|
; 34f60
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand0b: ; 34f60
|
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2013-03-27 13:19:51 -07:00
|
|
|
jp nz, BattleCommandaa
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-04-19 00:50:45 -07:00
|
|
|
ld de, PlayerRolloutCount
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, 1
|
|
|
|
jr z, .asm_34f76
|
2013-04-19 00:50:45 -07:00
|
|
|
ld de, EnemyRolloutCount
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, 4
|
|
|
|
|
|
|
|
.asm_34f76
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-04-25 01:26:37 -07:00
|
|
|
cp EFFECT_MULTI_HIT
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_34fb0
|
2013-04-25 01:26:37 -07:00
|
|
|
cp EFFECT_CONVERSION
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_34fb0
|
2013-04-25 01:26:37 -07:00
|
|
|
cp EFFECT_DOUBLE_HIT
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_34fb0
|
2013-04-25 01:26:37 -07:00
|
|
|
cp EFFECT_TWINEEDLE
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_34fb0
|
2013-04-25 01:26:37 -07:00
|
|
|
cp EFFECT_TRIPLE_KICK
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_34f96
|
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_34f96
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
call PlayFXAnimID
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
cp FLY
|
|
|
|
jr z, .asm_34fad
|
|
|
|
cp DIG
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
.asm_34fad
|
|
|
|
; clear sprite
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function37ec7
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_34fb0
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc689]
|
2013-05-02 23:43:44 -07:00
|
|
|
and 1
|
|
|
|
xor 1
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [de]
|
|
|
|
cp $1
|
|
|
|
push af
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
ld e, a
|
2013-05-02 23:43:44 -07:00
|
|
|
ld d, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
pop af
|
|
|
|
jp z, PlayFXAnimID
|
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
jp PlayFXAnimID
|
|
|
|
; 34fd1
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand92: ; 34fd1
|
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2013-03-27 13:19:51 -07:00
|
|
|
jp nz, BattleCommandaa
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
xor a
|
|
|
|
jr BattleCommand91_92
|
|
|
|
; 34fdb
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand91: ; 34fdb
|
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2013-03-27 13:19:51 -07:00
|
|
|
jp nz, BattleCommandaa
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
ld a, 2
|
|
|
|
jr z, BattleCommand91_92
|
|
|
|
ld a, 5
|
|
|
|
|
|
|
|
; fallthrough
|
|
|
|
; 34feb
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand91_92: ; 34feb
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
jp PlayFXAnimID
|
|
|
|
; 34ffd
|
|
|
|
|
|
|
|
|
2015-10-10 04:45:39 -07:00
|
|
|
BattleCommand_SwitchTurn: ; 34ffd
|
2013-03-26 22:52:04 -07:00
|
|
|
; switchturn
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
2013-03-26 22:52:04 -07:00
|
|
|
xor 1
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hBattleTurn], a
|
|
|
|
ret
|
|
|
|
; 35004
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand0c: ; 35004
|
2014-01-01 05:09:15 -08:00
|
|
|
; raisesub
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
bit SUBSTATUS_SUBSTITUTE, a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37ed5
|
2013-03-26 17:39:44 -07:00
|
|
|
jp c, BattleCommanda6
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [FXAnimIDHi], a
|
|
|
|
ld a, $2
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2014-01-01 05:09:15 -08:00
|
|
|
ld a, SUBSTITUTE
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function37e44
|
2013-03-26 17:39:44 -07:00
|
|
|
; 35023
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand0d: ; 35023
|
2013-03-27 14:07:00 -07:00
|
|
|
; resulttext
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
|
|
|
ret z
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function350e4
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 22:52:04 -07:00
|
|
|
|
|
|
|
cp FLY
|
2014-06-23 12:47:07 -07:00
|
|
|
jr z, .asm_3504f
|
2013-03-26 22:52:04 -07:00
|
|
|
cp DIG
|
2014-06-23 12:47:07 -07:00
|
|
|
jr z, .asm_3504f
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-27 14:33:29 -07:00
|
|
|
; Move effect:
|
2013-03-26 17:39:44 -07:00
|
|
|
inc hl
|
|
|
|
ld a, [hl]
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_MULTI_HIT
|
2013-03-26 22:52:04 -07:00
|
|
|
jr z, .asm_35049
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_DOUBLE_HIT
|
2013-03-26 22:52:04 -07:00
|
|
|
jr z, .asm_35049
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_TWINEEDLE
|
2013-03-26 22:52:04 -07:00
|
|
|
jr z, .asm_35049
|
2013-03-26 17:39:44 -07:00
|
|
|
jp EndMoveEffect
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35049
|
|
|
|
call BattleCommand0c
|
|
|
|
jp EndMoveEffect
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3504f
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-05-02 23:43:44 -07:00
|
|
|
res SUBSTATUS_UNDERGROUND, [hl]
|
|
|
|
res SUBSTATUS_FLYING, [hl]
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37ece
|
2013-03-26 17:39:44 -07:00
|
|
|
jp EndMoveEffect
|
|
|
|
; 3505e
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand0e: ; 3505e
|
2013-03-27 14:07:00 -07:00
|
|
|
; checkfaint
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS1_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
bit SUBSTATUS_ENDURE, a
|
2014-06-23 12:47:07 -07:00
|
|
|
jr z, .asm_35072
|
2013-03-27 14:07:00 -07:00
|
|
|
call BattleCommand4b
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, $0
|
2014-06-23 12:47:07 -07:00
|
|
|
jr nc, .asm_3508b
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, $1
|
2014-06-23 12:47:07 -07:00
|
|
|
jr .asm_3508b
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_35072
|
|
|
|
call GetOpponentItem
|
|
|
|
ld a, b
|
2013-05-02 22:29:57 -07:00
|
|
|
cp HELD_FOCUS_BAND
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, $0
|
2014-06-23 12:47:07 -07:00
|
|
|
jr nz, .asm_3508b
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp c
|
2014-06-23 12:47:07 -07:00
|
|
|
jr nc, .asm_3508b
|
2013-03-27 14:07:00 -07:00
|
|
|
call BattleCommand4b
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, $0
|
2014-06-23 12:47:07 -07:00
|
|
|
jr nc, .asm_3508b
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, $2
|
|
|
|
.asm_3508b
|
|
|
|
push bc
|
|
|
|
call .asm_50bb
|
|
|
|
ld c, $0
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr nz, .asm_3509b
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function35d1c
|
2013-03-26 17:39:44 -07:00
|
|
|
jr .asm_3509e
|
|
|
|
|
|
|
|
.asm_3509b
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function35d7e
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_3509e
|
|
|
|
pop bc
|
|
|
|
ld a, b
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
dec a
|
2014-06-23 12:47:07 -07:00
|
|
|
jr nz, .asm_350ab
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, EnduredText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_350ab
|
|
|
|
call GetOpponentItem
|
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-05-02 22:29:57 -07:00
|
|
|
call GetItemName
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, HungOnText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_50bb
|
2013-05-02 22:29:57 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 22:29:57 -07:00
|
|
|
bit SUBSTATUS_SUBSTITUTE, a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
2013-05-02 22:29:57 -07:00
|
|
|
|
|
|
|
ld de, PlayerDamageTaken + 1
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-05-02 22:29:57 -07:00
|
|
|
jr nz, .asm_350ce
|
|
|
|
ld de, EnemyDamageTaken + 1
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_350ce
|
|
|
|
ld a, [CurDamage + 1]
|
|
|
|
ld b, a
|
|
|
|
ld a, [de]
|
|
|
|
add b
|
|
|
|
ld [de], a
|
|
|
|
dec de
|
|
|
|
ld a, [CurDamage]
|
|
|
|
ld b, a
|
|
|
|
ld a, [de]
|
|
|
|
adc b
|
|
|
|
ld [de], a
|
|
|
|
ret nc
|
|
|
|
ld a, $ff
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld [de], a
|
|
|
|
ret
|
|
|
|
; 350e4
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function350e4: ; 350e4
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, DoesntAffectText
|
|
|
|
ld de, DoesntAffectText
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [TypeModifier]
|
|
|
|
and $7f
|
2014-06-23 12:47:07 -07:00
|
|
|
jr z, .asm_35110
|
2013-05-02 23:43:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
cp EFFECT_FUTURE_SIGHT
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, ButItFailedText
|
|
|
|
ld de, ItFailedText
|
2014-06-23 12:47:07 -07:00
|
|
|
jr z, .asm_35110
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, AttackMissedText
|
|
|
|
ld de, AttackMissed2Text
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [CriticalHit]
|
|
|
|
cp $ff
|
2014-06-23 12:47:07 -07:00
|
|
|
jr nz, .asm_35110
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, UnaffectedText
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35110
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function35157
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [CriticalHit], a
|
2014-06-23 12:47:07 -07:00
|
|
|
|
2013-05-02 23:43:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
cp EFFECT_JUMP_KICK
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
ld a, [TypeModifier]
|
|
|
|
and $7f
|
|
|
|
ret z
|
|
|
|
ld hl, CurDamage
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, [hl]
|
2014-06-23 12:47:07 -07:00
|
|
|
rept 3
|
2013-03-26 17:39:44 -07:00
|
|
|
srl a
|
|
|
|
rr b
|
2014-06-23 12:47:07 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], b
|
|
|
|
dec hl
|
|
|
|
ld [hli], a
|
|
|
|
or b
|
2014-06-23 12:47:07 -07:00
|
|
|
jr nz, .asm_3513e
|
2013-03-26 17:39:44 -07:00
|
|
|
inc a
|
|
|
|
ld [hl], a
|
|
|
|
.asm_3513e
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, CrashedText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $1
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37e36
|
2013-03-26 17:39:44 -07:00
|
|
|
ld c, $1
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-12-31 01:10:49 -08:00
|
|
|
jp nz, Function35d1c
|
|
|
|
jp Function35d7e
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function35157: ; 35157
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS1_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
bit SUBSTATUS_PROTECT, a
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_35162
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
.asm_35162
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 35165
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommanda5: ; 35165
|
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
|
|
|
ld a, [TypeModifier]
|
|
|
|
and $7f
|
|
|
|
jp z, PrintDoesntAffect
|
2013-03-27 15:50:10 -07:00
|
|
|
jp PrintButItFailed
|
2013-03-26 17:39:44 -07:00
|
|
|
; 35175
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand0f: ; 35175
|
|
|
|
; criticaltext
|
|
|
|
; Prints the message for critical hits or one-hit KOs.
|
|
|
|
|
|
|
|
; If there is no message to be printed, wait 20 frames.
|
|
|
|
ld a, [CriticalHit]
|
|
|
|
and a
|
|
|
|
jr z, .wait
|
|
|
|
|
|
|
|
dec a
|
|
|
|
add a
|
2014-06-23 12:47:07 -07:00
|
|
|
ld hl, .texts
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, 0
|
|
|
|
ld c, a
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
xor a
|
|
|
|
ld [CriticalHit], a
|
|
|
|
|
|
|
|
.wait
|
|
|
|
ld c, 20
|
|
|
|
jp DelayFrames
|
|
|
|
|
2014-06-23 12:47:07 -07:00
|
|
|
.texts
|
|
|
|
dw CriticalHitText
|
|
|
|
dw OneHitKOText
|
2013-03-26 17:39:44 -07:00
|
|
|
; 35197
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommandae: ; 35197
|
2013-03-26 22:52:04 -07:00
|
|
|
; startloop
|
|
|
|
|
2013-04-19 00:50:45 -07:00
|
|
|
ld hl, PlayerRolloutCount
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-23 12:47:07 -07:00
|
|
|
jr z, .ok
|
2013-04-19 00:50:45 -07:00
|
|
|
ld hl, EnemyRolloutCount
|
2014-06-23 12:47:07 -07:00
|
|
|
.ok
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 351a5
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommandad: ; 351a5
|
2013-03-26 22:52:04 -07:00
|
|
|
; supereffectivelooptext
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-23 12:47:07 -07:00
|
|
|
bit SUBSTATUS_IN_LOOP, a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
|
|
|
|
; fallthrough
|
|
|
|
; 351ad
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand10: ; 351ad
|
2013-03-26 22:52:04 -07:00
|
|
|
; supereffectivetext
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [TypeModifier]
|
|
|
|
and $7f
|
|
|
|
cp 10 ; 1.0
|
|
|
|
ret z
|
2014-06-23 12:47:07 -07:00
|
|
|
ld hl, SuperEffectiveText
|
2013-03-26 17:39:44 -07:00
|
|
|
jr nc, .print
|
2014-06-23 12:47:07 -07:00
|
|
|
ld hl, NotVeryEffectiveText
|
2013-03-26 17:39:44 -07:00
|
|
|
.print
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 351c0
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand11: ; 351c0
|
2013-03-26 22:52:04 -07:00
|
|
|
; checkdestinybond
|
|
|
|
|
|
|
|
; Faint the user if it fainted an opponent using Destiny Bond.
|
|
|
|
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, EnemyMonHP
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_351cb
|
|
|
|
ld hl, BattleMonHP
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-04-27 14:12:23 -07:00
|
|
|
.asm_351cb
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
or [hl]
|
|
|
|
ret nz
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS5_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
bit SUBSTATUS_DESTINY_BOND, a
|
2013-03-26 22:52:04 -07:00
|
|
|
jr z, .asm_35231
|
|
|
|
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, TookDownWithItText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-04-27 14:12:23 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-04-27 14:12:23 -07:00
|
|
|
ld hl, EnemyMonMaxHP + 1
|
|
|
|
bccoord 2, 2 ; hp bar
|
|
|
|
ld a, 0
|
|
|
|
jr nz, .asm_351f2
|
|
|
|
ld hl, BattleMonMaxHP + 1
|
|
|
|
bccoord 10, 9 ; hp bar
|
|
|
|
ld a, 1
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_351f2
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd10a], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hld]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [Buffer1], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hld]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [Buffer2], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ec], a
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [hld], a
|
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ed], a
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [hl], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ee], a
|
|
|
|
ld [wd1ef], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld h, b
|
|
|
|
ld l, c
|
2014-06-16 11:20:01 -07:00
|
|
|
predef Functionc6e0
|
2013-05-02 21:22:28 -07:00
|
|
|
call RefreshBattleHuds
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [FXAnimIDHi], a
|
|
|
|
inc a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $c2
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37e44
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
jr .asm_3524d ; 3522f $1c
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35231
|
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_MULTI_HIT
|
2013-03-26 22:52:04 -07:00
|
|
|
jr z, .asm_3524a
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_DOUBLE_HIT
|
2013-03-26 22:52:04 -07:00
|
|
|
jr z, .asm_3524a
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_TWINEEDLE
|
2013-03-26 22:52:04 -07:00
|
|
|
jr z, .asm_3524a
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_TRIPLE_KICK
|
2013-03-26 22:52:04 -07:00
|
|
|
jr z, .asm_3524a
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_BEAT_UP
|
2013-03-26 22:52:04 -07:00
|
|
|
jr nz, .asm_3524d
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3524a
|
|
|
|
call BattleCommand0c
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3524d
|
|
|
|
jp EndMoveEffect
|
|
|
|
; 35250
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand12: ; 35250
|
2013-03-26 22:52:04 -07:00
|
|
|
; buildopponentrage
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
jp .start
|
|
|
|
.start
|
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
|
|
|
ret nz
|
2013-03-26 22:52:04 -07:00
|
|
|
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
bit SUBSTATUS_RAGE, a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld de, wc72c
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_3526b
|
2015-02-08 00:03:32 -08:00
|
|
|
ld de, wc72b
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3526b
|
|
|
|
ld a, [de]
|
|
|
|
inc a
|
|
|
|
ret z
|
|
|
|
ld [de], a
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, RageBuildingText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2015-10-10 04:45:39 -07:00
|
|
|
jp BattleCommand_SwitchTurn
|
2013-03-26 17:39:44 -07:00
|
|
|
; 3527b
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommanda2: ; 3527b
|
2013-03-26 22:52:04 -07:00
|
|
|
; ragedamage
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [CurDamage]
|
|
|
|
ld h, a
|
|
|
|
ld b, a
|
|
|
|
ld a, [CurDamage + 1]
|
|
|
|
ld l, a
|
|
|
|
ld c, a
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc72b]
|
2014-06-23 12:47:07 -07:00
|
|
|
jr z, .asm_35290
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc72c]
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35290
|
|
|
|
and a
|
2014-06-23 12:47:07 -07:00
|
|
|
jr z, .asm_3529a
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
|
|
|
add hl, bc
|
2014-06-23 12:47:07 -07:00
|
|
|
jr nc, .asm_35290
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, $ffff
|
|
|
|
.asm_3529a
|
|
|
|
ld a, h
|
|
|
|
ld [CurDamage], a
|
|
|
|
ld a, l
|
|
|
|
ld [CurDamage + 1], a
|
|
|
|
ret
|
|
|
|
; 352a3
|
|
|
|
|
|
|
|
|
|
|
|
EndMoveEffect: ; 352a3
|
|
|
|
ld a, [BattleScriptBufferLoc]
|
|
|
|
ld l, a
|
|
|
|
ld a, [BattleScriptBufferLoc + 1]
|
|
|
|
ld h, a
|
|
|
|
ld a, $ff
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hli], a
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 352b1
|
|
|
|
|
|
|
|
|
|
|
|
DittoMetalPowder: ; 352b1
|
|
|
|
ld a, PartyMon1Species - PartyMon1
|
|
|
|
call BattlePartyAttr
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
ld a, [hl]
|
|
|
|
jr nz, .Ditto
|
|
|
|
ld a, [TempEnemyMonSpecies]
|
|
|
|
|
|
|
|
.Ditto
|
|
|
|
cp DITTO
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
push bc
|
|
|
|
call GetOpponentItem
|
|
|
|
ld a, [hl]
|
|
|
|
cp METAL_POWDER
|
|
|
|
pop bc
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
ld a, c
|
|
|
|
srl a
|
|
|
|
add c
|
|
|
|
ld c, a
|
|
|
|
ret nc
|
|
|
|
|
|
|
|
srl b
|
|
|
|
ld a, b
|
|
|
|
and a
|
|
|
|
jr nz, .asm_352d8
|
|
|
|
inc b
|
|
|
|
.asm_352d8
|
|
|
|
scf
|
|
|
|
rr c
|
|
|
|
ret
|
|
|
|
; 352dc
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand06: ; 352dc
|
2013-04-19 23:53:08 -07:00
|
|
|
; damagestats
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jp nz, EnemyAttackDamage
|
|
|
|
|
|
|
|
; fallthrough
|
|
|
|
; 352e2
|
|
|
|
|
|
|
|
|
|
|
|
PlayerAttackDamage: ; 352e2
|
2013-04-19 23:53:08 -07:00
|
|
|
; Return move power d, player level e, enemy defense c and player attack b.
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
call ResetDamage
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, wPlayerMoveStruct + MOVE_POWER
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
and a
|
|
|
|
ld d, a
|
|
|
|
ret z
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2014-01-05 05:24:27 -08:00
|
|
|
cp SPECIAL
|
2013-04-19 23:53:08 -07:00
|
|
|
jr nc, .special
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.physical
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, EnemyMonDefense
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld c, [hl]
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-04-19 23:57:11 -07:00
|
|
|
ld a, [EnemyScreens]
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SCREENS_REFLECT, a
|
2013-04-19 23:53:08 -07:00
|
|
|
jr z, .physicalcrit
|
2013-03-26 17:39:44 -07:00
|
|
|
sla c
|
|
|
|
rl b
|
2013-04-19 23:53:08 -07:00
|
|
|
|
|
|
|
.physicalcrit
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, BattleMonAttack
|
2013-03-26 17:39:44 -07:00
|
|
|
call GetDamageStatsCritical
|
2013-04-19 23:53:08 -07:00
|
|
|
jr c, .thickclub
|
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, EnemyStats + 2
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld c, [hl]
|
2013-06-13 13:10:39 -07:00
|
|
|
ld hl, PlayerStats
|
2013-04-19 23:53:08 -07:00
|
|
|
jr .thickclub
|
|
|
|
|
|
|
|
.special
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EnemyMonSpclDef
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld c, [hl]
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-04-19 23:57:11 -07:00
|
|
|
ld a, [EnemyScreens]
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SCREENS_LIGHT_SCREEN, a
|
2013-04-19 23:53:08 -07:00
|
|
|
jr z, .specialcrit
|
2013-03-26 17:39:44 -07:00
|
|
|
sla c
|
|
|
|
rl b
|
2013-04-19 23:53:08 -07:00
|
|
|
|
|
|
|
.specialcrit
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BattleMonSpclAtk
|
|
|
|
call GetDamageStatsCritical
|
2013-04-19 23:53:08 -07:00
|
|
|
jr c, .lightball
|
|
|
|
|
2014-06-23 12:47:07 -07:00
|
|
|
ld hl, EnemyStats + SP_DEFENSE * 2
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld c, [hl]
|
2014-06-23 12:47:07 -07:00
|
|
|
ld hl, PlayerStats + SP_ATTACK * 2
|
2013-04-19 23:53:08 -07:00
|
|
|
|
|
|
|
.lightball
|
|
|
|
; Note: Returns player special attack at hl in hl.
|
2013-03-27 15:50:10 -07:00
|
|
|
call LightBallBoost
|
2013-04-19 23:53:08 -07:00
|
|
|
jr .done
|
|
|
|
|
|
|
|
.thickclub
|
|
|
|
; Note: Returns player attack at hl in hl.
|
2013-03-27 15:50:10 -07:00
|
|
|
call ThickClubBoost
|
2013-04-19 23:53:08 -07:00
|
|
|
|
|
|
|
.done
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function3534d
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [BattleMonLevel]
|
|
|
|
ld e, a
|
|
|
|
call DittoMetalPowder
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, 1
|
|
|
|
and a
|
|
|
|
ret
|
2013-03-27 15:50:10 -07:00
|
|
|
; 3534d
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function3534d: ; 3534d
|
2013-04-19 23:53:08 -07:00
|
|
|
; Truncate 16-bit values hl and bc to 8-bit values b and c respectively.
|
|
|
|
; b = hl, c = bc
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, h
|
|
|
|
or b
|
2013-04-19 23:53:08 -07:00
|
|
|
jr z, .asm_3536b
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
srl b
|
|
|
|
rr c
|
|
|
|
srl b
|
|
|
|
rr c
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, c
|
|
|
|
or b
|
2013-04-19 23:53:08 -07:00
|
|
|
jr nz, .asm_3535e
|
2013-03-26 17:39:44 -07:00
|
|
|
inc c
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3535e
|
|
|
|
srl h
|
|
|
|
rr l
|
|
|
|
srl h
|
|
|
|
rr l
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, l
|
|
|
|
or h
|
2013-04-19 23:53:08 -07:00
|
|
|
jr nz, .asm_3536b
|
2013-03-26 17:39:44 -07:00
|
|
|
inc l
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3536b
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
2013-04-19 23:53:08 -07:00
|
|
|
cp 3
|
|
|
|
jr z, .done
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, h
|
|
|
|
or b
|
2013-12-31 01:10:49 -08:00
|
|
|
jr nz, Function3534d
|
2013-04-19 23:53:08 -07:00
|
|
|
|
|
|
|
.done
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, l
|
|
|
|
ret
|
|
|
|
; 35378
|
|
|
|
|
|
|
|
|
|
|
|
GetDamageStatsCritical: ; 35378
|
|
|
|
; Return carry if non-critical.
|
|
|
|
|
|
|
|
ld a, [CriticalHit]
|
|
|
|
and a
|
|
|
|
scf
|
|
|
|
ret z
|
|
|
|
|
|
|
|
; fallthrough
|
|
|
|
; 3537e
|
|
|
|
|
|
|
|
|
|
|
|
GetDamageStats: ; 3537e
|
|
|
|
; Return the attacker's offensive stat and the defender's defensive
|
|
|
|
; stat based on whether the attacking type is physical or special.
|
|
|
|
|
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr nz, .enemy
|
2014-06-12 18:32:42 -07:00
|
|
|
ld a, [wPlayerMoveStruct + MOVE_TYPE]
|
2014-01-05 05:24:27 -08:00
|
|
|
cp SPECIAL
|
2013-03-26 17:39:44 -07:00
|
|
|
; special
|
|
|
|
ld a, [PlayerSAtkLevel]
|
|
|
|
ld b, a
|
|
|
|
ld a, [EnemySDefLevel]
|
|
|
|
jr nc, .end
|
|
|
|
; physical
|
|
|
|
ld a, [PlayerAtkLevel]
|
|
|
|
ld b, a
|
|
|
|
ld a, [EnemyDefLevel]
|
|
|
|
jr .end
|
|
|
|
|
|
|
|
.enemy
|
2014-06-12 18:32:42 -07:00
|
|
|
ld a, [wEnemyMoveStruct + MOVE_TYPE]
|
2014-01-05 05:24:27 -08:00
|
|
|
cp SPECIAL
|
2013-03-26 17:39:44 -07:00
|
|
|
; special
|
|
|
|
ld a, [EnemySAtkLevel]
|
|
|
|
ld b, a
|
|
|
|
ld a, [PlayerSDefLevel]
|
|
|
|
jr nc, .end
|
|
|
|
; physical
|
|
|
|
ld a, [EnemyAtkLevel]
|
|
|
|
ld b, a
|
|
|
|
ld a, [PlayerDefLevel]
|
|
|
|
.end
|
|
|
|
cp b
|
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 353b5
|
|
|
|
|
|
|
|
|
|
|
|
ThickClubBoost: ; 353b5
|
2013-04-19 23:29:39 -07:00
|
|
|
; Return in hl the stat value at hl.
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
; If the attacking monster is Cubone or Marowak and
|
2013-04-19 23:29:39 -07:00
|
|
|
; it's holding a Thick Club, double it.
|
2013-03-26 17:39:44 -07:00
|
|
|
push bc
|
|
|
|
push de
|
|
|
|
ld b, CUBONE
|
|
|
|
ld c, MAROWAK
|
|
|
|
ld d, THICK_CLUB
|
|
|
|
call SpeciesItemBoost
|
|
|
|
pop de
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
; 353c3
|
|
|
|
|
|
|
|
|
|
|
|
LightBallBoost: ; 353c3
|
2013-04-19 23:29:39 -07:00
|
|
|
; Return in hl the stat value at hl.
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
; If the attacking monster is Pikachu and it's
|
2013-04-19 23:29:39 -07:00
|
|
|
; holding a Light Ball, double it.
|
2013-03-26 17:39:44 -07:00
|
|
|
push bc
|
|
|
|
push de
|
|
|
|
ld b, PIKACHU
|
|
|
|
ld c, PIKACHU
|
|
|
|
ld d, LIGHT_BALL
|
|
|
|
call SpeciesItemBoost
|
|
|
|
pop de
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
; 353d1
|
|
|
|
|
|
|
|
|
|
|
|
SpeciesItemBoost: ; 353d1
|
2013-04-19 23:29:39 -07:00
|
|
|
; Return in hl the stat value at hl.
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
; If the attacking monster is species b or c and
|
2013-04-19 23:29:39 -07:00
|
|
|
; it's holding item d, double it.
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, [hli]
|
|
|
|
ld l, [hl]
|
|
|
|
ld h, a
|
|
|
|
|
|
|
|
push hl
|
|
|
|
ld a, PartyMon1Species - PartyMon1
|
|
|
|
call BattlePartyAttr
|
|
|
|
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
ld a, [hl]
|
|
|
|
jr z, .CompareSpecies
|
|
|
|
ld a, [TempEnemyMonSpecies]
|
|
|
|
.CompareSpecies
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
cp b
|
|
|
|
jr z, .GetItem
|
|
|
|
cp c
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
.GetItem
|
|
|
|
push hl
|
|
|
|
call GetUserItem
|
|
|
|
ld a, [hl]
|
|
|
|
pop hl
|
|
|
|
cp d
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
; Double the stat
|
|
|
|
sla l
|
|
|
|
rl h
|
|
|
|
ret
|
|
|
|
; 353f6
|
|
|
|
|
|
|
|
|
|
|
|
EnemyAttackDamage: ; 353f6
|
|
|
|
call ResetDamage
|
|
|
|
|
|
|
|
; No damage dealt with 0 power.
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, wEnemyMoveStruct + MOVE_POWER
|
|
|
|
ld a, [hli] ; hl = wEnemyMoveStruct + MOVE_TYPE
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, a
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
|
|
|
ld a, [hl]
|
2014-01-05 05:24:27 -08:00
|
|
|
cp SPECIAL
|
2013-03-26 17:39:44 -07:00
|
|
|
jr nc, .Special
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.physical
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, BattleMonDefense
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld c, [hl]
|
|
|
|
|
|
|
|
ld a, [PlayerScreens]
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SCREENS_REFLECT, a
|
2013-04-19 23:53:08 -07:00
|
|
|
jr z, .physicalcrit
|
2013-03-26 17:39:44 -07:00
|
|
|
sla c
|
|
|
|
rl b
|
|
|
|
|
2013-04-19 23:53:08 -07:00
|
|
|
.physicalcrit
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, EnemyMonAttack
|
2013-03-26 17:39:44 -07:00
|
|
|
call GetDamageStatsCritical
|
2013-04-19 23:53:08 -07:00
|
|
|
jr c, .thickclub
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, PlayerStats + 2
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld c, [hl]
|
2013-06-13 13:10:39 -07:00
|
|
|
ld hl, EnemyStats
|
2013-04-19 23:53:08 -07:00
|
|
|
jr .thickclub
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.Special
|
|
|
|
ld hl, BattleMonSpclDef
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld c, [hl]
|
|
|
|
|
|
|
|
ld a, [PlayerScreens]
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SCREENS_LIGHT_SCREEN, a
|
2013-04-19 23:53:08 -07:00
|
|
|
jr z, .specialcrit
|
2013-03-26 17:39:44 -07:00
|
|
|
sla c
|
|
|
|
rl b
|
|
|
|
|
2013-04-19 23:53:08 -07:00
|
|
|
.specialcrit
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EnemyMonSpclAtk
|
|
|
|
call GetDamageStatsCritical
|
2013-04-19 23:53:08 -07:00
|
|
|
jr c, .lightball
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, PlayerStats + 8
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld c, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, EnemyStats + 6
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-04-19 23:53:08 -07:00
|
|
|
.lightball
|
2013-03-27 15:50:10 -07:00
|
|
|
call LightBallBoost
|
2013-04-19 23:53:08 -07:00
|
|
|
jr .done
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-04-19 23:53:08 -07:00
|
|
|
.thickclub
|
2013-03-27 15:50:10 -07:00
|
|
|
call ThickClubBoost
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-04-19 23:53:08 -07:00
|
|
|
.done
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function3534d
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [EnemyMonLevel]
|
|
|
|
ld e, a
|
2013-03-27 15:50:10 -07:00
|
|
|
call DittoMetalPowder
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, 1
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; 35461
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommanda1: ; 35461
|
|
|
|
; beatup
|
|
|
|
|
|
|
|
call ResetDamage
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jp nz, .asm_354ef
|
|
|
|
ld a, [PlayerSubStatus3]
|
2014-06-23 12:47:07 -07:00
|
|
|
bit SUBSTATUS_IN_LOOP, a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_35482
|
|
|
|
ld c, 20
|
2013-03-26 17:39:44 -07:00
|
|
|
call DelayFrames
|
|
|
|
xor a
|
2013-04-19 00:50:45 -07:00
|
|
|
ld [PlayerRolloutCount], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [DefaultFlypoint], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc72d], a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr .asm_3548d
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35482
|
2013-04-19 00:50:45 -07:00
|
|
|
ld a, [PlayerRolloutCount]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
ld a, [PartyCount]
|
|
|
|
sub b
|
|
|
|
ld [DefaultFlypoint], a
|
|
|
|
.asm_3548d
|
|
|
|
ld a, [DefaultFlypoint]
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, PartyMonNicknames
|
2013-12-31 01:09:00 -08:00
|
|
|
call GetNick
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $22
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function355bd
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
or [hl]
|
2013-12-31 01:10:49 -08:00
|
|
|
jp z, Function355b0
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [DefaultFlypoint]
|
|
|
|
ld c, a
|
|
|
|
ld a, [CurBattleMon]
|
|
|
|
cp [hl]
|
|
|
|
ld hl, BattleMonStatus
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_354b2
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $20
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function355bd
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_354b2
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2013-12-31 01:10:49 -08:00
|
|
|
jp nz, Function355b0
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $1
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc72d], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BeatUpAttackText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [EnemyMonSpecies]
|
|
|
|
ld [CurSpecies], a
|
2013-12-31 01:09:00 -08:00
|
|
|
call GetBaseData
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [BaseDefense]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld c, a
|
|
|
|
push bc
|
|
|
|
ld a, $0
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function355bd
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
ld [CurSpecies], a
|
2013-12-31 01:09:00 -08:00
|
|
|
call GetBaseData
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [BaseAttack]
|
2013-03-26 17:39:44 -07:00
|
|
|
pop bc
|
|
|
|
ld b, a
|
|
|
|
push bc
|
|
|
|
ld a, $1f
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function355bd
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
ld e, a
|
|
|
|
pop bc
|
2014-06-12 18:32:42 -07:00
|
|
|
ld a, [wPlayerMoveStruct + MOVE_POWER]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_354ef
|
|
|
|
ld a, [EnemySubStatus3]
|
2014-06-23 12:47:07 -07:00
|
|
|
bit SUBSTATUS_IN_LOOP, a
|
2013-03-26 17:39:44 -07:00
|
|
|
jr nz, .asm_35502
|
|
|
|
|
|
|
|
xor a
|
2013-04-19 00:50:45 -07:00
|
|
|
ld [EnemyRolloutCount], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [DefaultFlypoint], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc72d], a
|
2013-03-26 17:39:44 -07:00
|
|
|
jr .asm_3550d
|
|
|
|
|
|
|
|
.asm_35502
|
2013-04-19 00:50:45 -07:00
|
|
|
ld a, [EnemyRolloutCount]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
ld a, [OTPartyCount]
|
|
|
|
sub b
|
|
|
|
ld [DefaultFlypoint], a
|
|
|
|
.asm_3550d
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
|
|
|
jr z, .asm_3556b
|
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
jr nz, .asm_35532
|
|
|
|
|
2015-09-04 13:30:40 -07:00
|
|
|
ld a, [InBattleTowerBattle]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
jr nz, .asm_35532
|
|
|
|
|
|
|
|
ld a, [DefaultFlypoint]
|
|
|
|
ld c, a
|
2014-06-13 21:18:14 -07:00
|
|
|
ld b, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, OTPartySpecies
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-12-31 01:09:00 -08:00
|
|
|
call GetPokemonName
|
2013-03-26 17:39:44 -07:00
|
|
|
jr .asm_35544
|
|
|
|
|
|
|
|
.asm_35532
|
|
|
|
ld a, [DefaultFlypoint]
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, OTPartyMonNicknames
|
2014-06-13 21:18:14 -07:00
|
|
|
ld bc, NAME_LENGTH
|
2013-03-26 17:39:44 -07:00
|
|
|
call AddNTimes
|
|
|
|
ld de, StringBuffer1
|
|
|
|
call CopyBytes
|
|
|
|
.asm_35544
|
|
|
|
ld a, $22
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function355bd
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
or [hl]
|
2013-12-31 01:10:49 -08:00
|
|
|
jp z, Function355b0
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [DefaultFlypoint]
|
|
|
|
ld b, a
|
|
|
|
ld a, [CurOTMon]
|
|
|
|
cp b
|
|
|
|
ld hl, EnemyMonStatus
|
|
|
|
jr z, .asm_35560
|
|
|
|
|
|
|
|
ld a, $20
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function355bd
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35560
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2013-12-31 01:10:49 -08:00
|
|
|
jr nz, Function355b0
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, $1
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc72d], a
|
2013-03-26 17:39:44 -07:00
|
|
|
jr .asm_3557d
|
|
|
|
|
|
|
|
.asm_3556b
|
|
|
|
ld a, [EnemyMonSpecies]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-12-31 01:09:00 -08:00
|
|
|
call GetPokemonName
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BeatUpAttackText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-27 15:50:10 -07:00
|
|
|
jp EnemyAttackDamage
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3557d
|
|
|
|
ld hl, BeatUpAttackText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [BattleMonSpecies]
|
|
|
|
ld [CurSpecies], a
|
2013-04-29 12:08:13 -07:00
|
|
|
call GetBaseData
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [BaseDefense]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld c, a
|
|
|
|
push bc
|
|
|
|
ld a, $0
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function355bd
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
ld [CurSpecies], a
|
2013-04-29 12:08:13 -07:00
|
|
|
call GetBaseData
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [BaseAttack]
|
2013-03-26 17:39:44 -07:00
|
|
|
pop bc
|
|
|
|
ld b, a
|
|
|
|
push bc
|
|
|
|
ld a, $1f
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function355bd
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
ld e, a
|
|
|
|
pop bc
|
2014-06-12 18:32:42 -07:00
|
|
|
ld a, [wEnemyMoveStruct + MOVE_POWER]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, a
|
|
|
|
ret
|
2013-03-27 15:50:10 -07:00
|
|
|
; 355b0
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function355b0: ; 355b0
|
2015-04-13 21:39:54 -07:00
|
|
|
ld b, buildopponentrage_command
|
2013-03-26 22:52:04 -07:00
|
|
|
jp SkipToBattleCommand
|
2013-03-26 17:39:44 -07:00
|
|
|
; 355b5
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommanda8: ; 355b5
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc72d]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
2015-09-09 16:27:07 -07:00
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
jp PrintButItFailed
|
2013-03-26 17:39:44 -07:00
|
|
|
; 355bd
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function355bd: ; 355bd
|
2013-03-26 17:39:44 -07:00
|
|
|
push bc
|
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
ld hl, PartyMon1Species
|
|
|
|
jr z, .asm_355cc
|
2013-04-07 23:15:08 -07:00
|
|
|
ld hl, OTPartyMon1Species
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_355cc
|
|
|
|
ld a, [DefaultFlypoint]
|
|
|
|
add hl, bc
|
|
|
|
call GetPartyLocation
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
2015-10-10 04:45:39 -07:00
|
|
|
BattleCommand_IfAttackMissedResetDamage: ; 355d5
|
2013-03-26 22:52:04 -07:00
|
|
|
; clearmissdamage
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
|
|
|
ret z
|
2015-09-09 16:27:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
jp ResetDamage
|
|
|
|
; 355dd
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function355dd: ; 355dd
|
2013-03-26 17:39:44 -07:00
|
|
|
call ResetDamage
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, BattleMonDefense
|
2013-03-26 17:39:44 -07:00
|
|
|
ld de, PlayerScreens
|
|
|
|
ld a, [BattleMonLevel]
|
|
|
|
jr z, .asm_355f7
|
|
|
|
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, EnemyMonDefense
|
2013-04-19 23:57:11 -07:00
|
|
|
ld de, EnemyScreens
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [EnemyMonLevel]
|
|
|
|
.asm_355f7
|
|
|
|
push af
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld c, [hl]
|
|
|
|
ld a, [de]
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SCREENS_REFLECT, a
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_35604
|
|
|
|
|
|
|
|
sla c
|
|
|
|
rl b
|
|
|
|
.asm_35604
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 3
|
2013-03-26 17:39:44 -07:00
|
|
|
dec hl
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld l, [hl]
|
|
|
|
ld h, a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function3534d
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, $28
|
|
|
|
pop af
|
|
|
|
ld e, a
|
|
|
|
ret
|
|
|
|
; 35612
|
|
|
|
|
|
|
|
|
2015-10-10 04:45:39 -07:00
|
|
|
BattleCommand_DamageCalcWithStats: ; 35612
|
2013-04-19 23:53:08 -07:00
|
|
|
; damagecalc
|
|
|
|
|
|
|
|
; Return a damage value for move power d, player level e, enemy defense c and player attack b.
|
|
|
|
|
|
|
|
; Return 1 if successful, else 0.
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-04-19 23:53:08 -07:00
|
|
|
|
|
|
|
; Selfdestruct and Explosion halve defense.
|
2013-04-25 01:26:37 -07:00
|
|
|
cp EFFECT_EXPLOSION
|
2013-04-19 23:53:08 -07:00
|
|
|
jr nz, .asm_35620
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
srl c
|
2013-04-19 23:53:08 -07:00
|
|
|
jr nz, .asm_35620
|
2013-03-26 17:39:44 -07:00
|
|
|
inc c
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35620
|
2013-04-19 23:53:08 -07:00
|
|
|
|
|
|
|
; Variable-hit moves and Conversion can have a power of 0.
|
2013-04-25 01:26:37 -07:00
|
|
|
cp EFFECT_MULTI_HIT
|
2013-04-19 23:53:08 -07:00
|
|
|
jr z, .asm_3562b
|
|
|
|
|
2013-04-25 01:26:37 -07:00
|
|
|
cp EFFECT_CONVERSION
|
2013-04-19 23:53:08 -07:00
|
|
|
jr z, .asm_3562b
|
|
|
|
|
|
|
|
; No damage if move power is 0.
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, d
|
|
|
|
and a
|
|
|
|
ret z
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3562b
|
2013-04-19 23:53:08 -07:00
|
|
|
; Minimum defense value is 1.
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, c
|
|
|
|
and a
|
2013-04-19 23:53:08 -07:00
|
|
|
jr nz, .asm_35631
|
|
|
|
ld c, 1
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35631
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2013-04-19 23:53:08 -07:00
|
|
|
ld hl, hDividend
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hli], a
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], a
|
2013-04-19 23:53:08 -07:00
|
|
|
|
|
|
|
; Level * 2
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, e
|
|
|
|
add a
|
2013-04-19 23:53:08 -07:00
|
|
|
jr nc, .asm_3563e
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], $1
|
|
|
|
.asm_3563e
|
|
|
|
inc hl
|
|
|
|
ld [hli], a
|
2013-04-19 23:53:08 -07:00
|
|
|
|
|
|
|
; / 5
|
|
|
|
ld a, 5
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hld], a
|
|
|
|
push bc
|
|
|
|
ld b, $4
|
2013-04-19 23:53:08 -07:00
|
|
|
call Divide
|
2013-03-26 17:39:44 -07:00
|
|
|
pop bc
|
2013-04-19 23:53:08 -07:00
|
|
|
|
|
|
|
; + 2
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
inc [hl]
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-04-19 23:53:08 -07:00
|
|
|
|
|
|
|
; * bp
|
2013-03-26 17:39:44 -07:00
|
|
|
inc hl
|
|
|
|
ld [hl], d
|
2013-04-19 23:53:08 -07:00
|
|
|
call Multiply
|
|
|
|
|
|
|
|
; * Attack
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], b
|
2013-04-19 23:53:08 -07:00
|
|
|
call Multiply
|
|
|
|
|
|
|
|
; / Defense
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], c
|
|
|
|
ld b, $4
|
2013-04-19 23:53:08 -07:00
|
|
|
call Divide
|
|
|
|
|
|
|
|
; / 50
|
|
|
|
ld [hl], 50
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, $4
|
2013-04-19 23:53:08 -07:00
|
|
|
call Divide
|
|
|
|
|
|
|
|
; Item boosts
|
2013-03-26 17:39:44 -07:00
|
|
|
call GetUserItem
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, b
|
|
|
|
and a
|
2013-04-19 23:53:08 -07:00
|
|
|
jr z, .DoneItem
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, TypeBoostItems
|
2013-04-19 23:53:08 -07:00
|
|
|
|
|
|
|
.NextItem
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
cp $ff
|
2013-04-19 23:53:08 -07:00
|
|
|
jr z, .DoneItem
|
|
|
|
|
|
|
|
; Item effect
|
2013-03-26 17:39:44 -07:00
|
|
|
cp b
|
|
|
|
ld a, [hli]
|
2013-04-19 23:53:08 -07:00
|
|
|
jr nz, .NextItem
|
|
|
|
|
|
|
|
; Type
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
ld a, BATTLE_VARS_MOVE_TYPE
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
cp b
|
2013-04-19 23:53:08 -07:00
|
|
|
jr nz, .DoneItem
|
|
|
|
|
|
|
|
; * 100 + item effect amount
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, c
|
2013-04-19 23:53:08 -07:00
|
|
|
add 100
|
|
|
|
ld [hMultiplier], a
|
|
|
|
call Multiply
|
|
|
|
|
|
|
|
; / 100
|
|
|
|
ld a, 100
|
|
|
|
ld [hDivisor], a
|
|
|
|
ld b, 4
|
|
|
|
call Divide
|
|
|
|
.DoneItem
|
|
|
|
|
|
|
|
; Critical hits
|
|
|
|
call .CriticalMultiplier
|
|
|
|
|
|
|
|
|
|
|
|
; Update CurDamage (capped at 997).
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CurDamage
|
|
|
|
ld b, [hl]
|
2015-09-09 16:27:07 -07:00
|
|
|
ld a, [hQuotient + 2]
|
2013-03-26 17:39:44 -07:00
|
|
|
add b
|
|
|
|
ld [$ffb6], a
|
2013-04-19 23:53:08 -07:00
|
|
|
jr nc, .asm_356a5
|
|
|
|
|
2015-09-09 16:27:07 -07:00
|
|
|
ld a, [hQuotient + 1]
|
2013-03-26 17:39:44 -07:00
|
|
|
inc a
|
|
|
|
ld [$ffb5], a
|
|
|
|
and a
|
2013-04-19 23:53:08 -07:00
|
|
|
jr z, .Cap
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_356a5
|
|
|
|
ld a, [$ffb3]
|
|
|
|
ld b, a
|
|
|
|
ld a, [$ffb4]
|
|
|
|
or a
|
2013-04-19 23:53:08 -07:00
|
|
|
jr nz, .Cap
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [$ffb5]
|
2013-04-19 23:53:08 -07:00
|
|
|
cp 998 / $100
|
|
|
|
jr c, .asm_356bd
|
|
|
|
|
|
|
|
cp 998 / $100 + 1
|
|
|
|
jr nc, .Cap
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [$ffb6]
|
2013-04-19 23:53:08 -07:00
|
|
|
cp 998 % $100
|
|
|
|
jr nc, .Cap
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_356bd
|
|
|
|
inc hl
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [$ffb6]
|
|
|
|
ld b, [hl]
|
|
|
|
add b
|
|
|
|
ld [hld], a
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [$ffb5]
|
|
|
|
ld b, [hl]
|
|
|
|
adc b
|
|
|
|
ld [hl], a
|
2013-04-19 23:53:08 -07:00
|
|
|
jr c, .Cap
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2013-04-19 23:53:08 -07:00
|
|
|
cp 998 / $100
|
|
|
|
jr c, .asm_356df
|
|
|
|
|
|
|
|
cp 998 / $100 + 1
|
|
|
|
jr nc, .Cap
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
inc hl
|
|
|
|
ld a, [hld]
|
2013-04-19 23:53:08 -07:00
|
|
|
cp 998 % $100
|
|
|
|
jr c, .asm_356df
|
|
|
|
|
|
|
|
.Cap
|
|
|
|
ld a, 997 / $100
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hli], a
|
2013-04-19 23:53:08 -07:00
|
|
|
ld a, 997 % $100
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hld], a
|
2013-04-19 23:53:08 -07:00
|
|
|
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_356df
|
2013-04-19 23:53:08 -07:00
|
|
|
; Minimum neutral damage is 2 (bringing the cap to 999).
|
2013-03-26 17:39:44 -07:00
|
|
|
inc hl
|
|
|
|
ld a, [hl]
|
2013-04-19 23:53:08 -07:00
|
|
|
add 2
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hld], a
|
2013-04-19 23:53:08 -07:00
|
|
|
jr nc, .asm_356e7
|
2013-03-26 17:39:44 -07:00
|
|
|
inc [hl]
|
|
|
|
.asm_356e7
|
2013-04-19 23:53:08 -07:00
|
|
|
|
|
|
|
ld a, 1
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
2013-04-19 23:53:08 -07:00
|
|
|
.CriticalMultiplier
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [CriticalHit]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
2013-04-19 23:53:08 -07:00
|
|
|
; x2
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [$ffb6]
|
|
|
|
add a
|
|
|
|
ld [$ffb6], a
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [$ffb5]
|
|
|
|
rl a
|
|
|
|
ld [$ffb5], a
|
2013-04-19 23:53:08 -07:00
|
|
|
|
|
|
|
; Cap at $ffff.
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nc
|
|
|
|
|
|
|
|
ld a, $ff
|
|
|
|
ld [$ffb5], a
|
|
|
|
ld [$ffb6], a
|
2013-04-19 23:53:08 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 35703
|
|
|
|
|
|
|
|
|
|
|
|
TypeBoostItems: ; 35703
|
2013-05-02 23:43:44 -07:00
|
|
|
db HELD_NORMAL_BOOST, NORMAL ; Pink/Polkadot Bow
|
|
|
|
db HELD_FIGHTING_BOOST, FIGHTING ; Blackbelt
|
|
|
|
db HELD_FLYING_BOOST, FLYING ; Sharp Beak
|
|
|
|
db HELD_POISON_BOOST, POISON ; Poison Barb
|
|
|
|
db HELD_GROUND_BOOST, GROUND ; Soft Sand
|
|
|
|
db HELD_ROCK_BOOST, ROCK ; Hard Stone
|
|
|
|
db HELD_BUG_BOOST, BUG ; Silverpowder
|
|
|
|
db HELD_GHOST_BOOST, GHOST ; Spell Tag
|
|
|
|
db HELD_FIRE_BOOST, FIRE ; Charcoal
|
|
|
|
db HELD_WATER_BOOST, WATER ; Mystic Water
|
|
|
|
db HELD_GRASS_BOOST, GRASS ; Miracle Seed
|
|
|
|
db HELD_ELECTRIC_BOOST, ELECTRIC ; Magnet
|
|
|
|
db HELD_PSYCHIC_BOOST, PSYCHIC ; Twistedspoon
|
|
|
|
db HELD_ICE_BOOST, ICE ; Nevermeltice
|
|
|
|
db HELD_DRAGON_BOOST, DRAGON ; Dragon Scale
|
|
|
|
db HELD_DARK_BOOST, DARK ; Blackglasses
|
|
|
|
db HELD_STEEL_BOOST, STEEL ; Metal Coat
|
2013-03-26 17:39:44 -07:00
|
|
|
db $ff
|
|
|
|
; 35726
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand3f: ; 35726
|
2013-03-26 22:52:04 -07:00
|
|
|
; constantdamage
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, BattleMonLevel
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_35731
|
|
|
|
ld hl, EnemyMonLevel
|
|
|
|
|
|
|
|
.asm_35731
|
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
cp EFFECT_LEVEL_DAMAGE
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, [hl]
|
|
|
|
ld a, 0
|
|
|
|
jr z, .asm_3578c
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
cp EFFECT_PSYWAVE
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_35758
|
|
|
|
|
2013-05-02 23:43:44 -07:00
|
|
|
cp EFFECT_SUPER_FANG
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_3576b
|
|
|
|
|
2013-05-02 23:43:44 -07:00
|
|
|
cp EFFECT_REVERSAL
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_35792
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_POWER
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
ld a, $0
|
|
|
|
jr .asm_3578c
|
|
|
|
|
|
|
|
.asm_35758
|
|
|
|
ld a, b
|
|
|
|
srl a
|
|
|
|
add b
|
|
|
|
ld b, a
|
|
|
|
.asm_3575d
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
jr z, .asm_3575d ; 35761 $fa
|
|
|
|
cp b
|
|
|
|
jr nc, .asm_3575d ; 35764 $f7
|
|
|
|
ld b, a
|
|
|
|
ld a, $0
|
|
|
|
jr .asm_3578c ; 35769 $21
|
|
|
|
.asm_3576b
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, EnemyMonHP
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_35776 ; 35771 $3
|
|
|
|
ld hl, BattleMonHP
|
|
|
|
.asm_35776
|
|
|
|
ld a, [hli]
|
|
|
|
srl a
|
|
|
|
ld b, a
|
|
|
|
ld a, [hl]
|
|
|
|
rr a
|
|
|
|
push af
|
|
|
|
ld a, b
|
|
|
|
pop bc
|
|
|
|
and a
|
|
|
|
jr nz, .asm_3578c ; 35781 $9
|
|
|
|
or b
|
|
|
|
ld a, $0
|
|
|
|
jr nz, .asm_3578c ; 35786 $4
|
|
|
|
ld b, $1
|
|
|
|
jr .asm_3578c ; 3578a $0
|
|
|
|
.asm_3578c
|
|
|
|
ld hl, CurDamage
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], b
|
|
|
|
ret
|
|
|
|
.asm_35792
|
|
|
|
ld hl, BattleMonHP
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_3579d ; 35798 $3
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, EnemyMonHP
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3579d
|
|
|
|
xor a
|
|
|
|
ld [$ffb3], a
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplicand + 0], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplicand + 1], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplicand + 2], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $30
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplier], a
|
2013-05-02 23:43:44 -07:00
|
|
|
call Multiply
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld a, [hl]
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hDivisor], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, b
|
|
|
|
and a
|
|
|
|
jr z, .asm_357d6
|
|
|
|
|
|
|
|
ld a, [$ffb7]
|
|
|
|
srl b
|
|
|
|
rr a
|
|
|
|
srl b
|
|
|
|
rr a
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hDivisor], a
|
|
|
|
ld a, [hProduct + 2]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
srl b
|
2015-09-06 14:38:01 -07:00
|
|
|
ld a, [hProduct + 3]
|
2013-03-26 17:39:44 -07:00
|
|
|
rr a
|
|
|
|
srl b
|
|
|
|
rr a
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hDividend + 3], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, b
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hDividend + 2], a
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_357d6
|
|
|
|
ld b, $4
|
2013-05-02 23:43:44 -07:00
|
|
|
call Divide
|
2015-09-06 14:38:01 -07:00
|
|
|
ld a, [hQuotient + 2]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
2013-05-02 23:43:44 -07:00
|
|
|
ld hl, .FlailPower
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_357e1
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
|
|
|
jr nc, .asm_357e8
|
|
|
|
inc hl
|
|
|
|
jr .asm_357e1
|
|
|
|
|
|
|
|
.asm_357e8
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
ld a, [hl]
|
2015-09-09 16:27:07 -07:00
|
|
|
jr nz, .notPlayersTurn
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, wPlayerMoveStruct + MOVE_POWER
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], a
|
|
|
|
push hl
|
|
|
|
call PlayerAttackDamage
|
2015-09-09 16:27:07 -07:00
|
|
|
jr .notEnemysTurn
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2015-09-09 16:27:07 -07:00
|
|
|
.notPlayersTurn
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, wEnemyMoveStruct + MOVE_POWER
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], a
|
|
|
|
push hl
|
|
|
|
call EnemyAttackDamage
|
|
|
|
|
2015-09-09 16:27:07 -07:00
|
|
|
.notEnemysTurn
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_DamageCalcWithStats
|
2013-03-26 17:39:44 -07:00
|
|
|
pop hl
|
|
|
|
ld [hl], 1
|
|
|
|
ret
|
|
|
|
|
2013-05-02 23:43:44 -07:00
|
|
|
.FlailPower
|
|
|
|
; px, bp
|
|
|
|
db 1, 200
|
|
|
|
db 4, 150
|
|
|
|
db 9, 100
|
|
|
|
db 16, 80
|
|
|
|
db 32, 40
|
|
|
|
db 48, 20
|
2013-03-26 17:39:44 -07:00
|
|
|
; 35813
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand40: ; 35813
|
2013-03-26 22:52:04 -07:00
|
|
|
; counter
|
|
|
|
|
2014-01-05 05:24:27 -08:00
|
|
|
ld a, 1
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [AttackMissed], a
|
|
|
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret z
|
2013-03-27 15:50:10 -07:00
|
|
|
|
2014-01-05 05:24:27 -08:00
|
|
|
ld b, a
|
2013-12-30 20:32:37 -08:00
|
|
|
callab GetMoveEffect
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, b
|
2014-01-05 05:24:27 -08:00
|
|
|
cp EFFECT_COUNTER
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2014-01-05 05:24:27 -08:00
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
call BattleCommanda3
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd265]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret z
|
2014-01-05 05:24:27 -08:00
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function36abf
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2014-01-05 05:24:27 -08:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
|
|
|
ld de, StringBuffer1
|
|
|
|
call GetMoveData
|
2014-01-05 05:24:27 -08:00
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [StringBuffer1 + 2]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret z
|
2014-01-05 05:24:27 -08:00
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [StringBuffer1 + 3]
|
2014-01-05 05:24:27 -08:00
|
|
|
cp SPECIAL
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nc
|
2014-01-05 05:24:27 -08:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CurDamage
|
|
|
|
ld a, [hli]
|
|
|
|
or [hl]
|
|
|
|
ret z
|
2014-01-05 05:24:27 -08:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
add a
|
|
|
|
ld [hld], a
|
|
|
|
ld a, [hl]
|
|
|
|
adc a
|
|
|
|
ld [hl], a
|
2014-01-05 05:24:27 -08:00
|
|
|
jr nc, .capped
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $ff
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
2014-01-05 05:24:27 -08:00
|
|
|
.capped
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [AttackMissed], a
|
|
|
|
ret
|
|
|
|
; 35864
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand41: ; 35864
|
2013-03-26 22:52:04 -07:00
|
|
|
; encore
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EnemyMonMoves
|
2013-05-02 22:29:57 -07:00
|
|
|
ld de, EnemyEncoreCount
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-17 12:52:32 -07:00
|
|
|
jr z, .ok
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BattleMonMoves
|
|
|
|
ld de, PlayerEncoreCount
|
2014-06-17 12:52:32 -07:00
|
|
|
.ok
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_LAST_MOVE_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2014-06-17 12:52:32 -07:00
|
|
|
jp z, .failed
|
2013-03-27 15:50:10 -07:00
|
|
|
cp STRUGGLE
|
2014-06-17 12:52:32 -07:00
|
|
|
jp z, .failed
|
2013-03-27 15:50:10 -07:00
|
|
|
cp ENCORE
|
2014-06-17 12:52:32 -07:00
|
|
|
jp z, .failed
|
2013-03-27 15:50:10 -07:00
|
|
|
cp MIRROR_MOVE
|
2014-06-17 12:52:32 -07:00
|
|
|
jp z, .failed
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
2013-03-27 15:50:10 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3588e
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
2013-03-27 15:50:10 -07:00
|
|
|
jr nz, .asm_3588e
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld bc, $0005
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and $3f
|
2014-06-17 12:52:32 -07:00
|
|
|
jp z, .failed
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2014-06-17 12:52:32 -07:00
|
|
|
jp nz, .failed
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS5_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-17 12:52:32 -07:00
|
|
|
bit SUBSTATUS_ENCORED, [hl]
|
|
|
|
jp nz, .failed
|
|
|
|
set SUBSTATUS_ENCORED, [hl]
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
and $3
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 3
|
2013-03-26 17:39:44 -07:00
|
|
|
inc a
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [de], a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function36abf
|
2013-03-27 15:50:10 -07:00
|
|
|
jr nz, .asm_3591a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-03-27 15:50:10 -07:00
|
|
|
jr z, .asm_358ef
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
push hl
|
|
|
|
ld a, [LastPlayerMove]
|
|
|
|
ld b, a
|
2014-06-13 21:18:14 -07:00
|
|
|
ld c, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BattleMonMoves
|
|
|
|
.asm_358cc
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
2013-03-27 15:50:10 -07:00
|
|
|
jr z, .asm_358dd
|
2013-03-26 17:39:44 -07:00
|
|
|
inc c
|
|
|
|
ld a, c
|
2014-06-13 21:18:14 -07:00
|
|
|
cp NUM_MOVES
|
2013-03-27 15:50:10 -07:00
|
|
|
jr c, .asm_358cc
|
2013-03-26 17:39:44 -07:00
|
|
|
pop hl
|
2014-06-17 12:52:32 -07:00
|
|
|
res SUBSTATUS_ENCORED, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [de], a
|
2014-06-17 12:52:32 -07:00
|
|
|
jr .failed
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_358dd
|
|
|
|
pop hl
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, c
|
|
|
|
ld [CurMoveNum], a
|
|
|
|
ld a, b
|
|
|
|
ld [CurPlayerMove], a
|
|
|
|
dec a
|
2014-06-12 18:32:42 -07:00
|
|
|
ld de, wPlayerMoveStruct
|
2013-03-26 17:39:44 -07:00
|
|
|
call GetMoveData
|
2013-03-27 15:50:10 -07:00
|
|
|
jr .asm_3591a
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_358ef
|
|
|
|
push hl
|
|
|
|
ld a, [LastEnemyMove]
|
|
|
|
ld b, a
|
2014-06-13 21:18:14 -07:00
|
|
|
ld c, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EnemyMonMoves
|
|
|
|
.asm_358f9
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
2013-03-27 15:50:10 -07:00
|
|
|
jr z, .asm_3590a
|
2013-03-26 17:39:44 -07:00
|
|
|
inc c
|
|
|
|
ld a, c
|
2014-06-13 21:18:14 -07:00
|
|
|
cp NUM_MOVES
|
2013-03-27 15:50:10 -07:00
|
|
|
jr c, .asm_358f9
|
2013-03-26 17:39:44 -07:00
|
|
|
pop hl
|
2014-06-17 12:52:32 -07:00
|
|
|
res SUBSTATUS_ENCORED, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [de], a
|
2014-06-17 12:52:32 -07:00
|
|
|
jr .failed
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3590a
|
|
|
|
pop hl
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, c
|
|
|
|
ld [CurEnemyMoveNum], a
|
|
|
|
ld a, b
|
|
|
|
ld [CurEnemyMove], a
|
|
|
|
dec a
|
2014-06-12 18:32:42 -07:00
|
|
|
ld de, wEnemyMoveStruct
|
2013-03-26 17:39:44 -07:00
|
|
|
call GetMoveData
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3591a
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, GotAnEncoreText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-27 15:50:10 -07:00
|
|
|
|
2014-06-17 12:52:32 -07:00
|
|
|
.failed
|
2013-03-26 17:39:44 -07:00
|
|
|
jp PrintDidntAffect2
|
|
|
|
; 35926
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand42: ; 35926
|
2013-03-26 22:52:04 -07:00
|
|
|
; painsplit
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2013-12-31 01:10:49 -08:00
|
|
|
jp nz, Function359cd
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckSubstituteOpp
|
2013-12-31 01:10:49 -08:00
|
|
|
jp nz, Function359cd
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, BattleMonMaxHP + 1
|
2014-06-12 18:32:42 -07:00
|
|
|
ld de, EnemyMonMaxHP + 1
|
2013-03-26 17:39:44 -07:00
|
|
|
call .asm_3597d
|
|
|
|
ld a, $1
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd10a], a
|
2014-06-04 01:10:56 -07:00
|
|
|
hlcoord 10, 9
|
2014-06-16 11:20:01 -07:00
|
|
|
predef Functionc6e0
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, EnemyMonHP
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ed], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ec], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [Buffer2], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [Buffer1], a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function359ac
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd10a], a
|
2013-03-26 17:39:44 -07:00
|
|
|
call ResetDamage
|
2014-06-04 01:10:56 -07:00
|
|
|
hlcoord 2, 2
|
2014-06-16 11:20:01 -07:00
|
|
|
predef Functionc6e0
|
2013-10-01 17:47:54 -07:00
|
|
|
callba Function178000
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, SharedPainText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_3597d
|
|
|
|
ld a, [hld]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [Buffer1], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hld]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [Buffer2], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hld]
|
|
|
|
ld b, a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ec], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ed], a
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
dec de
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [de]
|
|
|
|
dec de
|
|
|
|
add b
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [CurDamage + 1], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, [hl]
|
|
|
|
ld a, [de]
|
|
|
|
adc b
|
|
|
|
srl a
|
|
|
|
ld [CurDamage], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [CurDamage + 1]
|
2013-03-26 17:39:44 -07:00
|
|
|
rr a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [CurDamage + 1], a
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 3
|
2013-03-26 17:39:44 -07:00
|
|
|
inc hl
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
|
|
|
rept 3
|
2013-03-26 17:39:44 -07:00
|
|
|
inc de
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-27 15:50:10 -07:00
|
|
|
|
|
|
|
; fallthrough
|
|
|
|
; 359ac
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function359ac: ; 359ac
|
2013-03-26 17:39:44 -07:00
|
|
|
ld c, [hl]
|
|
|
|
dec hl
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [CurDamage + 1]
|
2013-03-26 17:39:44 -07:00
|
|
|
sub c
|
|
|
|
ld b, [hl]
|
|
|
|
dec hl
|
|
|
|
ld a, [CurDamage]
|
|
|
|
sbc b
|
|
|
|
jr nc, .asm_359c2
|
|
|
|
|
|
|
|
ld a, [CurDamage]
|
|
|
|
ld b, a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [CurDamage + 1]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld c, a
|
|
|
|
.asm_359c2
|
|
|
|
ld a, c
|
|
|
|
ld [hld], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ee], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, b
|
|
|
|
ld [hli], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ef], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
2013-03-27 15:50:10 -07:00
|
|
|
; 359cd
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function359cd: ; 359cd
|
2013-03-27 15:50:10 -07:00
|
|
|
jp PrintDidntAffect2
|
2013-03-26 17:39:44 -07:00
|
|
|
; 359d0
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand43: ; 359d0
|
2013-03-26 22:52:04 -07:00
|
|
|
; snore
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_STATUS
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
and SLP
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
call ResetDamage
|
|
|
|
ld a, $1
|
|
|
|
ld [AttackMissed], a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37354
|
2013-03-26 17:39:44 -07:00
|
|
|
jp EndMoveEffect
|
|
|
|
; 359e6
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand44: ; 359e6
|
2013-03-26 22:52:04 -07:00
|
|
|
; conversion2
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_35a50
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BattleMonType1
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_359f7
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EnemyMonType1
|
|
|
|
.asm_359f7
|
|
|
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35a50
|
2013-03-26 17:39:44 -07:00
|
|
|
push hl
|
|
|
|
dec a
|
2014-06-10 23:23:55 -07:00
|
|
|
ld hl, Moves + MOVE_TYPE
|
2013-03-27 13:19:51 -07:00
|
|
|
call GetMoveAttr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, a
|
|
|
|
pop hl
|
2013-05-02 23:43:44 -07:00
|
|
|
cp CURSE_T
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35a50
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35a13
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
and $1f
|
2014-06-13 21:18:14 -07:00
|
|
|
cp UNUSED_TYPES
|
|
|
|
jr c, .asm_35a24
|
|
|
|
cp UNUSED_TYPES_END
|
|
|
|
jr c, .asm_35a13
|
|
|
|
cp TYPES_END
|
|
|
|
jr nc, .asm_35a13
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35a24
|
|
|
|
ld [hli], a
|
|
|
|
ld [hld], a
|
|
|
|
push hl
|
|
|
|
ld a, BATTLE_VARS_MOVE_TYPE
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
push af
|
|
|
|
push hl
|
|
|
|
ld a, d
|
|
|
|
ld [hl], a
|
2015-09-11 19:21:00 -07:00
|
|
|
call HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn
|
2013-03-26 17:39:44 -07:00
|
|
|
pop hl
|
|
|
|
pop af
|
|
|
|
ld [hl], a
|
|
|
|
pop hl
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd265]
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nc, .asm_35a13
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2014-06-16 11:20:01 -07:00
|
|
|
predef GetTypeName
|
2014-01-05 04:28:55 -08:00
|
|
|
ld hl, TransformedTypeText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35a50
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function37354
|
2013-03-26 17:39:44 -07:00
|
|
|
; 35a53
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand45: ; 35a53
|
2013-03-26 22:52:04 -07:00
|
|
|
; lockon
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckSubstituteOpp
|
2013-05-02 23:43:44 -07:00
|
|
|
jr nz, .asm_35a6e
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2013-05-02 23:43:44 -07:00
|
|
|
jr nz, .asm_35a6e
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS5_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-05-02 23:43:44 -07:00
|
|
|
set SUBSTATUS_LOCK_ON, [hl]
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, TookAimText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35a6e
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-26 17:39:44 -07:00
|
|
|
jp PrintDidntAffect
|
|
|
|
; 35a74
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand46: ; 35a74
|
2013-03-26 22:52:04 -07:00
|
|
|
; sketch
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function372d8
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35a83
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-26 17:39:44 -07:00
|
|
|
jp PrintNothingHappened
|
|
|
|
.asm_35a83
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckSubstituteOpp
|
2013-05-02 23:43:44 -07:00
|
|
|
jp nz, .asm_35b10
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS5_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SUBSTATUS_TRANSFORMED, [hl]
|
2013-05-02 23:43:44 -07:00
|
|
|
jp nz, .asm_35b10
|
2014-06-13 21:18:14 -07:00
|
|
|
|
|
|
|
ld a, PartyMon1Moves - PartyMon1
|
2013-05-02 23:43:44 -07:00
|
|
|
call UserPartyAttr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ld hl, BattleMonMoves
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35aa5
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EnemyMonMoves
|
|
|
|
.asm_35aa5
|
|
|
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35b10
|
2013-05-02 23:43:44 -07:00
|
|
|
cp STRUGGLE
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35b10
|
|
|
|
ld c, NUM_MOVES
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35ab7
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35b10
|
2013-03-26 17:39:44 -07:00
|
|
|
dec c
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_35ab7
|
2013-03-26 17:39:44 -07:00
|
|
|
dec hl
|
2014-06-13 21:18:14 -07:00
|
|
|
ld c, NUM_MOVES
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35ac1
|
|
|
|
dec c
|
|
|
|
ld a, [hld]
|
2013-05-02 23:43:44 -07:00
|
|
|
cp SKETCH
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_35ac1
|
2013-03-26 17:39:44 -07:00
|
|
|
inc hl
|
|
|
|
ld a, b
|
|
|
|
ld [hl], a
|
|
|
|
push bc
|
|
|
|
push hl
|
|
|
|
dec a
|
2014-06-10 23:23:55 -07:00
|
|
|
ld hl, Moves + MOVE_PP
|
2013-03-27 13:19:51 -07:00
|
|
|
call GetMoveAttr
|
2013-03-26 17:39:44 -07:00
|
|
|
pop hl
|
2014-06-10 23:23:55 -07:00
|
|
|
ld bc, BattleMonPP - BattleMonMoves
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
pop bc
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35af6
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_35af6
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
push bc
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc739
|
2014-06-13 21:18:14 -07:00
|
|
|
ld b, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc735
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
ld [hl], b
|
2014-06-13 21:18:14 -07:00
|
|
|
jr .asm_35b04
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35af6
|
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
ld l, c
|
2014-06-13 21:18:14 -07:00
|
|
|
ld h, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, de
|
|
|
|
ld a, b
|
|
|
|
ld [hl], a
|
|
|
|
pop af
|
|
|
|
ld de, $0015
|
|
|
|
add hl, de
|
|
|
|
ld [hl], a
|
|
|
|
.asm_35b04
|
2013-05-02 23:43:44 -07:00
|
|
|
call GetMoveName
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, SketchedText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35b10
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-26 17:39:44 -07:00
|
|
|
jp PrintDidntAffect
|
|
|
|
; 35b16
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand47: ; 35b16
|
2013-03-26 22:52:04 -07:00
|
|
|
; defrostopponent
|
2014-06-13 21:18:14 -07:00
|
|
|
; Thaw the opponent if frozen, and
|
|
|
|
; raise the user's Attack one stage.
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 22:52:04 -07:00
|
|
|
call Defrost
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
push hl
|
|
|
|
push af
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
ld a, EFFECT_ATTACK_UP
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], a
|
|
|
|
call BattleCommand1c
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
pop af
|
|
|
|
pop hl
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 35b33
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand48: ; 35b33
|
2013-03-26 22:52:04 -07:00
|
|
|
; sleeptalk
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function372d8
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_35ba3
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld hl, BattleMonMoves + 1
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [DisabledMove]
|
|
|
|
ld d, a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35b4f
|
2014-06-10 23:08:07 -07:00
|
|
|
ld hl, EnemyMonMoves + 1
|
2013-05-03 18:04:34 -07:00
|
|
|
ld a, [EnemyDisabledMove]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, a
|
|
|
|
.asm_35b4f
|
|
|
|
ld a, BATTLE_VARS_STATUS
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-10 23:08:07 -07:00
|
|
|
and SLP
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35ba3
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35ba3
|
2013-03-26 17:39:44 -07:00
|
|
|
call .asm_35ba9
|
2014-06-13 21:18:14 -07:00
|
|
|
jr c, .asm_35ba3
|
2013-03-26 17:39:44 -07:00
|
|
|
dec hl
|
|
|
|
.asm_35b62
|
|
|
|
push hl
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2014-06-10 23:08:07 -07:00
|
|
|
and 3 ; TODO factor in NUM_MOVES
|
2013-03-26 17:39:44 -07:00
|
|
|
ld c, a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld b, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
pop hl
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35b62
|
2013-03-26 17:39:44 -07:00
|
|
|
ld e, a
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
cp e
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35b62
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, e
|
|
|
|
cp d
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35b62
|
2013-03-26 17:39:44 -07:00
|
|
|
call .asm_35bdf
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35b62
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, e
|
|
|
|
ld [hl], a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34548
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_35b9a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc689]
|
2013-03-26 17:39:44 -07:00
|
|
|
push af
|
|
|
|
call BattleCommand0a
|
|
|
|
pop af
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35b9a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37e36
|
2013-03-26 17:39:44 -07:00
|
|
|
call UpdateMoveData
|
|
|
|
jp ResetTurn
|
|
|
|
.asm_35ba3
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-27 15:50:10 -07:00
|
|
|
jp TryPrintButItFailed
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_35ba9
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
call .asm_35bb3
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_35bb3
|
2013-03-26 22:52:04 -07:00
|
|
|
ld a, [hBattleTurn]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ld a, [DisabledMove]
|
|
|
|
jr z, .asm_35bbe
|
|
|
|
|
2013-05-03 18:04:34 -07:00
|
|
|
ld a, [EnemyDisabledMove]
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35bbe
|
|
|
|
ld b, a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
ld c, a
|
|
|
|
dec hl
|
2014-06-10 23:08:07 -07:00
|
|
|
ld d, NUM_MOVES
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35bc8
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .asm_35bdb
|
|
|
|
|
|
|
|
cp c
|
|
|
|
jr z, .asm_35bd7
|
|
|
|
cp b
|
|
|
|
jr z, .asm_35bd7
|
|
|
|
|
|
|
|
call .asm_35bdf
|
|
|
|
jr nz, .asm_35bdd
|
|
|
|
|
|
|
|
.asm_35bd7
|
|
|
|
inc hl
|
|
|
|
dec d
|
|
|
|
jr nz, .asm_35bc8
|
|
|
|
|
|
|
|
.asm_35bdb
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_35bdd
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_35bdf
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
|
|
|
|
ld b, a
|
2013-12-30 20:32:37 -08:00
|
|
|
callab GetMoveEffect
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, b
|
|
|
|
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
|
2014-06-10 23:08:07 -07:00
|
|
|
cp EFFECT_SKULL_BASH
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2014-06-10 23:08:07 -07:00
|
|
|
cp EFFECT_RAZOR_WIND
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2014-06-10 23:08:07 -07:00
|
|
|
cp EFFECT_SKY_ATTACK
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2014-06-10 23:08:07 -07:00
|
|
|
cp EFFECT_SOLARBEAM
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2014-06-10 23:08:07 -07:00
|
|
|
cp EFFECT_FLY
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2014-06-10 23:08:07 -07:00
|
|
|
cp EFFECT_BIDE
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 35bff
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand49: ; 35bff
|
2013-03-26 22:52:04 -07:00
|
|
|
; destinybond
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS5
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-10 23:08:07 -07:00
|
|
|
set SUBSTATUS_DESTINY_BOND, [hl]
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, DestinyBondEffectText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 35c0f
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand4a: ; 35c0f
|
2013-03-26 22:52:04 -07:00
|
|
|
; spite
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2013-05-02 23:43:44 -07:00
|
|
|
jp nz, .asm_35c91
|
2014-06-23 12:45:30 -07:00
|
|
|
ld bc, PartyMon2 - PartyMon1 ; ????
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EnemyMonMoves
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35c24
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BattleMonMoves
|
|
|
|
.asm_35c24
|
|
|
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35c91
|
2014-06-10 23:08:07 -07:00
|
|
|
cp STRUGGLE
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35c91
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
2014-06-23 12:45:30 -07:00
|
|
|
ld c, -1
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35c33
|
|
|
|
inc c
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_35c33
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-03-26 17:39:44 -07:00
|
|
|
dec hl
|
2014-06-23 12:45:30 -07:00
|
|
|
ld b, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
push bc
|
2014-06-23 12:45:30 -07:00
|
|
|
ld c, BattleMonPP - BattleMonMoves
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
ld a, [hl]
|
|
|
|
and $3f
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35c91
|
2013-03-26 17:39:44 -07:00
|
|
|
push bc
|
2013-05-02 23:43:44 -07:00
|
|
|
call GetMoveName
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2014-06-10 23:08:07 -07:00
|
|
|
and 3
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
inc a
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
ld a, [hl]
|
|
|
|
and $3f
|
|
|
|
cp b
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nc, .asm_35c5b
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
.asm_35c5b
|
|
|
|
ld a, [hl]
|
|
|
|
sub b
|
|
|
|
ld [hl], a
|
|
|
|
push af
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, PartyMon1PP - PartyMon1
|
2013-05-02 23:43:44 -07:00
|
|
|
call OpponentPartyAttr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, b
|
|
|
|
pop af
|
|
|
|
pop bc
|
|
|
|
add hl, bc
|
|
|
|
ld e, a
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS5_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SUBSTATUS_TRANSFORMED, a
|
|
|
|
jr nz, .asm_35c82
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_35c81
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_35c81
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc739
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
.asm_35c81
|
|
|
|
ld [hl], e
|
|
|
|
.asm_35c82
|
|
|
|
push de
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
pop de
|
|
|
|
ld a, d
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, SpiteEffectText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35c91
|
|
|
|
jp PrintDidntAffect2
|
|
|
|
; 35c94
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand4b: ; 35c94
|
2013-03-26 22:52:04 -07:00
|
|
|
; falseswipe
|
|
|
|
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, EnemyMonHP
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35c9f
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BattleMonHP
|
|
|
|
.asm_35c9f
|
|
|
|
ld de, CurDamage
|
|
|
|
ld c, $2
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
call StringCmp
|
|
|
|
pop de
|
|
|
|
pop hl
|
2014-06-13 21:18:14 -07:00
|
|
|
jr c, .asm_35cc7
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hl]
|
|
|
|
dec a
|
|
|
|
ld [de], a
|
|
|
|
inc a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_35cba
|
2013-03-26 17:39:44 -07:00
|
|
|
dec de
|
|
|
|
ld a, [de]
|
|
|
|
dec a
|
|
|
|
ld [de], a
|
|
|
|
.asm_35cba
|
|
|
|
ld a, [CriticalHit]
|
|
|
|
cp $2
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_35cc5
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [CriticalHit], a
|
|
|
|
.asm_35cc5
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
.asm_35cc7
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; 35cc9
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand4c: ; 35cc9
|
2013-03-26 22:52:04 -07:00
|
|
|
; healbell
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS1
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-10 23:08:07 -07:00
|
|
|
res SUBSTATUS_NIGHTMARE, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld de, PartyMon1Status
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35cdb
|
2013-03-26 17:39:44 -07:00
|
|
|
ld de, OTPartyMon1Status
|
|
|
|
.asm_35cdb
|
|
|
|
ld a, BATTLE_VARS_STATUS
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [hl], a
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
2014-06-10 23:08:07 -07:00
|
|
|
ld bc, PartyMon2 - PartyMon1
|
|
|
|
ld d, PartyEnd - PartySpecies
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35ce9
|
|
|
|
ld [hl], a
|
|
|
|
add hl, bc
|
|
|
|
dec d
|
2013-03-27 14:07:00 -07:00
|
|
|
jr nz, .asm_35ce9
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, BellChimedText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-12-31 01:10:49 -08:00
|
|
|
jp z, Function365d7
|
|
|
|
jp Function365fd
|
2013-03-26 17:39:44 -07:00
|
|
|
; 35d00
|
|
|
|
|
|
|
|
|
|
|
|
FarPlayBattleAnimation: ; 35d00
|
|
|
|
; play animation de
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-13 21:18:14 -07:00
|
|
|
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
|
|
|
|
; fallthrough
|
|
|
|
; 35d08
|
|
|
|
|
|
|
|
PlayFXAnimID: ; 35d08
|
|
|
|
ld a, e
|
|
|
|
ld [FXAnimIDLo], a
|
|
|
|
ld a, d
|
|
|
|
ld [FXAnimIDHi], a
|
|
|
|
|
|
|
|
ld c, 3
|
|
|
|
call DelayFrames
|
|
|
|
|
2013-12-03 21:44:45 -08:00
|
|
|
callab PlayBattleAnim
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ret
|
|
|
|
; 35d1c
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function35d1c: ; 35d1c
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CurDamage
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld a, [hl]
|
|
|
|
or b
|
|
|
|
jr z, .asm_35d7b
|
|
|
|
|
|
|
|
ld a, c
|
|
|
|
and a
|
|
|
|
jr nz, .asm_35d31
|
|
|
|
|
|
|
|
ld a, [EnemySubStatus4]
|
2014-06-10 23:08:07 -07:00
|
|
|
bit SUBSTATUS_SUBSTITUTE, a
|
2013-12-31 01:10:49 -08:00
|
|
|
jp nz, Function35de0
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35d31
|
|
|
|
ld a, [hld]
|
|
|
|
ld b, a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, [EnemyMonHP + 1]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ec], a
|
2013-03-26 17:39:44 -07:00
|
|
|
sub b
|
2014-06-10 23:08:07 -07:00
|
|
|
ld [EnemyMonHP + 1], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
ld b, a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, [EnemyMonHP]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ec + 1], a
|
2013-03-26 17:39:44 -07:00
|
|
|
sbc b
|
2014-06-12 18:32:42 -07:00
|
|
|
ld [EnemyMonHP], a
|
2013-03-26 17:39:44 -07:00
|
|
|
jr nc, .asm_35d59
|
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd1ed]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hli], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd1ec]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], a
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld hl, EnemyMonHP
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35d59
|
2014-06-10 23:08:07 -07:00
|
|
|
ld hl, EnemyMonMaxHP
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [Buffer2], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [Buffer1], a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld hl, EnemyMonHP
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ef], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ee], a
|
2014-06-04 01:10:56 -07:00
|
|
|
hlcoord 2, 2
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd10a], a
|
2014-06-16 11:20:01 -07:00
|
|
|
predef Functionc6e0
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35d7b
|
2013-05-02 21:22:28 -07:00
|
|
|
jp RefreshBattleHuds
|
2013-03-26 17:39:44 -07:00
|
|
|
; 35d7e
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function35d7e: ; 35d7e
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CurDamage
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld a, [hl]
|
|
|
|
or b
|
|
|
|
jr z, .asm_35ddd
|
|
|
|
|
|
|
|
ld a, c
|
|
|
|
and a
|
|
|
|
jr nz, .asm_35d93
|
|
|
|
|
|
|
|
ld a, [PlayerSubStatus4]
|
2014-06-10 23:08:07 -07:00
|
|
|
bit SUBSTATUS_SUBSTITUTE, a
|
2013-12-31 01:10:49 -08:00
|
|
|
jp nz, Function35de0
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35d93
|
|
|
|
ld a, [hld]
|
|
|
|
ld b, a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, [BattleMonHP + 1]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ec], a
|
2013-03-26 17:39:44 -07:00
|
|
|
sub b
|
2014-06-10 23:08:07 -07:00
|
|
|
ld [BattleMonHP + 1], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ee], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, [hl]
|
|
|
|
ld a, [BattleMonHP]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ec + 1], a
|
2013-03-26 17:39:44 -07:00
|
|
|
sbc b
|
|
|
|
ld [BattleMonHP], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ee + 1], a
|
2013-03-26 17:39:44 -07:00
|
|
|
jr nc, .asm_35dc5
|
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd1ec + 1]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hli], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd1ec]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], a
|
|
|
|
xor a
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BattleMonHP
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wd1ee
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35dc5
|
|
|
|
ld hl, BattleMonMaxHP
|
|
|
|
ld a, [hli]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [Buffer2], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [Buffer1], a
|
2014-06-04 01:10:56 -07:00
|
|
|
hlcoord 10, 9
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $1
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd10a], a
|
2014-06-16 11:20:01 -07:00
|
|
|
predef Functionc6e0
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35ddd
|
2013-05-02 21:22:28 -07:00
|
|
|
jp RefreshBattleHuds
|
2013-03-26 17:39:44 -07:00
|
|
|
; 35de0
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function35de0: ; 35de0
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, SubTookDamageText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2014-06-10 23:08:07 -07:00
|
|
|
ld de, EnemySubstituteHP
|
2013-03-26 22:52:04 -07:00
|
|
|
ld a, [hBattleTurn]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .got_hp
|
|
|
|
ld de, PlayerSubstituteHP
|
|
|
|
.got_hp
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, CurDamage
|
|
|
|
ld a, [hli]
|
|
|
|
and a
|
2014-06-10 23:08:07 -07:00
|
|
|
jr nz, .broke
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, [de]
|
|
|
|
sub [hl]
|
|
|
|
ld [de], a
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .broke
|
|
|
|
jr nc, .done
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-10 23:08:07 -07:00
|
|
|
.broke
|
2013-05-02 22:29:57 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-10 23:08:07 -07:00
|
|
|
res SUBSTATUS_SUBSTITUTE, [hl]
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, SubFadedText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-03-27 15:50:10 -07:00
|
|
|
call BattleCommanda7
|
2013-05-02 22:29:57 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-10 23:08:07 -07:00
|
|
|
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
|
2013-12-31 01:10:49 -08:00
|
|
|
call z, Function37ec7
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-03-26 22:52:04 -07:00
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-05-02 22:29:57 -07:00
|
|
|
cp EFFECT_MULTI_HIT
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .ok
|
2013-05-02 22:29:57 -07:00
|
|
|
cp EFFECT_DOUBLE_HIT
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .ok
|
2013-05-02 22:29:57 -07:00
|
|
|
cp EFFECT_TWINEEDLE
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .ok
|
2013-05-02 22:29:57 -07:00
|
|
|
cp EFFECT_TRIPLE_KICK
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .ok
|
2013-05-02 22:29:57 -07:00
|
|
|
cp EFFECT_BEAT_UP
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .ok
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [hl], a
|
2014-06-10 23:08:07 -07:00
|
|
|
.ok
|
2013-05-02 21:22:28 -07:00
|
|
|
call RefreshBattleHuds
|
2014-06-10 23:08:07 -07:00
|
|
|
.done
|
2013-03-26 17:39:44 -07:00
|
|
|
jp ResetDamage
|
|
|
|
; 35e40
|
|
|
|
|
|
|
|
|
|
|
|
UpdateMoveData: ; 35e40
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [CurSpecies], a ; not CurSpecies
|
|
|
|
ld [wd265], a
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
dec a
|
|
|
|
call GetMoveData
|
|
|
|
call GetMoveName
|
|
|
|
jp CopyName1
|
|
|
|
; 35e5c
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand14: ; 35e5c
|
|
|
|
; sleeptarget
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
call GetOpponentItem
|
|
|
|
ld a, b
|
2014-06-13 21:18:14 -07:00
|
|
|
cp HELD_PREVENT_SLEEP
|
|
|
|
jr nz, .asm_35e70
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-05-02 22:29:57 -07:00
|
|
|
call GetItemName
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, ProtectedByText
|
|
|
|
jr .asm_35ec6
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35e70
|
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ld a, [de]
|
2014-06-13 21:18:14 -07:00
|
|
|
and SLP
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, AlreadyAsleepText
|
|
|
|
jr nz, .asm_35ec6
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
|
|
|
jp nz, PrintDidntAffect2
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, DidntAffect1Text
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function35ece
|
2013-03-27 14:07:00 -07:00
|
|
|
jr c, .asm_35ec6
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [de]
|
|
|
|
and a
|
2013-03-27 14:07:00 -07:00
|
|
|
jr nz, .asm_35ec6
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckSubstituteOpp
|
2013-03-27 14:07:00 -07:00
|
|
|
jr nz, .asm_35ec6
|
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, $7
|
2015-09-04 13:30:40 -07:00
|
|
|
ld a, [InBattleTowerBattle]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2013-03-27 14:07:00 -07:00
|
|
|
jr z, .asm_35ea4
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, $3
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35ea4
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
and b
|
2013-03-27 14:07:00 -07:00
|
|
|
jr z, .asm_35ea4
|
|
|
|
cp 7
|
|
|
|
jr z, .asm_35ea4
|
2013-03-26 17:39:44 -07:00
|
|
|
inc a
|
|
|
|
ld [de], a
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateOpponentInParty
|
|
|
|
call RefreshBattleHuds
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, FellAsleepText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-10-01 17:47:54 -07:00
|
|
|
callba Function3dde9
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
jp z, Function34216
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35ec6
|
|
|
|
push hl
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-26 17:39:44 -07:00
|
|
|
pop hl
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 35ece
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function35ece: ; 35ece
|
2014-06-13 21:18:14 -07:00
|
|
|
; Enemy turn
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_35eec
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; Not in link battle
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
jr nz, .asm_35eec
|
|
|
|
|
2015-09-04 13:30:40 -07:00
|
|
|
ld a, [InBattleTowerBattle]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
jr nz, .asm_35eec
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; Not locked-on by the enemy
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [PlayerSubStatus5]
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SUBSTATUS_LOCK_ON, a
|
2013-03-26 17:39:44 -07:00
|
|
|
jr nz, .asm_35eec
|
|
|
|
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $40
|
|
|
|
ret c
|
|
|
|
|
|
|
|
.asm_35eec
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
; 35eee
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand13: ; 35eee
|
2013-03-26 22:52:04 -07:00
|
|
|
; poisontarget
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckSubstituteOpp
|
|
|
|
ret nz
|
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
ld a, [TypeModifier]
|
|
|
|
and $7f
|
|
|
|
ret z
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function35fe1
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
|
|
|
call GetOpponentItem
|
|
|
|
ld a, b
|
2014-06-13 21:18:14 -07:00
|
|
|
cp HELD_PREVENT_POISON
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [EffectFailed]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37962
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function35ff5
|
2014-06-13 21:18:14 -07:00
|
|
|
ld de, ANIM_PSN
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37e54
|
2013-05-02 21:22:28 -07:00
|
|
|
call RefreshBattleHuds
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, WasPoisonedText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-10-01 17:47:54 -07:00
|
|
|
callba Function3dde9
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 35f2c
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand2f: ; 35f2c
|
2013-03-26 22:52:04 -07:00
|
|
|
; poison
|
|
|
|
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, DoesntAffectText
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [TypeModifier]
|
|
|
|
and $7f
|
2013-03-27 15:50:10 -07:00
|
|
|
jp z, .asm_35fb8
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function35fe1
|
2013-03-27 15:50:10 -07:00
|
|
|
jp z, .asm_35fb8
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, AlreadyPoisonedText
|
2014-06-13 21:18:14 -07:00
|
|
|
and 1 << PSN
|
2013-03-27 15:50:10 -07:00
|
|
|
jp nz, .asm_35fb8
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
call GetOpponentItem
|
|
|
|
ld a, b
|
2014-06-13 21:18:14 -07:00
|
|
|
cp HELD_PREVENT_POISON
|
|
|
|
jr nz, .asm_35f5f
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-05-02 22:29:57 -07:00
|
|
|
call GetItemName
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, ProtectedByText
|
2014-06-13 21:18:14 -07:00
|
|
|
jr .asm_35fb8
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35f5f
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, DidntAffect1Text
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_35fb8
|
2015-09-04 13:30:40 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35f89
|
2015-09-04 13:30:40 -07:00
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_35f89
|
2015-09-04 13:30:40 -07:00
|
|
|
|
|
|
|
ld a, [InBattleTowerBattle]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_35f89
|
2015-09-04 13:30:40 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [PlayerSubStatus5]
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SUBSTATUS_LOCK_ON, a
|
|
|
|
jr nz, .asm_35f89
|
2015-09-04 13:30:40 -07:00
|
|
|
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $40
|
2014-06-13 21:18:14 -07:00
|
|
|
jr c, .asm_35fb8
|
2014-06-17 12:52:32 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35f89
|
|
|
|
call CheckSubstituteOpp
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_35fb8
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_35fb8
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function35fc9
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_35fa4
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2014-06-17 12:52:32 -07:00
|
|
|
call Function35fc0
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, WasPoisonedText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2014-06-13 21:18:14 -07:00
|
|
|
jr .asm_35fb1
|
2014-06-17 12:52:32 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35fa4
|
2014-06-13 21:18:14 -07:00
|
|
|
set SUBSTATUS_TOXIC, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [de], a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function35fc0
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, BadlyPoisonedText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35fb1
|
2013-10-01 17:47:54 -07:00
|
|
|
callba Function3dde9
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_35fb8
|
|
|
|
push hl
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-26 17:39:44 -07:00
|
|
|
pop hl
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 35fc0
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function35fc0: ; 35fc0
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function35ff5
|
2013-05-02 21:22:28 -07:00
|
|
|
jp RefreshBattleHuds
|
2013-03-26 17:39:44 -07:00
|
|
|
; 35fc9
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function35fc9: ; 35fc9
|
2013-05-02 22:29:57 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS5_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-17 12:52:32 -07:00
|
|
|
ld de, EnemyToxicCount
|
|
|
|
jr z, .ok
|
|
|
|
ld de, PlayerToxicCount
|
|
|
|
.ok
|
2013-05-02 22:29:57 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 22:29:57 -07:00
|
|
|
cp EFFECT_TOXIC
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 35fe1
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function35fe1: ; 35fe1
|
2013-03-26 17:39:44 -07:00
|
|
|
ld de, EnemyMonType1
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-17 12:52:32 -07:00
|
|
|
jr z, .ok
|
2013-03-26 17:39:44 -07:00
|
|
|
ld de, BattleMonType1
|
2014-06-17 12:52:32 -07:00
|
|
|
.ok
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
2013-05-02 22:29:57 -07:00
|
|
|
cp POISON
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
|
|
|
ld a, [de]
|
2013-05-02 22:29:57 -07:00
|
|
|
cp POISON
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 35ff5
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function35ff5: ; 35ff5
|
2013-05-02 22:29:57 -07:00
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-05-02 22:29:57 -07:00
|
|
|
set PSN, [hl]
|
2013-05-02 21:22:28 -07:00
|
|
|
jp UpdateOpponentInParty
|
2013-03-26 17:39:44 -07:00
|
|
|
; 35fff
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand15: ; 35fff
|
2013-03-27 14:07:00 -07:00
|
|
|
; draintarget
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function36011
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, SuckedHealthText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 36008
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand16: ; 36008
|
2013-03-27 14:07:00 -07:00
|
|
|
; eatdream
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function36011
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, DreamEatenText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 36011
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function36011: ; 36011
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CurDamage
|
|
|
|
ld a, [hli]
|
|
|
|
srl a
|
|
|
|
ld [$ffb3], a
|
|
|
|
ld b, a
|
|
|
|
ld a, [hl]
|
|
|
|
rr a
|
|
|
|
ld [$ffb4], a
|
|
|
|
or b
|
|
|
|
jr nz, .asm_36026 ; 0x36020 $4
|
|
|
|
ld a, $1
|
|
|
|
ld [$ffb4], a
|
|
|
|
.asm_36026
|
|
|
|
ld hl, BattleMonHP
|
|
|
|
ld de, BattleMonMaxHP
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_36037 ; 0x3602f $6
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, EnemyMonHP
|
|
|
|
ld de, EnemyMonMaxHP
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36037
|
2015-02-08 00:03:32 -08:00
|
|
|
ld bc, wd1ed
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld [bc], a
|
|
|
|
ld a, [hl]
|
|
|
|
dec bc
|
|
|
|
ld [bc], a
|
|
|
|
ld a, [de]
|
|
|
|
dec bc
|
|
|
|
ld [bc], a
|
|
|
|
inc de
|
|
|
|
ld a, [de]
|
|
|
|
dec bc
|
|
|
|
ld [bc], a
|
|
|
|
ld a, [$ffb4]
|
|
|
|
ld b, [hl]
|
|
|
|
add b
|
|
|
|
ld [hld], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ee], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [$ffb3]
|
|
|
|
ld b, [hl]
|
|
|
|
adc b
|
|
|
|
ld [hli], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ef], a
|
2013-03-26 17:39:44 -07:00
|
|
|
jr c, .asm_36064 ; 0x36056 $c
|
|
|
|
ld a, [hld]
|
|
|
|
ld b, a
|
|
|
|
ld a, [de]
|
|
|
|
dec de
|
|
|
|
sub b
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
sbc b
|
|
|
|
jr nc, .asm_36070 ; 0x36062 $c
|
|
|
|
.asm_36064
|
|
|
|
ld a, [de]
|
|
|
|
ld [hld], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ee], a
|
2013-03-26 17:39:44 -07:00
|
|
|
dec de
|
|
|
|
ld a, [de]
|
|
|
|
ld [hli], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ef], a
|
2013-03-26 17:39:44 -07:00
|
|
|
inc de
|
|
|
|
.asm_36070
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-04 01:10:56 -07:00
|
|
|
hlcoord 10, 9
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $1
|
|
|
|
jr z, .asm_3607e ; 0x36078 $4
|
2014-06-04 01:10:56 -07:00
|
|
|
hlcoord 2, 2
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
.asm_3607e
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd10a], a
|
2014-06-16 11:20:01 -07:00
|
|
|
predef Functionc6e0
|
2013-05-02 21:22:28 -07:00
|
|
|
call RefreshBattleHuds
|
|
|
|
jp UpdateBattleMonInParty
|
2013-03-26 17:39:44 -07:00
|
|
|
; 3608c
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand17: ; 3608c
|
2013-03-26 22:52:04 -07:00
|
|
|
; burntarget
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckSubstituteOpp
|
|
|
|
ret nz
|
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2013-03-26 22:52:04 -07:00
|
|
|
jp nz, Defrost
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [TypeModifier]
|
|
|
|
and $7f
|
|
|
|
ret z
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function36e5b
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
|
|
|
call GetOpponentItem
|
|
|
|
ld a, b
|
2014-06-13 21:18:14 -07:00
|
|
|
cp HELD_PREVENT_BURN
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [EffectFailed]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37962
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-13 21:18:14 -07:00
|
|
|
set BRN, [hl]
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateOpponentInParty
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, Function3ec76
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2014-06-13 21:18:14 -07:00
|
|
|
ld de, ANIM_BRN
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37e54
|
2013-05-02 21:22:28 -07:00
|
|
|
call RefreshBattleHuds
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, WasBurnedText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-10-01 17:47:54 -07:00
|
|
|
callba Function3dde9
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 360dd
|
|
|
|
|
|
|
|
|
2013-03-26 22:52:04 -07:00
|
|
|
Defrost: ; 360dd
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2014-06-13 21:18:14 -07:00
|
|
|
and 1 << FRZ
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [hl], a
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
ld a, [CurOTMon]
|
|
|
|
ld hl, OTPartyMon1Status
|
2013-03-26 22:52:04 -07:00
|
|
|
jr z, .ok
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, PartyMon1Status
|
|
|
|
ld a, [CurBattleMon]
|
2013-03-26 22:52:04 -07:00
|
|
|
.ok
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
call GetPartyLocation
|
|
|
|
xor a
|
|
|
|
ld [hl], a
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateOpponentInParty
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, DefrostedOpponentText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 36102
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand18: ; 36102
|
2013-03-26 22:52:04 -07:00
|
|
|
; freezetarget
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckSubstituteOpp
|
|
|
|
ret nz
|
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
ld a, [TypeModifier]
|
|
|
|
and $7f
|
|
|
|
ret z
|
|
|
|
ld a, [Weather]
|
2014-06-13 21:18:14 -07:00
|
|
|
cp WEATHER_SUN
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function36e5b
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
|
|
|
call GetOpponentItem
|
|
|
|
ld a, b
|
2014-06-13 21:18:14 -07:00
|
|
|
cp HELD_PREVENT_FREEZE
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [EffectFailed]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37962
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-13 21:18:14 -07:00
|
|
|
set FRZ, [hl]
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateOpponentInParty
|
2014-06-13 21:18:14 -07:00
|
|
|
ld de, ANIM_FRZ
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37e54
|
2013-05-02 21:22:28 -07:00
|
|
|
call RefreshBattleHuds
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, WasFrozenText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-10-01 17:47:54 -07:00
|
|
|
callba Function3dde9
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34216
|
2013-03-26 17:39:44 -07:00
|
|
|
call EndRechargeOpp
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc740
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_36162
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc73f
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36162
|
|
|
|
ld [hl], $1
|
|
|
|
ret
|
|
|
|
; 36165
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand19: ; 36165
|
2013-03-26 22:52:04 -07:00
|
|
|
; paralyzetarget
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckSubstituteOpp
|
|
|
|
ret nz
|
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
ld a, [TypeModifier]
|
|
|
|
and $7f
|
|
|
|
ret z
|
|
|
|
call GetOpponentItem
|
|
|
|
ld a, b
|
2014-06-13 21:18:14 -07:00
|
|
|
cp HELD_PREVENT_PARALYZE
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [EffectFailed]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37962
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-13 21:18:14 -07:00
|
|
|
set PAR, [hl]
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateOpponentInParty
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, Function3ec39
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2014-06-13 21:18:14 -07:00
|
|
|
ld de, ANIM_PAR
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37e54
|
2013-05-02 21:22:28 -07:00
|
|
|
call RefreshBattleHuds
|
2013-03-26 17:39:44 -07:00
|
|
|
call PrintParalyze
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, Function3dde9
|
2013-12-31 00:25:38 -08:00
|
|
|
jp CallBattleCore
|
2013-03-26 17:39:44 -07:00
|
|
|
; 361ac
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand70: ; 361ac
|
|
|
|
; attackup
|
|
|
|
ld b, $0
|
|
|
|
jr BattleCommand1c
|
|
|
|
BattleCommand71: ; 361b0
|
|
|
|
; defenseup
|
|
|
|
ld b, $1
|
|
|
|
jr BattleCommand1c
|
|
|
|
BattleCommand72: ; 361b4
|
|
|
|
; speedup
|
|
|
|
ld b, $2
|
|
|
|
jr BattleCommand1c
|
|
|
|
BattleCommand73: ; 361b8
|
|
|
|
; specialattackup
|
|
|
|
ld b, $3
|
|
|
|
jr BattleCommand1c
|
|
|
|
BattleCommand74: ; 361bc
|
|
|
|
; specialdefenseup
|
|
|
|
ld b, $4
|
|
|
|
jr BattleCommand1c
|
|
|
|
BattleCommand75: ; 361c0
|
|
|
|
; accuracyup
|
|
|
|
ld b, $5
|
|
|
|
jr BattleCommand1c
|
|
|
|
BattleCommand76: ; 361c4
|
|
|
|
; evasionup
|
|
|
|
ld b, $6
|
|
|
|
jr BattleCommand1c
|
|
|
|
BattleCommand77: ; 361c8
|
|
|
|
; attackup2
|
|
|
|
ld b, $10
|
|
|
|
jr BattleCommand1c
|
|
|
|
BattleCommand78: ; 361cc
|
|
|
|
; defenseup2
|
|
|
|
ld b, $11
|
|
|
|
jr BattleCommand1c
|
|
|
|
BattleCommand79: ; 361d0
|
|
|
|
; speedup2
|
|
|
|
ld b, $12
|
|
|
|
jr BattleCommand1c
|
|
|
|
BattleCommand7a: ; 361d4
|
|
|
|
; specialattackup2
|
|
|
|
ld b, $13
|
|
|
|
jr BattleCommand1c
|
|
|
|
BattleCommand7b: ; 361d8
|
|
|
|
; specialdefenseup2
|
|
|
|
ld b, $14
|
|
|
|
jr BattleCommand1c
|
|
|
|
BattleCommand7c: ; 361dc
|
|
|
|
; accuracyup2
|
|
|
|
ld b, $15
|
|
|
|
jr BattleCommand1c
|
|
|
|
BattleCommand7d: ; 361e0
|
|
|
|
; evasionup2
|
|
|
|
ld b, $16
|
|
|
|
jr BattleCommand1c
|
|
|
|
BattleCommand1c: ; 361e4
|
|
|
|
; statup
|
2015-10-07 18:27:32 -07:00
|
|
|
call CheckIfStatCanBeRaised
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [FailedMessage]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function36281
|
2013-03-26 17:39:44 -07:00
|
|
|
; 361ef
|
|
|
|
|
|
|
|
|
2015-10-07 18:27:32 -07:00
|
|
|
CheckIfStatCanBeRaised: ; 361ef
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, b
|
2013-06-13 13:10:39 -07:00
|
|
|
ld [LoweredStat], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, PlayerStatLevels
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_361fe ; 0x361f9 $3
|
|
|
|
ld hl, EnemyStatLevels
|
|
|
|
.asm_361fe
|
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2013-12-31 01:10:49 -08:00
|
|
|
jp nz, Function3627b
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [EffectFailed]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2013-12-31 01:10:49 -08:00
|
|
|
jp nz, Function3627b
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [LoweredStat]
|
2013-03-26 17:39:44 -07:00
|
|
|
and $f
|
|
|
|
ld c, a
|
2014-06-13 21:18:14 -07:00
|
|
|
ld b, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
ld b, [hl]
|
|
|
|
inc b
|
|
|
|
ld a, $d
|
|
|
|
cp b
|
2013-12-31 01:10:49 -08:00
|
|
|
jp c, Function36270
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [LoweredStat]
|
2013-03-26 17:39:44 -07:00
|
|
|
and $f0
|
|
|
|
jr z, .asm_3622b ; 0x36222 $7
|
|
|
|
inc b
|
|
|
|
ld a, $d
|
|
|
|
cp b
|
|
|
|
jr nc, .asm_3622b ; 0x36228 $1
|
|
|
|
ld b, a
|
|
|
|
.asm_3622b
|
|
|
|
ld [hl], b
|
|
|
|
push hl
|
|
|
|
ld a, c
|
|
|
|
cp $5
|
|
|
|
jr nc, .asm_36268 ; 0x36230 $36
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, BattleMonStats + 1
|
2013-06-13 13:10:39 -07:00
|
|
|
ld de, PlayerStats
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_36243 ; 0x3623b $6
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, EnemyMonStats + 1
|
2013-06-13 13:10:39 -07:00
|
|
|
ld de, EnemyStats
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36243
|
|
|
|
push bc
|
|
|
|
sla c
|
2014-06-13 21:18:14 -07:00
|
|
|
ld b, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
ld a, c
|
|
|
|
add e
|
|
|
|
ld e, a
|
|
|
|
jr nc, .asm_3624f ; 0x3624c $1
|
|
|
|
inc d
|
|
|
|
.asm_3624f
|
|
|
|
pop bc
|
|
|
|
ld a, [hld]
|
2014-06-13 21:18:14 -07:00
|
|
|
sub 999 % $100
|
2013-03-26 17:39:44 -07:00
|
|
|
jr nz, .asm_3625b ; 0x36253 $6
|
|
|
|
ld a, [hl]
|
2014-06-13 21:18:14 -07:00
|
|
|
sbc 999 / $100
|
2013-12-31 01:10:49 -08:00
|
|
|
jp z, Function3626e
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3625b
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_36265 ; 0x3625e $5
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function365fd
|
2013-03-26 17:39:44 -07:00
|
|
|
jr .asm_36268 ; 0x36263 $3
|
|
|
|
.asm_36265
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function365d7
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36268
|
|
|
|
pop hl
|
|
|
|
xor a
|
2013-06-13 13:10:39 -07:00
|
|
|
ld [FailedMessage], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 3626e
|
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function3626e: ; 3626e
|
2013-03-26 17:39:44 -07:00
|
|
|
pop hl
|
|
|
|
dec [hl]
|
2013-03-27 15:50:10 -07:00
|
|
|
; fallthrough
|
|
|
|
; 36270
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function36270: ; 36270
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $2
|
2013-06-13 13:10:39 -07:00
|
|
|
ld [FailedMessage], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $1
|
|
|
|
ld [AttackMissed], a
|
|
|
|
ret
|
|
|
|
; 3627b
|
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function3627b: ; 3627b
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $1
|
2013-06-13 13:10:39 -07:00
|
|
|
ld [FailedMessage], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 36281
|
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function36281: ; 36281
|
2015-02-08 00:03:32 -08:00
|
|
|
ld bc, wc6fe
|
2014-01-05 04:28:55 -08:00
|
|
|
ld hl, Function3f447
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_36292 ; 0x3628a $6
|
2015-02-08 00:03:32 -08:00
|
|
|
ld bc, wc6fa
|
2014-01-05 04:28:55 -08:00
|
|
|
ld hl, Function3f486
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36292
|
2014-01-05 04:28:55 -08:00
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-01-05 04:28:55 -08:00
|
|
|
cp MINIMIZE
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
ld a, $1
|
|
|
|
ld [bc], a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37ed5
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nc
|
|
|
|
xor a
|
|
|
|
ld [$ffd4], a
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2013-03-26 17:39:44 -07:00
|
|
|
call WaitBGMap
|
2013-03-27 13:19:51 -07:00
|
|
|
jp BattleCommandaa
|
2013-03-26 17:39:44 -07:00
|
|
|
; 362ad
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand7e: ; 362ad
|
|
|
|
; attackdown
|
2013-06-13 13:31:50 -07:00
|
|
|
ld a, ATTACK
|
2013-03-26 17:39:44 -07:00
|
|
|
jr BattleCommand1d
|
|
|
|
BattleCommand7f: ; 362b1
|
|
|
|
; defensedown
|
2013-06-13 13:31:50 -07:00
|
|
|
ld a, DEFENSE
|
2013-03-26 17:39:44 -07:00
|
|
|
jr BattleCommand1d
|
|
|
|
BattleCommand80: ; 362b5
|
|
|
|
; speeddown
|
2013-06-13 13:31:50 -07:00
|
|
|
ld a, SPEED
|
2013-03-26 17:39:44 -07:00
|
|
|
jr BattleCommand1d
|
|
|
|
BattleCommand81: ; 362b9
|
|
|
|
; specialattackdown
|
2013-06-13 13:31:50 -07:00
|
|
|
ld a, SP_ATTACK
|
2013-03-26 17:39:44 -07:00
|
|
|
jr BattleCommand1d
|
|
|
|
BattleCommand82: ; 362bd
|
|
|
|
; specialdefensedown
|
2013-06-13 13:31:50 -07:00
|
|
|
ld a, SP_DEFENSE
|
2013-03-26 17:39:44 -07:00
|
|
|
jr BattleCommand1d
|
|
|
|
BattleCommand83: ; 362c1
|
|
|
|
; accuracydown
|
2013-06-13 13:31:50 -07:00
|
|
|
ld a, ACCURACY
|
2013-03-26 17:39:44 -07:00
|
|
|
jr BattleCommand1d
|
|
|
|
BattleCommand84: ; 362c5
|
|
|
|
; evasiondown
|
2013-06-13 13:31:50 -07:00
|
|
|
ld a, EVASION
|
2013-03-26 17:39:44 -07:00
|
|
|
jr BattleCommand1d
|
|
|
|
BattleCommand85: ; 362c9
|
|
|
|
; attackdown2
|
2013-06-13 13:31:50 -07:00
|
|
|
ld a, $10 | ATTACK
|
2013-03-26 17:39:44 -07:00
|
|
|
jr BattleCommand1d
|
|
|
|
BattleCommand86: ; 362cd
|
|
|
|
; defensedown2
|
2013-06-13 13:31:50 -07:00
|
|
|
ld a, $10 | DEFENSE
|
2013-03-26 17:39:44 -07:00
|
|
|
jr BattleCommand1d
|
|
|
|
BattleCommand87: ; 362d1
|
|
|
|
; speeddown2
|
2013-06-13 13:31:50 -07:00
|
|
|
ld a, $10 | SPEED
|
2013-03-26 17:39:44 -07:00
|
|
|
jr BattleCommand1d
|
|
|
|
BattleCommand88: ; 362d5
|
|
|
|
; specialattackdown2
|
2013-06-13 13:31:50 -07:00
|
|
|
ld a, $10 | SP_ATTACK
|
2013-03-26 17:39:44 -07:00
|
|
|
jr BattleCommand1d
|
|
|
|
BattleCommand89: ; 362d9
|
|
|
|
; specialdefensedown2
|
2013-06-13 13:31:50 -07:00
|
|
|
ld a, $10 | SP_DEFENSE
|
2013-03-26 17:39:44 -07:00
|
|
|
jr BattleCommand1d
|
|
|
|
BattleCommand8a: ; 362dd
|
|
|
|
; accuracydown2
|
2013-06-13 13:31:50 -07:00
|
|
|
ld a, $10 | ACCURACY
|
2013-03-26 17:39:44 -07:00
|
|
|
jr BattleCommand1d
|
|
|
|
BattleCommand8b: ; 362e1
|
|
|
|
; evasiondown2
|
2013-06-13 13:31:50 -07:00
|
|
|
ld a, $10 | EVASION
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
BattleCommand1d: ; 362e3
|
|
|
|
; statdown
|
2013-06-13 13:10:39 -07:00
|
|
|
|
|
|
|
ld [LoweredStat], a
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function36391
|
2013-06-13 13:10:39 -07:00
|
|
|
jp nz, .Mist
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EnemyStatLevels
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-06-13 13:10:39 -07:00
|
|
|
jr z, .GetStatLevel
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, PlayerStatLevels
|
2013-06-13 13:10:39 -07:00
|
|
|
|
|
|
|
.GetStatLevel
|
|
|
|
; Attempt to lower the stat.
|
|
|
|
ld a, [LoweredStat]
|
2013-03-26 17:39:44 -07:00
|
|
|
and $f
|
|
|
|
ld c, a
|
2013-06-13 13:10:39 -07:00
|
|
|
ld b, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
ld b, [hl]
|
|
|
|
dec b
|
2013-06-13 13:10:39 -07:00
|
|
|
jp z, .CantLower
|
|
|
|
|
|
|
|
; Sharply lower the stat if applicable.
|
|
|
|
ld a, [LoweredStat]
|
2013-03-26 17:39:44 -07:00
|
|
|
and $f0
|
2013-06-13 13:10:39 -07:00
|
|
|
jr z, .ComputerMiss
|
2013-03-26 17:39:44 -07:00
|
|
|
dec b
|
2013-06-13 13:10:39 -07:00
|
|
|
jr nz, .ComputerMiss
|
2013-03-26 17:39:44 -07:00
|
|
|
inc b
|
2013-06-13 13:10:39 -07:00
|
|
|
|
|
|
|
.ComputerMiss
|
|
|
|
; Computer opponents have a 1/4 chance of failing.
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-06-13 13:10:39 -07:00
|
|
|
jr z, .DidntMiss
|
2015-09-04 13:30:40 -07:00
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2013-06-13 13:10:39 -07:00
|
|
|
jr nz, .DidntMiss
|
|
|
|
|
2015-09-04 13:30:40 -07:00
|
|
|
ld a, [InBattleTowerBattle]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2013-06-13 13:10:39 -07:00
|
|
|
jr nz, .DidntMiss
|
|
|
|
|
|
|
|
; Lock-On still always works.
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [PlayerSubStatus5]
|
2013-06-13 13:10:39 -07:00
|
|
|
bit SUBSTATUS_LOCK_ON, a
|
|
|
|
jr nz, .DidntMiss
|
|
|
|
|
|
|
|
; Attacking moves that also lower accuracy are unaffected.
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-06-13 13:10:39 -07:00
|
|
|
cp EFFECT_ACCURACY_DOWN_HIT
|
|
|
|
jr z, .DidntMiss
|
|
|
|
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $40
|
2013-06-13 13:10:39 -07:00
|
|
|
jr c, .Failed
|
|
|
|
|
|
|
|
.DidntMiss
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckSubstituteOpp
|
2013-06-13 13:10:39 -07:00
|
|
|
jr nz, .Failed
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2013-06-13 13:10:39 -07:00
|
|
|
jr nz, .Failed
|
|
|
|
|
|
|
|
ld a, [EffectFailed]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2013-06-13 13:10:39 -07:00
|
|
|
jr nz, .Failed
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckHiddenOpponent
|
2013-06-13 13:10:39 -07:00
|
|
|
jr nz, .Failed
|
|
|
|
|
|
|
|
; Accuracy/Evasion reduction don't involve stats.
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], b
|
|
|
|
ld a, c
|
2013-06-13 13:10:39 -07:00
|
|
|
cp ACCURACY
|
|
|
|
jr nc, .Hit
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
push hl
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, EnemyMonAttack + 1
|
2013-06-13 13:10:39 -07:00
|
|
|
ld de, EnemyStats
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-06-13 13:10:39 -07:00
|
|
|
jr z, .asm_36366
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, BattleMonAttack + 1
|
2013-06-13 13:10:39 -07:00
|
|
|
ld de, PlayerStats
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36366
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function3641a
|
2013-03-26 17:39:44 -07:00
|
|
|
pop hl
|
2013-06-13 13:10:39 -07:00
|
|
|
jr z, .CouldntLower
|
|
|
|
|
|
|
|
.Hit
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2013-06-13 13:10:39 -07:00
|
|
|
ld [FailedMessage], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
2013-06-13 13:10:39 -07:00
|
|
|
|
|
|
|
.CouldntLower
|
2013-03-26 17:39:44 -07:00
|
|
|
inc [hl]
|
2013-06-13 13:10:39 -07:00
|
|
|
.CantLower
|
|
|
|
ld a, 3
|
|
|
|
ld [FailedMessage], a
|
|
|
|
ld a, 1
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [AttackMissed], a
|
|
|
|
ret
|
2013-06-13 13:10:39 -07:00
|
|
|
|
|
|
|
.Failed
|
|
|
|
ld a, 1
|
|
|
|
ld [FailedMessage], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [AttackMissed], a
|
|
|
|
ret
|
|
|
|
|
2013-06-13 13:10:39 -07:00
|
|
|
.Mist
|
|
|
|
ld a, 2
|
|
|
|
ld [FailedMessage], a
|
|
|
|
ld a, 1
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [AttackMissed], a
|
|
|
|
ret
|
|
|
|
; 36391
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function36391: ; 36391
|
2013-05-02 22:29:57 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 22:29:57 -07:00
|
|
|
cp EFFECT_ATTACK_DOWN
|
|
|
|
jr c, .asm_363ae
|
|
|
|
cp EFFECT_EVASION_DOWN + 1
|
|
|
|
jr c, .asm_363b0
|
|
|
|
cp EFFECT_ATTACK_DOWN_2
|
|
|
|
jr c, .asm_363ae
|
|
|
|
cp EFFECT_EVASION_DOWN_2 + 1
|
|
|
|
jr c, .asm_363b0
|
|
|
|
cp EFFECT_ATTACK_DOWN_HIT
|
|
|
|
jr c, .asm_363ae
|
|
|
|
cp EFFECT_EVASION_DOWN_HIT + 1
|
|
|
|
jr c, .asm_363b0
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_363ae
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
.asm_363b0
|
2013-05-02 22:29:57 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 22:29:57 -07:00
|
|
|
bit SUBSTATUS_MIST, a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 363b8
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand8c: ; 363b8
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [FailedMessage]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [LoweredStat]
|
2013-03-26 17:39:44 -07:00
|
|
|
and $f
|
|
|
|
ld b, a
|
|
|
|
inc b
|
2013-03-27 15:50:10 -07:00
|
|
|
call GetStatName
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, .stat
|
|
|
|
jp BattleTextBox
|
|
|
|
|
|
|
|
.stat
|
2015-07-22 12:57:02 -07:00
|
|
|
text_jump UnknownText_0x1c0cc6
|
2013-03-26 17:39:44 -07:00
|
|
|
start_asm
|
|
|
|
|
|
|
|
ld hl, .up
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [LoweredStat]
|
2013-03-26 17:39:44 -07:00
|
|
|
and $f0
|
|
|
|
ret z
|
|
|
|
ld hl, .wayup
|
|
|
|
ret
|
|
|
|
|
|
|
|
.wayup
|
2015-07-22 12:57:02 -07:00
|
|
|
text_jump UnknownText_0x1c0cd0
|
2013-03-26 17:39:44 -07:00
|
|
|
db "@"
|
|
|
|
|
|
|
|
.up
|
2015-07-22 12:57:02 -07:00
|
|
|
text_jump UnknownText_0x1c0ce0
|
2013-03-26 17:39:44 -07:00
|
|
|
db "@"
|
|
|
|
|
|
|
|
; 363e9
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand8d: ; 363e9
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [FailedMessage]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [LoweredStat]
|
2013-03-26 17:39:44 -07:00
|
|
|
and $f
|
|
|
|
ld b, a
|
|
|
|
inc b
|
2013-03-27 15:50:10 -07:00
|
|
|
call GetStatName
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, .stat
|
|
|
|
jp BattleTextBox
|
|
|
|
|
|
|
|
.stat
|
2015-07-22 12:57:02 -07:00
|
|
|
text_jump UnknownText_0x1c0ceb
|
2013-03-26 17:39:44 -07:00
|
|
|
start_asm
|
|
|
|
|
|
|
|
ld hl, .fell
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [LoweredStat]
|
2013-03-26 17:39:44 -07:00
|
|
|
and $f0
|
|
|
|
ret z
|
|
|
|
ld hl, .sharplyfell
|
|
|
|
ret
|
|
|
|
|
|
|
|
.sharplyfell
|
2015-07-22 12:57:02 -07:00
|
|
|
text_jump UnknownText_0x1c0cf5
|
2013-03-26 17:39:44 -07:00
|
|
|
db "@"
|
|
|
|
.fell
|
2015-07-22 12:57:02 -07:00
|
|
|
text_jump UnknownText_0x1c0d06
|
2013-03-26 17:39:44 -07:00
|
|
|
db "@"
|
|
|
|
|
|
|
|
; 3641a
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function3641a: ; 3641a
|
2013-06-13 13:10:39 -07:00
|
|
|
; Lower stat c from stat struct hl (buffer de).
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
push bc
|
|
|
|
sla c
|
2013-03-26 22:52:04 -07:00
|
|
|
ld b, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
2013-06-13 13:10:39 -07:00
|
|
|
; add de, c
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, c
|
|
|
|
add e
|
|
|
|
ld e, a
|
2013-03-26 22:52:04 -07:00
|
|
|
jr nc, .asm_36426
|
2013-03-26 17:39:44 -07:00
|
|
|
inc d
|
|
|
|
.asm_36426
|
|
|
|
pop bc
|
2013-06-13 13:10:39 -07:00
|
|
|
|
|
|
|
; The lowest possible stat is 1.
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hld]
|
2013-03-26 22:52:04 -07:00
|
|
|
sub 1
|
|
|
|
jr nz, .asm_3642f
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
ret z
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3642f
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-06-13 13:10:39 -07:00
|
|
|
jr z, .Player
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function365d7
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-06-13 13:10:39 -07:00
|
|
|
jr .end
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-06-13 13:10:39 -07:00
|
|
|
.Player
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function365fd
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-06-13 13:10:39 -07:00
|
|
|
.end
|
|
|
|
ld a, 1
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; 3644c
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand8e: ; 3644c
|
2013-03-26 22:52:04 -07:00
|
|
|
; statupfailtext
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [FailedMessage]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
push af
|
2013-03-27 13:19:51 -07:00
|
|
|
call BattleCommandaa
|
2013-03-26 17:39:44 -07:00
|
|
|
pop af
|
|
|
|
dec a
|
2013-03-27 15:50:10 -07:00
|
|
|
jp z, TryPrintButItFailed
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [LoweredStat]
|
2013-03-26 17:39:44 -07:00
|
|
|
and $f
|
|
|
|
ld b, a
|
|
|
|
inc b
|
2013-03-27 15:50:10 -07:00
|
|
|
call GetStatName
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, WontRiseAnymoreText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 3646a
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand8f: ; 3646a
|
2013-03-26 22:52:04 -07:00
|
|
|
; statdownfailtext
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [FailedMessage]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
push af
|
2013-03-27 13:19:51 -07:00
|
|
|
call BattleCommandaa
|
2013-03-26 17:39:44 -07:00
|
|
|
pop af
|
|
|
|
dec a
|
2013-03-27 15:50:10 -07:00
|
|
|
jp z, TryPrintButItFailed
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
2013-03-26 22:52:04 -07:00
|
|
|
ld hl, ProtectedByMistText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp z, StdBattleTextBox
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [LoweredStat]
|
2013-03-26 17:39:44 -07:00
|
|
|
and $f
|
|
|
|
ld b, a
|
|
|
|
inc b
|
2013-03-27 15:50:10 -07:00
|
|
|
call GetStatName
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, WontDropAnymoreText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 3648f
|
|
|
|
|
|
|
|
|
|
|
|
GetStatName: ; 3648f
|
|
|
|
ld hl, .names
|
|
|
|
ld c, "@"
|
|
|
|
.CheckName
|
|
|
|
dec b
|
|
|
|
jr z, .Copy
|
|
|
|
.GetName
|
|
|
|
ld a, [hli]
|
|
|
|
cp c
|
|
|
|
jr z, .CheckName
|
|
|
|
jr .GetName
|
|
|
|
.Copy
|
|
|
|
ld de, StringBuffer2
|
|
|
|
ld bc, StringBuffer3 - StringBuffer2
|
|
|
|
jp CopyBytes
|
|
|
|
|
|
|
|
.names
|
|
|
|
db "ATTACK@"
|
|
|
|
db "DEFENSE@"
|
|
|
|
db "SPEED@"
|
|
|
|
db "SPCL.ATK@"
|
|
|
|
db "SPCL.DEF@"
|
|
|
|
db "ACCURACY@"
|
|
|
|
db "EVASION@"
|
|
|
|
db "ABILITY@"
|
|
|
|
; 364e6
|
|
|
|
|
|
|
|
|
|
|
|
Table0x364e6: ; 364e6
|
2013-12-01 11:19:57 -08:00
|
|
|
db 25, 100
|
|
|
|
db 28, 100
|
|
|
|
db 33, 100
|
|
|
|
db 40, 100
|
|
|
|
db 50, 100
|
|
|
|
db 66, 100
|
2013-03-26 17:39:44 -07:00
|
|
|
; 364f2
|
|
|
|
|
|
|
|
|
|
|
|
StatLevelMulipliers: ; 364f2
|
|
|
|
db 1, 1 ; 1.0x
|
|
|
|
db 15, 10 ; 1.5x
|
|
|
|
db 2, 1 ; 2.0x
|
|
|
|
db 25, 10 ; 2.5x
|
|
|
|
db 3, 1 ; 3.0x
|
|
|
|
db 35, 10 ; 3.5x
|
|
|
|
db 4, 1 ; 4.0x
|
|
|
|
; 36500
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommanda4: ; 36500
|
2013-03-27 15:50:10 -07:00
|
|
|
; allstatsup
|
|
|
|
|
|
|
|
; Attack
|
2013-03-26 17:39:44 -07:00
|
|
|
call ResetMiss
|
|
|
|
call BattleCommand70
|
2013-03-27 15:50:10 -07:00
|
|
|
call BattleCommand8c
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
; Defense
|
2013-03-26 17:39:44 -07:00
|
|
|
call ResetMiss
|
2013-03-27 15:50:10 -07:00
|
|
|
call BattleCommand71
|
|
|
|
call BattleCommand8c
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
; Speed
|
2013-03-26 17:39:44 -07:00
|
|
|
call ResetMiss
|
2013-03-27 15:50:10 -07:00
|
|
|
call BattleCommand72
|
|
|
|
call BattleCommand8c
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
; Special Attack
|
2013-03-26 17:39:44 -07:00
|
|
|
call ResetMiss
|
2013-03-27 15:50:10 -07:00
|
|
|
call BattleCommand73
|
|
|
|
call BattleCommand8c
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
; Special Defense
|
2013-03-26 17:39:44 -07:00
|
|
|
call ResetMiss
|
2013-03-27 15:50:10 -07:00
|
|
|
call BattleCommand74
|
|
|
|
jp BattleCommand8c
|
2013-03-26 17:39:44 -07:00
|
|
|
; 3652d
|
|
|
|
|
|
|
|
|
|
|
|
ResetMiss: ; 3652d
|
|
|
|
xor a
|
|
|
|
ld [AttackMissed], a
|
|
|
|
ret
|
|
|
|
; 36532
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function36532: ; 36532
|
2013-06-13 13:10:39 -07:00
|
|
|
ld [LoweredStat], a
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, PlayerStatLevels
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_36540
|
|
|
|
ld hl, EnemyStatLevels
|
|
|
|
|
|
|
|
.asm_36540
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [LoweredStat]
|
2013-03-26 17:39:44 -07:00
|
|
|
and $f
|
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
|
|
|
add hl, bc
|
|
|
|
ld b, [hl]
|
|
|
|
dec b
|
|
|
|
jr z, .asm_36589
|
|
|
|
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [LoweredStat]
|
2013-03-26 17:39:44 -07:00
|
|
|
and $f0
|
|
|
|
jr z, .asm_36558
|
|
|
|
dec b
|
|
|
|
jr nz, .asm_36558
|
|
|
|
inc b
|
|
|
|
|
|
|
|
.asm_36558
|
|
|
|
ld [hl], b
|
|
|
|
ld a, c
|
|
|
|
cp 5
|
|
|
|
jr nc, .asm_36576
|
|
|
|
|
|
|
|
push hl
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, BattleMonStats + 1
|
2013-06-13 13:10:39 -07:00
|
|
|
ld de, PlayerStats
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_36570
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, EnemyMonStats + 1
|
2013-06-13 13:10:39 -07:00
|
|
|
ld de, EnemyStats
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_36570
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function3641a
|
2013-03-26 17:39:44 -07:00
|
|
|
pop hl
|
|
|
|
jr z, .asm_36588
|
|
|
|
|
|
|
|
.asm_36576
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_36580
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function365fd
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
jr .asm_36583
|
|
|
|
|
|
|
|
.asm_36580
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function365d7
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_36583
|
|
|
|
xor a
|
2013-06-13 13:10:39 -07:00
|
|
|
ld [FailedMessage], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_36588
|
|
|
|
inc [hl]
|
|
|
|
|
|
|
|
.asm_36589
|
|
|
|
ld a, 2
|
2013-06-13 13:10:39 -07:00
|
|
|
ld [FailedMessage], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 3658f
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommandac: ; 3658f
|
2013-03-26 22:52:04 -07:00
|
|
|
; tristatuschance
|
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
call BattleCommand90
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-03-26 22:52:04 -07:00
|
|
|
; 1/3 chance of each status
|
2013-03-26 17:39:44 -07:00
|
|
|
.loop
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
swap a
|
2013-03-26 22:52:04 -07:00
|
|
|
and 3
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .loop
|
|
|
|
; jump
|
|
|
|
dec a
|
|
|
|
ld hl, .ptrs
|
2013-07-04 12:42:01 -07:00
|
|
|
rst JumpTable
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
.ptrs
|
2013-03-26 22:52:04 -07:00
|
|
|
dw BattleCommand19 ; paralyze
|
|
|
|
dw BattleCommand18 ; freeze
|
|
|
|
dw BattleCommand17 ; burn
|
2013-03-26 17:39:44 -07:00
|
|
|
; 365a7
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommandaf: ; 365a7
|
2013-03-26 22:52:04 -07:00
|
|
|
; curl
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS2
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-17 11:58:11 -07:00
|
|
|
set SUBSTATUS_CURLED, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 365af
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommanda6: ; 365af
|
2014-01-05 04:28:55 -08:00
|
|
|
ld hl, Function3f43d
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_365ba ; 365b5 $3
|
2014-01-05 04:28:55 -08:00
|
|
|
ld hl, Function3f47c
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_365ba
|
|
|
|
xor a
|
|
|
|
ld [$ffd4], a
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2013-12-01 11:19:57 -08:00
|
|
|
jp WaitBGMap
|
2013-03-26 17:39:44 -07:00
|
|
|
; 365c3
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommanda7: ; 365c3
|
2014-01-05 04:28:55 -08:00
|
|
|
ld hl, Function3f447
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_365ce ; 365c9 $3
|
2014-01-05 04:28:55 -08:00
|
|
|
ld hl, Function3f486
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_365ce
|
|
|
|
xor a
|
|
|
|
ld [$ffd4], a
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2013-12-01 11:19:57 -08:00
|
|
|
jp WaitBGMap
|
2013-03-26 17:39:44 -07:00
|
|
|
; 365d7
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function365d7: ; 365d7
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, PlayerAtkLevel
|
2013-06-13 13:10:39 -07:00
|
|
|
ld de, PlayerStats
|
2014-06-12 18:32:42 -07:00
|
|
|
ld bc, BattleMonAttack
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, $5
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function3661d
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-07-29 10:58:20 -07:00
|
|
|
ld hl, BadgeStatBoosts
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, Function3ec39
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, Function3ec76
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2015-10-10 04:45:39 -07:00
|
|
|
jp BattleCommand_SwitchTurn
|
2013-03-26 17:39:44 -07:00
|
|
|
; 365fd
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function365fd: ; 365fd
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EnemyAtkLevel
|
2013-06-13 13:10:39 -07:00
|
|
|
ld de, EnemyStats
|
2014-06-12 18:32:42 -07:00
|
|
|
ld bc, EnemyMonAttack
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, $5
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function3661d
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, Function3ec39
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, Function3ec76
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2015-10-10 04:45:39 -07:00
|
|
|
jp BattleCommand_SwitchTurn
|
2013-03-26 17:39:44 -07:00
|
|
|
; 3661d
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function3661d: ; 3661d
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3661d
|
|
|
|
push af
|
|
|
|
ld a, [hli]
|
|
|
|
push hl
|
|
|
|
push bc
|
2013-12-01 11:19:57 -08:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld c, a
|
|
|
|
dec c
|
|
|
|
ld b, 0
|
|
|
|
ld hl, Table0x364e6
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-12-01 11:19:57 -08:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplicand + 0], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [de]
|
2013-12-01 11:19:57 -08:00
|
|
|
ld [hMultiplicand + 1], a
|
2013-03-26 17:39:44 -07:00
|
|
|
inc de
|
|
|
|
ld a, [de]
|
2013-12-01 11:19:57 -08:00
|
|
|
ld [hMultiplicand + 2], a
|
2013-03-26 17:39:44 -07:00
|
|
|
inc de
|
2013-12-01 11:19:57 -08:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
2013-12-01 11:19:57 -08:00
|
|
|
ld [hMultiplier], a
|
2013-03-26 17:39:44 -07:00
|
|
|
call Multiply
|
|
|
|
|
|
|
|
ld a, [hl]
|
2013-12-01 11:19:57 -08:00
|
|
|
ld [hDivisor], a
|
|
|
|
ld b, 4
|
2013-03-26 17:39:44 -07:00
|
|
|
call Divide
|
|
|
|
|
2013-12-01 11:19:57 -08:00
|
|
|
ld a, [hQuotient + 1]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
2013-12-01 11:19:57 -08:00
|
|
|
ld a, [hQuotient + 2]
|
2013-03-26 17:39:44 -07:00
|
|
|
or b
|
|
|
|
jr nz, .asm_36651
|
|
|
|
|
2013-12-01 11:19:57 -08:00
|
|
|
ld a, 1
|
|
|
|
ld [hQuotient + 2], a
|
2013-03-26 17:39:44 -07:00
|
|
|
jr .asm_36662
|
|
|
|
|
|
|
|
.asm_36651
|
2013-12-01 11:19:57 -08:00
|
|
|
ld a, [hQuotient + 2]
|
|
|
|
cp 999 % $100
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, b
|
2013-12-01 11:19:57 -08:00
|
|
|
sbc 999 / $100
|
2013-03-26 17:39:44 -07:00
|
|
|
jr c, .asm_36662
|
|
|
|
|
2013-12-01 11:19:57 -08:00
|
|
|
ld a, 999 % $100
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [$ffb6], a
|
2013-12-01 11:19:57 -08:00
|
|
|
ld a, 999 / $100
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [$ffb5], a
|
2013-12-01 11:19:57 -08:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36662
|
|
|
|
pop bc
|
|
|
|
ld a, [$ffb5]
|
|
|
|
ld [bc], a
|
|
|
|
inc bc
|
|
|
|
ld a, [$ffb6]
|
|
|
|
ld [bc], a
|
|
|
|
inc bc
|
|
|
|
pop hl
|
|
|
|
pop af
|
|
|
|
dec a
|
|
|
|
jr nz, .asm_3661d
|
|
|
|
|
|
|
|
ret
|
|
|
|
; 36671
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand21: ; 36671
|
2013-03-26 22:52:04 -07:00
|
|
|
; storeenergy
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-08-13 19:44:56 -07:00
|
|
|
bit SUBSTATUS_BIDE, a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2014-08-13 19:44:56 -07:00
|
|
|
|
2013-04-19 00:50:45 -07:00
|
|
|
ld hl, PlayerRolloutCount
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-05-02 22:29:57 -07:00
|
|
|
jr z, .asm_36684
|
2013-04-19 00:50:45 -07:00
|
|
|
ld hl, EnemyRolloutCount
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36684
|
|
|
|
dec [hl]
|
2013-05-02 22:29:57 -07:00
|
|
|
jr nz, .asm_366dc
|
2014-08-13 19:44:56 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-08-13 19:44:56 -07:00
|
|
|
res SUBSTATUS_BIDE, [hl]
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, UnleashedEnergyText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_POWER
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-05-02 22:29:57 -07:00
|
|
|
ld a, 1
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], a
|
2013-05-02 22:29:57 -07:00
|
|
|
ld hl, PlayerDamageTaken + 1
|
2015-02-08 00:03:32 -08:00
|
|
|
ld de, wc732
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-05-02 22:29:57 -07:00
|
|
|
jr z, .asm_366ad
|
|
|
|
ld hl, EnemyDamageTaken + 1
|
2015-02-08 00:03:32 -08:00
|
|
|
ld de, wc733
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_366ad
|
|
|
|
ld a, [hld]
|
|
|
|
add a
|
|
|
|
ld b, a
|
|
|
|
ld [CurDamage + 1], a
|
|
|
|
ld a, [hl]
|
|
|
|
rl a
|
|
|
|
ld [CurDamage], a
|
2013-05-02 22:29:57 -07:00
|
|
|
jr nc, .asm_366c3
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $ff
|
|
|
|
ld [CurDamage], a
|
|
|
|
ld [CurDamage + 1], a
|
|
|
|
.asm_366c3
|
|
|
|
or b
|
2013-05-02 22:29:57 -07:00
|
|
|
jr nz, .asm_366cb
|
|
|
|
ld a, 1
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [AttackMissed], a
|
|
|
|
.asm_366cb
|
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
ld [de], a
|
2013-05-02 22:29:57 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-05-02 22:29:57 -07:00
|
|
|
ld a, BIDE
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], a
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2015-04-13 21:39:54 -07:00
|
|
|
ld b, unleashenergy_command
|
2013-03-26 22:52:04 -07:00
|
|
|
jp SkipToBattleCommand
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_366dc
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, StoringEnergyText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
jp EndMoveEffect
|
|
|
|
; 366e5
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand22: ; 366e5
|
2013-03-26 22:52:04 -07:00
|
|
|
; unleashenergy
|
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld de, PlayerDamageTaken
|
2013-04-19 00:50:45 -07:00
|
|
|
ld bc, PlayerRolloutCount
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-08-13 19:44:56 -07:00
|
|
|
jr z, .asm_366f6
|
2015-02-08 00:03:32 -08:00
|
|
|
ld de, EnemyDamageTaken
|
2013-04-19 00:50:45 -07:00
|
|
|
ld bc, EnemyRolloutCount
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_366f6
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-08-13 19:44:56 -07:00
|
|
|
set SUBSTATUS_BIDE, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld [de], a
|
2014-06-12 18:32:42 -07:00
|
|
|
ld [wPlayerMoveStruct + MOVE_EFFECT], a
|
|
|
|
ld [wEnemyMoveStruct + MOVE_EFFECT], a
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2014-08-13 19:44:56 -07:00
|
|
|
and 1
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
inc a
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [bc], a
|
2014-08-13 19:44:56 -07:00
|
|
|
ld a, 1
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
jp EndMoveEffect
|
|
|
|
; 3671a
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand3e: ; 3671a
|
2013-03-26 22:52:04 -07:00
|
|
|
; checkrampage
|
|
|
|
|
2013-04-19 00:50:45 -07:00
|
|
|
ld de, PlayerRolloutCount
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_36725 ; 36720 $3
|
2013-04-19 00:50:45 -07:00
|
|
|
ld de, EnemyRolloutCount
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36725
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
bit 1, [hl]
|
|
|
|
ret z
|
|
|
|
ld a, [de]
|
|
|
|
dec a
|
|
|
|
ld [de], a
|
|
|
|
jr nz, .asm_3674c ; 36730 $1a
|
|
|
|
res 1, [hl]
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37962
|
2013-03-26 17:39:44 -07:00
|
|
|
push af
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-03-26 17:39:44 -07:00
|
|
|
pop af
|
|
|
|
jr nz, .asm_3674c ; 3673f $b
|
|
|
|
set 7, [hl]
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
and $1
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
inc a
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
inc de
|
|
|
|
ld [de], a
|
|
|
|
.asm_3674c
|
2015-04-13 21:39:54 -07:00
|
|
|
ld b, rampage_command
|
2013-03-26 22:52:04 -07:00
|
|
|
jp SkipToBattleCommand
|
2013-03-26 17:39:44 -07:00
|
|
|
; 36751
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand3d: ; 36751
|
2013-03-26 22:52:04 -07:00
|
|
|
; rampage
|
|
|
|
|
|
|
|
; No rampage during Sleep Talk.
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_STATUS
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-17 11:58:11 -07:00
|
|
|
and SLP
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-04-19 00:50:45 -07:00
|
|
|
ld de, PlayerRolloutCount
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-17 11:58:11 -07:00
|
|
|
jr z, .ok
|
2013-04-19 00:50:45 -07:00
|
|
|
ld de, EnemyRolloutCount
|
2014-06-17 11:58:11 -07:00
|
|
|
.ok
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-17 12:52:32 -07:00
|
|
|
set SUBSTATUS_RAMPAGE, [hl]
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2014-06-17 11:58:11 -07:00
|
|
|
and 1
|
2013-03-26 17:39:44 -07:00
|
|
|
inc a
|
|
|
|
ld [de], a
|
2013-04-19 00:50:45 -07:00
|
|
|
ld a, 1
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc73e], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 36778
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommanda0: ; 36778
|
2013-03-26 22:52:04 -07:00
|
|
|
; teleport
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [BattleType]
|
2013-05-02 23:43:44 -07:00
|
|
|
cp BATTLETYPE_SHINY
|
2014-06-17 11:58:11 -07:00
|
|
|
jr z, .failed
|
|
|
|
cp BATTLETYPE_TRAP
|
|
|
|
jr z, .failed
|
2014-06-13 22:53:20 -07:00
|
|
|
cp BATTLETYPE_CELEBI
|
2014-06-17 11:58:11 -07:00
|
|
|
jr z, .failed
|
2013-05-02 23:43:44 -07:00
|
|
|
cp BATTLETYPE_SUICUNE
|
2014-06-17 11:58:11 -07:00
|
|
|
jr z, .failed
|
2013-05-02 23:43:44 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS5_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-05-02 23:43:44 -07:00
|
|
|
bit SUBSTATUS_CANT_RUN, a
|
2014-06-17 11:58:11 -07:00
|
|
|
jr nz, .failed
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr nz, .asm_367bf
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
2014-06-17 11:58:11 -07:00
|
|
|
jr nz, .failed
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [CurPartyLevel]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
ld a, [BattleMonLevel]
|
|
|
|
cp b
|
|
|
|
jr nc, .asm_367df
|
|
|
|
add b
|
|
|
|
ld c, a
|
|
|
|
inc c
|
|
|
|
.asm_367ac
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp c
|
|
|
|
jr nc, .asm_367ac ; 367b0 $fa
|
|
|
|
srl b
|
|
|
|
srl b
|
|
|
|
cp b
|
|
|
|
jr nc, .asm_367df ; 367b7 $26
|
|
|
|
|
2014-06-17 11:58:11 -07:00
|
|
|
.failed
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-27 15:50:10 -07:00
|
|
|
jp PrintButItFailed
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_367bf
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
2014-06-17 11:58:11 -07:00
|
|
|
jr nz, .failed
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [BattleMonLevel]
|
|
|
|
ld b, a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [CurPartyLevel]
|
2013-03-26 17:39:44 -07:00
|
|
|
cp b
|
|
|
|
jr nc, .asm_367df ; 367cd $10
|
|
|
|
add b
|
|
|
|
ld c, a
|
|
|
|
inc c
|
|
|
|
.asm_367d2
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp c
|
|
|
|
jr nc, .asm_367d2 ; 367d6 $fa
|
|
|
|
srl b
|
|
|
|
srl b
|
|
|
|
cp b
|
|
|
|
jr nc, .asm_367df ; 367dd $0
|
|
|
|
.asm_367df
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateBattleMonInParty
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
inc a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd232], a
|
|
|
|
ld [wc689], a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function36804
|
2013-03-26 17:39:44 -07:00
|
|
|
call BattleCommand0a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37e36
|
2013-05-02 23:43:44 -07:00
|
|
|
ld c, 20
|
2013-03-26 17:39:44 -07:00
|
|
|
call DelayFrames
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function36804
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, FledFromBattleText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 36804
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function36804: ; 36804
|
2015-10-24 07:34:19 -07:00
|
|
|
ld a, [wBattleResult]
|
2013-03-26 17:39:44 -07:00
|
|
|
and $c0
|
|
|
|
or $2
|
2015-10-24 07:34:19 -07:00
|
|
|
ld [wBattleResult], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 3680f
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand23: ; 3680f
|
2013-03-26 22:52:04 -07:00
|
|
|
; forceswitch
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [BattleType]
|
2013-05-02 23:43:44 -07:00
|
|
|
cp BATTLETYPE_SHINY
|
2013-03-27 15:50:10 -07:00
|
|
|
jp z, .asm_36969
|
2015-09-09 16:27:07 -07:00
|
|
|
cp BATTLETYPE_TRAP
|
2013-03-27 15:50:10 -07:00
|
|
|
jp z, .asm_36969
|
2014-06-13 22:53:20 -07:00
|
|
|
cp BATTLETYPE_CELEBI
|
2013-03-27 15:50:10 -07:00
|
|
|
jp z, .asm_36969
|
2013-05-02 23:43:44 -07:00
|
|
|
cp BATTLETYPE_SUICUNE
|
2013-03-27 15:50:10 -07:00
|
|
|
jp z, .asm_36969
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jp nz, .asm_368cd
|
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
|
|
|
jr nz, .asm_36852 ; 36830 $20
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
|
|
|
jr nz, .asm_36869 ; 36836 $31
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [CurPartyLevel]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
ld a, [BattleMonLevel]
|
|
|
|
cp b
|
|
|
|
jr nc, .asm_36855 ; 36840 $13
|
|
|
|
add b
|
|
|
|
ld c, a
|
|
|
|
inc c
|
|
|
|
.asm_36845
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp c
|
|
|
|
jr nc, .asm_36845 ; 36849 $fa
|
|
|
|
srl b
|
|
|
|
srl b
|
|
|
|
cp b
|
|
|
|
jr nc, .asm_36855 ; 36850 $3
|
|
|
|
.asm_36852
|
2013-03-27 15:50:10 -07:00
|
|
|
jp .asm_36969
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36855
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateBattleMonInParty
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
inc a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd232], a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function36804
|
2014-06-12 18:32:42 -07:00
|
|
|
ld a, [wPlayerMoveStruct + MOVE_ANIM]
|
2013-03-27 15:50:10 -07:00
|
|
|
jp .asm_36975
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36869
|
2014-08-13 19:44:56 -07:00
|
|
|
call CountEnemyAliveMons
|
2013-03-26 17:39:44 -07:00
|
|
|
jr c, .asm_368ca ; 3686c $5c
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc70f]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
jr z, .asm_368ca ; 36872 $56
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateEnemyMonInParty
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $1
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld c, $14
|
|
|
|
call DelayFrames
|
2014-06-04 01:10:56 -07:00
|
|
|
hlcoord 1, 0
|
2015-11-01 06:38:48 -08:00
|
|
|
lb bc, 4, 10
|
2013-03-26 17:39:44 -07:00
|
|
|
call ClearBox
|
|
|
|
ld c, $14
|
|
|
|
call DelayFrames
|
|
|
|
ld a, [OTPartyCount]
|
|
|
|
ld b, a
|
|
|
|
ld a, [CurOTMon]
|
|
|
|
ld c, a
|
|
|
|
.asm_3689a
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
and $7
|
|
|
|
cp b
|
|
|
|
jr nc, .asm_3689a ; 368a0 $f8
|
|
|
|
cp c
|
|
|
|
jr z, .asm_3689a ; 368a3 $f5
|
|
|
|
push af
|
|
|
|
push bc
|
2014-02-22 21:37:09 -08:00
|
|
|
ld hl, OTPartyMon1HP
|
2013-03-26 17:39:44 -07:00
|
|
|
call GetPartyLocation
|
|
|
|
ld a, [hli]
|
|
|
|
or [hl]
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
jr z, .asm_3689a ; 368b1 $e7
|
|
|
|
ld a, d
|
|
|
|
inc a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc718], a
|
2013-10-01 17:47:54 -07:00
|
|
|
callab Function3d4c3
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, DraggedOutText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
ld hl, SpikesDamage
|
2013-12-31 00:25:38 -08:00
|
|
|
jp CallBattleCore
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_368ca
|
2013-03-27 15:50:10 -07:00
|
|
|
jp .asm_36969
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_368cd
|
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
|
|
|
jr nz, .asm_368f3
|
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
|
|
|
jr nz, .asm_36908
|
|
|
|
|
|
|
|
ld a, [BattleMonLevel]
|
|
|
|
ld b, a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [CurPartyLevel]
|
2013-03-26 17:39:44 -07:00
|
|
|
cp b
|
|
|
|
jr nc, .asm_368f5
|
|
|
|
|
|
|
|
add b
|
|
|
|
ld c, a
|
|
|
|
inc c
|
|
|
|
.asm_368e6
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp c
|
|
|
|
jr nc, .asm_368e6
|
|
|
|
|
|
|
|
srl b
|
|
|
|
srl b
|
|
|
|
cp b
|
|
|
|
jr nc, .asm_368f5
|
|
|
|
|
|
|
|
.asm_368f3
|
|
|
|
jr .asm_36969
|
|
|
|
|
|
|
|
.asm_368f5
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateBattleMonInParty
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
inc a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd232], a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function36804
|
2014-06-12 18:32:42 -07:00
|
|
|
ld a, [wEnemyMoveStruct + MOVE_ANIM]
|
2013-03-26 17:39:44 -07:00
|
|
|
jr .asm_36975
|
|
|
|
|
|
|
|
.asm_36908
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function36994
|
2013-03-26 17:39:44 -07:00
|
|
|
jr c, .asm_36969
|
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc70f]
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $1
|
|
|
|
jr z, .asm_368ca
|
|
|
|
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateBattleMonInParty
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $1
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld c, $14
|
|
|
|
call DelayFrames
|
2014-06-04 01:10:56 -07:00
|
|
|
hlcoord 9, 7
|
2015-11-01 06:38:48 -08:00
|
|
|
lb bc, 5, 11
|
2013-12-31 01:09:00 -08:00
|
|
|
call ClearBox
|
2013-03-26 17:39:44 -07:00
|
|
|
ld c, $14
|
|
|
|
call DelayFrames
|
|
|
|
ld a, [PartyCount]
|
|
|
|
ld b, a
|
|
|
|
ld a, [CurBattleMon]
|
|
|
|
ld c, a
|
|
|
|
.asm_3693a
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
and $7
|
|
|
|
cp b
|
|
|
|
jr nc, .asm_3693a
|
|
|
|
|
|
|
|
cp c
|
|
|
|
jr z, .asm_3693a
|
|
|
|
|
|
|
|
push af
|
|
|
|
push bc
|
2014-02-22 21:37:09 -08:00
|
|
|
ld hl, PartyMon1HP
|
2013-03-26 17:39:44 -07:00
|
|
|
call GetPartyLocation
|
|
|
|
ld a, [hli]
|
|
|
|
or [hl]
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
jr z, .asm_3693a
|
|
|
|
|
|
|
|
ld a, d
|
|
|
|
ld [CurPartyMon], a
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, Function3db32
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, DraggedOutText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
ld hl, SpikesDamage
|
2013-12-31 00:25:38 -08:00
|
|
|
jp CallBattleCore
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36969
|
2013-03-27 13:19:51 -07:00
|
|
|
call BattleCommand0a
|
|
|
|
call BattleCommandaa
|
|
|
|
call BattleCommand0c
|
2013-03-27 15:50:10 -07:00
|
|
|
jp PrintButItFailed
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36975
|
|
|
|
push af
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function36804
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $1
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld c, $14
|
|
|
|
call DelayFrames
|
|
|
|
pop af
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, FledInFearText
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $2e
|
|
|
|
jr z, .asm_36991
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, BlownAwayText
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36991
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 36994
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function36994: ; 36994
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [PartyCount]
|
|
|
|
ld d, a
|
|
|
|
ld e, 0
|
2014-06-23 12:45:30 -07:00
|
|
|
ld bc, PartyMon2 - PartyMon1
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3699d
|
|
|
|
ld a, [CurBattleMon]
|
|
|
|
cp e
|
|
|
|
jr z, .asm_369ae
|
|
|
|
|
|
|
|
ld a, e
|
2014-02-22 21:37:09 -08:00
|
|
|
ld hl, PartyMon1HP
|
2013-03-26 17:39:44 -07:00
|
|
|
call AddNTimes
|
|
|
|
ld a, [hli]
|
|
|
|
or [hl]
|
|
|
|
jr nz, .asm_369b4
|
|
|
|
|
|
|
|
.asm_369ae
|
|
|
|
inc e
|
|
|
|
dec d
|
|
|
|
jr nz, .asm_3699d
|
|
|
|
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_369b4
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; 369b6
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand24: ; 369b6
|
2013-03-26 22:52:04 -07:00
|
|
|
; endloop
|
|
|
|
|
|
|
|
; Loop back to the command before 'critical'.
|
|
|
|
|
2013-04-19 00:50:45 -07:00
|
|
|
ld de, PlayerRolloutCount
|
2015-02-08 00:03:32 -08:00
|
|
|
ld bc, PlayerDamageTaken
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-03-26 22:52:04 -07:00
|
|
|
jr z, .asm_369c7
|
2013-04-19 00:50:45 -07:00
|
|
|
ld de, EnemyRolloutCount
|
2015-02-08 00:03:32 -08:00
|
|
|
ld bc, EnemyDamageTaken
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_369c7
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-23 12:47:07 -07:00
|
|
|
bit SUBSTATUS_IN_LOOP, [hl]
|
2013-05-02 23:43:44 -07:00
|
|
|
jp nz, .asm_36a43
|
2014-06-23 12:47:07 -07:00
|
|
|
set SUBSTATUS_IN_LOOP, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_TWINEEDLE
|
|
|
|
jr z, .asm_36a3f
|
|
|
|
cp EFFECT_DOUBLE_HIT
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $1
|
2013-04-27 14:12:23 -07:00
|
|
|
jr z, .asm_36a3a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_BEAT_UP
|
|
|
|
jr z, .asm_369fb
|
|
|
|
cp EFFECT_TRIPLE_KICK
|
|
|
|
jr nz, .asm_36a2b
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_369ec
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
and $3
|
2013-04-27 14:12:23 -07:00
|
|
|
jr z, .asm_369ec
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
2013-04-27 14:12:23 -07:00
|
|
|
jr nz, .asm_36a3a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $1
|
|
|
|
ld [bc], a
|
2013-04-27 14:12:23 -07:00
|
|
|
jr .asm_36a48
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_369fb
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-04-27 14:12:23 -07:00
|
|
|
jr nz, .asm_36a0b
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [PartyCount]
|
|
|
|
cp $1
|
2013-03-27 15:50:10 -07:00
|
|
|
jp z, .asm_36a1e
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
2013-04-27 14:12:23 -07:00
|
|
|
jr .asm_36a3a
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36a0b
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $1
|
2013-03-27 15:50:10 -07:00
|
|
|
jp z, .asm_36a1e
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [OTPartyCount]
|
|
|
|
cp $1
|
2013-03-27 15:50:10 -07:00
|
|
|
jp z, .asm_36a1e
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
2013-03-27 15:50:10 -07:00
|
|
|
jr .asm_36a3a
|
|
|
|
|
|
|
|
.asm_36a1e
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-23 12:47:07 -07:00
|
|
|
res SUBSTATUS_IN_LOOP, [hl]
|
2013-03-27 15:50:10 -07:00
|
|
|
call BattleCommanda8
|
2013-03-26 17:39:44 -07:00
|
|
|
jp EndMoveEffect
|
|
|
|
.asm_36a2b
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
and $3
|
|
|
|
cp $2
|
2014-06-13 21:18:14 -07:00
|
|
|
jr c, .asm_36a39
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
and $3
|
|
|
|
.asm_36a39
|
|
|
|
inc a
|
|
|
|
.asm_36a3a
|
|
|
|
ld [de], a
|
|
|
|
inc a
|
|
|
|
ld [bc], a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr .asm_36a6b
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36a3f
|
|
|
|
ld a, $1
|
2014-06-13 21:18:14 -07:00
|
|
|
jr .asm_36a3a
|
2013-05-02 23:43:44 -07:00
|
|
|
|
|
|
|
.asm_36a43
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [de]
|
|
|
|
dec a
|
|
|
|
ld [de], a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_36a6b
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36a48
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-23 12:47:07 -07:00
|
|
|
res SUBSTATUS_IN_LOOP, [hl]
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, PlayerHitTimesText
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-03-27 14:07:00 -07:00
|
|
|
jr z, .asm_36a5a
|
|
|
|
ld hl, EnemyHitTimesText
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36a5a
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
push bc
|
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_BEAT_UP
|
2013-03-27 14:07:00 -07:00
|
|
|
jr z, .asm_36a67
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36a67
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
pop bc
|
|
|
|
xor a
|
|
|
|
ld [bc], a
|
|
|
|
ret
|
2013-03-26 22:52:04 -07:00
|
|
|
|
|
|
|
; Loop back to the command before 'critical'.
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36a6b
|
|
|
|
ld a, [BattleScriptBufferLoc + 1]
|
|
|
|
ld h, a
|
|
|
|
ld a, [BattleScriptBufferLoc]
|
|
|
|
ld l, a
|
|
|
|
.asm_36a73
|
|
|
|
ld a, [hld]
|
2013-03-26 22:52:04 -07:00
|
|
|
cp $5 ; critical
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_36a73
|
2013-03-26 17:39:44 -07:00
|
|
|
inc hl
|
|
|
|
ld a, h
|
|
|
|
ld [BattleScriptBufferLoc + 1], a
|
|
|
|
ld a, l
|
|
|
|
ld [BattleScriptBufferLoc], a
|
|
|
|
ret
|
|
|
|
; 36a82
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand94: ; 36a82
|
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
|
|
|
ret nz
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckSubstituteOpp
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_36a9a
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-13 21:18:14 -07:00
|
|
|
and 1 << FRZ | SLP
|
|
|
|
jr nz, .asm_36a9a
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function36abf
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, Function36ab5
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36a9a
|
|
|
|
ld a, 1
|
|
|
|
ld [AttackMissed], a
|
|
|
|
ret
|
|
|
|
; 36aa0
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand25: ; 36aa0
|
|
|
|
call CheckSubstituteOpp
|
|
|
|
ret nz
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-13 21:18:14 -07:00
|
|
|
and 1 << FRZ | SLP
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function36abf
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [EffectFailed]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
; fallthrough
|
|
|
|
; 36ab5
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function36ab5: ; 36ab5
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-13 21:18:14 -07:00
|
|
|
set SUBSTATUS_FLINCHED, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
jp EndRechargeOpp
|
|
|
|
; 36abf
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function36abf: ; 36abf
|
2013-03-26 17:39:44 -07:00
|
|
|
push bc
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc70f]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
xor b
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
; 36ac9
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand4d: ; 36ac9
|
2013-03-26 22:52:04 -07:00
|
|
|
; kingsrock
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
|
|
|
ret nz
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
call GetUserItem
|
|
|
|
ld a, b
|
2014-06-13 21:18:14 -07:00
|
|
|
cp HELD_TRADE_EVOLVE ; Only King's Rock has this effect
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckSubstituteOpp
|
|
|
|
ret nz
|
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
call GetUserItem
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp c
|
|
|
|
ret nc
|
|
|
|
call EndRechargeOpp
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-13 21:18:14 -07:00
|
|
|
set SUBSTATUS_FLINCHED, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 36af3
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand26: ; 36af3
|
2013-03-26 22:52:04 -07:00
|
|
|
; ohko
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
call ResetDamage
|
|
|
|
ld a, [TypeModifier]
|
|
|
|
and $7f
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_36b2f
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EnemyMonLevel
|
|
|
|
ld de, BattleMonLevel
|
2014-06-12 18:32:42 -07:00
|
|
|
ld bc, wPlayerMoveStruct + MOVE_ACC
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_36b12
|
2013-03-26 17:39:44 -07:00
|
|
|
push hl
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
pop de
|
2014-06-12 18:32:42 -07:00
|
|
|
ld bc, wEnemyMoveStruct + MOVE_ACC
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36b12
|
|
|
|
ld a, [de]
|
|
|
|
sub [hl]
|
2014-06-13 21:18:14 -07:00
|
|
|
jr c, .asm_36b2f
|
2013-03-26 17:39:44 -07:00
|
|
|
add a
|
|
|
|
ld e, a
|
|
|
|
ld a, [bc]
|
|
|
|
add e
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nc, .asm_36b1e
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $ff
|
|
|
|
.asm_36b1e
|
|
|
|
ld [bc], a
|
2013-03-27 15:50:10 -07:00
|
|
|
call BattleCommand09
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CurDamage
|
|
|
|
ld a, $ff
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
ld a, $2
|
|
|
|
ld [CriticalHit], a
|
|
|
|
ret
|
|
|
|
.asm_36b2f
|
|
|
|
ld a, $ff
|
|
|
|
ld [CriticalHit], a
|
|
|
|
ld a, $1
|
|
|
|
ld [AttackMissed], a
|
|
|
|
ret
|
|
|
|
; 36b3a
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand3a: ; 36b3a
|
2013-03-26 22:52:04 -07:00
|
|
|
; checkcharge
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SUBSTATUS_CHARGED, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2014-06-13 21:18:14 -07:00
|
|
|
res SUBSTATUS_CHARGED, [hl]
|
|
|
|
res SUBSTATUS_UNDERGROUND, [hl]
|
|
|
|
res SUBSTATUS_FLYING, [hl]
|
2015-04-13 21:39:54 -07:00
|
|
|
ld b, charge_command
|
2013-03-26 22:52:04 -07:00
|
|
|
jp SkipToBattleCommand
|
2013-03-26 17:39:44 -07:00
|
|
|
; 36b4d
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand39: ; 36b4d
|
2013-03-26 22:52:04 -07:00
|
|
|
; charge
|
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
call BattleCommand38
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_STATUS
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-13 21:18:14 -07:00
|
|
|
and SLP
|
2013-03-27 14:07:00 -07:00
|
|
|
jr z, .asm_36b65
|
|
|
|
|
2013-03-27 13:19:51 -07:00
|
|
|
call BattleCommandaa
|
2013-03-26 17:39:44 -07:00
|
|
|
call BattleCommand0c
|
2013-03-27 15:50:10 -07:00
|
|
|
call PrintButItFailed
|
2013-03-26 17:39:44 -07:00
|
|
|
jp EndMoveEffect
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36b65
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-13 21:18:14 -07:00
|
|
|
set SUBSTATUS_CHARGED, [hl]
|
2013-03-27 14:07:00 -07:00
|
|
|
|
|
|
|
ld hl, IgnoredOrders2Text
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AlreadyDisobeyed]
|
|
|
|
and a
|
2013-08-31 00:54:02 -07:00
|
|
|
call nz, StdBattleTextBox
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
call BattleCommand0a
|
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
inc a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37e36
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-13 21:18:14 -07:00
|
|
|
cp FLY
|
|
|
|
jr z, .asm_36b96
|
|
|
|
cp DIG
|
|
|
|
jr z, .asm_36b96
|
2013-03-26 17:39:44 -07:00
|
|
|
call BattleCommand0c
|
2014-06-13 21:18:14 -07:00
|
|
|
jr .asm_36b99
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36b96
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37ec0
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36b99
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
2014-06-13 21:18:14 -07:00
|
|
|
cp FLY
|
|
|
|
jr z, .asm_36bb0
|
|
|
|
cp DIG
|
|
|
|
jr nz, .asm_36bb2
|
|
|
|
set SUBSTATUS_UNDERGROUND, [hl]
|
|
|
|
jr .asm_36bb2
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_36bb0
|
2014-06-13 21:18:14 -07:00
|
|
|
set SUBSTATUS_FLYING, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_36bb2
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34548
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_36bc3
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], b
|
|
|
|
ld a, BATTLE_VARS_LAST_MOVE
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], b
|
|
|
|
|
|
|
|
.asm_36bc3
|
|
|
|
call ResetDamage
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
ld hl, .UsedText
|
2013-03-26 17:39:44 -07:00
|
|
|
call BattleTextBox
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_SKULL_BASH
|
2015-04-13 21:39:54 -07:00
|
|
|
ld b, endturn_command
|
2013-03-26 22:52:04 -07:00
|
|
|
jp z, SkipToBattleCommand
|
2013-03-26 17:39:44 -07:00
|
|
|
jp EndMoveEffect
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.UsedText
|
2015-07-22 12:57:02 -07:00
|
|
|
text_jump UnknownText_0x1c0d0e ; "[USER]"
|
2013-03-26 17:39:44 -07:00
|
|
|
start_asm
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
cp RAZOR_WIND
|
|
|
|
ld hl, .RazorWind
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .done
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
cp SOLARBEAM
|
|
|
|
ld hl, .Solarbeam
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .done
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
cp SKULL_BASH
|
|
|
|
ld hl, .SkullBash
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .done
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
cp SKY_ATTACK
|
|
|
|
ld hl, .SkyAttack
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .done
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
cp FLY
|
|
|
|
ld hl, .Fly
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .done
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
cp DIG
|
|
|
|
ld hl, .Dig
|
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
.done
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
|
|
|
|
.RazorWind
|
|
|
|
; 'made a whirlwind!'
|
2015-07-22 12:57:02 -07:00
|
|
|
text_jump UnknownText_0x1c0d12
|
2013-03-26 17:39:44 -07:00
|
|
|
db "@"
|
|
|
|
|
|
|
|
.Solarbeam
|
|
|
|
; 'took in sunlight!'
|
2015-07-22 12:57:02 -07:00
|
|
|
text_jump UnknownText_0x1c0d26
|
2013-03-26 17:39:44 -07:00
|
|
|
db "@"
|
|
|
|
|
|
|
|
.SkullBash
|
|
|
|
; 'lowered its head!'
|
2015-07-22 12:57:02 -07:00
|
|
|
text_jump UnknownText_0x1c0d3a
|
2013-03-26 17:39:44 -07:00
|
|
|
db "@"
|
|
|
|
|
|
|
|
.SkyAttack
|
|
|
|
; 'is glowing!'
|
2015-07-22 12:57:02 -07:00
|
|
|
text_jump UnknownText_0x1c0d4e
|
2013-03-26 17:39:44 -07:00
|
|
|
db "@"
|
|
|
|
|
|
|
|
.Fly
|
|
|
|
; 'flew up high!'
|
2015-07-22 12:57:02 -07:00
|
|
|
text_jump UnknownText_0x1c0d5c
|
2013-03-26 17:39:44 -07:00
|
|
|
db "@"
|
|
|
|
|
|
|
|
.Dig
|
|
|
|
; 'dug a hole!'
|
2015-07-22 12:57:02 -07:00
|
|
|
text_jump UnknownText_0x1c0d6c
|
2013-03-26 17:39:44 -07:00
|
|
|
db "@"
|
|
|
|
; 36c2c
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand3c: ; 36c2c
|
|
|
|
; unused
|
|
|
|
ret
|
|
|
|
; 36c2d
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand3b: ; 36c2d
|
2013-03-26 22:52:04 -07:00
|
|
|
; traptarget
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
|
|
|
ret nz
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc731
|
|
|
|
ld de, wc72f
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_36c43
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc730
|
|
|
|
ld de, wc72e
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_36c43
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SUBSTATUS_SUBSTITUTE, a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
and 3
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 3
|
2013-03-26 17:39:44 -07:00
|
|
|
inc a
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], a
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [de], a
|
|
|
|
ld b, a
|
|
|
|
ld hl, .Traps
|
|
|
|
|
|
|
|
.asm_36c61
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
|
|
|
jr z, .asm_36c69
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
inc hl
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
jr .asm_36c61
|
|
|
|
|
|
|
|
.asm_36c69
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.Traps
|
|
|
|
dbw BIND, UsedBindText ; 'used BIND on'
|
|
|
|
dbw WRAP, WrappedByText ; 'was WRAPPED by'
|
|
|
|
dbw FIRE_SPIN, FireSpinTrapText ; 'was trapped!'
|
|
|
|
dbw CLAMP, ClampedByText ; 'was CLAMPED by'
|
|
|
|
dbw WHIRLPOOL, WhirlpoolTrapText ; 'was trapped!'
|
|
|
|
; 36c7e
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand28: ; 36c7e
|
2013-03-26 22:52:04 -07:00
|
|
|
; mist
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SUBSTATUS_MIST, [hl]
|
|
|
|
jr nz, .asm_36c92
|
|
|
|
set SUBSTATUS_MIST, [hl]
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, MistText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36c92
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-27 15:50:10 -07:00
|
|
|
jp PrintButItFailed
|
2013-03-26 17:39:44 -07:00
|
|
|
; 36c98
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand29: ; 36c98
|
2013-03-26 22:52:04 -07:00
|
|
|
; focusenergy
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SUBSTATUS_FOCUS_ENERGY, [hl]
|
|
|
|
jr nz, .asm_36cac
|
|
|
|
set SUBSTATUS_FOCUS_ENERGY, [hl]
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, GettingPumpedText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36cac
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-27 15:50:10 -07:00
|
|
|
jp PrintButItFailed
|
2013-03-26 17:39:44 -07:00
|
|
|
; 36cb2
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand27: ; 36cb2
|
2013-03-26 22:52:04 -07:00
|
|
|
; recoil
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BattleMonMaxHP
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_36cbd
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, EnemyMonMaxHP
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36cbd
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, a
|
|
|
|
ld a, [CurDamage]
|
|
|
|
ld b, a
|
|
|
|
ld a, [CurDamage + 1]
|
|
|
|
ld c, a
|
|
|
|
srl b
|
|
|
|
rr c
|
|
|
|
srl b
|
|
|
|
rr c
|
|
|
|
ld a, b
|
|
|
|
or c
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_36cd8
|
2013-03-26 17:39:44 -07:00
|
|
|
inc c
|
|
|
|
.asm_36cd8
|
|
|
|
ld a, [hli]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [Buffer2], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [Buffer1], a
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
dec hl
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ec], a
|
2013-03-26 17:39:44 -07:00
|
|
|
sub c
|
|
|
|
ld [hld], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ee], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ed], a
|
2013-03-26 17:39:44 -07:00
|
|
|
sbc b
|
|
|
|
ld [hl], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd1ef], a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nc, .asm_36cfe
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wd1ee
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
.asm_36cfe
|
2014-06-04 01:10:56 -07:00
|
|
|
hlcoord 10, 9
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
ld a, $1
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_36d0c
|
2014-06-04 01:10:56 -07:00
|
|
|
hlcoord 2, 2
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
.asm_36d0c
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd10a], a
|
2014-06-16 11:20:01 -07:00
|
|
|
predef Functionc6e0
|
2013-05-02 21:22:28 -07:00
|
|
|
call RefreshBattleHuds
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, RecoilText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 36d1d
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand2b: ; 36d1d
|
2013-03-26 22:52:04 -07:00
|
|
|
; confusetarget
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
call GetOpponentItem
|
|
|
|
ld a, b
|
2014-06-13 21:18:14 -07:00
|
|
|
cp HELD_PREVENT_CONFUSE
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2013-06-13 13:10:39 -07:00
|
|
|
ld a, [EffectFailed]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37962
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
call CheckSubstituteOpp
|
|
|
|
ret nz
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SUBSTATUS_CONFUSED, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
2013-12-31 01:10:49 -08:00
|
|
|
jr Function36d70
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
BattleCommand2a: ; 36d3b
|
2013-03-26 22:52:04 -07:00
|
|
|
; confuse
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
call GetOpponentItem
|
|
|
|
ld a, b
|
2014-06-13 21:18:14 -07:00
|
|
|
cp HELD_PREVENT_CONFUSE
|
2013-03-26 17:39:44 -07:00
|
|
|
jr nz, .asm_36d53
|
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-05-02 22:29:57 -07:00
|
|
|
call GetItemName
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, ProtectedByText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_36d53
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SUBSTATUS_CONFUSED, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_36d65
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, AlreadyConfusedText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_36d65
|
|
|
|
call CheckSubstituteOpp
|
2013-12-31 01:10:49 -08:00
|
|
|
jr nz, Function36db6
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2013-12-31 01:10:49 -08:00
|
|
|
jr nz, Function36db6
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
; fallthrough
|
|
|
|
; 36d70
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function36d70: ; 36d70
|
2013-04-27 14:12:23 -07:00
|
|
|
ld bc, EnemyConfuseCount
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-04-27 14:12:23 -07:00
|
|
|
jr z, .asm_36d7b
|
2013-03-26 17:39:44 -07:00
|
|
|
ld bc, PlayerConfuseCount
|
2013-04-27 14:12:23 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36d7b
|
2014-06-13 21:18:14 -07:00
|
|
|
set SUBSTATUS_CONFUSED, [hl]
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-04-27 14:12:23 -07:00
|
|
|
and 3
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
inc a
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [bc], a
|
2013-04-27 14:12:23 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_CONFUSE_HIT
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_36d99
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_SNORE
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_36d99
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_SWAGGER
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_36d99
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-04-27 14:12:23 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36d99
|
2014-06-13 21:18:14 -07:00
|
|
|
ld de, ANIM_CONFUSED
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37e54
|
2013-04-27 14:12:23 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BecameConfusedText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-04-27 14:12:23 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
call GetOpponentItem
|
|
|
|
ld a, b
|
2014-06-13 21:18:14 -07:00
|
|
|
cp HELD_HEAL_STATUS
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_36db0
|
2014-06-13 21:18:14 -07:00
|
|
|
cp HELD_HEAL_CONFUSION
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
|
|
|
.asm_36db0
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, Function3de51
|
2013-12-31 00:25:38 -08:00
|
|
|
jp CallBattleCore
|
2013-03-26 17:39:44 -07:00
|
|
|
; 36db6
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function36db6: ; 36db6
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_CONFUSE_HIT
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_SNORE
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_SWAGGER
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
|
|
|
jp PrintDidntAffect2
|
|
|
|
; 36dc7
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand30: ; 36dc7
|
2013-03-26 22:52:04 -07:00
|
|
|
; paralyze
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-13 21:18:14 -07:00
|
|
|
bit PAR, a
|
|
|
|
jr nz, .asm_36e49
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [TypeModifier]
|
|
|
|
and $7f
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_36e55
|
2013-03-26 17:39:44 -07:00
|
|
|
call GetOpponentItem
|
|
|
|
ld a, b
|
2014-06-13 21:18:14 -07:00
|
|
|
cp HELD_PREVENT_PARALYZE
|
|
|
|
jr nz, .asm_36def
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-05-02 22:29:57 -07:00
|
|
|
call GetItemName
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, ProtectedByText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2014-06-13 21:18:14 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36def
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_36e0e
|
2015-09-04 13:30:40 -07:00
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_36e0e
|
2015-09-04 13:30:40 -07:00
|
|
|
|
|
|
|
ld a, [InBattleTowerBattle]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_36e0e
|
2015-09-04 13:30:40 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [PlayerSubStatus5]
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SUBSTATUS_LOCK_ON, a
|
|
|
|
jr nz, .asm_36e0e
|
2015-09-04 13:30:40 -07:00
|
|
|
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $40
|
2014-06-13 21:18:14 -07:00
|
|
|
jr c, .asm_36e52
|
2015-09-04 13:30:40 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36e0e
|
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_36e52
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_36e52
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckSubstituteOpp
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_36e52
|
|
|
|
ld c, 30
|
2013-03-26 17:39:44 -07:00
|
|
|
call DelayFrames
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $1
|
|
|
|
ld [$ffd4], a
|
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-13 21:18:14 -07:00
|
|
|
set PAR, [hl]
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateOpponentInParty
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, Function3ec39
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateBattleHuds
|
2013-03-26 17:39:44 -07:00
|
|
|
call PrintParalyze
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, Function3dde9
|
2013-12-31 00:25:38 -08:00
|
|
|
jp CallBattleCore
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36e49
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, AlreadyParalyzedText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36e52
|
|
|
|
jp PrintDidntAffect2
|
|
|
|
.asm_36e55
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-26 17:39:44 -07:00
|
|
|
jp PrintDoesntAffect
|
|
|
|
; 36e5b
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function36e5b: ; 36e5b
|
2014-06-13 21:18:14 -07:00
|
|
|
; Compare move type to opponent type.
|
|
|
|
; Return z if matching the opponent type,
|
|
|
|
; unless the move is Normal (Tri Attack).
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
push hl
|
|
|
|
|
|
|
|
ld hl, EnemyMonType1
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .ok
|
|
|
|
ld hl, BattleMonType1
|
|
|
|
.ok
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_TYPE
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
cp NORMAL
|
|
|
|
jr z, .normal
|
|
|
|
|
|
|
|
cp [hl]
|
|
|
|
jr z, .return
|
|
|
|
|
|
|
|
inc hl
|
|
|
|
cp [hl]
|
|
|
|
|
|
|
|
.return
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
|
|
|
.normal
|
|
|
|
ld a, 1
|
|
|
|
and a
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 36e7c
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand31: ; 36e7c
|
2013-03-26 22:52:04 -07:00
|
|
|
; substitute
|
|
|
|
|
2013-03-27 13:19:51 -07:00
|
|
|
call BattleCommandaa
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BattleMonMaxHP
|
2014-06-10 23:08:07 -07:00
|
|
|
ld de, PlayerSubstituteHP
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .got_hp
|
|
|
|
ld hl, EnemyMonMaxHP
|
|
|
|
ld de, EnemySubstituteHP
|
|
|
|
.got_hp
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-10 23:08:07 -07:00
|
|
|
bit SUBSTATUS_SUBSTITUTE, a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_36ef4
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld b, [hl]
|
|
|
|
srl a
|
|
|
|
rr b
|
|
|
|
srl a
|
|
|
|
rr b
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
dec hl
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, b
|
|
|
|
ld [de], a
|
|
|
|
ld a, [hld]
|
|
|
|
sub b
|
|
|
|
ld e, a
|
|
|
|
ld a, [hl]
|
2014-06-10 23:08:07 -07:00
|
|
|
sbc 0
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr c, .asm_36eff
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, d
|
|
|
|
or e
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_36eff
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], d
|
|
|
|
inc hl
|
|
|
|
ld [hl], e
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-10 23:08:07 -07:00
|
|
|
set SUBSTATUS_SUBSTITUTE, [hl]
|
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc730
|
|
|
|
ld de, wc72e
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .asm_36ecf
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc731
|
|
|
|
ld de, wc72f
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36ecf
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [hl], a
|
|
|
|
ld [de], a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37ed5
|
2014-06-13 21:18:14 -07:00
|
|
|
jr c, .asm_36ee8
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [FXAnimIDHi], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2014-06-13 21:18:14 -07:00
|
|
|
ld a, SUBSTITUTE
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37e44
|
2014-06-13 21:18:14 -07:00
|
|
|
jr .asm_36eeb
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36ee8
|
|
|
|
call BattleCommanda6
|
|
|
|
.asm_36eeb
|
|
|
|
ld hl, MadeSubstituteText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-05-02 21:22:28 -07:00
|
|
|
jp RefreshBattleHuds
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36ef4
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34548
|
2013-03-26 17:39:44 -07:00
|
|
|
call nz, BattleCommand0c
|
|
|
|
ld hl, HasSubstituteText
|
2014-06-10 23:08:07 -07:00
|
|
|
jr .asm_36f08
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36eff
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34548
|
2013-03-26 17:39:44 -07:00
|
|
|
call nz, BattleCommand0c
|
|
|
|
ld hl, TooWeakSubText
|
|
|
|
.asm_36f08
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 36f0b
|
|
|
|
|
|
|
|
BattleCommand32: ; 36f0b
|
2013-03-26 22:52:04 -07:00
|
|
|
; rechargenextturn
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-10 23:08:07 -07:00
|
|
|
set SUBSTATUS_RECHARGE, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 36f13
|
|
|
|
|
|
|
|
|
|
|
|
EndRechargeOpp: ; 36f13
|
|
|
|
push hl
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-10 23:08:07 -07:00
|
|
|
res SUBSTATUS_RECHARGE, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 36f1d
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand97: ; 36f1d
|
2013-03-26 22:52:04 -07:00
|
|
|
; rage
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-10 23:08:07 -07:00
|
|
|
set SUBSTATUS_RAGE, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 36f25
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand98: ; 36f25
|
2013-03-26 22:52:04 -07:00
|
|
|
; doubleflyingdamage
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-07-29 10:58:20 -07:00
|
|
|
bit SUBSTATUS_FLYING, a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2013-03-26 22:52:04 -07:00
|
|
|
jr DoubleDamage
|
2013-03-26 17:39:44 -07:00
|
|
|
; 36f2f
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand99: ; 36f2f
|
2013-03-26 22:52:04 -07:00
|
|
|
; doubleundergrounddamage
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-07-29 10:58:20 -07:00
|
|
|
bit SUBSTATUS_UNDERGROUND, a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
|
|
|
|
|
|
|
; fallthrough
|
|
|
|
; 36f37
|
|
|
|
|
|
|
|
|
2013-03-26 22:52:04 -07:00
|
|
|
DoubleDamage: ; 36f37
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CurDamage + 1
|
|
|
|
sla [hl]
|
|
|
|
dec hl
|
|
|
|
rl [hl]
|
|
|
|
jr nc, .quit
|
|
|
|
|
|
|
|
ld a, $ff
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
.quit
|
|
|
|
ret
|
|
|
|
; 36f46
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand33: ; 36f46
|
2013-03-26 22:52:04 -07:00
|
|
|
; mimic
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function372d8
|
2013-03-27 13:19:51 -07:00
|
|
|
call BattleCommandaa
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_36f9a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BattleMonMoves
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_36f5d
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EnemyMonMoves
|
|
|
|
.asm_36f5d
|
|
|
|
call CheckHiddenOpponent
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_36f9a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_36f9a
|
2014-06-10 23:08:07 -07:00
|
|
|
cp STRUGGLE
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_36f9a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld c, NUM_MOVES
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36f71
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_36f9a
|
2013-03-26 17:39:44 -07:00
|
|
|
dec c
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_36f71
|
2013-03-26 17:39:44 -07:00
|
|
|
dec hl
|
|
|
|
.asm_36f79
|
|
|
|
ld a, [hld]
|
2014-06-10 23:08:07 -07:00
|
|
|
cp MIMIC
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_36f79
|
2013-03-26 17:39:44 -07:00
|
|
|
inc hl
|
|
|
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld bc, BattleMonPP - BattleMonMoves
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
2014-06-10 23:08:07 -07:00
|
|
|
ld [hl], 5
|
2013-05-02 23:43:44 -07:00
|
|
|
call GetMoveName
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, LearnedMoveText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_36f9a
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function37357
|
2013-03-26 17:39:44 -07:00
|
|
|
; 36f9d
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand35: ; 36f9d
|
|
|
|
; leechseed
|
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2014-06-10 23:08:07 -07:00
|
|
|
jr nz, .evaded
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckSubstituteOpp
|
2014-06-10 23:08:07 -07:00
|
|
|
jr nz, .evaded
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld de, EnemyMonType1
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .ok
|
2013-03-26 17:39:44 -07:00
|
|
|
ld de, BattleMonType1
|
2014-06-10 23:08:07 -07:00
|
|
|
.ok
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [de]
|
2014-06-10 23:08:07 -07:00
|
|
|
cp GRASS
|
|
|
|
jr z, .grass
|
2013-03-26 17:39:44 -07:00
|
|
|
inc de
|
|
|
|
ld a, [de]
|
2014-06-10 23:08:07 -07:00
|
|
|
cp GRASS
|
|
|
|
jr z, .grass
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-10 23:08:07 -07:00
|
|
|
bit SUBSTATUS_LEECH_SEED, [hl]
|
|
|
|
jr nz, .evaded
|
|
|
|
set SUBSTATUS_LEECH_SEED, [hl]
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, WasSeededText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2014-06-10 23:08:07 -07:00
|
|
|
|
|
|
|
.grass
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-26 17:39:44 -07:00
|
|
|
jp PrintDoesntAffect
|
2014-06-10 23:08:07 -07:00
|
|
|
|
|
|
|
.evaded
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EvadedText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 36fe1
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand36: ; 36fe1
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2015-10-24 07:34:19 -07:00
|
|
|
callba MobileFn_1060e5
|
2013-03-26 17:39:44 -07:00
|
|
|
jp PrintNothingHappened
|
|
|
|
; 36fed
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand37: ; 36fed
|
|
|
|
; disable
|
|
|
|
|
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_37059
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-05-02 22:29:57 -07:00
|
|
|
ld de, EnemyDisableCount
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EnemyMonMoves
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_37004
|
2013-03-26 17:39:44 -07:00
|
|
|
ld de, PlayerDisableCount
|
|
|
|
ld hl, BattleMonMoves
|
|
|
|
.asm_37004
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [de]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_37059
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_37059
|
2014-06-10 23:08:07 -07:00
|
|
|
cp STRUGGLE
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_37059
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
ld c, $ff
|
|
|
|
.asm_37017
|
|
|
|
inc c
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_37017
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld hl, EnemyMonPP
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_37027
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BattleMonPP
|
|
|
|
.asm_37027
|
2014-06-10 23:08:07 -07:00
|
|
|
ld b, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_37059
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3702e
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2014-06-10 23:08:07 -07:00
|
|
|
and 7
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_3702e
|
2013-03-26 17:39:44 -07:00
|
|
|
inc a
|
|
|
|
inc c
|
|
|
|
swap c
|
|
|
|
add c
|
|
|
|
ld [de], a
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, DisabledMove
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_37047
|
2013-03-26 17:39:44 -07:00
|
|
|
inc hl
|
|
|
|
.asm_37047
|
|
|
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-05-02 23:43:44 -07:00
|
|
|
call GetMoveName
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, WasDisabledText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_37059
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function37354
|
2013-03-26 17:39:44 -07:00
|
|
|
; 3705c
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand1e: ; 3705c
|
2013-03-26 22:52:04 -07:00
|
|
|
; payday
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld hl, StringBuffer1
|
|
|
|
ld [hli], a
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
ld a, [BattleMonLevel]
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .ok
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [EnemyMonLevel]
|
2014-06-10 23:08:07 -07:00
|
|
|
.ok
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
add a
|
2014-06-13 21:18:14 -07:00
|
|
|
ld hl, wPayDayMoney + 2
|
2013-03-26 17:39:44 -07:00
|
|
|
add [hl]
|
|
|
|
ld [hld], a
|
2014-06-10 23:08:07 -07:00
|
|
|
jr nc, .done
|
2013-03-26 17:39:44 -07:00
|
|
|
inc [hl]
|
|
|
|
dec hl
|
2014-06-10 23:08:07 -07:00
|
|
|
jr nz, .done
|
2013-03-26 17:39:44 -07:00
|
|
|
inc [hl]
|
2014-06-10 23:08:07 -07:00
|
|
|
.done
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CoinsScatteredText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 3707f
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand1f: ; 3707f
|
2013-03-26 22:52:04 -07:00
|
|
|
; conversion
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BattleMonMoves
|
|
|
|
ld de, BattleMonType1
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .asm_37090
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EnemyMonMoves
|
|
|
|
ld de, EnemyMonType1
|
|
|
|
.asm_37090
|
|
|
|
push de
|
2014-06-13 21:18:14 -07:00
|
|
|
ld c, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
ld de, StringBuffer1
|
|
|
|
.asm_37096
|
|
|
|
push hl
|
2014-06-13 21:18:14 -07:00
|
|
|
ld b, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
pop hl
|
|
|
|
and a
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .asm_370b2
|
2013-03-26 17:39:44 -07:00
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
dec a
|
2014-06-10 23:23:55 -07:00
|
|
|
ld hl, Moves + MOVE_TYPE
|
2013-03-27 13:19:51 -07:00
|
|
|
call GetMoveAttr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
inc c
|
|
|
|
ld a, c
|
2014-06-10 23:08:07 -07:00
|
|
|
cp NUM_MOVES
|
|
|
|
jr c, .asm_37096
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_370b2
|
|
|
|
ld a, $ff
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld [de], a
|
|
|
|
pop de
|
|
|
|
ld hl, StringBuffer1
|
|
|
|
.asm_370bd
|
|
|
|
ld a, [hl]
|
|
|
|
cp $ff
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .asm_370d3
|
|
|
|
cp CURSE_T
|
|
|
|
jr z, .asm_370d0
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [de]
|
|
|
|
cp [hl]
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .asm_370d0
|
2013-03-26 17:39:44 -07:00
|
|
|
inc de
|
|
|
|
ld a, [de]
|
|
|
|
dec de
|
|
|
|
cp [hl]
|
2014-06-10 23:08:07 -07:00
|
|
|
jr nz, .asm_370d9_a
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_370d0
|
|
|
|
inc hl
|
2014-06-10 23:08:07 -07:00
|
|
|
jr .asm_370bd
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_370d3
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-27 15:50:10 -07:00
|
|
|
jp PrintButItFailed
|
2014-06-10 23:08:07 -07:00
|
|
|
.asm_370d9_a
|
|
|
|
.asm_370d9_b
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2014-06-10 23:08:07 -07:00
|
|
|
and 3 ; TODO factor in NUM_MOVES
|
2013-03-26 17:39:44 -07:00
|
|
|
ld c, a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld b, 0
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, StringBuffer1
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
cp $ff
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_370d9_b
|
2014-06-10 23:08:07 -07:00
|
|
|
cp CURSE_T
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_370d9_b
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [de]
|
|
|
|
cp [hl]
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_370d9_b
|
2013-03-26 17:39:44 -07:00
|
|
|
inc de
|
|
|
|
ld a, [de]
|
|
|
|
dec de
|
|
|
|
cp [hl]
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_370d9_b
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld [de], a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-10-01 17:47:54 -07:00
|
|
|
callba GetTypeName
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, TransformedTypeText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 3710e
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand20: ; 3710e
|
|
|
|
; resetstats
|
2013-03-26 22:52:04 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, 7 ; neutral
|
|
|
|
ld hl, PlayerStatLevels
|
|
|
|
call .Fill
|
|
|
|
ld hl, EnemyStatLevels
|
|
|
|
call .Fill
|
|
|
|
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
push af
|
|
|
|
|
|
|
|
call SetPlayerTurn
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function365d7
|
2013-03-26 17:39:44 -07:00
|
|
|
call SetEnemyTurn
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function365fd
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
pop af
|
|
|
|
ld [hBattleTurn], a
|
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld hl, EliminatedStatsText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.Fill
|
|
|
|
ld b, PlayerStatLevelsEnd - PlayerStatLevels
|
2014-06-10 23:08:07 -07:00
|
|
|
.next
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hli], a
|
|
|
|
dec b
|
2014-06-10 23:08:07 -07:00
|
|
|
jr nz, .next
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 3713e
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand2c: ; 3713e
|
2013-03-26 22:52:04 -07:00
|
|
|
; heal
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld de, BattleMonHP
|
|
|
|
ld hl, BattleMonMaxHP
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_3714f
|
2014-06-10 23:08:07 -07:00
|
|
|
ld de, EnemyMonHP
|
|
|
|
ld hl, EnemyMonMaxHP
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3714f
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2014-06-10 23:08:07 -07:00
|
|
|
ld c, 2
|
2013-03-26 17:39:44 -07:00
|
|
|
call StringCmp
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
jp z, .asm_371c4
|
|
|
|
ld a, b
|
2014-06-10 23:08:07 -07:00
|
|
|
cp REST
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_37199
|
2013-03-26 17:39:44 -07:00
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push af
|
2013-03-27 13:19:51 -07:00
|
|
|
call BattleCommandaa
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS5
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-10 23:08:07 -07:00
|
|
|
res SUBSTATUS_TOXIC, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_STATUS
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
ld [hl], REST_TURNS + 1
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, WentToSleepText
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_37186
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, RestedText
|
|
|
|
.asm_37186
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_37193
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function365d7
|
2014-06-13 21:18:14 -07:00
|
|
|
jr .asm_37196
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_37193
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function365fd
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_37196
|
|
|
|
pop af
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
.asm_37199
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_371a3
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, GetHalfMaxHP
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2014-06-13 21:18:14 -07:00
|
|
|
jr .asm_371a9
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_371a3
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, GetMaxHP
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_371a9
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, Function3ccef
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateUserInParty
|
|
|
|
call RefreshBattleHuds
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, RegainedHealthText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_371c4
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, HPIsFullText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 371cd
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand2d: ; 371cd
|
|
|
|
; transform
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function372d8
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS5_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SUBSTATUS_TRANSFORMED, [hl]
|
2013-12-31 01:10:49 -08:00
|
|
|
jp nz, Function372d2
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckHiddenOpponent
|
2013-12-31 01:10:49 -08:00
|
|
|
jp nz, Function372d2
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [FXAnimIDHi], a
|
|
|
|
ld a, $1
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-10 23:08:07 -07:00
|
|
|
bit SUBSTATUS_SUBSTITUTE, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
push af
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_37200
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34548
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_37200
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, SUBSTITUTE
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37e44
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_37200
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS5
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-13 21:18:14 -07:00
|
|
|
set SUBSTATUS_TRANSFORMED, [hl]
|
2014-01-01 05:09:15 -08:00
|
|
|
call ResetActorDisable
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BattleMonSpecies
|
|
|
|
ld de, EnemyMonSpecies
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_3721f
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EnemyMonSpecies
|
|
|
|
ld de, BattleMonSpecies
|
|
|
|
xor a
|
|
|
|
ld [CurMoveNum], a
|
|
|
|
.asm_3721f
|
|
|
|
push hl
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc hl
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
inc de
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2014-06-10 23:08:07 -07:00
|
|
|
ld bc, NUM_MOVES
|
2013-12-31 01:09:00 -08:00
|
|
|
call CopyBytes
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_3723a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [de]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc6f2], a
|
2013-03-26 17:39:44 -07:00
|
|
|
inc de
|
|
|
|
ld a, [de]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc6f2 + 1], a
|
2013-03-26 17:39:44 -07:00
|
|
|
dec de
|
|
|
|
.asm_3723a
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld bc, $000c
|
|
|
|
add hl, bc
|
|
|
|
push hl
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
add hl, bc
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
pop hl
|
|
|
|
ld bc, $000c
|
2013-12-31 01:09:00 -08:00
|
|
|
call CopyBytes
|
2013-03-26 17:39:44 -07:00
|
|
|
ld bc, $ffe2
|
|
|
|
add hl, bc
|
|
|
|
push de
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
pop hl
|
|
|
|
ld bc, $ffe8
|
|
|
|
add hl, bc
|
2014-06-10 23:08:07 -07:00
|
|
|
ld b, NUM_MOVES
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3725f
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_3726c
|
2013-12-31 01:09:00 -08:00
|
|
|
cp SKETCH
|
|
|
|
ld a, 1
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_3726c
|
2013-12-31 01:09:00 -08:00
|
|
|
ld a, 5
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3726c
|
|
|
|
ld [hli], a
|
|
|
|
dec b
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_3725f
|
2013-03-26 17:39:44 -07:00
|
|
|
pop hl
|
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-12-31 01:09:00 -08:00
|
|
|
call GetPokemonName
|
2013-06-13 13:10:39 -07:00
|
|
|
ld hl, EnemyStats
|
|
|
|
ld de, PlayerStats
|
2013-03-26 17:39:44 -07:00
|
|
|
ld bc, $000a
|
|
|
|
call BattleSideCopy
|
|
|
|
ld hl, EnemyStatLevels
|
|
|
|
ld de, PlayerStatLevels
|
|
|
|
ld bc, $0008
|
|
|
|
call BattleSideCopy
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37ed5
|
2014-06-13 21:18:14 -07:00
|
|
|
jr c, .asm_372a8
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc6fe]
|
2014-06-13 21:18:14 -07:00
|
|
|
jr z, .asm_372a0
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc6fa]
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_372a0
|
|
|
|
and a
|
2014-06-13 21:18:14 -07:00
|
|
|
jr nz, .asm_372a8
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37e36
|
2014-06-13 21:18:14 -07:00
|
|
|
jr .asm_372ae
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_372a8
|
2013-03-27 13:19:51 -07:00
|
|
|
call BattleCommandaa
|
2013-03-26 17:39:44 -07:00
|
|
|
call BattleCommanda6
|
|
|
|
.asm_372ae
|
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [FXAnimIDHi], a
|
|
|
|
ld a, $2
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2013-03-26 17:39:44 -07:00
|
|
|
pop af
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, SUBSTITUTE
|
2013-12-31 01:10:49 -08:00
|
|
|
call nz, Function37e44
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, TransformedText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 372c6
|
|
|
|
|
|
|
|
|
|
|
|
BattleSideCopy: ; 372c6
|
|
|
|
; Copy bc bytes from hl to de if it's the player's turn.
|
|
|
|
; Copy bc bytes from de to hl if it's the enemy's turn.
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .copy
|
|
|
|
|
|
|
|
; Swap hl and de
|
|
|
|
push hl
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
pop de
|
|
|
|
.copy
|
|
|
|
jp CopyBytes
|
|
|
|
; 372d2
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function372d2: ; 372d2
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-27 15:50:10 -07:00
|
|
|
jp PrintButItFailed
|
2013-03-26 17:39:44 -07:00
|
|
|
; 372d8
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function372d8: ; 372d8
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [hl], a
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_LAST_MOVE
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 372e7
|
|
|
|
|
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
ResetActorDisable: ; 372e7
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .player
|
|
|
|
|
|
|
|
xor a
|
2013-05-02 22:29:57 -07:00
|
|
|
ld [EnemyDisableCount], a
|
2013-05-03 18:04:34 -07:00
|
|
|
ld [EnemyDisabledMove], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
|
|
|
|
.player
|
|
|
|
xor a
|
|
|
|
ld [PlayerDisableCount], a
|
|
|
|
ld [DisabledMove], a
|
|
|
|
ret
|
|
|
|
; 372fc
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand2e: ; 372fc
|
2013-03-26 22:52:04 -07:00
|
|
|
; screen
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, PlayerScreens
|
|
|
|
ld bc, PlayerLightScreenCount
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-03-27 14:07:00 -07:00
|
|
|
jr z, .asm_3730d
|
2013-04-19 23:57:11 -07:00
|
|
|
ld hl, EnemyScreens
|
2013-04-27 14:12:23 -07:00
|
|
|
ld bc, EnemyLightScreenCount
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_3730d
|
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-04-27 14:12:23 -07:00
|
|
|
cp EFFECT_LIGHT_SCREEN
|
|
|
|
jr nz, .Reflect
|
|
|
|
|
2014-06-10 23:08:07 -07:00
|
|
|
bit SCREENS_LIGHT_SCREEN, [hl]
|
|
|
|
jr nz, .failed
|
|
|
|
set SCREENS_LIGHT_SCREEN, [hl]
|
|
|
|
ld a, 5
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [bc], a
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, LightScreenEffectText
|
|
|
|
jr .asm_37331
|
|
|
|
|
2013-04-27 14:12:23 -07:00
|
|
|
.Reflect
|
2014-06-10 23:08:07 -07:00
|
|
|
bit SCREENS_REFLECT, [hl]
|
|
|
|
jr nz, .failed
|
|
|
|
set SCREENS_REFLECT, [hl]
|
2013-04-27 14:12:23 -07:00
|
|
|
|
2014-06-13 21:18:14 -07:00
|
|
|
; LightScreenCount -> ReflectCount
|
2013-03-26 17:39:44 -07:00
|
|
|
inc bc
|
2013-04-27 14:12:23 -07:00
|
|
|
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, 5
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [bc], a
|
2013-03-27 14:07:00 -07:00
|
|
|
ld hl, ReflectEffectText
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_37331
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-27 14:07:00 -07:00
|
|
|
|
2014-06-10 23:08:07 -07:00
|
|
|
.failed
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-27 15:50:10 -07:00
|
|
|
jp PrintButItFailed
|
2013-03-26 17:39:44 -07:00
|
|
|
; 3733d
|
|
|
|
|
|
|
|
|
|
|
|
PrintDoesntAffect: ; 3733d
|
|
|
|
; 'it doesn't affect'
|
|
|
|
ld hl, DoesntAffectText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 37343
|
|
|
|
|
|
|
|
|
|
|
|
PrintNothingHappened: ; 37343
|
|
|
|
; 'but nothing happened!'
|
|
|
|
ld hl, NothingHappenedText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 37349
|
|
|
|
|
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
TryPrintButItFailed: ; 37349
|
|
|
|
ld a, [AlreadyFailed]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
; fallthrough
|
|
|
|
; 3734e
|
|
|
|
|
|
|
|
|
|
|
|
PrintButItFailed: ; 3734e
|
2013-03-26 17:39:44 -07:00
|
|
|
; 'but it failed!'
|
|
|
|
ld hl, ButItFailedText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 37354
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function37354: ; 37354
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-27 15:50:10 -07:00
|
|
|
; fallthrough
|
|
|
|
; 37357
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function37357: ; 37357
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, ButItFailedText ; 'but it failed!'
|
|
|
|
ld de, ItFailedText ; 'it failed!'
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function35157
|
2013-03-26 17:39:44 -07:00
|
|
|
; 37360
|
|
|
|
|
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
PrintDidntAffect: ; 37360
|
2013-03-26 17:39:44 -07:00
|
|
|
; 'it didn't affect'
|
|
|
|
ld hl, DidntAffect1Text
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 37366
|
|
|
|
|
|
|
|
|
|
|
|
PrintDidntAffect2: ; 37366
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, DidntAffect1Text ; 'it didn't affect'
|
|
|
|
ld de, DidntAffect2Text ; 'it didn't affect'
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function35157
|
2013-03-26 17:39:44 -07:00
|
|
|
; 37372
|
|
|
|
|
|
|
|
|
|
|
|
PrintParalyze: ; 37372
|
|
|
|
; 'paralyzed! maybe it can't attack!'
|
|
|
|
ld hl, ParalyzedText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 37378
|
|
|
|
|
|
|
|
|
|
|
|
CheckSubstituteOpp: ; 37378
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-10 23:08:07 -07:00
|
|
|
bit SUBSTATUS_SUBSTITUTE, a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 37380
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand1a: ; 37380
|
2015-10-24 07:34:19 -07:00
|
|
|
callba MobileFn_10610d
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $4
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld c, $3
|
|
|
|
call DelayFrames
|
|
|
|
ld a, BATTLE_VARS_STATUS
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
inc hl
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
ld a, $1
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2013-03-26 17:39:44 -07:00
|
|
|
call BattleCommand0a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37e36
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-10 23:08:07 -07:00
|
|
|
res SUBSTATUS_LEECH_SEED, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS5_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-10 23:08:07 -07:00
|
|
|
res SUBSTATUS_DESTINY_BOND, [hl]
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37ed5
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nc
|
2013-10-01 17:47:54 -07:00
|
|
|
callba DrawPlayerHUD
|
2014-06-16 22:52:59 -07:00
|
|
|
callba DrawEnemyHUD
|
2013-12-01 11:19:57 -08:00
|
|
|
call WaitBGMap
|
2013-05-02 21:22:28 -07:00
|
|
|
jp RefreshBattleHuds
|
2013-03-26 17:39:44 -07:00
|
|
|
; 373c9
|
|
|
|
|
|
|
|
|
2013-12-01 11:19:57 -08:00
|
|
|
INCLUDE "battle/effects/mirror_move.asm"
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-12-01 11:19:57 -08:00
|
|
|
INCLUDE "battle/effects/metronome.asm"
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
CheckUserMove: ; 37462
|
|
|
|
; Return z if the user has move a.
|
|
|
|
ld b, a
|
|
|
|
ld de, BattleMonMoves
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .ok
|
|
|
|
ld de, EnemyMonMoves
|
|
|
|
.ok
|
|
|
|
|
|
|
|
ld c, NUM_MOVES
|
|
|
|
.loop
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
cp b
|
|
|
|
ret z
|
|
|
|
|
|
|
|
dec c
|
|
|
|
jr nz, .loop
|
|
|
|
|
|
|
|
ld a, 1
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; 3747b
|
|
|
|
|
|
|
|
|
|
|
|
ResetTurn: ; 3747b
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc732
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_37486
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc733
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.asm_37486
|
|
|
|
ld [hl], 1
|
|
|
|
xor a
|
|
|
|
ld [AlreadyDisobeyed], a
|
2013-03-27 15:50:10 -07:00
|
|
|
call DoMove
|
|
|
|
jp EndMoveEffect
|
2013-03-26 17:39:44 -07:00
|
|
|
; 37492
|
|
|
|
|
|
|
|
|
2013-12-01 11:19:57 -08:00
|
|
|
INCLUDE "battle/effects/thief.asm"
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
BattleCommand51: ; 37517
|
|
|
|
; arenatrap
|
2013-09-08 19:44:20 -07:00
|
|
|
|
|
|
|
; Doesn't work on an absent opponent.
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckHiddenOpponent
|
2013-09-08 19:44:20 -07:00
|
|
|
jr nz, .failed
|
|
|
|
|
|
|
|
; Don't trap if the opponent is already trapped.
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS5
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-09-08 19:44:20 -07:00
|
|
|
bit SUBSTATUS_CANT_RUN, [hl]
|
|
|
|
jr nz, .failed
|
|
|
|
|
|
|
|
; Otherwise trap the opponent.
|
|
|
|
|
|
|
|
set SUBSTATUS_CANT_RUN, [hl]
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CantEscapeNowText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-09-08 19:44:20 -07:00
|
|
|
|
|
|
|
.failed
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-27 15:50:10 -07:00
|
|
|
jp PrintButItFailed
|
2013-03-26 17:39:44 -07:00
|
|
|
; 37536
|
|
|
|
|
|
|
|
|
2013-12-01 11:19:57 -08:00
|
|
|
INCLUDE "battle/effects/nightmare.asm"
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
BattleCommand53: ; 37563
|
|
|
|
; defrost
|
|
|
|
|
2013-09-08 19:30:10 -07:00
|
|
|
; Thaw the user.
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_STATUS
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-09-08 19:30:10 -07:00
|
|
|
bit FRZ, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2013-09-08 19:30:10 -07:00
|
|
|
res FRZ, [hl]
|
|
|
|
|
|
|
|
; Don't update the enemy's party struct in a wild battle.
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-09-08 19:30:10 -07:00
|
|
|
jr z, .party
|
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
2013-09-08 19:30:10 -07:00
|
|
|
jr z, .done
|
|
|
|
|
|
|
|
.party
|
|
|
|
ld a, PartyMon1Status - PartyMon1
|
2013-05-02 23:43:44 -07:00
|
|
|
call UserPartyAttr
|
2013-09-08 19:30:10 -07:00
|
|
|
res FRZ, [hl]
|
|
|
|
|
|
|
|
.done
|
2013-05-02 21:22:28 -07:00
|
|
|
call RefreshBattleHuds
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, WasDefrostedText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 37588
|
|
|
|
|
|
|
|
|
2013-09-09 15:43:22 -07:00
|
|
|
INCLUDE "battle/effects/curse.asm"
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-09-09 18:51:41 -07:00
|
|
|
INCLUDE "battle/effects/protect.asm"
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-09-09 18:51:41 -07:00
|
|
|
INCLUDE "battle/effects/endure.asm"
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-09-09 19:02:26 -07:00
|
|
|
INCLUDE "battle/effects/spikes.asm"
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-12-01 11:19:57 -08:00
|
|
|
INCLUDE "battle/effects/foresight.asm"
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-12-01 11:19:57 -08:00
|
|
|
INCLUDE "battle/effects/perish_song.asm"
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-12-01 11:19:57 -08:00
|
|
|
INCLUDE "battle/effects/sandstorm.asm"
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-12-01 11:19:57 -08:00
|
|
|
INCLUDE "battle/effects/rollout.asm"
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
BattleCommand5d: ; 37791
|
|
|
|
; unused
|
|
|
|
ret
|
|
|
|
; 37792
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand5e: ; 37792
|
|
|
|
; furycutter
|
|
|
|
|
2013-04-19 00:50:45 -07:00
|
|
|
ld hl, PlayerFuryCutterCount
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-04-19 00:50:45 -07:00
|
|
|
jr z, .go
|
|
|
|
ld hl, EnemyFuryCutterCount
|
|
|
|
|
|
|
|
.go
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2013-04-19 00:50:45 -07:00
|
|
|
jp nz, ResetFuryCutterCount
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
inc [hl]
|
2013-04-19 00:50:45 -07:00
|
|
|
|
|
|
|
; Damage capped at 5 turns' worth (16x).
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
ld b, a
|
2013-04-19 00:50:45 -07:00
|
|
|
cp 6
|
|
|
|
jr c, .checkdouble
|
|
|
|
ld b, 5
|
|
|
|
|
|
|
|
.checkdouble
|
2013-03-26 17:39:44 -07:00
|
|
|
dec b
|
|
|
|
ret z
|
2013-04-19 00:50:45 -07:00
|
|
|
|
|
|
|
; Double the damage
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CurDamage + 1
|
|
|
|
sla [hl]
|
|
|
|
dec hl
|
|
|
|
rl [hl]
|
2013-04-19 00:50:45 -07:00
|
|
|
jr nc, .checkdouble
|
|
|
|
|
|
|
|
; No overflow
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $ff
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 377be
|
|
|
|
|
|
|
|
|
2013-04-19 00:50:45 -07:00
|
|
|
ResetFuryCutterCount: ; 377be
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
push hl
|
|
|
|
|
2013-04-19 00:50:45 -07:00
|
|
|
ld hl, PlayerFuryCutterCount
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-04-19 00:50:45 -07:00
|
|
|
jr z, .reset
|
|
|
|
ld hl, EnemyFuryCutterCount
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-04-19 00:50:45 -07:00
|
|
|
.reset
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [hl], a
|
|
|
|
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 377ce
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand5f: ; 377ce
|
|
|
|
; attract
|
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2014-06-10 23:08:07 -07:00
|
|
|
jr nz, .failed
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function377f5
|
2014-06-10 23:08:07 -07:00
|
|
|
jr c, .failed
|
2013-03-26 17:39:44 -07:00
|
|
|
call CheckHiddenOpponent
|
2014-06-10 23:08:07 -07:00
|
|
|
jr nz, .failed
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS1_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-10 23:08:07 -07:00
|
|
|
bit SUBSTATUS_IN_LOVE, [hl]
|
|
|
|
jr nz, .failed
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-10 23:08:07 -07:00
|
|
|
set SUBSTATUS_IN_LOVE, [hl]
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
; 'fell in love!'
|
|
|
|
ld hl, FellInLoveText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-10 23:08:07 -07:00
|
|
|
.failed
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function37354
|
2013-03-26 17:39:44 -07:00
|
|
|
; 377f5
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function377f5: ; 377f5
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, PartyMon1Species - PartyMon1
|
2013-03-26 17:39:44 -07:00
|
|
|
call BattlePartyAttr
|
|
|
|
ld a, [hl]
|
|
|
|
ld [CurPartySpecies], a
|
|
|
|
|
|
|
|
ld a, [CurBattleMon]
|
|
|
|
ld [CurPartyMon], a
|
|
|
|
xor a
|
|
|
|
ld [MonType], a
|
|
|
|
|
2013-10-01 17:47:54 -07:00
|
|
|
callba GetGender
|
2013-03-26 17:39:44 -07:00
|
|
|
jr c, .asm_37849
|
|
|
|
|
|
|
|
ld b, 1
|
|
|
|
jr nz, .asm_37815
|
|
|
|
dec b
|
|
|
|
|
|
|
|
.asm_37815
|
|
|
|
push bc
|
|
|
|
ld a, [TempEnemyMonSpecies]
|
|
|
|
ld [CurPartySpecies], a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld hl, EnemyMonDVs
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [EnemySubStatus5]
|
2014-06-13 21:18:14 -07:00
|
|
|
bit SUBSTATUS_TRANSFORMED, a
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_37829
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc6f2
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_37829
|
|
|
|
ld a, [hli]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [TempMonDVs], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [TempMonDVs + 1], a
|
2013-07-02 11:10:49 -07:00
|
|
|
ld a, 3
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [MonType], a
|
2013-10-01 17:47:54 -07:00
|
|
|
callba GetGender
|
2013-03-26 17:39:44 -07:00
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand60: ; 3784b
|
2013-03-26 22:52:04 -07:00
|
|
|
; happinesspower
|
2013-03-26 17:39:44 -07:00
|
|
|
push bc
|
|
|
|
ld hl, BattleMonHappiness
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .ok
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EnemyMonHappiness
|
2014-06-10 23:08:07 -07:00
|
|
|
.ok
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplicand + 0], a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld [hMultiplicand + 1], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
2014-06-10 23:08:07 -07:00
|
|
|
ld [hMultiplicand + 2], a
|
|
|
|
ld a, 10
|
|
|
|
ld [hMultiplier], a
|
2013-05-02 23:43:44 -07:00
|
|
|
call Multiply
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, 25
|
|
|
|
ld [hDivisor], a
|
|
|
|
ld b, 4
|
2013-05-02 23:43:44 -07:00
|
|
|
call Divide
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, [hQuotient + 2]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, a
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
; 37874
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand61: ; 37874
|
|
|
|
; present
|
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $3
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .asm_3787d
|
2013-03-26 17:39:44 -07:00
|
|
|
push bc
|
|
|
|
push de
|
|
|
|
.asm_3787d
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_CalcDamageTypeMultiplier
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
cp $3
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .asm_37889
|
2013-03-26 17:39:44 -07:00
|
|
|
pop de
|
|
|
|
pop bc
|
|
|
|
.asm_37889
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd265]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
2014-01-01 05:09:15 -08:00
|
|
|
jp z, AnimateFailedMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2014-01-01 05:09:15 -08:00
|
|
|
jp nz, AnimateFailedMove
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
push bc
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
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
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_378ad
|
|
|
|
ld a, c
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37de9
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, [hl]
|
|
|
|
pop bc
|
|
|
|
ret
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_378b7
|
|
|
|
pop bc
|
|
|
|
ld a, $3
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-10-01 17:47:54 -07:00
|
|
|
ld hl, AICheckPlayerMaxHP
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_378ce ; 378c9 $3
|
2013-10-01 17:47:54 -07:00
|
|
|
ld hl, AICheckEnemyMaxHP
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_378ce
|
2013-10-01 17:47:54 -07:00
|
|
|
ld a, BANK(AICheckPlayerMaxHP)
|
2013-03-26 17:39:44 -07:00
|
|
|
rst FarCall
|
|
|
|
jr c, .asm_378f3 ; 378d1 $20
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, GetQuarterMaxHP
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, Function3ccef
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, RegainedHealthText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateOpponentInParty
|
2013-03-26 17:39:44 -07:00
|
|
|
jr .asm_37904 ; 378f1 $11
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_378f3
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37ed5
|
2013-03-26 17:39:44 -07:00
|
|
|
jr nc, .asm_37904 ; 378f9 $9
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, RefusedGiftText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_37904
|
|
|
|
jp EndMoveEffect
|
|
|
|
|
|
|
|
.table_37907
|
2014-06-10 23:08:07 -07:00
|
|
|
db 40 percent, 40
|
|
|
|
db 70 percent + 1, 80
|
|
|
|
db 80 percent, 120
|
2013-03-26 17:39:44 -07:00
|
|
|
db $ff
|
|
|
|
; 3790e
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand63: ; 3790e
|
2013-03-26 22:52:04 -07:00
|
|
|
; frustrationpower
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
push bc
|
|
|
|
ld hl, BattleMonHappiness
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_3791a ; 37915 $3
|
|
|
|
ld hl, EnemyMonHappiness
|
|
|
|
.asm_3791a
|
|
|
|
ld a, $ff
|
|
|
|
sub [hl]
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplicand + 2], a
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplicand + 0], a
|
|
|
|
ld [hMultiplicand + 1], a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, 10
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hMultiplier], a
|
2013-05-02 23:43:44 -07:00
|
|
|
call Multiply
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, 25
|
2015-09-06 14:38:01 -07:00
|
|
|
ld [hDivisor], a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld b, 4
|
2013-05-02 23:43:44 -07:00
|
|
|
call Divide
|
2015-09-06 14:38:01 -07:00
|
|
|
ld a, [hQuotient + 2]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, a
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
; 37939
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand64: ; 37939
|
|
|
|
; safeguard
|
|
|
|
|
|
|
|
ld hl, PlayerScreens
|
2014-06-10 23:08:07 -07:00
|
|
|
ld de, PlayerSafeguardCount
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .ok
|
2013-04-19 23:57:11 -07:00
|
|
|
ld hl, EnemyScreens
|
2014-06-10 23:08:07 -07:00
|
|
|
ld de, EnemySafeguardCount
|
|
|
|
.ok
|
|
|
|
bit SCREENS_SAFEGUARD, [hl]
|
|
|
|
jr nz, .failed
|
|
|
|
set SCREENS_SAFEGUARD, [hl]
|
|
|
|
ld a, 5
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [de], a
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CoveredByVeilText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2014-06-10 23:08:07 -07:00
|
|
|
.failed
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-27 15:50:10 -07:00
|
|
|
jp PrintButItFailed
|
2013-03-26 17:39:44 -07:00
|
|
|
; 37962
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function37962: ; 37962
|
2013-03-26 17:39:44 -07:00
|
|
|
push hl
|
2013-04-19 23:57:11 -07:00
|
|
|
ld hl, EnemyScreens
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_3796e
|
|
|
|
ld hl, PlayerScreens
|
|
|
|
|
|
|
|
.asm_3796e
|
2014-06-10 23:08:07 -07:00
|
|
|
bit SCREENS_SAFEGUARD, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 37972
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand65: ; 37972
|
2013-03-26 22:52:04 -07:00
|
|
|
; checksafeguard
|
2013-04-19 23:57:11 -07:00
|
|
|
ld hl, EnemyScreens
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_3797d ; 37978 $3
|
|
|
|
ld hl, PlayerScreens
|
|
|
|
.asm_3797d
|
2014-06-10 23:08:07 -07:00
|
|
|
bit SCREENS_SAFEGUARD, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, 1
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [AttackMissed], a
|
2013-03-27 13:19:51 -07:00
|
|
|
call BattleCommandaa
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, SafeguardProtectText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
jp EndMoveEffect
|
|
|
|
; 37991
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand66: ; 37991
|
|
|
|
; getmagnitude
|
|
|
|
|
|
|
|
push bc
|
2013-08-30 19:59:40 -07:00
|
|
|
call BattleRandom
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
ld hl, .Magnitudes
|
2014-06-10 23:08:07 -07:00
|
|
|
.loop
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
2014-06-10 23:08:07 -07:00
|
|
|
jr nc, .ok
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
inc hl
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2014-06-10 23:08:07 -07:00
|
|
|
jr .loop
|
|
|
|
.ok
|
2013-03-26 17:39:44 -07:00
|
|
|
ld d, [hl]
|
|
|
|
push de
|
|
|
|
inc hl
|
|
|
|
ld a, [hl]
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2013-03-27 13:19:51 -07:00
|
|
|
call BattleCommandaa
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, MagnitudeText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
pop de
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
|
|
|
|
.Magnitudes
|
|
|
|
; /255, BP, magnitude
|
|
|
|
db 13, 10, 4
|
|
|
|
db 38, 30, 5
|
|
|
|
db 89, 50, 6
|
|
|
|
db 166, 70, 7
|
|
|
|
db 217, 90, 8
|
|
|
|
db 242, 110, 9
|
|
|
|
db 255, 150, 10
|
|
|
|
; 379c9
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand67: ; 379c9
|
|
|
|
; batonpass
|
|
|
|
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jp nz, .Enemy
|
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
|
|
|
|
; Need something to switch to
|
|
|
|
call CheckAnyOtherAlivePartyMons
|
|
|
|
jp z, FailedBatonPass
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateBattleMonInParty
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld c, 50
|
|
|
|
call DelayFrames
|
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
; Transition into switchmon menu
|
2015-09-11 19:21:00 -07:00
|
|
|
call LoadMenuDataHeader_0x1d75
|
2013-10-01 17:47:54 -07:00
|
|
|
callba Function3d2f7
|
2014-01-01 05:09:15 -08:00
|
|
|
|
|
|
|
callba ForcePickSwitchMonInBattle
|
|
|
|
|
|
|
|
; Return to battle scene
|
2013-12-02 11:18:03 -08:00
|
|
|
call ClearPalettes
|
2013-10-01 17:47:54 -07:00
|
|
|
callba Function3ed9f
|
2015-07-15 12:48:44 -07:00
|
|
|
call WriteBackup
|
2013-12-02 11:18:03 -08:00
|
|
|
call ClearSprites
|
2013-12-31 01:09:00 -08:00
|
|
|
hlcoord 1, 0
|
|
|
|
lb bc, 4, 10
|
2013-03-26 17:39:44 -07:00
|
|
|
call ClearBox
|
|
|
|
ld b, 1
|
2013-12-02 11:18:03 -08:00
|
|
|
call GetSGBLayout
|
2015-09-09 16:27:07 -07:00
|
|
|
call SetPalettes
|
2014-01-05 04:28:55 -08:00
|
|
|
call BatonPass_LinkPlayerSwitch
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
; Mobile link battles handle entrances differently
|
2013-10-01 17:47:54 -07:00
|
|
|
callba Function3d2e0
|
2013-03-26 17:39:44 -07:00
|
|
|
jp c, EndMoveEffect
|
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
ld hl, PassedBattleMonEntrance
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2014-01-01 05:09:15 -08:00
|
|
|
|
|
|
|
call ResetBatonPassStatus
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.Enemy
|
2014-01-01 05:09:15 -08:00
|
|
|
|
|
|
|
; Wildmons don't have anything to switch to
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2014-01-05 04:28:55 -08:00
|
|
|
dec a ; WILDMON
|
2014-01-01 05:09:15 -08:00
|
|
|
jp z, FailedBatonPass
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
call CheckAnyOtherAliveEnemyMons
|
|
|
|
jp z, FailedBatonPass
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateEnemyMonInParty
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2014-01-05 04:28:55 -08:00
|
|
|
call BatonPass_LinkEnemySwitch
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
; Mobile link battles handle entrances differently
|
2013-10-01 17:47:54 -07:00
|
|
|
callba Function3d2e0
|
2013-03-27 15:50:10 -07:00
|
|
|
jp c, EndMoveEffect
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
; Passed enemy PartyMon entrance
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc718], a
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, Function3d517
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, Function3d57a
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, 1
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd265], a
|
2015-09-09 16:27:07 -07:00
|
|
|
ld hl, ApplyStatLevelMultiplierOnAllStats
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
ld hl, SpikesDamage
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
jr ResetBatonPassStatus
|
2013-03-27 15:50:10 -07:00
|
|
|
; 37a67
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-01-05 04:28:55 -08:00
|
|
|
BatonPass_LinkPlayerSwitch: ; 37a67
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
|
|
|
ld a, 1
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd0ec], a
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2015-09-11 19:21:00 -07:00
|
|
|
call LoadMenuDataHeader_0x1d75
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, Function3e8e4
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2015-07-15 12:48:44 -07:00
|
|
|
call WriteBackup
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wd0ec], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 37a82
|
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
|
2014-01-05 04:28:55 -08:00
|
|
|
BatonPass_LinkEnemySwitch: ; 37a82
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
2015-09-11 19:21:00 -07:00
|
|
|
call LoadMenuDataHeader_0x1d75
|
2013-12-31 01:09:00 -08:00
|
|
|
ld hl, Function3e8e4
|
2013-12-31 00:25:38 -08:00
|
|
|
call CallBattleCore
|
2014-01-01 05:09:15 -08:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [OTPartyCount]
|
2014-06-13 21:18:14 -07:00
|
|
|
add NUM_MOVES
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
2014-06-13 21:18:14 -07:00
|
|
|
ld a, [wBattleAction]
|
|
|
|
cp NUM_MOVES
|
2013-03-26 17:39:44 -07:00
|
|
|
jr c, .asm_37aa0
|
|
|
|
cp b
|
|
|
|
jr c, .asm_37aa8
|
|
|
|
|
|
|
|
.asm_37aa0
|
|
|
|
ld a, [CurOTMon]
|
2014-06-13 21:18:14 -07:00
|
|
|
add NUM_MOVES
|
|
|
|
ld [wBattleAction], a
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_37aa8
|
2015-07-15 12:48:44 -07:00
|
|
|
jp WriteBackup
|
2013-03-27 15:50:10 -07:00
|
|
|
; 37aab
|
|
|
|
|
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
FailedBatonPass: ; 37aab
|
|
|
|
call AnimateFailedMove
|
2013-03-27 15:50:10 -07:00
|
|
|
jp PrintButItFailed
|
|
|
|
; 37ab1
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
ResetBatonPassStatus: ; 37ab1
|
|
|
|
; Reset status changes that aren't passed by Baton Pass.
|
|
|
|
|
2014-06-10 23:08:07 -07:00
|
|
|
; Nightmare isn't passed.
|
2013-03-26 22:52:04 -07:00
|
|
|
ld a, BATTLE_VARS_STATUS
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-01-01 05:09:15 -08:00
|
|
|
and SLP
|
|
|
|
jr nz, .ok
|
|
|
|
|
2013-03-26 22:52:04 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS1
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-01-01 05:09:15 -08:00
|
|
|
res SUBSTATUS_NIGHTMARE, [hl]
|
|
|
|
.ok
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-06-10 23:08:07 -07:00
|
|
|
; Disable isn't passed.
|
2014-01-01 05:09:15 -08:00
|
|
|
call ResetActorDisable
|
|
|
|
|
2014-06-10 23:08:07 -07:00
|
|
|
; Attraction isn't passed.
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, PlayerSubStatus1
|
2014-01-01 05:09:15 -08:00
|
|
|
res SUBSTATUS_IN_LOVE, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, EnemySubStatus1
|
2014-01-01 05:09:15 -08:00
|
|
|
res SUBSTATUS_IN_LOVE, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, PlayerSubStatus5
|
2014-01-01 05:09:15 -08:00
|
|
|
|
2013-03-26 22:52:04 -07:00
|
|
|
ld a, BATTLE_VARS_SUBSTATUS5
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-13 21:18:14 -07:00
|
|
|
res SUBSTATUS_TRANSFORMED, [hl]
|
2014-06-17 12:52:32 -07:00
|
|
|
res SUBSTATUS_ENCORED, [hl]
|
2014-01-01 05:09:15 -08:00
|
|
|
|
2014-06-10 23:08:07 -07:00
|
|
|
; New mon hasn't used a move yet.
|
2013-03-26 22:52:04 -07:00
|
|
|
ld a, BATTLE_VARS_LAST_MOVE
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 22:52:04 -07:00
|
|
|
ld [hl], 0
|
2014-01-01 05:09:15 -08:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc730], a
|
|
|
|
ld [wc731], a
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 37ae9
|
|
|
|
|
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
CheckAnyOtherAlivePartyMons: ; 37ae9
|
2014-02-22 21:37:09 -08:00
|
|
|
ld hl, PartyMon1HP
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [PartyCount]
|
|
|
|
ld d, a
|
|
|
|
ld a, [CurBattleMon]
|
|
|
|
ld e, a
|
2014-01-01 05:09:15 -08:00
|
|
|
jr CheckAnyOtherAliveMons
|
2013-03-27 15:50:10 -07:00
|
|
|
; 37af6
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
CheckAnyOtherAliveEnemyMons: ; 37af6
|
2014-02-22 21:37:09 -08:00
|
|
|
ld hl, OTPartyMon1HP
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [OTPartyCount]
|
|
|
|
ld d, a
|
|
|
|
ld a, [CurOTMon]
|
|
|
|
ld e, a
|
2013-03-27 15:50:10 -07:00
|
|
|
|
|
|
|
; fallthrough
|
|
|
|
; 37b01
|
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
CheckAnyOtherAliveMons: ; 37b01
|
|
|
|
; Check for nonzero HP starting from partymon
|
|
|
|
; HP at hl for d partymons, besides current mon e.
|
|
|
|
|
|
|
|
; Return nz if any are alive.
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld b, a
|
|
|
|
ld c, a
|
2014-01-01 05:09:15 -08:00
|
|
|
.loop
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, c
|
|
|
|
cp d
|
2014-01-01 05:09:15 -08:00
|
|
|
jr z, .done
|
2013-03-26 17:39:44 -07:00
|
|
|
cp e
|
2014-01-01 05:09:15 -08:00
|
|
|
jr z, .next
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, [hli]
|
|
|
|
or b
|
|
|
|
ld b, a
|
|
|
|
ld a, [hld]
|
|
|
|
or b
|
|
|
|
ld b, a
|
2014-01-01 05:09:15 -08:00
|
|
|
|
|
|
|
.next
|
2013-03-26 17:39:44 -07:00
|
|
|
push bc
|
2014-01-01 05:09:15 -08:00
|
|
|
ld bc, PartyMon2 - PartyMon1
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
inc c
|
2014-01-01 05:09:15 -08:00
|
|
|
jr .loop
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
.done
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, b
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; 37b1d
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand68: ; 37b1d
|
2014-06-12 18:32:42 -07:00
|
|
|
; pursuit
|
|
|
|
; Double damage if the opponent is switching.
|
|
|
|
|
|
|
|
ld hl, wEnemyIsSwitching
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-12 18:32:42 -07:00
|
|
|
jr z, .ok
|
|
|
|
ld hl, wPlayerIsSwitching
|
|
|
|
.ok
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
ret z
|
2014-06-12 18:32:42 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CurDamage + 1
|
|
|
|
sla [hl]
|
|
|
|
dec hl
|
|
|
|
rl [hl]
|
|
|
|
ret nc
|
2014-06-12 18:32:42 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $ff
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 37b39
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand69: ; 37b39
|
|
|
|
; clearhazards
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2014-06-10 23:08:07 -07:00
|
|
|
bit SUBSTATUS_LEECH_SEED, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_37b4a ; 37b40 $8
|
2014-06-10 23:08:07 -07:00
|
|
|
res SUBSTATUS_LEECH_SEED, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, ShedLeechSeedText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_37b4a
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, PlayerScreens
|
2015-02-08 00:03:32 -08:00
|
|
|
ld de, wc730
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_37b5b ; 37b53 $6
|
2013-04-19 23:57:11 -07:00
|
|
|
ld hl, EnemyScreens
|
2015-02-08 00:03:32 -08:00
|
|
|
ld de, wc731
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_37b5b
|
2014-06-10 23:08:07 -07:00
|
|
|
bit SCREENS_SPIKES, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
jr z, .asm_37b69 ; 37b5d $a
|
2014-06-10 23:08:07 -07:00
|
|
|
res SCREENS_SPIKES, [hl]
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BlewSpikesText
|
|
|
|
push de
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
pop de
|
|
|
|
.asm_37b69
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [de]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
xor a
|
|
|
|
ld [de], a
|
|
|
|
ld hl, ReleasedByText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 37b74
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand6a: ; 37b74
|
|
|
|
; healmorn
|
|
|
|
ld b, MORN
|
|
|
|
jr BattleCommand6a6c
|
|
|
|
; 37b78
|
|
|
|
|
|
|
|
BattleCommand6b: ; 37b78
|
|
|
|
; healday
|
|
|
|
ld b, DAY
|
|
|
|
jr BattleCommand6a6c
|
|
|
|
; 37b7c
|
|
|
|
|
|
|
|
BattleCommand6c: ; 37b7c
|
|
|
|
; healnite
|
|
|
|
ld b, NITE
|
|
|
|
; fallthrough
|
|
|
|
; 37b7e
|
|
|
|
|
|
|
|
BattleCommand6a6c: ; 37b7e
|
|
|
|
; Time- and weather-sensitive heal.
|
|
|
|
|
|
|
|
ld hl, BattleMonMaxHP
|
|
|
|
ld de, BattleMonHP
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .start
|
|
|
|
ld hl, EnemyMonMaxHP
|
|
|
|
ld de, EnemyMonHP
|
|
|
|
|
|
|
|
.start
|
|
|
|
; Index for .Multipliers
|
|
|
|
; Default restores half max HP.
|
|
|
|
ld c, 2
|
|
|
|
|
|
|
|
; Don't bother healing if HP is already full.
|
|
|
|
push bc
|
|
|
|
call StringCmp
|
|
|
|
pop bc
|
|
|
|
jr z, .Full
|
|
|
|
|
|
|
|
; Don't factor in time of day in link battles.
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
jr nz, .Weather
|
|
|
|
|
|
|
|
ld a, [TimeOfDay]
|
|
|
|
cp b
|
|
|
|
jr z, .Weather
|
|
|
|
dec c
|
|
|
|
|
|
|
|
.Weather
|
|
|
|
ld a, [Weather]
|
|
|
|
and a
|
|
|
|
jr z, .Heal
|
|
|
|
|
|
|
|
; x2 in sun
|
|
|
|
; /2 in rain/sandstorm
|
|
|
|
inc c
|
|
|
|
cp WEATHER_SUN
|
|
|
|
jr z, .Heal
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
dec c
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.Heal
|
|
|
|
ld b, 0
|
|
|
|
ld hl, .Multipliers
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-03-26 17:39:44 -07:00
|
|
|
add hl, bc
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ld a, BANK(GetMaxHP)
|
|
|
|
rst FarCall
|
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2013-10-01 17:47:54 -07:00
|
|
|
callab Function3ccef
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateUserInParty
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
; 'regained health!'
|
|
|
|
ld hl, RegainedHealthText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.Full
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
; 'hp is full!'
|
|
|
|
ld hl, HPIsFullText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
.Multipliers
|
|
|
|
dw GetEighthMaxHP
|
|
|
|
dw GetQuarterMaxHP
|
|
|
|
dw GetHalfMaxHP
|
|
|
|
dw GetMaxHP
|
|
|
|
; 37be8
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand6d: ; 37be8
|
2013-03-26 22:52:04 -07:00
|
|
|
; hiddenpower
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
|
|
|
ret nz
|
2014-01-05 04:49:35 -08:00
|
|
|
callba HiddenPowerDamage
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 37bf4
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand6e: ; 37bf4
|
|
|
|
; startrain
|
|
|
|
ld a, WEATHER_RAIN
|
|
|
|
ld [Weather], a
|
|
|
|
ld a, 5
|
|
|
|
ld [WeatherCount], a
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, DownpourText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 37c07
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand6f: ; 37c07
|
|
|
|
; startsun
|
|
|
|
ld a, WEATHER_SUN
|
|
|
|
ld [Weather], a
|
|
|
|
ld a, 5
|
|
|
|
ld [WeatherCount], a
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, SunGotBrightText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 37c1a
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand95: ; 37c1a
|
|
|
|
; bellydrum
|
2013-03-27 15:50:10 -07:00
|
|
|
call BattleCommand77
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [AttackMissed]
|
|
|
|
and a
|
2013-03-27 15:50:10 -07:00
|
|
|
jr nz, .asm_37c4f
|
|
|
|
|
2013-10-01 17:47:54 -07:00
|
|
|
callab GetHalfMaxHP
|
2013-03-27 15:50:10 -07:00
|
|
|
|
2013-10-01 17:47:54 -07:00
|
|
|
callab Function3ccde
|
2013-03-27 15:50:10 -07:00
|
|
|
jr nc, .asm_37c4f
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
push bc
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
pop bc
|
2013-10-01 17:47:54 -07:00
|
|
|
callab Function3cc3f
|
2013-05-02 21:22:28 -07:00
|
|
|
call UpdateUserInParty
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, 5
|
2013-03-27 15:50:10 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_37c41
|
|
|
|
push af
|
2013-03-27 15:50:10 -07:00
|
|
|
call BattleCommand77
|
2013-03-26 17:39:44 -07:00
|
|
|
pop af
|
|
|
|
dec a
|
2014-06-10 23:08:07 -07:00
|
|
|
jr nz, .asm_37c41
|
2013-03-27 15:50:10 -07:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, BellyDrumText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_37c4f
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-27 15:50:10 -07:00
|
|
|
jp PrintButItFailed
|
2013-03-26 17:39:44 -07:00
|
|
|
; 37c55
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand96: ; 37c55
|
|
|
|
; psychup
|
|
|
|
|
|
|
|
ld hl, EnemyStatLevels
|
|
|
|
ld de, PlayerStatLevels
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_37c64 ; 37c5e $4
|
|
|
|
push hl
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
pop de
|
|
|
|
.asm_37c64
|
|
|
|
push hl
|
|
|
|
ld b, $8
|
|
|
|
.asm_37c67
|
|
|
|
ld a, [hli]
|
|
|
|
cp $7
|
|
|
|
jr nz, .asm_37c76 ; 37c6a $a
|
|
|
|
dec b
|
|
|
|
jr nz, .asm_37c67 ; 37c6d $f8
|
|
|
|
pop hl
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-27 15:50:10 -07:00
|
|
|
jp PrintButItFailed
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_37c76
|
|
|
|
pop hl
|
|
|
|
ld b, $8
|
|
|
|
.asm_37c79
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec b
|
|
|
|
jr nz, .asm_37c79 ; 37c7d $fa
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr nz, .asm_37c89 ; 37c82 $5
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function365d7
|
2013-03-26 17:39:44 -07:00
|
|
|
jr .asm_37c8c ; 37c87 $3
|
|
|
|
.asm_37c89
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function365fd
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_37c8c
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CopiedStatsText
|
2013-08-31 00:54:02 -07:00
|
|
|
jp StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
; 37c95
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand9a: ; 37c95
|
|
|
|
; mirrorcoat
|
|
|
|
|
2014-01-05 05:24:27 -08:00
|
|
|
ld a, 1
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [AttackMissed], a
|
2014-01-05 05:24:27 -08:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret z
|
2014-01-05 05:24:27 -08:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
2013-12-30 20:32:37 -08:00
|
|
|
callab GetMoveEffect
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, b
|
2014-01-05 05:24:27 -08:00
|
|
|
cp EFFECT_MIRROR_COAT
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2014-01-05 05:24:27 -08:00
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
call BattleCommanda3
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wd265]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret z
|
2014-01-05 05:24:27 -08:00
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function36abf
|
2013-03-26 17:39:44 -07:00
|
|
|
ret z
|
2014-01-05 05:24:27 -08:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
|
|
|
ld de, StringBuffer1
|
|
|
|
call GetMoveData
|
2014-01-05 05:24:27 -08:00
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [StringBuffer1 + 2]
|
2013-03-26 17:39:44 -07:00
|
|
|
and a
|
|
|
|
ret z
|
2014-01-05 05:24:27 -08:00
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [StringBuffer1 + 3]
|
2014-01-05 05:24:27 -08:00
|
|
|
cp SPECIAL
|
2013-03-26 17:39:44 -07:00
|
|
|
ret c
|
2014-01-05 05:24:27 -08:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, CurDamage
|
|
|
|
ld a, [hli]
|
|
|
|
or [hl]
|
|
|
|
ret z
|
2014-01-05 05:24:27 -08:00
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
add a
|
|
|
|
ld [hld], a
|
|
|
|
ld a, [hl]
|
|
|
|
adc a
|
|
|
|
ld [hl], a
|
2014-01-05 05:24:27 -08:00
|
|
|
jr nc, .capped
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, $ff
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
2014-01-05 05:24:27 -08:00
|
|
|
.capped
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
xor a
|
|
|
|
ld [AttackMissed], a
|
|
|
|
ret
|
|
|
|
; 37ce6
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand9d: ; 37ce6
|
2013-03-26 22:52:04 -07:00
|
|
|
; doubleminimizedamage
|
2013-03-26 17:39:44 -07:00
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc6fa
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .ok
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc6fe
|
2014-06-10 23:08:07 -07:00
|
|
|
.ok
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
ld hl, CurDamage + 1
|
|
|
|
sla [hl]
|
|
|
|
dec hl
|
|
|
|
rl [hl]
|
|
|
|
ret nc
|
|
|
|
ld a, $ff
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 37d02
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand9e: ; 37d02
|
|
|
|
; skipsuncharge
|
|
|
|
ld a, [Weather]
|
|
|
|
cp WEATHER_SUN
|
|
|
|
ret nz
|
2015-04-13 21:39:54 -07:00
|
|
|
ld b, charge_command
|
2013-03-26 22:52:04 -07:00
|
|
|
jp SkipToBattleCommand
|
2013-03-26 17:39:44 -07:00
|
|
|
; 37d0d
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand9b: ; 37d0d
|
2013-03-26 22:52:04 -07:00
|
|
|
; checkfuturesight
|
|
|
|
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc71d
|
|
|
|
ld de, wc727
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
2013-03-26 22:52:04 -07:00
|
|
|
jr z, .ok
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc71e
|
|
|
|
ld de, wc729
|
2013-03-26 22:52:04 -07:00
|
|
|
.ok
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
ret z
|
2013-03-26 22:52:04 -07:00
|
|
|
cp 1
|
2013-03-26 17:39:44 -07:00
|
|
|
ret nz
|
2013-03-26 22:52:04 -07:00
|
|
|
|
|
|
|
ld [hl], 0
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
ld [CurDamage], a
|
|
|
|
ld a, [de]
|
|
|
|
ld [CurDamage + 1], a
|
2015-04-13 21:39:54 -07:00
|
|
|
ld b, futuresight_command
|
2013-03-26 22:52:04 -07:00
|
|
|
jp SkipToBattleCommand
|
2013-03-26 17:39:44 -07:00
|
|
|
; 37d34
|
|
|
|
|
|
|
|
BattleCommand9c: ; 37d34
|
|
|
|
; futuresight
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function34548
|
2013-03-26 17:39:44 -07:00
|
|
|
jr nz, .asm_37d4b ; 37d37 $12
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-26 17:39:44 -07:00
|
|
|
ld b, a
|
|
|
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], b
|
|
|
|
ld a, BATTLE_VARS_LAST_MOVE
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
ld [hl], b
|
|
|
|
.asm_37d4b
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc71d
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_37d56 ; 37d51 $3
|
2015-02-08 00:03:32 -08:00
|
|
|
ld hl, wc71e
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_37d56
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr nz, .asm_37d87 ; 37d58 $2d
|
|
|
|
ld a, $4
|
|
|
|
ld [hl], a
|
|
|
|
call BattleCommand0a
|
2013-03-27 13:19:51 -07:00
|
|
|
call BattleCommandaa
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, ForesawAttackText
|
2013-08-31 00:54:02 -07:00
|
|
|
call StdBattleTextBox
|
2013-03-26 17:39:44 -07:00
|
|
|
call BattleCommand0c
|
2015-02-08 00:03:32 -08:00
|
|
|
ld de, wc727
|
2013-03-26 17:39:44 -07:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .asm_37d77 ; 37d72 $3
|
2015-02-08 00:03:32 -08:00
|
|
|
ld de, wc729
|
2013-03-26 17:39:44 -07:00
|
|
|
.asm_37d77
|
|
|
|
ld hl, CurDamage
|
|
|
|
ld a, [hl]
|
|
|
|
ld [de], a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld [hl], 0
|
2013-03-26 17:39:44 -07:00
|
|
|
inc hl
|
|
|
|
inc de
|
|
|
|
ld a, [hl]
|
|
|
|
ld [de], a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld [hl], 0
|
2013-03-26 17:39:44 -07:00
|
|
|
jp EndMoveEffect
|
|
|
|
.asm_37d87
|
|
|
|
pop bc
|
|
|
|
call ResetDamage
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-03-27 15:50:10 -07:00
|
|
|
call PrintButItFailed
|
2013-03-26 17:39:44 -07:00
|
|
|
jp EndMoveEffect
|
|
|
|
; 37d94
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand9f: ; 37d94
|
|
|
|
; thunderaccuracy
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_TYPE
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-03-26 17:39:44 -07:00
|
|
|
inc hl
|
|
|
|
ld a, [Weather]
|
|
|
|
cp WEATHER_RAIN
|
2014-06-10 23:08:07 -07:00
|
|
|
jr z, .rain
|
2013-03-26 17:39:44 -07:00
|
|
|
cp WEATHER_SUN
|
|
|
|
ret nz
|
2014-06-10 23:08:07 -07:00
|
|
|
ld [hl], 50 percent + 1
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
2014-06-10 23:08:07 -07:00
|
|
|
.rain
|
|
|
|
ld [hl], 100 percent
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 37daa
|
|
|
|
|
|
|
|
|
|
|
|
CheckHiddenOpponent: ; 37daa
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS3_OPP
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2014-06-10 23:08:07 -07:00
|
|
|
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
|
2013-03-26 17:39:44 -07:00
|
|
|
ret
|
|
|
|
; 37db2
|
|
|
|
|
|
|
|
|
|
|
|
GetUserItem: ; 37db2
|
|
|
|
; Return the effect of the user's item in bc, and its id at hl.
|
|
|
|
ld hl, BattleMonItem
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .go
|
|
|
|
ld hl, EnemyMonItem
|
|
|
|
.go
|
|
|
|
ld b, [hl]
|
|
|
|
jp GetItem
|
|
|
|
; 37dc1
|
|
|
|
|
|
|
|
|
|
|
|
GetOpponentItem: ; 37dc1
|
|
|
|
; Return the effect of the opponent's item in bc, and its id at hl.
|
|
|
|
ld hl, EnemyMonItem
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .go
|
|
|
|
ld hl, BattleMonItem
|
|
|
|
.go
|
|
|
|
ld b, [hl]
|
|
|
|
jp GetItem
|
|
|
|
; 37dd0
|
|
|
|
|
|
|
|
|
|
|
|
GetItem: ; 37dd0
|
|
|
|
; Return the effect of item b in bc.
|
|
|
|
ld a, b
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
|
|
|
push hl
|
2013-04-29 23:01:54 -07:00
|
|
|
ld hl, ItemAttributes + 2
|
2013-03-26 17:39:44 -07:00
|
|
|
dec a
|
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
2013-04-29 23:01:54 -07:00
|
|
|
ld a, Item2Attributes - Item1Attributes
|
2013-03-26 17:39:44 -07:00
|
|
|
call AddNTimes
|
2013-04-29 23:01:54 -07:00
|
|
|
ld a, BANK(ItemAttributes)
|
2013-03-26 17:39:44 -07:00
|
|
|
call GetFarHalfword
|
|
|
|
ld b, l
|
|
|
|
ld c, h
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 37de9
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function37de9: ; 37de9
|
2013-03-27 13:19:51 -07:00
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc689]
|
2013-03-27 13:19:51 -07:00
|
|
|
push af
|
|
|
|
call BattleCommand0a
|
|
|
|
pop af
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37e19
|
2013-03-27 13:19:51 -07:00
|
|
|
call BattleCommand0c
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 37e01
|
|
|
|
|
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
AnimateCurrentMove: ; 37e01
|
2013-03-27 13:19:51 -07:00
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2015-02-08 00:03:32 -08:00
|
|
|
ld a, [wc689]
|
2013-03-27 13:19:51 -07:00
|
|
|
push af
|
|
|
|
call BattleCommand0a
|
|
|
|
pop af
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wc689], a
|
2013-12-31 01:10:49 -08:00
|
|
|
call Function37e36
|
2013-03-27 13:19:51 -07:00
|
|
|
call BattleCommand0c
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 37e19
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function37e19: ; 37e19
|
2013-03-27 13:19:51 -07:00
|
|
|
xor a
|
|
|
|
ld [FXAnimIDHi], a
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-27 13:19:51 -07:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
|
|
|
ld [FXAnimIDLo], a
|
|
|
|
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
ld a, 1
|
|
|
|
jr z, .asm_37e30
|
|
|
|
ld a, 4
|
|
|
|
|
|
|
|
.asm_37e30
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-27 13:19:51 -07:00
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
jp Function37e47
|
2013-03-27 13:19:51 -07:00
|
|
|
; 37e36
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function37e36: ; 37e36
|
2013-03-27 13:19:51 -07:00
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-27 13:19:51 -07:00
|
|
|
ld [FXAnimIDHi], a
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
2013-10-11 00:04:21 -07:00
|
|
|
call GetBattleVar
|
2013-03-27 13:19:51 -07:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
2013-03-27 15:50:10 -07:00
|
|
|
; fallthrough
|
|
|
|
; 37e44
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function37e44: ; 37e44
|
2013-03-27 15:50:10 -07:00
|
|
|
|
2013-03-27 13:19:51 -07:00
|
|
|
ld [FXAnimIDLo], a
|
|
|
|
|
|
|
|
; fallthrough
|
|
|
|
; 37e47
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function37e47: ; 37e47
|
2013-03-27 13:19:51 -07:00
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2013-12-03 21:44:45 -08:00
|
|
|
callab PlayBattleAnim
|
2013-03-27 13:19:51 -07:00
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 37e54
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function37e54: ; 37e54
|
2013-03-27 13:19:51 -07:00
|
|
|
ld a, e
|
|
|
|
ld [FXAnimIDLo], a
|
|
|
|
ld a, d
|
|
|
|
ld [FXAnimIDHi], a
|
|
|
|
xor a
|
2015-02-08 00:03:32 -08:00
|
|
|
ld [wcfca], a
|
2013-03-27 13:19:51 -07:00
|
|
|
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-03-27 13:19:51 -07:00
|
|
|
|
2013-12-03 21:44:45 -08:00
|
|
|
callab PlayBattleAnim
|
2013-03-27 13:19:51 -07:00
|
|
|
|
2015-10-10 04:45:39 -07:00
|
|
|
call BattleCommand_SwitchTurn
|
2013-03-27 13:19:51 -07:00
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 37e73
|
|
|
|
|
|
|
|
|
2013-12-31 00:25:38 -08:00
|
|
|
CallBattleCore: ; 37e73
|
|
|
|
ld a, BANK(BattleCore)
|
2013-03-27 13:19:51 -07:00
|
|
|
rst FarCall
|
|
|
|
ret
|
|
|
|
; 37e77
|
|
|
|
|
|
|
|
|
2014-01-01 05:09:15 -08:00
|
|
|
AnimateFailedMove: ; 37e77
|
2013-03-27 13:19:51 -07:00
|
|
|
call BattleCommand0a
|
|
|
|
call BattleCommandaa
|
|
|
|
jp BattleCommand0c
|
|
|
|
; 37e80
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
BattleCommandaa: ; 37e80
|
2013-09-30 22:02:33 -07:00
|
|
|
; movedelay
|
2013-03-26 17:39:44 -07:00
|
|
|
; Wait 40 frames.
|
|
|
|
ld c, 40
|
|
|
|
jp DelayFrames
|
|
|
|
; 37e85
|
|
|
|
|
|
|
|
|
|
|
|
BattleCommand38: ; 37e85
|
2013-03-26 22:52:04 -07:00
|
|
|
; cleartext
|
|
|
|
|
2013-03-26 17:39:44 -07:00
|
|
|
; Used in multi-hit moves.
|
|
|
|
ld hl, .text
|
|
|
|
jp BattleTextBox
|
|
|
|
.text
|
|
|
|
db "@"
|
|
|
|
; 37e8c
|
|
|
|
|
|
|
|
|
2013-03-26 22:52:04 -07:00
|
|
|
SkipToBattleCommand: ; 37e8c
|
|
|
|
; Skip over commands until reaching command b.
|
|
|
|
ld a, [BattleScriptBufferLoc + 1]
|
|
|
|
ld h, a
|
|
|
|
ld a, [BattleScriptBufferLoc]
|
|
|
|
ld l, a
|
|
|
|
.asm_37e94
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
|
|
|
jr nz, .asm_37e94
|
|
|
|
|
|
|
|
ld a, h
|
|
|
|
ld [BattleScriptBufferLoc + 1], a
|
|
|
|
ld a, l
|
|
|
|
ld [BattleScriptBufferLoc], a
|
|
|
|
ret
|
|
|
|
; 37ea1
|
|
|
|
|
|
|
|
|
2013-03-27 13:19:51 -07:00
|
|
|
GetMoveAttr: ; 37ea1
|
|
|
|
; Assuming hl = Moves + x, return attribute x of move a.
|
|
|
|
push bc
|
2014-06-10 23:23:55 -07:00
|
|
|
ld bc, MOVE_LENGTH
|
2013-03-27 13:19:51 -07:00
|
|
|
call AddNTimes
|
|
|
|
call GetMoveByte
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
; 37ead
|
2013-03-26 17:39:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
GetMoveData: ; 37ead
|
2013-03-27 13:19:51 -07:00
|
|
|
; Copy move struct a to de.
|
2013-03-26 17:39:44 -07:00
|
|
|
ld hl, Moves
|
2014-06-10 23:23:55 -07:00
|
|
|
ld bc, MOVE_LENGTH
|
2013-03-26 17:39:44 -07:00
|
|
|
call AddNTimes
|
|
|
|
ld a, Bank(Moves)
|
|
|
|
jp FarCopyBytes
|
|
|
|
; 37ebb
|
|
|
|
|
2013-03-27 13:19:51 -07:00
|
|
|
|
|
|
|
GetMoveByte: ; 37ebb
|
|
|
|
ld a, BANK(Moves)
|
|
|
|
jp GetFarByte
|
|
|
|
; 37ec0
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function37ec0: ; 37ec0
|
2013-10-01 18:20:48 -07:00
|
|
|
callba Functionfbd54
|
2013-03-27 13:19:51 -07:00
|
|
|
ret
|
|
|
|
; 37ec7
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function37ec7: ; 37ec7
|
2013-10-01 18:20:48 -07:00
|
|
|
callba Functionfbd71
|
2013-03-27 13:19:51 -07:00
|
|
|
ret
|
|
|
|
; 37ece
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function37ece: ; 37ece
|
2013-10-01 18:20:48 -07:00
|
|
|
callba Functionfbd69
|
2013-03-27 13:19:51 -07:00
|
|
|
ret
|
|
|
|
; 37ed5
|
|
|
|
|
|
|
|
|
2013-12-31 01:10:49 -08:00
|
|
|
Function37ed5: ; 37ed5
|
2013-03-27 13:19:51 -07:00
|
|
|
; Related to mobile link battles.
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2013-12-09 13:20:19 -08:00
|
|
|
callba CheckBattleScene
|
2013-03-27 13:19:51 -07:00
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 37ee2
|