2018-06-24 07:09:41 -07:00
|
|
|
BattleCommand_SleepTalk:
|
2018-01-26 08:36:00 -08:00
|
|
|
; sleeptalk
|
|
|
|
|
|
|
|
call ClearLastMove
|
2018-02-03 15:21:53 -08:00
|
|
|
ld a, [wAttackMissed]
|
2018-01-26 08:36:00 -08:00
|
|
|
and a
|
|
|
|
jr nz, .fail
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hBattleTurn]
|
2018-01-26 08:36:00 -08:00
|
|
|
and a
|
2018-02-03 15:21:53 -08:00
|
|
|
ld hl, wBattleMonMoves + 1
|
|
|
|
ld a, [wDisabledMove]
|
2018-01-26 08:36:00 -08:00
|
|
|
ld d, a
|
|
|
|
jr z, .got_moves
|
2018-02-03 15:21:53 -08:00
|
|
|
ld hl, wEnemyMonMoves + 1
|
|
|
|
ld a, [wEnemyDisabledMove]
|
2018-01-26 08:36:00 -08:00
|
|
|
ld d, a
|
|
|
|
.got_moves
|
|
|
|
ld a, BATTLE_VARS_STATUS
|
|
|
|
call GetBattleVar
|
|
|
|
and SLP
|
|
|
|
jr z, .fail
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .fail
|
|
|
|
call .safely_check_has_usable_move
|
|
|
|
jr c, .fail
|
|
|
|
dec hl
|
|
|
|
.sample_move
|
|
|
|
push hl
|
|
|
|
call BattleRandom
|
|
|
|
maskbits NUM_MOVES
|
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
pop hl
|
|
|
|
and a
|
|
|
|
jr z, .sample_move
|
|
|
|
ld e, a
|
|
|
|
ld a, BATTLE_VARS_MOVE_ANIM
|
|
|
|
call GetBattleVar
|
|
|
|
cp e
|
|
|
|
jr z, .sample_move
|
|
|
|
ld a, e
|
|
|
|
cp d
|
|
|
|
jr z, .sample_move
|
|
|
|
call .check_two_turn_move
|
|
|
|
jr z, .sample_move
|
|
|
|
ld a, BATTLE_VARS_MOVE
|
|
|
|
call GetBattleVarAddr
|
|
|
|
ld a, e
|
|
|
|
ld [hl], a
|
|
|
|
call CheckUserIsCharging
|
|
|
|
jr nz, .charging
|
|
|
|
ld a, [wKickCounter]
|
|
|
|
push af
|
|
|
|
call BattleCommand_LowerSub
|
|
|
|
pop af
|
|
|
|
ld [wKickCounter], a
|
|
|
|
.charging
|
|
|
|
call LoadMoveAnim
|
|
|
|
call UpdateMoveData
|
|
|
|
jp ResetTurn
|
|
|
|
|
|
|
|
.fail
|
|
|
|
call AnimateFailedMove
|
|
|
|
jp TryPrintButItFailed
|
|
|
|
|
|
|
|
.safely_check_has_usable_move
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
call .check_has_usable_move
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
|
|
|
.check_has_usable_move
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hBattleTurn]
|
2018-01-26 08:36:00 -08:00
|
|
|
and a
|
2018-02-03 15:21:53 -08:00
|
|
|
ld a, [wDisabledMove]
|
2018-01-26 08:36:00 -08:00
|
|
|
jr z, .got_move_2
|
|
|
|
|
2018-02-03 15:21:53 -08:00
|
|
|
ld a, [wEnemyDisabledMove]
|
2018-01-26 08:36:00 -08:00
|
|
|
.got_move_2
|
|
|
|
ld b, a
|
|
|
|
ld a, BATTLE_VARS_MOVE
|
|
|
|
call GetBattleVar
|
|
|
|
ld c, a
|
|
|
|
dec hl
|
|
|
|
ld d, NUM_MOVES
|
|
|
|
.loop2
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .carry
|
|
|
|
|
|
|
|
cp c
|
|
|
|
jr z, .nope
|
|
|
|
cp b
|
|
|
|
jr z, .nope
|
|
|
|
|
|
|
|
call .check_two_turn_move
|
|
|
|
jr nz, .no_carry
|
|
|
|
|
|
|
|
.nope
|
|
|
|
inc hl
|
|
|
|
dec d
|
|
|
|
jr nz, .loop2
|
|
|
|
|
|
|
|
.carry
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.no_carry
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.check_two_turn_move
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
|
|
|
|
ld b, a
|
|
|
|
callfar GetMoveEffect
|
|
|
|
ld a, b
|
|
|
|
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
cp EFFECT_SKULL_BASH
|
|
|
|
ret z
|
|
|
|
cp EFFECT_RAZOR_WIND
|
|
|
|
ret z
|
|
|
|
cp EFFECT_SKY_ATTACK
|
|
|
|
ret z
|
|
|
|
cp EFFECT_SOLARBEAM
|
|
|
|
ret z
|
|
|
|
cp EFFECT_FLY
|
|
|
|
ret z
|
|
|
|
cp EFFECT_BIDE
|
|
|
|
ret
|