shithub: pokecrystal

ref: 6e91c3a293d94990695e6b002a8c031873aefdf9
dir: /engine/battle/move_effects/safeguard.asm/

View raw version
BattleCommand_Safeguard: ; 37939
; safeguard

	ld hl, wPlayerScreens
	ld de, wPlayerSafeguardCount
	ld a, [hBattleTurn]
	and a
	jr z, .ok
	ld hl, wEnemyScreens
	ld de, wEnemySafeguardCount
.ok
	bit SCREENS_SAFEGUARD, [hl]
	jr nz, .failed
	set SCREENS_SAFEGUARD, [hl]
	ld a, 5
	ld [de], a
	call AnimateCurrentMove
	ld hl, CoveredByVeilText
	jp StdBattleTextBox

.failed
	call AnimateFailedMove
	jp PrintButItFailed

; 37962