diff options
| author | dannye <33dannye@gmail.com> | 2025-09-06 16:54:17 -0500 |
|---|---|---|
| committer | dannye <33dannye@gmail.com> | 2025-09-06 16:54:17 -0500 |
| commit | 377749ca4efac05b6c57dfed049899891af6c35a (patch) | |
| tree | 4b429403935c4a7c2de710a6cbf7310246874539 /engine/battle/core.asm | |
| parent | Fix .tilemap file extension, fix some typos (#138) (diff) | |
| parent | Document visual glitch with Pewter City Gym guy (#526) (diff) | |
| download | pokeyellow-377749ca4efac05b6c57dfed049899891af6c35a.tar.gz pokeyellow-377749ca4efac05b6c57dfed049899891af6c35a.tar.xz pokeyellow-377749ca4efac05b6c57dfed049899891af6c35a.zip | |
Merge branch 'master' of https://github.com/pret/pokered
Diffstat (limited to 'engine/battle/core.asm')
| -rw-r--r-- | engine/battle/core.asm | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 8024fb9e..ca5dcec9 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1869,7 +1869,8 @@ AnimateRetreatingPlayerMon: call ClearScreenArea ret -; reads player's current mon's HP into wBattleMonHP +; Copies player's current pokemon's current HP and status into the party +; struct data so it stays after battle or switching ReadPlayerMonCurHPAndStatus: ld a, [wPlayerMonNumber] ld hl, wPartyMon1HP @@ -3308,30 +3309,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 @@ -3350,7 +3351,7 @@ playPlayerMoveAnimation: ld b, BANK(ReshowSubstituteAnim) call nz, Bankswitch jr MirrorMoveCheck -playerCheckIfFlyOrChargeEffect: +PlayerCheckIfFlyOrChargeEffect: ld c, 30 call DelayFrames ld a, [wPlayerMoveEffect] @@ -3417,7 +3418,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 @@ -3694,7 +3695,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 @@ -3728,7 +3729,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 @@ -5749,7 +5750,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] @@ -5842,7 +5843,7 @@ EnemyCalcMoveDamage: jp c, EnemyMoveHitTest call CriticalHitTest call HandleCounterMove - jr z, handleIfEnemyMoveMissed + jr z, HandleIfEnemyMoveMissed call SwapPlayerAndEnemyLevels call GetDamageVarsForEnemyAttack call SwapPlayerAndEnemyLevels @@ -5853,13 +5854,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 @@ -5868,13 +5869,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? @@ -6213,7 +6214,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? |
