Specify the ldh instruction, don't turn ld into ldh

This commit is contained in:
Rangi 2020-07-06 19:03:05 -04:00
parent c480632d54
commit 772fcc7588
219 changed files with 2556 additions and 2556 deletions

View file

@ -163,7 +163,7 @@ DrawFrameBlock:
PlayAnimation:
xor a
ld [hROMBankTemp], a ; it looks like nothing reads this
ldh [hROMBankTemp], a ; it looks like nothing reads this
ld [wSubAnimTransform], a
ld a, [wAnimationID] ; get animation number
dec a
@ -241,15 +241,15 @@ PlayAnimation:
ld l, c
ld h, b
push hl
ld a, [rOBP0]
ldh a, [rOBP0]
push af
ld a, [wAnimPalette]
ld [rOBP0], a
ldh [rOBP0], a
call LoadAnimationTileset
call LoadSubanimation
call PlaySubanimation
pop af
ld [rOBP0], a
ldh [rOBP0], a
.nextAnimationCommand
pop hl
jr .animationLoop
@ -308,7 +308,7 @@ LoadSubanimation:
; sets the transform to the subanimation type if it's the enemy's turn
GetSubanimationTransform1:
ld b, a
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld a, b
ret nz
@ -319,7 +319,7 @@ GetSubanimationTransform1:
; sets the transform to 2 (i.e. horizontal and vertical flip) if it's the player's turn
; sets the transform to 0 (i.e. no transform) if it's the enemy's turn
GetSubanimationTransform2:
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld a, 2 << 5
ret z
@ -421,7 +421,7 @@ MoveAnimation:
ShareMoveAnimations:
; some moves just reuse animations from status conditions
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ret z
@ -497,18 +497,18 @@ AnimationShakeScreenHorizontallySlow:
push bc
push bc
.loop1
ld a, [rWX]
ldh a, [rWX]
inc a
ld [rWX], a
ldh [rWX], a
ld c, 2
call DelayFrames
dec b
jr nz, .loop1
pop bc
.loop2
ld a, [rWX]
ldh a, [rWX]
dec a
ld [rWX], a
ldh [rWX], a
ld c, 2
call DelayFrames
dec b
@ -534,16 +534,16 @@ SetAnimationPalette:
ld b, $f0
.next
ld a, b
ld [rOBP0], a
ldh [rOBP0], a
ld a, $6c
ld [rOBP1], a
ldh [rOBP1], a
ret
.notSGB
ld a, $e4
ld [wAnimPalette], a
ld [rOBP0], a
ldh [rOBP0], a
ld a, $6c
ld [rOBP1], a
ldh [rOBP1], a
ret
PlaySubanimation:
@ -656,9 +656,9 @@ DoBallTossSpecialEffects:
cp 3 ; is it a Master Ball or Ultra Ball?
jr nc, .skipFlashingEffect
.flashingEffect ; do a flashing effect if it's Master Ball or Ultra Ball
ld a, [rOBP0]
ldh a, [rOBP0]
xor %00111100 ; complement colors 1 and 2
ld [rOBP0], a
ldh [rOBP0], a
.skipFlashingEffect
ld a, [wSubAnimCounter]
cp 11 ; is it the beginning of the subanimation?
@ -695,7 +695,7 @@ DoBallTossSpecialEffects:
dec b
jr nz, .loop
ld a, %00001000
ld [rNR10], a ; Channel 1 sweep register
ldh [rNR10], a ; Channel 1 sweep register
ret
.isTrainerBattle ; if it's a trainer battle, shorten the animation by one frame
ld a, [wSubAnimCounter]
@ -882,9 +882,9 @@ TradeJumpPokeball:
ld c, 5
call DelayFrames
pop bc
ld a, [hSCX] ; background scroll X
ldh a, [hSCX] ; background scroll X
sub 8 ; scroll to the left
ld [hSCX], a
ldh [hSCX], a
pop de
jr .loop
@ -920,16 +920,16 @@ AnimationDelay10:
; calls a function with the turn flipped from player to enemy or vice versa
; input - hl - address of function to call
CallWithTurnFlipped:
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
push af
xor 1
ld [hWhoseTurn], a
ldh [hWhoseTurn], a
ld de, .returnAddress
push de
jp hl
.returnAddress
pop af
ld [hWhoseTurn], a
ldh [hWhoseTurn], a
ret
; flashes the screen for an extended period (48 frames)
@ -947,7 +947,7 @@ AnimationFlashScreenLong:
ld a, [hli]
cp $01 ; is it the end of the palettes?
jr z, .endOfPalettes
ld [rBGP], a
ldh [rBGP], a
call FlashScreenLongDelay
jr .innerLoop
.endOfPalettes
@ -1006,18 +1006,18 @@ FlashScreenLongDelay:
jp DelayFrames
AnimationFlashScreen:
ld a, [rBGP]
ldh a, [rBGP]
push af ; save initial palette
ld a, %00011011 ; 0, 1, 2, 3 (inverted colors)
ld [rBGP], a
ldh [rBGP], a
ld c, 2
call DelayFrames
xor a ; white out background
ld [rBGP], a
ldh [rBGP], a
ld c, 2
call DelayFrames
pop af
ld [rBGP], a ; restore initial palette
ldh [rBGP], a ; restore initial palette
ret
AnimationDarkScreenPalette:
@ -1062,7 +1062,7 @@ SetAnimationBGPalette:
jr z, .next
ld a, c
.next
ld [rBGP], a
ldh [rBGP], a
ret
ld b, $5
@ -1133,7 +1133,7 @@ _AnimationWaterDroplets:
AnimationSlideMonUp:
; Slides the mon's sprite upwards.
ld c, 7
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
coord hl, 1, 6
coord de, 1, 5
@ -1201,7 +1201,7 @@ _AnimationSlideMonUp:
jr nz, .slideLoop
; Fill in the bottom row of the mon pic with the next row's tile IDs.
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
coord hl, 1, 11
jr z, .next
@ -1370,7 +1370,7 @@ AnimationShowEnemyMonPic:
AnimationShakeBackAndForth:
; Shakes the mon's sprite back and forth rapidly. This is used in Double Team.
; The mon's sprite disappears after this animation.
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
coord hl, 0, 5
coord de, 2, 5
@ -1418,7 +1418,7 @@ AnimationMoveMonHorizontally:
; Shifts the mon's sprite horizontally to a fixed location. Used by lots of
; animations like Tackle/Body Slam.
call AnimationHideMonPic
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
coord hl, 2, 5
jr z, .next
@ -1434,7 +1434,7 @@ AnimationMoveMonHorizontally:
AnimationResetMonPosition:
; Resets the mon's sprites to be located at the normal coordinates.
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld a, 5 * SCREEN_WIDTH + 2
jr z, .next
@ -1446,7 +1446,7 @@ AnimationResetMonPosition:
AnimationSpiralBallsInward:
; Creates an effect that looks like energy balls spiralling into the
; player mon's sprite. Used in Focus Energy, for example.
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
ld a, -40
@ -1530,7 +1530,7 @@ AnimationSquishMonPic:
ld c, 4
.loop
push bc
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
coord hl, 16, 0
@ -1583,7 +1583,7 @@ _AnimationSquishMonPic:
AnimationShootBallsUpward:
; Shoots one pillar of "energy" balls upwards. Used in Teleport/Sky Attack
; animations.
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
lb bc, 0, 16 * 8
@ -1651,7 +1651,7 @@ _AnimationShootBallsUpward:
AnimationShootManyBallsUpward:
; Shoots several pillars of "energy" balls upward.
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld hl, UpwardBallsAnimXCoordinatesPlayerTurn
ld a, $50 ; y coordinate for "energy" ball pillar
@ -1743,7 +1743,7 @@ AnimationSlideMonDownAndHide:
_AnimationSlideMonOff:
; Slides the mon's sprite off the screen horizontally by e tiles and waits
; [wSlideMonDelay] V-blanks each time the pic is slid by one tile.
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
coord hl, 12, 0
@ -1758,7 +1758,7 @@ _AnimationSlideMonOff:
.rowLoop ; iterates once for each row
ld c, 8
.tileLoop ; iterates once for each tile in the row
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .playerTurn2
call .EnemyNextTile
@ -1821,7 +1821,7 @@ AnimationSlideMonHalfOff:
jp Delay3
CopyTempPicToMonPic:
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld hl, vBackPic ; player turn
jr z, .next
@ -1837,9 +1837,9 @@ AnimationWavyScreen:
call BattleAnimCopyTileMapToVRAM
call Delay3
xor a
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
ld a, SCREEN_HEIGHT_PX
ld [hWY], a
ldh [hWY], a
ld d, $80 ; terminator
ld e, SCREEN_HEIGHT_PX - 1
ld c, $ff
@ -1848,7 +1848,7 @@ AnimationWavyScreen:
push hl
.innerLoop
call WavyScreen_SetSCX
ld a, [rLY]
ldh a, [rLY]
cp e ; is it the last visible line in the frame?
jr nz, .innerLoop ; keep going if not
pop hl
@ -1861,11 +1861,11 @@ AnimationWavyScreen:
dec c
jr nz, .loop
xor a
ld [hWY], a
ldh [hWY], a
call SaveScreenTilesToBuffer2
call ClearScreen
ld a, 1
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
call Delay3
call LoadScreenTilesFromBuffer2
ld hl, vBGMap1
@ -1873,11 +1873,11 @@ AnimationWavyScreen:
ret
WavyScreen_SetSCX:
ld a, [rSTAT]
ldh a, [rSTAT]
and $3 ; is it H-blank?
jr nz, WavyScreen_SetSCX ; wait until it's H-blank
ld a, [hl]
ld [rSCX], a
ldh [rSCX], a
inc hl
ld a, [hl]
cp d ; have we reached the end?
@ -1898,7 +1898,7 @@ AnimationSubstitute:
xor a
ld bc, $310
call FillMemory
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
ld hl, SlowbroSprite ; facing down sprite
@ -1937,7 +1937,7 @@ CopySlowbroSpriteData:
jp FarCopyData2
HideSubstituteShowMonAnim:
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld hl, wPlayerMonMinimized
ld a, [wPlayerBattleStatus2]
@ -1987,7 +1987,7 @@ AnimationTransformMon:
ld [wChangeMonPicEnemyTurnSpecies], a
ChangeMonPic:
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
ld a, [wChangeMonPicEnemyTurnSpecies]
@ -2020,11 +2020,11 @@ ChangeMonPic:
AnimationHideEnemyMonPic:
; Hides the enemy mon's sprite
xor a
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
ld hl, AnimationHideMonPic
call CallWithTurnFlipped
ld a, $1
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
jp Delay3
InitMultipleObjectsOAM:
@ -2050,7 +2050,7 @@ InitMultipleObjectsOAM:
AnimationHideMonPic:
; Hides the mon's sprite.
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
ld a, 12
@ -2078,7 +2078,7 @@ ClearMonPicFromTileMap:
; in order to show only a portion of the mon sprite.
GetMonSpriteTileMapPointerFromRowCount:
push de
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr nz, .enemyTurn
ld a, 20 * 5 + 1
@ -2166,7 +2166,7 @@ GetMoveSound:
ld b, a
call IsCryMove
jr nc, .NotCryMove
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr nz, .next
ld a, [wBattleMonSpecies] ; get number of current monster
@ -2211,14 +2211,14 @@ IsCryMove:
INCLUDE "data/moves/sfx.asm"
CopyPicTiles:
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld a, $31 ; base tile ID of player mon sprite
jr z, .next
; enemy turn
xor a ; base tile ID of enemy mon sprite
.next
ld [hBaseTileID], a
ldh [hBaseTileID], a
jr CopyTileIDs_NoBGTransfer
; copy the tiles used when a mon is being sent out of or into a pokeball
@ -2235,7 +2235,7 @@ CopyDownscaledMonTiles:
CopyTileIDs_NoBGTransfer:
xor a
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
; fall through
; b = number of rows
@ -2245,7 +2245,7 @@ CopyTileIDs:
.rowLoop
push bc
push hl
ld a, [hBaseTileID]
ldh a, [hBaseTileID]
ld b, a
.columnLoop
ld a, [de]
@ -2261,7 +2261,7 @@ CopyTileIDs:
dec b
jr nz, .rowLoop
ld a, $1
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
pop hl
ret
@ -2361,16 +2361,16 @@ Unknown_79c50:
AnimationLeavesFalling:
; Makes leaves float down from the top of the screen. This is used
; in Razor Leaf's animation.
ld a, [rOBP0]
ldh a, [rOBP0]
push af
ld a, [wAnimPalette]
ld [rOBP0], a
ldh [rOBP0], a
ld d, $37 ; leaf tile
ld a, 3 ; number of leaves
ld [wNumFallingObjects], a
call AnimationFallingObjects
pop af
ld [rOBP0], a
ldh [rOBP0], a
ret
AnimationPetalsFalling:
@ -2529,7 +2529,7 @@ AnimationShakeEnemyHUD:
call CopyVideoData
xor a
ld [hSCX], a
ldh [hSCX], a
; Copy wTileMap to BG map 0. The regular BG (not the window) is set to use
; map 0 and can be scrolled with SCX, which allows a shaking effect.
@ -2539,7 +2539,7 @@ AnimationShakeEnemyHUD:
; Now that the regular BG is showing the same thing the window was, move the
; window off the screen so that we can modify its contents below.
ld a, SCREEN_HEIGHT_PX
ld [hWY], a
ldh [hWY], a
; Copy wTileMap to VRAM such that the row below the enemy HUD (in wTileMap) is
; lined up with row 0 of the window.
@ -2551,7 +2551,7 @@ AnimationShakeEnemyHUD:
; covers everything below the enemy HD with a copy that looks just like what
; was there before.
ld a, 7 * 8
ld [hWY], a
ldh [hWY], a
; Write OAM entries so that the copy of the back pic from the top of this
; function shows up on screen. We need this because the back pic's Y coordinates
@ -2576,11 +2576,11 @@ AnimationShakeEnemyHUD:
call AnimationShowMonPic
call ClearSprites
ld a, SCREEN_HEIGHT_PX
ld [hWY], a
ldh [hWY], a
ld hl, vBGMap1
call BattleAnimCopyTileMapToVRAM
xor a
ld [hWY], a
ldh [hWY], a
call SaveScreenTilesToBuffer1
ld hl, vBGMap0
call BattleAnimCopyTileMapToVRAM
@ -2595,7 +2595,7 @@ AnimationShakeEnemyHUD:
CopyTileIDsFromList:
call GetPredefRegisters
ld a, c
ld [hBaseTileID], a
ldh [hBaseTileID], a
ld a, b
push hl
call GetTileIDList
@ -2603,30 +2603,30 @@ CopyTileIDsFromList:
jp CopyTileIDs
ShakeEnemyHUD_ShakeBG:
ld a, [hSCX]
ldh a, [hSCX]
ld [wTempSCX], a
.loop
ld a, [wTempSCX]
add d
ld [hSCX], a
ldh [hSCX], a
ld c, 2
call DelayFrames
ld a, [wTempSCX]
sub d
ld [hSCX], a
ldh [hSCX], a
ld c, 2
call DelayFrames
dec e
jr nz, .loop
ld a, [wTempSCX]
ld [hSCX], a
ldh [hSCX], a
ret
BattleAnimCopyTileMapToVRAM:
ld a, h
ld [hAutoBGTransferDest + 1], a
ldh [hAutoBGTransferDest + 1], a
ld a, l
ld [hAutoBGTransferDest], a
ldh [hAutoBGTransferDest], a
jp Delay3
TossBallAnimation:

View file

@ -1,9 +1,9 @@
BattleTransition:
ld a, 1
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
call Delay3
xor a
ld [hWY], a
ldh [hWY], a
dec a
ld [wUpdateSpritesEnabled], a
call DelayFrame
@ -11,7 +11,7 @@ BattleTransition:
; Determine which OAM block is being used by the enemy trainer sprite (if there
; is one).
ld hl, wSpritePlayerStateData1ImageIndex
ld a, [hSpriteIndexOrTextID] ; enemy trainer sprite index (0 if wild battle)
ldh a, [hSpriteIndexOrTextID] ; enemy trainer sprite index (0 if wild battle)
ld c, a
ld b, 0
ld de, $10
@ -165,9 +165,9 @@ BattleTransitionTileEnd:
BattleTransition_BlackScreen:
ld a, $ff
ld [rBGP], a
ld [rOBP0], a
ld [rOBP1], a
ldh [rBGP], a
ldh [rOBP0], a
ldh [rOBP1], a
ret
; for non-dungeon trainer battles
@ -330,7 +330,7 @@ BattleTransition_FlashScreen_:
ld a, [hli]
cp $1
jr z, .done
ld [rBGP], a
ldh [rBGP], a
ld c, 2
call DelayFrames
jr .loop
@ -349,7 +349,7 @@ BattleTransition_Shrink:
.loop
push bc
xor a
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
coord hl, 0, 7
coord de, 0, 8
ld bc, -SCREEN_WIDTH * 2
@ -367,7 +367,7 @@ BattleTransition_Shrink:
ld bc, 2
call BattleTransition_CopyTiles2
ld a, $1
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
ld c, 6
call DelayFrames
pop bc
@ -381,7 +381,7 @@ BattleTransition_Shrink:
BattleTransition_Split:
ld c, SCREEN_HEIGHT / 2
xor a
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
.loop
push bc
coord hl, 0, 16
@ -496,7 +496,7 @@ BattleTransition_VerticalStripes:
coord hl, 0, 0
coord de, 1, 17
xor a
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
.loop
push bc
push hl
@ -535,7 +535,7 @@ BattleTransition_HorizontalStripes:
coord hl, 0, 0
coord de, 19, 1
xor a
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
.loop
push bc
push hl
@ -582,7 +582,7 @@ BattleTransition_FlashScreen:
ld b, $3
call BattleTransition_FlashScreen_
xor a
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
ret
BattleTransition_Circle_Sub1:
@ -601,10 +601,10 @@ BattleTransition_Circle_Sub1:
BattleTransition_TransferDelay3:
ld a, 1
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
call Delay3
xor a
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
ret
; used for low level wild non-dungeon battles

View file

@ -101,16 +101,16 @@ PrintSendOutMonMessage:
ld hl, GoText
jr z, .printText
xor a
ld [hMultiplicand], a
ldh [hMultiplicand], a
ld hl, wEnemyMonHP
ld a, [hli]
ld [wLastSwitchInEnemyMonHP], a
ld [hMultiplicand + 1], a
ldh [hMultiplicand + 1], a
ld a, [hl]
ld [wLastSwitchInEnemyMonHP + 1], a
ld [hMultiplicand + 2], a
ldh [hMultiplicand + 2], a
ld a, 25
ld [hMultiplier], a
ldh [hMultiplier], a
call Multiply
ld hl, wEnemyMonMaxHP
ld a, [hli]
@ -121,9 +121,9 @@ PrintSendOutMonMessage:
rr b
ld a, b
ld b, 4
ld [hDivisor], a ; enemy mon max HP divided by 4
ldh [hDivisor], a ; enemy mon max HP divided by 4
call Divide
ld a, [hQuotient + 3] ; a = (enemy mon current HP * 25) / (enemy max HP / 4); this approximates the current percentage of max HP
ldh a, [hQuotient + 3] ; a = (enemy mon current HP * 25) / (enemy max HP / 4); this approximates the current percentage of max HP
ld hl, GoText ; 70% or greater
cp 70
jr nc, .printText
@ -179,14 +179,14 @@ PlayerMon2Text:
dec hl
ld a, [de]
sub b
ld [hMultiplicand + 2], a
ldh [hMultiplicand + 2], a
dec de
ld b, [hl]
ld a, [de]
sbc b
ld [hMultiplicand + 1], a
ldh [hMultiplicand + 1], a
ld a, 25
ld [hMultiplier], a
ldh [hMultiplier], a
call Multiply
ld hl, wEnemyMonMaxHP
ld a, [hli]
@ -197,11 +197,11 @@ PlayerMon2Text:
rr b
ld a, b
ld b, 4
ld [hDivisor], a
ldh [hDivisor], a
call Divide
pop bc
pop de
ld a, [hQuotient + 3] ; a = ((LastSwitchInEnemyMonHP - CurrentEnemyMonHP) / 25) / (EnemyMonMaxHP / 4)
ldh a, [hQuotient + 3] ; a = ((LastSwitchInEnemyMonHP - CurrentEnemyMonHP) / 25) / (EnemyMonMaxHP / 4)
; Assuming that the enemy mon hasn't gained HP since the last switch in,
; a approximates the percentage that the enemy mon's total HP has decreased
; since the last switch in.

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,7 @@ JumpMoveEffect:
ret
_JumpMoveEffect:
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld a, [wPlayerMoveEffect]
jr z, .next1
@ -26,7 +26,7 @@ INCLUDE "data/moves/effects_pointers.asm"
SleepEffect:
ld de, wEnemyMonStatus
ld bc, wEnemyBattleStatus2
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jp z, .sleepEffect
ld de, wBattleMonStatus
@ -78,7 +78,7 @@ AlreadyAsleepText:
PoisonEffect:
ld hl, wEnemyMonStatus
ld de, wPlayerMoveEffect
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .poisonEffect
ld hl, wBattleMonStatus
@ -121,7 +121,7 @@ PoisonEffect:
set 3, [hl] ; mon is now poisoned
push de
dec de
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld b, ANIM_C7
ld hl, wPlayerBattleStatus3
@ -175,7 +175,7 @@ DrainHPEffect:
ExplodeEffect:
ld hl, wBattleMonHP
ld de, wPlayerBattleStatus2
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .faintUser
ld hl, wEnemyMonHP
@ -196,7 +196,7 @@ FreezeBurnParalyzeEffect:
ld [wAnimationType], a
call CheckTargetSubstitute ; test bit 4 of d063/d068 flags [target has substitute flag]
ret nz ; return if they have a substitute, can't effect them
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jp nz, opponentAttacker
ld a, [wEnemyMonStatus]
@ -308,7 +308,7 @@ CheckDefrost:
; any fire-type move that has a chance inflict burn (all but Fire Spin) will defrost a frozen target
and 1 << FRZ ; are they frozen?
ret z ; return if so
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr nz, .opponent
;player [attacker]
@ -346,7 +346,7 @@ FireDefrostedText:
StatModifierUpEffect:
ld hl, wPlayerMonStatMods
ld de, wPlayerMoveEffect
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .statModifierUpEffect
ld hl, wEnemyMonStatMods
@ -382,7 +382,7 @@ StatModifierUpEffect:
push hl
ld hl, wBattleMonAttack + 1
ld de, wPlayerMonUnmodifiedAttack
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .pointToStats
ld hl, wEnemyMonAttack + 1
@ -417,35 +417,35 @@ StatModifierUpEffect:
add hl, bc
pop bc
xor a
ld [hMultiplicand], a
ldh [hMultiplicand], a
ld a, [de]
ld [hMultiplicand + 1], a
ldh [hMultiplicand + 1], a
inc de
ld a, [de]
ld [hMultiplicand + 2], a
ldh [hMultiplicand + 2], a
ld a, [hli]
ld [hMultiplier], a
ldh [hMultiplier], a
call Multiply
ld a, [hl]
ld [hDivisor], a
ldh [hDivisor], a
ld b, $4
call Divide
pop hl
; cap at 999
ld a, [hProduct + 3]
ldh a, [hProduct + 3]
sub 999 % $100
ld a, [hProduct + 2]
ldh a, [hProduct + 2]
sbc 999 / $100
jp c, UpdateStat
ld a, 999 / $100
ld [hMultiplicand + 1], a
ldh [hMultiplicand + 1], a
ld a, 999 % $100
ld [hMultiplicand + 2], a
ldh [hMultiplicand + 2], a
UpdateStat:
ld a, [hProduct + 2]
ldh a, [hProduct + 2]
ld [hli], a
ld a, [hProduct + 3]
ldh a, [hProduct + 3]
ld [hl], a
pop hl
UpdateStatDone:
@ -455,7 +455,7 @@ UpdateStatDone:
ld hl, wPlayerBattleStatus2
ld de, wPlayerMoveNum
ld bc, wPlayerMonMinimized
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .asm_3f4e6
ld hl, wEnemyBattleStatus2
@ -488,7 +488,7 @@ UpdateStatDone:
pop af
call nz, Bankswitch
.applyBadgeBoostsAndStatusPenalties
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
call z, ApplyBadgeStatBoosts ; whenever the player uses a stat-up move, badge boosts get reapplied again to every stat,
; even to those not affected by the stat-up move (will be boosted further)
@ -511,7 +511,7 @@ MonsStatsRoseText:
text_far _MonsStatsRoseText
text_asm
ld hl, GreatlyRoseText
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld a, [wPlayerMoveEffect]
jr z, .playerTurn
@ -534,7 +534,7 @@ StatModifierDownEffect:
ld hl, wEnemyMonStatMods
ld de, wPlayerMoveEffect
ld bc, wEnemyBattleStatus1
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .statModifierDownEffect
ld hl, wPlayerMonStatMods
@ -601,7 +601,7 @@ StatModifierDownEffect:
push de
ld hl, wEnemyMonAttack + 1
ld de, wEnemyMonUnmodifiedAttack
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .pointToStat
ld hl, wBattleMonAttack + 1
@ -637,33 +637,33 @@ StatModifierDownEffect:
add hl, bc
pop bc
xor a
ld [hMultiplicand], a
ldh [hMultiplicand], a
ld a, [de]
ld [hMultiplicand + 1], a
ldh [hMultiplicand + 1], a
inc de
ld a, [de]
ld [hMultiplicand + 2], a
ldh [hMultiplicand + 2], a
ld a, [hli]
ld [hMultiplier], a
ldh [hMultiplier], a
call Multiply
ld a, [hl]
ld [hDivisor], a
ldh [hDivisor], a
ld b, $4
call Divide
pop hl
ld a, [hProduct + 3]
ldh a, [hProduct + 3]
ld b, a
ld a, [hProduct + 2]
ldh a, [hProduct + 2]
or b
jp nz, UpdateLoweredStat
ld [hMultiplicand + 1], a
ldh [hMultiplicand + 1], a
ld a, $1
ld [hMultiplicand + 2], a
ldh [hMultiplicand + 2], a
UpdateLoweredStat:
ld a, [hProduct + 2]
ldh a, [hProduct + 2]
ld [hli], a
ld a, [hProduct + 3]
ldh a, [hProduct + 3]
ld [hl], a
pop de
pop hl
@ -678,7 +678,7 @@ UpdateLoweredStatDone:
jr nc, .ApplyBadgeBoostsAndStatusPenalties
call PlayCurrentMoveAnimation2
.ApplyBadgeBoostsAndStatusPenalties
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
call nz, ApplyBadgeStatBoosts ; whenever the player uses a stat-down move, badge boosts get reapplied again to every stat,
; even to those not affected by the stat-up move (will be boosted further)
@ -713,7 +713,7 @@ MonsStatsFellText:
text_far _MonsStatsFellText
text_asm
ld hl, FellText
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld a, [wPlayerMoveEffect]
jr z, .playerTurn
@ -759,7 +759,7 @@ BideEffect:
ld hl, wPlayerBattleStatus1
ld de, wPlayerBideAccumulatedDamage
ld bc, wPlayerNumAttacksLeft
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .bideEffect
ld hl, wEnemyBattleStatus1
@ -778,14 +778,14 @@ BideEffect:
inc a
inc a
ld [bc], a ; set Bide counter to 2 or 3 at random
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
add XSTATITEM_ANIM
jp PlayBattleAnimation2
ThrashPetalDanceEffect:
ld hl, wPlayerBattleStatus1
ld de, wPlayerNumAttacksLeft
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .thrashPetalDanceEffect
ld hl, wEnemyBattleStatus1
@ -797,12 +797,12 @@ ThrashPetalDanceEffect:
inc a
inc a
ld [de], a ; set thrash/petal dance counter to 2 or 3 at random
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
add ANIM_B0
jp PlayBattleAnimation2
SwitchAndTeleportEffect:
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr nz, .handleEnemy
ld a, [wIsInBattle]
@ -920,7 +920,7 @@ TwoToFiveAttacksEffect:
ld hl, wPlayerBattleStatus1
ld de, wPlayerNumAttacksLeft
ld bc, wPlayerNumHits
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .twoToFiveAttacksEffect
ld hl, wEnemyBattleStatus1
@ -931,7 +931,7 @@ TwoToFiveAttacksEffect:
ret nz
set ATTACKING_MULTIPLE_TIMES, [hl] ; mon is now attacking multiple times
ld hl, wPlayerMoveEffect
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .setNumberOfHits
ld hl, wEnemyMoveEffect
@ -967,7 +967,7 @@ FlinchSideEffect:
ret nz
ld hl, wEnemyBattleStatus1
ld de, wPlayerMoveEffect
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .flinchSideEffect
ld hl, wPlayerBattleStatus1
@ -992,7 +992,7 @@ OneHitKOEffect:
ChargeEffect:
ld hl, wPlayerBattleStatus1
ld de, wPlayerMoveEffect
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld b, XSTATITEM_ANIM
jr z, .chargeEffect
@ -1074,7 +1074,7 @@ DugAHoleText:
TrappingEffect:
ld hl, wPlayerBattleStatus1
ld de, wPlayerNumAttacksLeft
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .trappingEffect
ld hl, wEnemyBattleStatus1
@ -1120,7 +1120,7 @@ ConfusionEffect:
jr nz, ConfusionEffectFailed
ConfusionSideEffectSuccess:
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld hl, wEnemyBattleStatus1
ld bc, wEnemyConfusedCounter
@ -1164,7 +1164,7 @@ SubstituteEffect:
HyperBeamEffect:
ld hl, wPlayerBattleStatus2
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .hyperBeamEffect
ld hl, wEnemyBattleStatus2
@ -1175,7 +1175,7 @@ HyperBeamEffect:
ClearHyperBeam:
push hl
ld hl, wEnemyBattleStatus2
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
ld hl, wPlayerBattleStatus2
@ -1186,7 +1186,7 @@ ClearHyperBeam:
RageEffect:
ld hl, wPlayerBattleStatus2
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .player
ld hl, wEnemyBattleStatus2
@ -1201,7 +1201,7 @@ MimicEffect:
ld a, [wMoveMissed]
and a
jr nz, .mimicMissed
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld hl, wBattleMonMoves
ld a, [wPlayerBattleStatus1]
@ -1226,7 +1226,7 @@ MimicEffect:
and a
jr z, .getRandomMove
ld d, a
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld hl, wBattleMonMoves
ld a, [wPlayerMoveListIndex]
@ -1284,7 +1284,7 @@ DisableEffect:
jr nz, .moveMissed
ld de, wEnemyDisabledMove
ld hl, wEnemyMonMoves
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .disableEffect
ld de, wPlayerDisabledMove
@ -1307,7 +1307,7 @@ DisableEffect:
jr z, .pickMoveToDisable ; loop until a non-00 move slot is found
ld [wd11e], a ; store move number
push hl
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld hl, wBattleMonPP
jr nz, .enemyTurn
@ -1345,7 +1345,7 @@ DisableEffect:
ld [de], a
call PlayCurrentMoveAnimation2
ld hl, wPlayerDisabledMoveNumber
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr nz, .printDisableText
inc hl ; wEnemyDisabledMoveNumber
@ -1430,7 +1430,7 @@ ParalyzedMayNotAttackText:
CheckTargetSubstitute:
push hl
ld hl, wEnemyBattleStatus2
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .next1
ld hl, wPlayerBattleStatus2
@ -1442,7 +1442,7 @@ CheckTargetSubstitute:
PlayCurrentMoveAnimation2:
; animation at MOVENUM will be played unless MOVENUM is 0
; plays wAnimationType 3 or 6
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld a, [wPlayerMoveNum]
jr z, .notEnemyTurn
@ -1454,7 +1454,7 @@ PlayCurrentMoveAnimation2:
PlayBattleAnimation2:
; play animation ID at a and animation type 6 or 3
ld [wAnimationID], a
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld a, $6
jr z, .storeAnimationType
@ -1468,7 +1468,7 @@ PlayCurrentMoveAnimation:
; resets wAnimationType
xor a
ld [wAnimationType], a
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld a, [wPlayerMoveNum]
jr z, .notEnemyTurn

View file

@ -55,15 +55,15 @@ GainExperience:
jr .gainStatExpLoop
.statExpDone
xor a
ld [hMultiplicand], a
ld [hMultiplicand + 1], a
ldh [hMultiplicand], a
ldh [hMultiplicand + 1], a
ld a, [wEnemyMonBaseExp]
ld [hMultiplicand + 2], a
ldh [hMultiplicand + 2], a
ld a, [wEnemyMonLevel]
ld [hMultiplier], a
ldh [hMultiplier], a
call Multiply
ld a, 7
ld [hDivisor], a
ldh [hDivisor], a
ld b, 4
call Divide
ld hl, wPartyMon1OTID - (wPartyMon1DVs - 1)
@ -91,12 +91,12 @@ GainExperience:
inc hl
; add the gained exp to the party mon's exp
ld b, [hl]
ld a, [hQuotient + 3]
ldh a, [hQuotient + 3]
ld [wExpAmountGained + 1], a
add b
ld [hld], a
ld b, [hl]
ld a, [hQuotient + 2]
ldh a, [hQuotient + 2]
ld [wExpAmountGained], a
adc b
ld [hl], a
@ -119,11 +119,11 @@ GainExperience:
ld d, MAX_LEVEL
callab CalcExperience ; get max exp
; compare max exp with current exp
ld a, [hExperience]
ldh a, [hExperience]
ld b, a
ld a, [hExperience + 1]
ldh a, [hExperience + 1]
ld c, a
ld a, [hExperience + 2]
ldh a, [hExperience + 2]
ld d, a
pop hl
ld a, [hld]
@ -311,14 +311,14 @@ DivideExpDataByNumMonsGainingExp:
ld c, wEnemyMonBaseExp + 1 - wEnemyMonBaseStats
.divideLoop
xor a
ld [hDividend], a
ldh [hDividend], a
ld a, [hl]
ld [hDividend + 1], a
ldh [hDividend + 1], a
ld a, [wd11e]
ld [hDivisor], a
ldh [hDivisor], a
ld b, $2
call Divide ; divide value by number of mons gaining exp
ld a, [hQuotient + 3]
ldh a, [hQuotient + 3]
ld [hli], a
dec c
jr nz, .divideLoop
@ -326,17 +326,17 @@ DivideExpDataByNumMonsGainingExp:
; multiplies exp by 1.5
BoostExp:
ld a, [hQuotient + 2]
ldh a, [hQuotient + 2]
ld b, a
ld a, [hQuotient + 3]
ldh a, [hQuotient + 3]
ld c, a
srl b
rr c
add c
ld [hQuotient + 3], a
ld a, [hQuotient + 2]
ldh [hQuotient + 3], a
ldh a, [hQuotient + 2]
adc b
ld [hQuotient + 2], a
ldh [hQuotient + 2], a
ret
GainedText:

View file

@ -1,7 +1,7 @@
MarowakAnim:
; animate the ghost being unveiled as a Marowak
ld a, $e4
ld [rOBP1], a
ldh [rOBP1], a
call CopyMonPicFromBGToSpriteVRAM ; cover the BG ghost pic with a sprite ghost pic that looks the same
; now that the ghost pic is being displayed using sprites, clear the ghost pic from the BG tilemap
coord hl, 12, 0
@ -9,12 +9,12 @@ MarowakAnim:
call ClearScreenArea
call Delay3
xor a
ld [hAutoBGTransferEnabled], a ; disable BG transfer so we don't see the Marowak too soon
ldh [hAutoBGTransferEnabled], a ; disable BG transfer so we don't see the Marowak too soon
; replace ghost pic with Marowak in BG
ld a, MAROWAK
ld [wChangeMonPicEnemyTurnSpecies], a
ld a, $1
ld [hWhoseTurn], a
ldh [hWhoseTurn], a
callab ChangeMonPic
; alternate between black and light grey 8 times.
; this makes the ghost's body appear to flash
@ -23,10 +23,10 @@ MarowakAnim:
.fadeOutGhostLoop
ld c, 10
call DelayFrames
ld a, [rOBP1]
ldh a, [rOBP1]
sla a
sla a
ld [rOBP1], a
ldh [rOBP1], a
jr nz, .fadeOutGhostLoop
call ClearSprites
call CopyMonPicFromBGToSpriteVRAM ; copy Marowak pic from BG to sprite VRAM
@ -34,17 +34,17 @@ MarowakAnim:
.fadeInMarowakLoop
ld c, 10
call DelayFrames
ld a, [rOBP1]
ldh a, [rOBP1]
srl b
rra
srl b
rra
ld [rOBP1], a
ldh [rOBP1], a
ld a, b
and a
jr nz, .fadeInMarowakLoop
ld a, $1
ld [hAutoBGTransferEnabled], a ; enable BG transfer so the BG Marowak pic will be visible after the sprite one is cleared
ldh [hAutoBGTransferEnabled], a ; enable BG transfer so the BG Marowak pic will be visible after the sprite one is cleared
call Delay3
jp ClearSprites

View file

@ -1,5 +1,5 @@
InitBattleVariables:
ld a, [hTilesetType]
ldh a, [hTilesetType]
ld [wSavedTilesetType], a
xor a
ld [wActionResultOrTookBattleTurn], a

View file

@ -1,7 +1,7 @@
ConversionEffect_:
ld hl, wEnemyMonType1
ld de, wBattleMonType1
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld a, [wEnemyBattleStatus1]
jr z, .conversionEffect

View file

@ -14,7 +14,7 @@ DrainHPEffect_:
.getAttackerHP
ld hl, wBattleMonHP
ld de, wBattleMonMaxHP
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jp z, .addDamageToAttackerHP
ld hl, wEnemyMonHP
@ -69,7 +69,7 @@ DrainHPEffect_:
ld [wHPBarNewHP+1], a
inc de
.next
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
coord hl, 10, 9
ld a, $1
@ -83,7 +83,7 @@ DrainHPEffect_:
predef DrawEnemyHUDAndHPBar
callab ReadPlayerMonCurHPAndStatus
ld hl, SuckedHealthText
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld a, [wPlayerMoveEffect]
jr z, .next3

View file

@ -1,6 +1,6 @@
FocusEnergyEffect_:
ld hl, wPlayerBattleStatus2
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .notEnemy
ld hl, wEnemyBattleStatus2

View file

@ -15,7 +15,7 @@ HazeEffect_:
; cure non-volatile status, but only for the target
ld hl, wEnemyMonStatus
ld de, wEnemySelectedMove
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .cureStatuses
ld hl, wBattleMonStatus

View file

@ -1,5 +1,5 @@
HealEffect_:
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld de, wBattleMonHP
ld hl, wBattleMonMaxHP
@ -27,7 +27,7 @@ HealEffect_:
ld c, 50
call DelayFrames
ld hl, wBattleMonStatus
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .restEffect
ld hl, wEnemyMonStatus
@ -87,7 +87,7 @@ HealEffect_:
.playAnim
ld hl, PlayCurrentMoveAnimation
call BankswitchEtoF
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
coord hl, 10, 9
ld a, $1

View file

@ -5,7 +5,7 @@ LeechSeedEffect_:
jr nz, .moveMissed
ld hl, wEnemyBattleStatus2
ld de, wEnemyMonType1
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .leechSeedEffect
ld hl, wPlayerBattleStatus2

View file

@ -1,6 +1,6 @@
MistEffect_:
ld hl, wPlayerBattleStatus2
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .mistEffect
ld hl, wEnemyBattleStatus2

View file

@ -7,7 +7,7 @@ OneHitKOEffect_:
ld [wCriticalHitOrOHKO], a
ld hl, wBattleMonSpeed + 1
ld de, wEnemyMonSpeed + 1
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .compareSpeed
ld hl, wEnemyMonSpeed + 1

View file

@ -1,7 +1,7 @@
ParalyzeEffect_:
ld hl, wEnemyMonStatus
ld de, wPlayerMoveType
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jp z, .next
ld hl, wBattleMonStatus

View file

@ -2,7 +2,7 @@ PayDayEffect_:
xor a
ld hl, wcd6d
ld [hli], a
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld a, [wBattleMonLevel]
jr z, .payDayEffect
@ -10,28 +10,28 @@ PayDayEffect_:
.payDayEffect
; level * 2
add a
ld [hDividend + 3], a
ldh [hDividend + 3], a
xor a
ld [hDividend], a
ld [hDividend + 1], a
ld [hDividend + 2], a
ldh [hDividend], a
ldh [hDividend + 1], a
ldh [hDividend + 2], a
; convert to BCD
ld a, 100
ld [hDivisor], a
ldh [hDivisor], a
ld b, $4
call Divide
ld a, [hQuotient + 3]
ldh a, [hQuotient + 3]
ld [hli], a
ld a, [hRemainder]
ld [hDividend + 3], a
ldh a, [hRemainder]
ldh [hDividend + 3], a
ld a, 10
ld [hDivisor], a
ldh [hDivisor], a
ld b, $4
call Divide
ld a, [hQuotient + 3]
ldh a, [hQuotient + 3]
swap a
ld b, a
ld a, [hRemainder]
ldh a, [hRemainder]
add b
ld [hl], a
ld de, wTotalPayDayMoney + 2

View file

@ -1,5 +1,5 @@
RecoilEffect_:
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld a, [wPlayerMoveNum]
ld hl, wBattleMonMaxHP
@ -54,7 +54,7 @@ RecoilEffect_:
ld [hl], a
.getHPBarCoords
coord hl, 10, 9
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld a, $1
jr z, .updateHPBar

View file

@ -1,7 +1,7 @@
ReflectLightScreenEffect_:
ld hl, wPlayerBattleStatus3
ld de, wPlayerMoveEffect
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .reflectLightScreenEffect
ld hl, wEnemyBattleStatus3

View file

@ -4,7 +4,7 @@ SubstituteEffect_:
ld hl, wBattleMonMaxHP
ld de, wPlayerSubstituteHP
ld bc, wPlayerBattleStatus2
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .notEnemy
ld hl, wEnemyMonMaxHP

View file

@ -3,7 +3,7 @@ TransformEffect_:
ld de, wEnemyMonSpecies
ld bc, wEnemyBattleStatus3
ld a, [wEnemyBattleStatus1]
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr nz, .hitTest
ld hl, wEnemyMonSpecies
@ -18,7 +18,7 @@ TransformEffect_:
push de
push bc
ld hl, wPlayerBattleStatus2
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .transformEffect
ld hl, wEnemyBattleStatus2
@ -64,7 +64,7 @@ TransformEffect_:
inc bc
inc bc
call CopyData
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .next
; save enemy mon DVs at wTransformedEnemyMonOriginalDVs
@ -128,7 +128,7 @@ TransformEffect_:
jp PrintText
.copyBasedOnTurn
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
jr z, .gotStatsOrModsToCopy
push hl

View file

@ -41,16 +41,16 @@ ScaleFirstThreeSpriteColumnsByTwo:
ScaleLastSpriteColumnByTwo:
ld a, 4*8 - 4 ; $1c, 4 tiles minus 4 unused rows
ld [hSpriteInterlaceCounter], a
ldh [hSpriteInterlaceCounter], a
ld bc, -1
.columnInnerLoop
ld a, [de]
dec de
swap a ; only high nybble contains information
call ScalePixelsByTwo
ld a, [hSpriteInterlaceCounter]
ldh a, [hSpriteInterlaceCounter]
dec a
ld [hSpriteInterlaceCounter], a
ldh [hSpriteInterlaceCounter], a
jr nz, .columnInnerLoop
dec de ; skip last 4 rows of new column
dec de

View file

@ -655,17 +655,17 @@ AIUseDireHit: ; unused
AICheckIfHPBelowFraction:
; return carry if enemy trainer's current HP is below 1 / a of the maximum
ld [hDivisor], a
ldh [hDivisor], a
ld hl, wEnemyMonMaxHP
ld a, [hli]
ld [hDividend], a
ldh [hDividend], a
ld a, [hl]
ld [hDividend + 1], a
ldh [hDividend + 1], a
ld b, 2
call Divide
ld a, [hQuotient + 3]
ldh a, [hQuotient + 3]
ld c, a
ld a, [hQuotient + 2]
ldh a, [hQuotient + 2]
ld b, a
ld hl, wEnemyMonHP + 1
ld a, [hld]

View file

@ -1,6 +1,6 @@
; does nothing since no stats are ever selected (barring glitches)
DoubleSelectedStats:
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld a, [wPlayerStatsToDouble]
ld hl, wBattleMonAttack + 1
@ -30,7 +30,7 @@ DoubleSelectedStats:
; does nothing since no stats are ever selected (barring glitches)
HalveSelectedStats:
ld a, [hWhoseTurn]
ldh a, [hWhoseTurn]
and a
ld a, [wPlayerStatsToHalve]
ld hl, wBattleMonAttack

View file

@ -48,10 +48,10 @@ TryDoWildEncounter:
.CanEncounter
; compare encounter chance with a random number to determine if there will be an encounter
ld b, a
ld a, [hRandomAdd]
ldh a, [hRandomAdd]
cp b
jr nc, .CantEncounter2
ld a, [hRandomSub]
ldh a, [hRandomSub]
ld b, a
ld hl, WildMonEncounterSlotChances
.determineEncounterSlot
@ -90,7 +90,7 @@ TryDoWildEncounter:
.lastRepelStep
ld [wRepelRemainingSteps], a
ld a, TEXT_REPEL_WORE_OFF
ld [hSpriteIndexOrTextID], a
ldh [hSpriteIndexOrTextID], a
call EnableAutoTextBoxDrawing
call DisplayTextID
.CantEncounter2