aboutsummaryrefslogtreecommitdiffstats
path: root/engine/battle
diff options
context:
space:
mode:
authorNarishma-gb <194818981+Narishma-gb@users.noreply.github.com>2025-09-03 17:56:09 +0200
committerGitHub <noreply@github.com>2025-09-03 11:56:09 -0400
commit4d2594cb24b7e67cde4e1373c9a2b5e0ae7ff473 (patch)
tree5bd4fce0a314171b46b3962a5db5df6eb5154ee2 /engine/battle
parentDocument where badge and elevator floor "items" are used (diff)
downloadpokeyellow-4d2594cb24b7e67cde4e1373c9a2b5e0ae7ff473.tar.gz
pokeyellow-4d2594cb24b7e67cde4e1373c9a2b5e0ae7ff473.tar.xz
pokeyellow-4d2594cb24b7e67cde4e1373c9a2b5e0ae7ff473.zip
Label and constant cleanup (#528)
* Label cleanup, add some constants instead of raw numbers * Rename load/save game functions to be more explicit
Diffstat (limited to 'engine/battle')
-rw-r--r--engine/battle/core.asm48
-rw-r--r--engine/battle/effects.asm12
2 files changed, 30 insertions, 30 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 28c164e5..296f9019 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -3137,30 +3137,30 @@ PlayerCalcMoveDamage:
jp c, .moveHitTest ; SetDamageEffects moves (e.g. Seismic Toss and Super Fang) skip damage calculation
call CriticalHitTest
call HandleCounterMove
- jr z, handleIfPlayerMoveMissed
+ jr z, HandleIfPlayerMoveMissed
call GetDamageVarsForPlayerAttack
call CalculateDamage
- jp z, playerCheckIfFlyOrChargeEffect ; for moves with 0 BP, skip any further damage calculation and, for now, skip MoveHitTest
+ jp z, PlayerCheckIfFlyOrChargeEffect ; for moves with 0 BP, skip any further damage calculation and, for now, skip MoveHitTest
; for these moves, accuracy tests will only occur if they are called as part of the effect itself
call AdjustDamageForMoveType
call RandomizeDamage
.moveHitTest
call MoveHitTest
-handleIfPlayerMoveMissed:
+HandleIfPlayerMoveMissed:
ld a, [wMoveMissed]
and a
- jr z, getPlayerAnimationType
+ jr z, GetPlayerAnimationType
ld a, [wPlayerMoveEffect]
sub EXPLODE_EFFECT
- jr z, playPlayerMoveAnimation ; don't play any animation if the move missed, unless it was EXPLODE_EFFECT
- jr playerCheckIfFlyOrChargeEffect
-getPlayerAnimationType:
+ jr z, PlayPlayerMoveAnimation ; don't play any animation if the move missed, unless it was EXPLODE_EFFECT
+ jr PlayerCheckIfFlyOrChargeEffect
+GetPlayerAnimationType:
ld a, [wPlayerMoveEffect]
and a
ld a, ANIMATIONTYPE_BLINK_ENEMY_MON_SPRITE ; move has no effect other than dealing damage
- jr z, playPlayerMoveAnimation
+ jr z, PlayPlayerMoveAnimation
ld a, ANIMATIONTYPE_SHAKE_SCREEN_HORIZONTALLY_LIGHT ; move has effect
-playPlayerMoveAnimation:
+PlayPlayerMoveAnimation:
push af
ld a, [wPlayerBattleStatus2]
bit HAS_SUBSTITUTE_UP, a
@@ -3179,7 +3179,7 @@ playPlayerMoveAnimation:
ld b, BANK(ReshowSubstituteAnim)
call nz, Bankswitch
jr MirrorMoveCheck
-playerCheckIfFlyOrChargeEffect:
+PlayerCheckIfFlyOrChargeEffect:
ld c, 30
call DelayFrames
ld a, [wPlayerMoveEffect]
@@ -3246,7 +3246,7 @@ MirrorMoveCheck:
ld a, [wPlayerNumAttacksLeft]
dec a
ld [wPlayerNumAttacksLeft], a
- jp nz, getPlayerAnimationType ; for multi-hit moves, apply attack until PlayerNumAttacksLeft hits 0 or the enemy faints.
+ jp nz, GetPlayerAnimationType ; for multi-hit moves, apply attack until PlayerNumAttacksLeft hits 0 or the enemy faints.
; damage calculation and accuracy tests only happen for the first hit
res ATTACKING_MULTIPLE_TIMES, [hl] ; clear attacking multiple times status when all attacks are over
ld hl, MultiHitText
@@ -3523,7 +3523,7 @@ CheckPlayerStatusConditions:
ld [hl], a
ld a, BIDE
ld [wPlayerMoveNum], a
- ld hl, handleIfPlayerMoveMissed ; skip damage calculation, DecrementPP and MoveHitTest
+ ld hl, HandleIfPlayerMoveMissed ; skip damage calculation, DecrementPP and MoveHitTest
jp .returnToHL
.ThrashingAboutCheck
@@ -3557,7 +3557,7 @@ CheckPlayerStatusConditions:
ld a, [wPlayerNumAttacksLeft]
dec a ; did multi-turn move end?
ld [wPlayerNumAttacksLeft], a
- ld hl, getPlayerAnimationType ; if it didn't, skip damage calculation (deal damage equal to last hit),
+ ld hl, GetPlayerAnimationType ; if it didn't, skip damage calculation (deal damage equal to last hit),
; DecrementPP and MoveHitTest
jp nz, .returnToHL
jp .returnToHL
@@ -5567,7 +5567,7 @@ RandomizeDamage:
.loop
call BattleRandom
rrca
- cp 217
+ cp 85 percent + 1
jr c, .loop
ldh [hMultiplier], a
call Multiply ; multiply damage by the random number, which is in the range [217, 255]
@@ -5660,7 +5660,7 @@ EnemyCalcMoveDamage:
jp c, EnemyMoveHitTest
call CriticalHitTest
call HandleCounterMove
- jr z, handleIfEnemyMoveMissed
+ jr z, HandleIfEnemyMoveMissed
call SwapPlayerAndEnemyLevels
call GetDamageVarsForEnemyAttack
call SwapPlayerAndEnemyLevels
@@ -5671,13 +5671,13 @@ EnemyCalcMoveDamage:
EnemyMoveHitTest:
call MoveHitTest
-handleIfEnemyMoveMissed:
+HandleIfEnemyMoveMissed:
ld a, [wMoveMissed]
and a
jr z, .moveDidNotMiss
ld a, [wEnemyMoveEffect]
cp EXPLODE_EFFECT
- jr z, handleExplosionMiss
+ jr z, HandleExplosionMiss
jr EnemyCheckIfFlyOrChargeEffect
.moveDidNotMiss
call SwapPlayerAndEnemyLevels
@@ -5686,13 +5686,13 @@ GetEnemyAnimationType:
ld a, [wEnemyMoveEffect]
and a
ld a, ANIMATIONTYPE_SHAKE_SCREEN_VERTICALLY
- jr z, playEnemyMoveAnimation
+ jr z, PlayEnemyMoveAnimation
ld a, ANIMATIONTYPE_SHAKE_SCREEN_HORIZONTALLY_HEAVY
- jr playEnemyMoveAnimation
-handleExplosionMiss:
+ jr PlayEnemyMoveAnimation
+HandleExplosionMiss:
call SwapPlayerAndEnemyLevels
xor a
-playEnemyMoveAnimation:
+PlayEnemyMoveAnimation:
push af
ld a, [wEnemyBattleStatus2]
bit HAS_SUBSTITUTE_UP, a ; does mon have a substitute?
@@ -6031,7 +6031,7 @@ CheckEnemyStatusConditions:
ld a, BIDE
ld [wEnemyMoveNum], a
call SwapPlayerAndEnemyLevels
- ld hl, handleIfEnemyMoveMissed ; skip damage calculation, DecrementPP and MoveHitTest
+ ld hl, HandleIfEnemyMoveMissed ; skip damage calculation, DecrementPP and MoveHitTest
jp .enemyReturnToHL
.checkIfThrashingAbout
bit THRASHING_ABOUT, [hl] ; is mon using thrash or petal dance?
@@ -6881,12 +6881,12 @@ _InitBattleCommon:
call PrintText
call SaveScreenTilesToBuffer1
call ClearScreen
- ld a, $98
+ ld a, HIGH(vBGMap0)
ldh [hAutoBGTransferDest + 1], a
ld a, $1
ldh [hAutoBGTransferEnabled], a
call Delay3
- ld a, $9c
+ ld a, HIGH(vBGMap1)
ldh [hAutoBGTransferDest + 1], a
call LoadScreenTilesFromBuffer1
hlcoord 9, 7
diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm
index a3a552e7..e111f783 100644
--- a/engine/battle/effects.asm
+++ b/engine/battle/effects.asm
@@ -7,9 +7,9 @@ _JumpMoveEffect:
ldh a, [hWhoseTurn]
and a
ld a, [wPlayerMoveEffect]
- jr z, .next1
+ jr z, .next
ld a, [wEnemyMoveEffect]
-.next1
+.next
dec a ; subtract 1, there is no special effect for 00
add a ; x2, 16bit pointers
ld hl, MoveEffectPointerTable
@@ -680,14 +680,14 @@ UpdateLoweredStatDone:
call PrintStatText
pop de
ld a, [de]
- cp $44
+ cp ATTACK_DOWN_SIDE_EFFECT ; for all side effects, move animation has already played, skip it
jr nc, .ApplyBadgeBoostsAndStatusPenalties
call PlayCurrentMoveAnimation2
.ApplyBadgeBoostsAndStatusPenalties
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)
+ ; even to those not affected by the stat-down move (will be boosted further)
ld hl, MonsStatsFellText
call PrintText
@@ -1438,9 +1438,9 @@ CheckTargetSubstitute:
ld hl, wEnemyBattleStatus2
ldh a, [hWhoseTurn]
and a
- jr z, .next1
+ jr z, .next
ld hl, wPlayerBattleStatus2
-.next1
+.next
bit HAS_SUBSTITUTE_UP, [hl]
pop hl
ret