shithub: pokecrystal

ref: ae79200b1dd8ed693f968dc61048aaf9515db530
dir: /engine/battle/move_effects/safeguard.asm/

View raw version
BattleCommand_Safeguard:
	ld hl, wPlayerScreens
	ld de, wPlayerSafeguardCount
	ldh 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