Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BattleCommand_SleepTarget:
- ; sleeptarget
- call GetOpponentItem
- ld a, b
- cp HELD_PREVENT_SLEEP
- jr nz, .not_protected_by_item
- ld a, [hl]
- ld [wNamedObjectIndex], a
- call GetItemName
- ld hl, ProtectedByText
- jr .fail
- .not_protected_by_item
- ld a, BATTLE_VARS_STATUS_OPP
- call GetBattleVarAddr
- ld d, h
- ld e, l
- ld a, [de]
- and SLP
- ld hl, AlreadyAsleepText
- jr nz, .fail
- ld a, [wAttackMissed]
- and a
- jp nz, PrintDidntAffect2
- ld hl, DidntAffect1Text
- ld a, [de]
- and a
- jr nz, .fail
- call CheckSubstituteOpp
- jr nz, .fail
- call AnimateCurrentMove
- ld b, SLP
- ld a, [wInBattleTowerBattle]
- and a
- jr z, .random_sleep
- ld b, %011
- .random_sleep
- call BattleRandom
- cp 51 percent
- jr c, .two_turns
- cp 86 percent
- jr c, .three_turns
- jr .four_turns
- .two_turns
- ld a, 2
- jr .continue
- .three_turns
- ld a, 3
- jr .continue
- .four_turns
- ld a, 4
- .continue
- inc a
- ld [de], a
- call UpdateOpponentInParty
- call RefreshBattleHuds
- ld hl, FellAsleepText
- call StdBattleTextbox
- farcall UseHeldStatusHealingItem
- jp z, OpponentCantMove
- ret
- .fail
- push hl
- call AnimateFailedMove
- pop hl
- jp StdBattleTextbox
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement