diff options
Diffstat (limited to 'engine/battle')
| -rw-r--r-- | engine/battle/animations.asm | 18 | ||||
| -rw-r--r-- | engine/battle/core.asm | 39 | ||||
| -rw-r--r-- | engine/battle/draw_hud_pokeball_gfx.asm | 2 | ||||
| -rw-r--r-- | engine/battle/effects.asm | 12 | ||||
| -rw-r--r-- | engine/battle/ghost_marowak_anim.asm | 2 | ||||
| -rw-r--r-- | engine/battle/move_effects/substitute.asm | 4 | ||||
| -rw-r--r-- | engine/battle/move_effects/transform.asm | 5 |
7 files changed, 46 insertions, 36 deletions
diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index f66be640..eac4115a 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -22,7 +22,7 @@ DrawFrameBlock: jp z, .flipHorizontalTranslateDown ; SUBANIMTYPE_HFLIP dec a jr z, .flipBaseCoords ; SUBANIMTYPE_COORDFLIP -.noTransformation +; no transformation ld a, [wBaseCoordY] add [hl] ld [de], a ; store Y @@ -130,7 +130,7 @@ DrawFrameBlock: ld a, [wNumFBTiles] cp c jp nz, .loop ; go back up if there are more tiles to draw -.afterDrawingTiles +; after drawing tiles ld a, [wFBMode] cp FRAMEBLOCKMODE_02 jr z, .advanceFrameBlockDestAddr ; skip delay and don't clean OAM buffer @@ -185,7 +185,7 @@ PlayAnimation: jr z, .AnimationOver cp FIRST_SE_ID ; is this subanimation or a special effect? jr c, .playSubanimation -.doSpecialEffect +; do Special Effect ld c, a ld de, SpecialEffectPointers .searchSpecialEffectTableLoop @@ -295,11 +295,11 @@ LoadSubanimation: and %11100000 cp SUBANIMTYPE_ENEMY << 5 vc_hook_blue Reduce_move_anim_flashing_Blizzard - jr nz, .isNotType5 -.isType5 + jr nz, .isNotTypeEnemy +; subanim type enemy call GetSubanimationTransform2 jr .saveTransformation -.isNotType5 +.isNotTypeEnemy vc_hook Reduce_move_anim_flashing_Hyper_Beam call GetSubanimationTransform1 .saveTransformation @@ -427,11 +427,11 @@ MoveAnimation: call PlayAnimation vc_hook_red Stop_reducing_move_anim_flashing_Bubblebeam_Mega_Kick vc_hook_blue Stop_reducing_move_anim_flashing_Spore - jr .next4 + jr .next .animationsDisabled ld c, 30 call DelayFrames -.next4 +.next vc_hook_red Stop_reducing_move_anim_flashing vc_hook_blue Stop_reducing_move_anim_flashing_Rock_Slide_Dream_Eater call PlayApplyingAttackAnimation ; shake the screen or flash the pic in and out (to show damage) @@ -1097,6 +1097,8 @@ SetAnimationBGPalette: ldh [rBGP], a ret +AnimationUnusedShakeScreen: ; unreferenced +; Shakes the screen for a while. ld b, $5 AnimationShakeScreenVertically: diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 44fd9a70..dd9fbc71 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1247,7 +1247,7 @@ SlideTrainerPicOffScreen: ldh a, [hSlideAmount] cp 8 jr z, .slideRight -.slideLeft ; slide player sprite off screen +; slide player sprite left off screen ld a, [hld] ld [hli], a inc hl @@ -3557,11 +3557,12 @@ CheckPlayerStatusConditions: ld hl, AttackContinuesText call PrintText ld a, [wPlayerNumAttacksLeft] - dec a ; did multi-turn move end? + dec a ld [wPlayerNumAttacksLeft], a - ld hl, GetPlayerAnimationType ; if it didn't, skip damage calculation (deal damage equal to last hit), - ; DecrementPP and MoveHitTest - jp nz, .returnToHL + ld hl, GetPlayerAnimationType ; skip damage calculation (deal damage equal to last hit), + ; DecrementPP and MoveHitTest + jp nz, .returnToHL ; redundant leftover code, the case wEnemyNumAttacksLeft == 0 + ; is handled within CheckNumAttacksLeft jp .returnToHL .RageCheck @@ -3626,7 +3627,7 @@ ConfusedNoMoreText: text_far _ConfusedNoMoreText text_end -SavingEnergyText: +SavingEnergyText: ; unreferenced text_far _SavingEnergyText text_end @@ -4171,7 +4172,7 @@ GetDamageVarsForPlayerAttack: ld a, [hl] ; a = [wPlayerMoveType] cp SPECIAL ; types >= SPECIAL are all special jr nc, .specialAttack -.physicalAttack +; physical attack ld hl, wEnemyMonDefense ld a, [hli] ld b, a @@ -4284,7 +4285,7 @@ GetDamageVarsForEnemyAttack: ld a, [hl] ; a = [wEnemyMoveType] cp SPECIAL ; types >= SPECIAL are all special jr nc, .specialAttack -.physicalAttack +; physical attack ld hl, wBattleMonDefense ld a, [hli] ld b, a @@ -5301,7 +5302,6 @@ AdjustDamageForMoveType: ld [hl], a or b ; is damage 0? jr nz, .skipTypeImmunity -.typeImmunity ; if damage is 0, make the move miss ; this only occurs if a move that would do 2 or 3 damage is 0.25x effective against the target inc a @@ -5394,7 +5394,7 @@ MoveHitTest: ldh a, [hWhoseTurn] and a jr nz, .enemyTurn -.playerTurn +; player's turn ; this checks if the move effect is disallowed by mist ld a, [wPlayerMoveEffect] cp ATTACK_DOWN1_EFFECT @@ -5466,12 +5466,12 @@ MoveHitTest: ld [wMoveMissed], a ldh a, [hWhoseTurn] and a - jr z, .playerTurn2 -.enemyTurn2 + jr z, .playerTurn +; enemy's turn ld hl, wEnemyBattleStatus1 res USING_TRAPPING_MOVE, [hl] ; end multi-turn attack e.g. wrap ret -.playerTurn2 +.playerTurn ld hl, wPlayerBattleStatus1 res USING_TRAPPING_MOVE, [hl] ; end multi-turn attack e.g. wrap ret @@ -6063,10 +6063,11 @@ CheckEnemyStatusConditions: ld hl, AttackContinuesText call PrintText ld hl, wEnemyNumAttacksLeft - dec [hl] ; did multi-turn move end? - ld hl, GetEnemyAnimationType ; if it didn't, skip damage calculation (deal damage equal to last hit), + dec [hl] + ld hl, GetEnemyAnimationType ; skip damage calculation (deal damage equal to last hit), ; DecrementPP and MoveHitTest - jp nz, .enemyReturnToHL + jp nz, .enemyReturnToHL ; redundant leftover code, the case wEnemyNumAttacksLeft == 0 + ; is handled within CheckNumAttacksLeft jp .enemyReturnToHL .checkIfUsingRage ld a, [wEnemyBattleStatus2] @@ -6415,7 +6416,7 @@ QuarterSpeedDueToParalysis: ldh a, [hWhoseTurn] and a jr z, .playerTurn -.enemyTurn ; quarter the player's speed +; enemy's turn, quarter the player's speed ld a, [wBattleMonStatus] and 1 << PAR ret z ; return if player not paralysed @@ -6458,7 +6459,7 @@ HalveAttackDueToBurn: ldh a, [hWhoseTurn] and a jr z, .playerTurn -.enemyTurn ; halve the player's attack +; enemy's turn, halve the player's attack ld a, [wBattleMonStatus] and 1 << BRN ret z ; return if player not burnt @@ -6642,7 +6643,7 @@ LoadHudTilePatterns: ldh a, [rLCDC] add a ; is LCD disabled? jr c, .lcdEnabled -.lcdDisabled +; LCD disabled ld hl, BattleHudTiles1 ld de, vChars2 tile $6d ld bc, BattleHudTiles1End - BattleHudTiles1 diff --git a/engine/battle/draw_hud_pokeball_gfx.asm b/engine/battle/draw_hud_pokeball_gfx.asm index 768a6e20..adeaaf62 100644 --- a/engine/battle/draw_hud_pokeball_gfx.asm +++ b/engine/battle/draw_hud_pokeball_gfx.asm @@ -18,7 +18,7 @@ LoadPartyPokeballGfx: SetupOwnPartyPokeballs: call PlacePlayerHUDTiles - ld hl, wPartyMon1 + ld hl, wPartyMons ld de, wPartyCount call SetupPokeballs ld a, $60 diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index 2cef2521..22765140 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -230,7 +230,7 @@ FreezeBurnParalyzeEffect: jr z, .burn1 cp FREEZE_SIDE_EFFECT1 jr z, .freeze1 -; .paralyze1 +; paralyze1 ld a, 1 << PAR ld [wEnemyMonStatus], a call QuarterSpeedDueToParalysis ; quarter speed of affected mon @@ -283,7 +283,7 @@ FreezeBurnParalyzeEffect: jr z, .burn2 cp FREEZE_SIDE_EFFECT1 jr z, .freeze2 -; .paralyze2 +; paralyze2 ld a, 1 << PAR ld [wBattleMonStatus], a call QuarterSpeedDueToParalysis @@ -593,7 +593,7 @@ StatModifierDownEffect: ld a, [de] cp ATTACK_DOWN2_EFFECT - $16 ; $24 jr c, .ok - cp EVASION_DOWN2_EFFECT + $5 ; $44 + cp ATTACK_DOWN_SIDE_EFFECT ; move side effects, stat mod decrease is always 1 jr nc, .ok dec b ; stat down 2 effects only (dec mod again) jr nz, .ok @@ -711,7 +711,7 @@ CantLowerAnymore: MoveMissed: ld a, [de] - cp $44 + cp ATTACK_DOWN_SIDE_EFFECT ret nc jp ConditionalPrintButItFailed @@ -1321,7 +1321,7 @@ DisableEffect: cp LINK_STATE_BATTLING pop hl ; wEnemyMonMoves jr nz, .playerTurnNotLinkBattle -; .playerTurnLinkBattle +; player's turn, Link Battle push hl ld hl, wEnemyMonPP .enemyTurn @@ -1456,6 +1456,7 @@ PlayCurrentMoveAnimation2: .notEnemyTurn and a ret z +; fallthrough PlayBattleAnimation2: ; play animation ID at a and animation type 6 or 3 @@ -1482,6 +1483,7 @@ PlayCurrentMoveAnimation: .notEnemyTurn and a ret z +; fallthrough PlayBattleAnimation: ; play animation ID at a and predefined animation type diff --git a/engine/battle/ghost_marowak_anim.asm b/engine/battle/ghost_marowak_anim.asm index 1040f85f..efda9f8f 100644 --- a/engine/battle/ghost_marowak_anim.asm +++ b/engine/battle/ghost_marowak_anim.asm @@ -48,7 +48,7 @@ MarowakAnim: call Delay3 jp ClearSprites -; copies a mon pic's from background VRAM to sprite VRAM and sets up OAM +; copies a mon pic's from background VRAM to sprite VRAM and sets up OAM CopyMonPicFromBGToSpriteVRAM: ld de, vFrontPic ld hl, vSprites diff --git a/engine/battle/move_effects/substitute.asm b/engine/battle/move_effects/substitute.asm index e4311209..01d5a8a3 100644 --- a/engine/battle/move_effects/substitute.asm +++ b/engine/battle/move_effects/substitute.asm @@ -37,8 +37,8 @@ SubstituteEffect_: sbc 0 pop bc jr c, .notEnoughHP ; underflow means user would be left with negative health - ; bug: since it only branches on carry, it will possibly leave user with 0 HP -.userHasZeroOrMoreHP + ; bug: since it only branches on carry, it will possibly leave user with 0 HP +; user has 0 or more HP ld [hli], a ; save resulting HP after subtraction into current HP ld [hl], d ld h, b diff --git a/engine/battle/move_effects/transform.asm b/engine/battle/move_effects/transform.asm index 343fa3ca..95e17833 100644 --- a/engine/battle/move_effects/transform.asm +++ b/engine/battle/move_effects/transform.asm @@ -2,17 +2,22 @@ TransformEffect_: ld hl, wBattleMonSpecies ld de, wEnemyMonSpecies ld bc, wEnemyBattleStatus3 + ; bug: on enemy's turn, a is overloaded with hWhoseTurn, + ; before the check for INVULNERABLE ld a, [wEnemyBattleStatus1] ldh a, [hWhoseTurn] and a jr nz, .hitTest +; player's turn ld hl, wEnemyMonSpecies ld de, wBattleMonSpecies ld bc, wPlayerBattleStatus3 ld [wPlayerMoveListIndex], a + ; bug: this should be target's BattleStatus1 (i.e. wEnemyBattleStatus1) ld a, [wPlayerBattleStatus1] .hitTest bit INVULNERABLE, a ; is mon invulnerable to typical attacks? (fly/dig) + ; this check doesn't work due to above bugs jp nz, .failed push hl push de |
