diff options
Diffstat (limited to 'battle')
-rw-r--r-- | battle/ai/items.asm | 2 | ||||
-rw-r--r-- | battle/ai/scoring.asm | 8 | ||||
-rwxr-xr-x | battle/ai/switch.asm | 36 | ||||
-rw-r--r-- | battle/bg_effects.asm | 4 | ||||
-rw-r--r-- | battle/core.asm | 150 | ||||
-rw-r--r-- | battle/effect_commands.asm | 10 | ||||
-rw-r--r-- | battle/misc.asm | 4 |
7 files changed, 107 insertions, 107 deletions
diff --git a/battle/ai/items.asm b/battle/ai/items.asm index 2fb479590..f5d22d786 100644 --- a/battle/ai/items.asm +++ b/battle/ai/items.asm @@ -549,7 +549,7 @@ AIUpdateHUD: ; 38387 callba UpdateEnemyHUD ld a, $1 ld [hBGMapMode], a - ld hl, wc6e6 + ld hl, wEnemyItemState dec [hl] scf ret diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm index 5445671ac..e9df9c62a 100644 --- a/battle/ai/scoring.asm +++ b/battle/ai/scoring.asm @@ -982,7 +982,7 @@ AI_Smart_Whirlwind: ; 38a2a push hl callab CheckPlayerMoveTypeMatchups - ld a, [wc716] + ld a, [wEnemyAISwitchScore] cp 10 ; neutral pop hl ret c @@ -1909,7 +1909,7 @@ AI_Smart_MeanLook: ; 38dfb ; Otherwise, discourage this move unless the player only has not very effective moves against the enemy. push hl callab CheckPlayerMoveTypeMatchups - ld a, [wc716] + ld a, [wEnemyAISwitchScore] cp $b ; not very effective pop hl ret nc @@ -2170,7 +2170,7 @@ AI_Smart_PerishSong: ; 38f4a push hl callab CheckPlayerMoveTypeMatchups - ld a, [wc716] + ld a, [wEnemyAISwitchScore] cp 10 ; 1.0 pop hl ret c @@ -2432,7 +2432,7 @@ AI_Smart_BatonPass: ; 39062 push hl callab CheckPlayerMoveTypeMatchups - ld a, [wc716] + ld a, [wEnemyAISwitchScore] cp 10 ; neutral pop hl ret c diff --git a/battle/ai/switch.asm b/battle/ai/switch.asm index 62a6bcd83..8209d8f2a 100755 --- a/battle/ai/switch.asm +++ b/battle/ai/switch.asm @@ -6,7 +6,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e push de push bc ld a, 10 - ld [wc716], a + ld [wEnemyAISwitchScore], a ld hl, PlayerUsedMoves ld a, [hl] and a @@ -167,17 +167,17 @@ endr .DecreaseScore: ; 34931 - ld a, [wc716] + ld a, [wEnemyAISwitchScore] dec a - ld [wc716], a + ld [wEnemyAISwitchScore], a ret ; 34939 .IncreaseScore: ; 34939 - ld a, [wc716] + ld a, [wEnemyAISwitchScore] inc a - ld [wc716], a + ld [wEnemyAISwitchScore], a ret ; 34941 @@ -206,7 +206,7 @@ CheckAbleToSwitch: ; 34941 cp 2 jr nz, .not_2 - ld a, [wc716] + ld a, [wEnemyAISwitchScore] add $30 ld [wEnemySwitchMonParam], a ret @@ -230,7 +230,7 @@ CheckAbleToSwitch: ; 34941 .no_perish call CheckPlayerMoveTypeMatchups - ld a, [wc716] + ld a, [wEnemyAISwitchScore] cp 11 ret nc @@ -239,13 +239,13 @@ CheckAbleToSwitch: ; 34941 jr z, .no_last_counter_move call Function34a2a - ld a, [wc716] + ld a, [wEnemyAISwitchScore] and a jr z, .no_last_counter_move ld c, a call Function34aa7 - ld a, [wc716] + ld a, [wEnemyAISwitchScore] cp $ff ret z @@ -255,7 +255,7 @@ CheckAbleToSwitch: ; 34941 jr z, .not_2_again call CheckPlayerMoveTypeMatchups - ld a, [wc716] + ld a, [wEnemyAISwitchScore] cp 10 ret nc @@ -267,7 +267,7 @@ CheckAbleToSwitch: ; 34941 .not_2_again ld c, $10 call CheckPlayerMoveTypeMatchups - ld a, [wc716] + ld a, [wEnemyAISwitchScore] cp 10 jr nc, .okay ld c, $20 @@ -280,7 +280,7 @@ CheckAbleToSwitch: ; 34941 .no_last_counter_move call CheckPlayerMoveTypeMatchups - ld a, [wc716] + ld a, [wEnemyAISwitchScore] cp 10 ret nc @@ -293,7 +293,7 @@ CheckAbleToSwitch: ; 34941 cp $2 ret nz - ld a, [wc716] + ld a, [wEnemyAISwitchScore] add $10 ld [wEnemySwitchMonParam], a ret @@ -359,7 +359,7 @@ Function34a2a: ; 34a2a ld c, 1 << (PARTY_LENGTH - 1) ld d, 0 xor a - ld [wc716], a + ld [wEnemyAISwitchScore], a .asm_34a39 ld a, [CurOTMon] @@ -395,9 +395,9 @@ Function34a2a: ; 34a2a and a jr nz, .asm_34a77 - ld a, [wc716] + ld a, [wEnemyAISwitchScore] or c - ld [wc716], a + ld [wEnemyAISwitchScore], a .asm_34a77 pop hl dec b @@ -451,7 +451,7 @@ Function34a85: ; 34a85 Function34aa7: ; 34aa7 ld a, $ff - ld [wc716], a + ld [wEnemyAISwitchScore], a ld hl, OTPartyMon1Moves ld b, 1 << (PARTY_LENGTH - 1) ld d, 0 @@ -540,7 +540,7 @@ Function34aa7: ; 34aa7 jr nc, .loop2 ld a, c - ld [wc716], a + ld [wEnemyAISwitchScore], a pop bc ret ; 34b20 diff --git a/battle/bg_effects.asm b/battle/bg_effects.asm index 188a3e43d..b03e3aea5 100644 --- a/battle/bg_effects.asm +++ b/battle/bg_effects.asm @@ -748,7 +748,7 @@ endr jr z, .clear cp -3 jr z, .skip - call .FillBox + call .PlaceGraphic .skip call BattleBGEffects_IncrementJumptable ld a, $1 @@ -798,7 +798,7 @@ endr pop bc ret -.FillBox +.PlaceGraphic ; get dims push bc push hl diff --git a/battle/core.asm b/battle/core.asm index 5355df23a..f8f6340a8 100644 --- a/battle/core.asm +++ b/battle/core.asm @@ -3,7 +3,7 @@ BattleCore: DoBattle: ; 3c000 xor a ld [wBattleParticipantsNotFainted], a - ld [wc6fc], a + ld [wBattleParticipantsIncludingFainted], a ld [wPlayerAction], a ld [BattleEnded], a inc a @@ -2110,8 +2110,8 @@ HandleEnemyMonFaint: ; 3cd55 or [hl] call z, FaintYourPokemon xor a - ld [wc6f7], a - call Function3ce01 + ld [wWhichMonFaintedFirst], a + call UpdateBattleStateAndExperienceAfterEnemyFaint call CheckPlayerPartyForFitPkmn ld a, d and a @@ -2202,7 +2202,7 @@ DoubleSwitch: ; 3cdca ret ; 3ce01 -Function3ce01: ; 3ce01 +UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01 call UpdateBattleMonInParty ld a, [wBattleMode] dec a @@ -2231,14 +2231,14 @@ Function3ce01: ; 3ce01 .wild2 call StopDangerSound ld a, $1 - ld [wc6fd], a + ld [wDanger], a .trainer ld hl, BattleMonHP ld a, [hli] or [hl] jr nz, .player_mon_did_not_faint - ld a, [wc6f7] + ld a, [wWhichMonFaintedFirst] and a jr nz, .player_mon_did_not_faint call PlayerMonFaintHappinessMod @@ -2256,10 +2256,10 @@ Function3ce01: ; 3ce01 ld a, [wBattleResult] and $c0 ld [wBattleResult], a - call DoOthersShareExperience + call IsAnyMonHoldingExpShare jr z, .skip_exp ld hl, EnemyMonBaseStats - ld b, $7 + ld b, EnemyMonEnd - EnemyMonBaseStats .loop srl [hl] inc hl @@ -2268,32 +2268,32 @@ Function3ce01: ; 3ce01 .skip_exp ld hl, EnemyMonBaseStats - ld de, wc720 + ld de, wBackupEnemyMonBaseStats ld bc, EnemyMonEnd - EnemyMonBaseStats call CopyBytes xor a - ld [wc71f], a + ld [wGivingExperienceToExpShareHolders], a call GiveExperiencePoints - call DoOthersShareExperience + call IsAnyMonHoldingExpShare ret z ld a, [wBattleParticipantsNotFainted] push af ld a, d ld [wBattleParticipantsNotFainted], a - ld hl, wc720 + ld hl, wBackupEnemyMonBaseStats ld de, EnemyMonBaseStats ld bc, EnemyMonEnd - EnemyMonBaseStats call CopyBytes ld a, $1 - ld [wc71f], a + ld [wGivingExperienceToExpShareHolders], a call GiveExperiencePoints pop af ld [wBattleParticipantsNotFainted], a ret ; 3ceaa -DoOthersShareExperience: ; 3ceaa +IsAnyMonHoldingExpShare: ; 3ceaa ld a, [PartyCount] ld b, a ld hl, PartyMon1 @@ -2465,7 +2465,7 @@ WinTrainerBattle: ; 3cfa4 ; Player won the battle call StopDangerSound ld a, $1 - ld [wc6fd], a + ld [wDanger], a ld [BattleEnded], a ld a, [wLinkMode] and a @@ -2682,7 +2682,7 @@ PlayVictoryMusic: ; 3d0ea dec a jr nz, .trainer_victory push de - call DoOthersShareExperience + call IsAnyMonHoldingExpShare pop de jr nz, .play_music ld hl, wPayDayMoney @@ -2771,7 +2771,7 @@ HandlePlayerMonFaint: ; 3d14e or [hl] call z, FaintEnemyPokemon ld a, $1 - ld [wc6f7], a + ld [wWhichMonFaintedFirst], a call PlayerMonFaintHappinessMod call CheckPlayerPartyForFitPkmn ld a, d @@ -2781,7 +2781,7 @@ HandlePlayerMonFaint: ; 3d14e ld a, [hli] or [hl] jr nz, .notfainted - call Function3ce01 + call UpdateBattleStateAndExperienceAfterEnemyFaint ld a, [wBattleMode] dec a jr nz, .trainer @@ -2847,7 +2847,7 @@ PlayerMonFaintHappinessMod: ; 3d1aa and %11000000 add $1 ld [wBattleResult], a - ld a, [wc6f7] + ld a, [wWhichMonFaintedFirst] and a ret z ret ; ?????????? @@ -3338,7 +3338,7 @@ EnemySwitch: ; 3d4e1 ; If we're here, then we're switching too xor a ld [wBattleParticipantsNotFainted], a - ld [wc6fc], a + ld [wBattleParticipantsIncludingFainted], a ld [wPlayerAction], a inc a ld [wEnemyIsSwitching], a @@ -3403,7 +3403,7 @@ ResetEnemyBattleVars: ; 3d557 ld [LastEnemyMove], a ld [CurEnemyMove], a dec a - ld [wc6e6], a + ld [wEnemyItemState], a xor a ld [wPlayerWrapCount], a hlcoord 18, 0 @@ -3416,7 +3416,7 @@ ResetEnemyBattleVars: ; 3d557 ResetBattleParticipants: ; 3d57a xor a ld [wBattleParticipantsNotFainted], a - ld [wc6fc], a + ld [wBattleParticipantsIncludingFainted], a AddBattleParticipant: ; 3d581 ld a, [CurBattleMon] ld c, a @@ -3425,7 +3425,7 @@ AddBattleParticipant: ; 3d581 push bc predef FlagPredef pop bc - ld hl, wc6fc + ld hl, wBattleParticipantsIncludingFainted predef_jump FlagPredef ; 3d599 @@ -4250,7 +4250,7 @@ SendOutPlayerMon: ; 3db5f ld [hBGMapMode], a call GetMonBackpic xor a - ld [hFillBox], a + ld [hGraphicStartTile], a ld [wd0d2], a ld [CurMoveNum], a ld [TypeModifier], a @@ -4418,7 +4418,7 @@ PursuitSwitch: ; 3dc5b ld [CryTracks], a ld a, [BattleMonSpecies] call PlayStereoCry - ld a, [wc71a] + ld a, [LastPlayerMon] ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG @@ -4887,7 +4887,7 @@ CheckDanger: ; 3df9e ld a, [hli] or [hl] jr z, .no_danger - ld a, [wc6fd] + ld a, [wDanger] and a jr nz, .done ld a, [PlayerHPPal] @@ -5771,7 +5771,7 @@ MoveSelectionScreen: ; 3e4bc dec a cp c jr z, .move_disabled - ld a, [wc6e1] + ld a, [wUnusedPlayerLockedMove] and a jr nz, .skip2 ld a, [wMenuCursorY] @@ -7383,7 +7383,7 @@ GiveExperiencePoints: ; 3ee3b bit 0, a ret nz - call Function3f0d4 + call .EvenlyDivideExpAmongParticipants xor a ld [CurPartyMon], a ld bc, PartyMon1Species @@ -7407,6 +7407,7 @@ GiveExperiencePoints: ; 3ee3b pop bc jp z, .skip_stats +; give stat exp ld hl, MON_STAT_EXP + 1 add hl, bc ld d, h @@ -7472,6 +7473,7 @@ GiveExperiencePoints: ; 3ee3b ld [hDivisor], a ld b, 4 call Divide +; Boost Experience for traded Pokemon pop bc ld hl, MON_ID add hl, bc @@ -7489,10 +7491,12 @@ GiveExperiencePoints: ; 3ee3b ld a, $1 .no_boost +; Boost experience for a Trainer Battle ld [StringBuffer2 + 2], a ld a, [wBattleMode] dec a call nz, BoostExp +; Boost experience for Lucky Egg push bc ld a, MON_ITEM call GetPartyParamLocation @@ -7513,7 +7517,7 @@ GiveExperiencePoints: ; 3ee3b ld a, [StringBuffer2] ld [hQuotient + 1], a pop bc - call Function3f136 + call AnimateExpBar push bc call LoadTileMapToTempTileMap pop bc @@ -7748,26 +7752,26 @@ GiveExperiencePoints: ; 3ee3b jp ResetBattleParticipants ; 3f0d4 -Function3f0d4: ; 3f0d4 +.EvenlyDivideExpAmongParticipants ; count number of battle participants ld a, [wBattleParticipantsNotFainted] ld b, a ld c, PARTY_LENGTH ld d, 0 -.loop +.count_loop xor a srl b adc d ld d, a dec c - jr nz, .loop + jr nz, .count_loop cp 2 ret c ld [wd265], a ld hl, EnemyMonBaseStats ld c, EnemyMonEnd - EnemyMonBaseStats -.loop2 +.count_loop2 xor a ld [hDividend + 0], a ld a, [hl] @@ -7779,7 +7783,7 @@ Function3f0d4: ; 3f0d4 ld a, [hQuotient + 2] ld [hli], a dec c - jr nz, .loop2 + jr nz, .count_loop2 ret ; 3f106 @@ -7827,7 +7831,7 @@ TextJump_StringBuffer2ExpPoints: ; 3f131 ; 3f136 -Function3f136: ; 3f136 +AnimateExpBar: ; 3f136 push bc ld hl, CurPartyMon @@ -7864,15 +7868,15 @@ Function3f136: ; 3f136 ld a, [wd003] adc [hl] ld [hld], a - jr nc, .asm_3f186 + jr nc, .NoOverflow inc [hl] - jr nz, .asm_3f186 + jr nz, .NoOverflow ld a, $ff ld [hli], a ld [hli], a ld [hl], a -.asm_3f186 +.NoOverflow ld d, MAX_LEVEL callab CalcExpAtLevel ld a, [hProduct + 1] @@ -7888,7 +7892,7 @@ Function3f136: ; 3f136 sbc c ld a, [hl] sbc b - jr c, .asm_3f1a8 + jr c, .AlreadyAtMaxExp ld a, b ld [hli], a ld a, c @@ -7896,37 +7900,37 @@ Function3f136: ; 3f136 ld a, d ld [hld], a -.asm_3f1a8 +.AlreadyAtMaxExp callab CalcLevel ld a, d pop bc pop de ld d, a cp e - jr nc, .asm_3f1b7 + jr nc, .LoopLevels ld a, e ld d, a -.asm_3f1b7 +.LoopLevels ld a, e cp MAX_LEVEL - jr nc, .asm_3f1ff + jr nc, .FinishExpBar cp d - jr z, .asm_3f1ff + jr z, .FinishExpBar inc a ld [TempMonLevel], a ld [CurPartyLevel], a ld [BattleMonLevel], a push de - call Function3f21b + call .PlayExpBarSound ld c, $40 - call Function3f22c + call .LoopBarAnimation call PrintPlayerHUD ld hl, BattleMonNick ld de, StringBuffer1 ld bc, PKMN_NAME_LENGTH call CopyBytes - call Function3dfe + call TerminateExpBarSound ld de, SFX_HIT_END_OF_EXP_BAR call PlaySFX callba AnimateEndOfExpBar @@ -7936,9 +7940,9 @@ Function3f136: ; 3f136 pop de inc e ld b, $0 - jr .asm_3f1b7 + jr .LoopLevels -.asm_3f1ff +.FinishExpBar push bc ld b, d ld de, TempMonExp + 2 @@ -7946,9 +7950,9 @@ Function3f136: ; 3f136 ld a, b pop bc ld c, a - call Function3f21b - call Function3f22c - call Function3dfe + call .PlayExpBarSound + call .LoopBarAnimation + call TerminateExpBarSound pop af ld [hProduct + 2], a pop af @@ -7957,9 +7961,8 @@ Function3f136: ; 3f136 .finish pop bc ret -; 3f21b -Function3f21b: ; 3f21b +.PlayExpBarSound push bc call WaitSFX ld de, SFX_EXP_BAR @@ -7968,12 +7971,11 @@ Function3f21b: ; 3f21b call DelayFrames pop bc ret -; 3f22c -Function3f22c: ; 3f22c - ld d, $3 +.LoopBarAnimation + ld d, 3 dec b -.asm_3f22f +.anim_loop inc b push bc push de @@ -7989,7 +7991,7 @@ Function3f22c: ; 3f22c pop bc ld a, c cp b - jr z, .asm_3f268 + jr z, .end_animation inc b push bc push de @@ -8003,16 +8005,14 @@ Function3f22c: ; 3f22c xor a ld [hBGMapMode], a dec d - jr nz, .asm_3f263 - ld d, $1 - -.asm_3f263 + jr nz, .min_number_of_frames + ld d, 1 +.min_number_of_frames pop bc ld a, c cp b - jr nz, .asm_3f22f - -.asm_3f268 + jr nz, .anim_loop +.end_animation ld a, $1 ld [hBGMapMode], a ret @@ -8575,12 +8575,12 @@ InitEnemyTrainer: ; 3f594 ld de, VTiles2 callab GetTrainerPic xor a - ld [hFillBox], a + ld [hGraphicStartTile], a dec a - ld [wc6e6], a + ld [wEnemyItemState], a hlcoord 12, 0 lb bc, 7, 7 - predef FillBox + predef PlaceGraphic ld a, -1 ld [CurOTMon], a ld a, TRAINER_BATTLE @@ -8640,10 +8640,10 @@ InitEnemyWildmon: ; 3f607 predef FrontpicPredef xor a ld [TrainerClass], a - ld [hFillBox], a + ld [hGraphicStartTile], a hlcoord 12, 0 lb bc, 7, 7 - predef FillBox + predef PlaceGraphic ret ; 3f662 @@ -9402,10 +9402,10 @@ InitBattleDisplay: ; 3fb6c ld a, $1 ld [hBGMapMode], a ld a, $31 - ld [hFillBox], a + ld [hGraphicStartTile], a hlcoord 2, 6 lb bc, 6, 6 - predef FillBox + predef PlaceGraphic xor a ld [hWY], a ld [rWY], a @@ -9499,10 +9499,10 @@ CopyBackpic: ; 3fc30 ld [rSVBK], a call Function3fc5b ld a, $31 - ld [hFillBox], a + ld [hGraphicStartTile], a hlcoord 2, 6 lb bc, 6, 6 - predef FillBox + predef PlaceGraphic ret ; 3fc5b diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index b2712937f..856a1da7f 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -3155,7 +3155,7 @@ BattleCommand_BeatUp: ; 35461 xor a ld [PlayerRolloutCount], a ld [wd002], a - ld [wc72d], a + ld [wBeatUpHitAtLeastOnce], a jr .got_mon .next_mon @@ -3188,7 +3188,7 @@ BattleCommand_BeatUp: ; 35461 jp nz, .beatup_fail ld a, $1 - ld [wc72d], a + ld [wBeatUpHitAtLeastOnce], a ld hl, BeatUpAttackText call StdBattleTextBox ld a, [EnemyMonSpecies] @@ -3223,7 +3223,7 @@ BattleCommand_BeatUp: ; 35461 xor a ld [EnemyRolloutCount], a ld [wd002], a - ld [wc72d], a + ld [wBeatUpHitAtLeastOnce], a jr .enemy_continue .not_first_enemy_beatup @@ -3283,7 +3283,7 @@ BattleCommand_BeatUp: ; 35461 jr nz, .beatup_fail ld a, $1 - ld [wc72d], a + ld [wBeatUpHitAtLeastOnce], a jr .finish_beatup .wild @@ -3332,7 +3332,7 @@ BattleCommand_BeatUp: ; 35461 BattleCommanda8: ; 355b5 - ld a, [wc72d] + ld a, [wBeatUpHitAtLeastOnce] and a ret nz diff --git a/battle/misc.asm b/battle/misc.asm index d47573df9..beb9ce333 100644 --- a/battle/misc.asm +++ b/battle/misc.asm @@ -32,8 +32,8 @@ AppearUser: ; fbd77 (3e:7d77) call GetPlayerBackpicCoords ld a, $31 .okay - ld [hFillBox], a - predef FillBox + ld [hGraphicStartTile], a + predef PlaceGraphic FinishAppearDisappearUser: ; fbd91 (3e:7d91) ld a, $1 ld [hBGMapMode], a |