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 | |
| 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')
| -rw-r--r-- | engine/battle/core.asm | 47 | ||||
| -rw-r--r-- | engine/battle/effects.asm | 12 | ||||
| -rw-r--r-- | engine/battle/init_battle.asm | 4 | ||||
| -rw-r--r-- | engine/battle/read_trainer_party.asm | 8 | ||||
| -rw-r--r-- | engine/battle/trainer_ai.asm | 8 |
5 files changed, 40 insertions, 39 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? diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index b2976a64..6a674ec5 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 @@ -716,14 +716,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 @@ -1494,9 +1494,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 diff --git a/engine/battle/init_battle.asm b/engine/battle/init_battle.asm index fabff3e3..629ae7b0 100644 --- a/engine/battle/init_battle.asm +++ b/engine/battle/init_battle.asm @@ -117,12 +117,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/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index 6a46759e..c8ee8fda 100644 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -31,14 +31,14 @@ ReadTrainer: ; and hl points to the trainer class. ; Our next task is to iterate through the trainers, ; decrementing b each time, until we get to the right one. -.outer +.CheckNextTrainer dec b jr z, .IterateTrainer -.inner +.SkipTrainer ld a, [hli] and a - jr nz, .inner - jr .outer + jr nz, .SkipTrainer + jr .CheckNextTrainer ; if the first byte of trainer data is FF, ; - each pokemon has a specific level diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index 7843b1e2..7081fdfd 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -692,22 +692,22 @@ AICheckIfHPBelowFraction: ret AIUseXAttack: - ld b, $A + ld b, ATTACK_UP1_EFFECT ld a, X_ATTACK jr AIIncreaseStat AIUseXDefend: - ld b, $B + ld b, DEFENSE_UP1_EFFECT ld a, X_DEFEND jr AIIncreaseStat AIUseXSpeed: - ld b, $C + ld b, SPEED_UP1_EFFECT ld a, X_SPEED jr AIIncreaseStat AIUseXSpecial: - ld b, $D + ld b, SPECIAL_UP1_EFFECT ld a, X_SPECIAL ; fallthrough |
