diff options
author | mid-kid <esteve.varela@gmail.com> | 2018-06-24 16:09:41 +0200 |
---|---|---|
committer | mid-kid <esteve.varela@gmail.com> | 2018-06-24 16:13:22 +0200 |
commit | 1d9a68dbdd0132035f1fc7b7ea8f7fdc24741507 (patch) | |
tree | 3af0a92f5f7dc10f32eed04d9daae52749fc33c2 /engine/battle/ai/items.asm | |
parent | 131875d3e37044ec995287af7c93decd86a0d659 (diff) |
Remove all address comments
Diffstat (limited to 'engine/battle/ai/items.asm')
-rw-r--r-- | engine/battle/ai/items.asm | 147 |
1 files changed, 53 insertions, 94 deletions
diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm index 218ecd375..14817f414 100644 --- a/engine/battle/ai/items.asm +++ b/engine/battle/ai/items.asm @@ -1,4 +1,4 @@ -AI_SwitchOrTryItem: ; 38000 +AI_SwitchOrTryItem: and a ld a, [wBattleMode] @@ -38,12 +38,11 @@ AI_SwitchOrTryItem: ; 38000 jp nz, SwitchSometimes ; fallthrough -DontSwitch: ; 38041 +DontSwitch: call AI_TryItem ret -; 38045 -SwitchOften: ; 38045 +SwitchOften: callfar CheckAbleToSwitch ld a, [wEnemySwitchMonParam] and $f0 @@ -77,9 +76,8 @@ SwitchOften: ; 38045 ; In register 'a' is the number (1-6) of the mon to switch to ld [wEnemySwitchMonIndex], a jp AI_TrySwitch -; 38083 -SwitchRarely: ; 38083 +SwitchRarely: callfar CheckAbleToSwitch ld a, [wEnemySwitchMonParam] and $f0 @@ -112,9 +110,8 @@ SwitchRarely: ; 38083 inc a ld [wEnemySwitchMonIndex], a jp AI_TrySwitch -; 380c1 -SwitchSometimes: ; 380c1 +SwitchSometimes: callfar CheckAbleToSwitch ld a, [wEnemySwitchMonParam] and $f0 @@ -147,17 +144,15 @@ SwitchSometimes: ; 380c1 inc a ld [wEnemySwitchMonIndex], a jp AI_TrySwitch -; 380ff -CheckSubstatusCantRun: ; 380ff +CheckSubstatusCantRun: ld a, [wEnemySubStatus5] bit SUBSTATUS_CANT_RUN, a ret -; 38105 -AI_TryItem: ; 38105 +AI_TryItem: ; items are not allowed in the BattleTower ld a, [wInBattleTowerBattle] and a @@ -244,7 +239,7 @@ AI_TryItem: ; 38105 ret -.IsHighestLevel: ; 38170 +.IsHighestLevel: ld a, [wOTPartyCount] ld d, a ld e, 0 @@ -274,10 +269,9 @@ AI_TryItem: ; 38105 .yes scf ret -; 38196 -AI_Items: ; 39196 +AI_Items: dbw FULL_RESTORE, .FullRestore dbw MAX_POTION, .MaxPotion dbw HYPER_POTION, .HyperPotion @@ -292,16 +286,14 @@ AI_Items: ; 39196 dbw X_SPEED, .XSpeed dbw X_SPECIAL, .XSpecial db -1 ; end -; 381be -.FullHeal: ; 381be +.FullHeal: call .Status jp c, .DontUse call EnemyUsedFullHeal jp .Use -; 381ca -.Status: ; 381ca (e:41ca) +.Status: ld a, [wEnemyMonStatus] and a jp z, .DontUse @@ -332,9 +324,8 @@ AI_Items: ; 39196 and 1 << FRZ | SLP jp z, .DontUse jp .Use -; 38208 -.FullRestore: ; 38208 +.FullRestore: call .HealItem jp nc, .UseFullRestore ld a, [bc] @@ -346,15 +337,14 @@ AI_Items: ; 39196 .UseFullRestore: call EnemyUsedFullRestore jp .Use -; 38220 -.MaxPotion: ; 38220 +.MaxPotion: call .HealItem jp c, .DontUse call EnemyUsedMaxPotion jp .Use -.HealItem: ; 3822c (e:422c) +.HealItem: ld a, [bc] bit CONTEXT_USE_F, a jr nz, .CheckHalfOrQuarterHP @@ -370,7 +360,7 @@ AI_Items: ; 39196 jp c, .UseHealItem jp .DontUse -.CheckQuarterHP: ; 38254 (e:4254) +.CheckQuarterHP: callfar AICheckEnemyQuarterHP jp c, .DontUse call Random @@ -378,7 +368,7 @@ AI_Items: ; 39196 jp c, .DontUse jr .UseHealItem -.CheckHalfOrQuarterHP: ; 38267 (e:4267) +.CheckHalfOrQuarterHP: callfar AICheckEnemyHalfHP jp c, .DontUse callfar AICheckEnemyQuarterHP @@ -387,33 +377,29 @@ AI_Items: ; 39196 cp 20 percent - 1 jp nc, .DontUse -.UseHealItem: ; 38281 (e:4281) +.UseHealItem: jp .Use -; 38284 -.HyperPotion: ; 38284 +.HyperPotion: call .HealItem jp c, .DontUse ld b, 200 call EnemyUsedHyperPotion jp .Use -; 38292 (e:4292) -.SuperPotion: ; 38292 +.SuperPotion: call .HealItem jp c, .DontUse ld b, 50 call EnemyUsedSuperPotion jp .Use -; 382a0 -.Potion: ; 382a0 +.Potion: call .HealItem jp c, .DontUse ld b, 20 call EnemyUsedPotion jp .Use -; 382ae .asm_382ae ; This appears to be unused callfar AICheckEnemyMaxHP @@ -457,58 +443,50 @@ AI_Items: ; 39196 cp 39 percent + 1 jp c, .Use jp .DontUse -; 382f9 -.XAccuracy: ; 382f9 +.XAccuracy: call .XItem jp c, .DontUse call EnemyUsedXAccuracy jp .Use -; 38305 -.GuardSpec: ; 38305 +.GuardSpec: call .XItem jp c, .DontUse call EnemyUsedGuardSpec jp .Use -; 38311 -.DireHit: ; 38311 +.DireHit: call .XItem jp c, .DontUse call EnemyUsedDireHit jp .Use -; 3831d (e:431d) -.XAttack: ; 3831d +.XAttack: call .XItem jp c, .DontUse call EnemyUsedXAttack jp .Use -; 38329 -.XDefend: ; 38329 +.XDefend: call .XItem jp c, .DontUse call EnemyUsedXDefend jp .Use -; 38335 -.XSpeed: ; 38335 +.XSpeed: call .XItem jp c, .DontUse call EnemyUsedXSpeed jp .Use -; 38341 -.XSpecial: ; 38341 +.XSpecial: call .XItem jp c, .DontUse call EnemyUsedXSpecial jp .Use -; 3834d -.XItem: ; 3834d (e:434d) +.XItem: ld a, [wEnemyTurnsTaken] and a jr nz, .notfirstturnout @@ -543,7 +521,7 @@ AI_Items: ; 39196 ret -AIUpdateHUD: ; 38387 +AIUpdateHUD: call UpdateEnemyMonInParty farcall UpdateEnemyHUD ld a, $1 @@ -552,29 +530,27 @@ AIUpdateHUD: ; 38387 dec [hl] scf ret -; 3839a -AIUsedItemSound: ; 3839a +AIUsedItemSound: push de ld de, SFX_FULL_HEAL call PlaySFX pop de ret -; 383a3 -EnemyUsedFullHeal: ; 383a3 (e:43a3) +EnemyUsedFullHeal: call AIUsedItemSound call AI_HealStatus ld a, FULL_HEAL jp PrintText_UsedItemOn_AND_AIUpdateHUD -EnemyUsedMaxPotion: ; 383ae (e:43ae) +EnemyUsedMaxPotion: ld a, MAX_POTION ld [wCurEnemyItem], a jr FullRestoreContinue -EnemyUsedFullRestore: ; 383b5 (e:43b5) +EnemyUsedFullRestore: call AI_HealStatus ld a, FULL_RESTORE ld [wCurEnemyItem], a @@ -583,7 +559,7 @@ EnemyUsedFullRestore: ; 383b5 (e:43b5) xor a ld [wEnemyConfuseCount], a -FullRestoreContinue: ; 383c6 +FullRestoreContinue: ld de, wCurHPAnimOldHP ld hl, wEnemyMonHP + 1 ld a, [hld] @@ -603,23 +579,22 @@ FullRestoreContinue: ; 383c6 ld [wCurHPAnimMaxHP + 1], a ld [wEnemyMonHP], a jr EnemyPotionFinish -; 383e8 (e:43e8) -EnemyUsedPotion: ; 383e8 +EnemyUsedPotion: ld a, POTION ld b, 20 jr EnemyPotionContinue -EnemyUsedSuperPotion: ; 383ee +EnemyUsedSuperPotion: ld a, SUPER_POTION ld b, 50 jr EnemyPotionContinue -EnemyUsedHyperPotion: ; 383f4 (e:43f4) +EnemyUsedHyperPotion: ld a, HYPER_POTION ld b, 200 -EnemyPotionContinue: ; 383f8 +EnemyPotionContinue: ld [wCurEnemyItem], a ld hl, wEnemyMonHP + 1 ld a, [hl] @@ -658,7 +633,7 @@ EnemyPotionContinue: ; 383f8 ld [hl], a ld [wCurHPAnimNewHP + 1], a -EnemyPotionFinish: ; 38436 +EnemyPotionFinish: call PrintText_UsedItemOn hlcoord 2, 2 xor a @@ -668,7 +643,7 @@ EnemyPotionFinish: ; 38436 jp AIUpdateHUD -AI_TrySwitch: ; 3844b +AI_TrySwitch: ; Determine whether the AI can switch based on how many Pokemon are still alive. ; If it can switch, it will. ld a, [wOTPartyCount] @@ -695,9 +670,8 @@ AI_TrySwitch: ; 3844b jp nc, AI_Switch and a ret -; 3846c -AI_Switch: ; 3846c +AI_Switch: ld a, $1 ld [wEnemyIsSwitching], a ld [wEnemyGoesFirst], a @@ -739,21 +713,18 @@ AI_Switch: ; 3846c ret nz scf ret -; 384d0 -TextJump_EnemyWithdrew: ; 384d0 +TextJump_EnemyWithdrew: text_jump Text_EnemyWithdrew db "@" -; 384d5 Function384d5: ; This appears to be unused call AIUsedItemSound call AI_HealStatus ld a, FULL_HEAL_RED ; X_SPEED jp PrintText_UsedItemOn_AND_AIUpdateHUD -; 384e0 -AI_HealStatus: ; 384e0 +AI_HealStatus: ld a, [wCurOTMon] ld hl, wOTPartyMon1Status ld bc, PARTYMON_STRUCT_LENGTH @@ -768,31 +739,27 @@ AI_HealStatus: ; 384e0 ld hl, wEnemySubStatus5 res SUBSTATUS_TOXIC, [hl] ret -; 384f7 -EnemyUsedXAccuracy: ; 384f7 +EnemyUsedXAccuracy: call AIUsedItemSound ld hl, wEnemySubStatus4 set SUBSTATUS_X_ACCURACY, [hl] ld a, X_ACCURACY jp PrintText_UsedItemOn_AND_AIUpdateHUD -; 38504 -EnemyUsedGuardSpec: ; 38504 +EnemyUsedGuardSpec: call AIUsedItemSound ld hl, wEnemySubStatus4 set SUBSTATUS_MIST, [hl] ld a, GUARD_SPEC jp PrintText_UsedItemOn_AND_AIUpdateHUD -; 38511 -EnemyUsedDireHit: ; 38511 +EnemyUsedDireHit: call AIUsedItemSound ld hl, wEnemySubStatus4 set SUBSTATUS_FOCUS_ENERGY, [hl] ld a, DIRE_HIT jp PrintText_UsedItemOn_AND_AIUpdateHUD -; 3851e Function3851e: ; This appears to be unused ld [hDivisor], a @@ -818,27 +785,23 @@ Function3851e: ; This appears to be unused ld a, e sub c ret -; 38541 -EnemyUsedXAttack: ; 38541 +EnemyUsedXAttack: ld b, ATTACK ld a, X_ATTACK jr EnemyUsedXItem -; 38547 -EnemyUsedXDefend: ; 38547 +EnemyUsedXDefend: ld b, DEFENSE ld a, X_DEFEND jr EnemyUsedXItem -; 3854d -EnemyUsedXSpeed: ; 3854d +EnemyUsedXSpeed: ld b, SPEED ld a, X_SPEED jr EnemyUsedXItem -; 38553 -EnemyUsedXSpecial: ; 38553 +EnemyUsedXSpecial: ld b, SP_ATTACK ld a, X_SPECIAL @@ -853,18 +816,16 @@ EnemyUsedXItem: pop bc farcall CheckIfStatCanBeRaised jp AIUpdateHUD -; 38568 ; Parameter ; a = ITEM_CONSTANT -PrintText_UsedItemOn_AND_AIUpdateHUD: ; 38568 +PrintText_UsedItemOn_AND_AIUpdateHUD: ld [wCurEnemyItem], a call PrintText_UsedItemOn jp AIUpdateHUD -; 38571 -PrintText_UsedItemOn: ; 38571 +PrintText_UsedItemOn: ld a, [wCurEnemyItem] ld [wd265], a call GetItemName @@ -874,9 +835,7 @@ PrintText_UsedItemOn: ; 38571 call CopyBytes ld hl, TextJump_EnemyUsedOn jp PrintText -; 3858c -TextJump_EnemyUsedOn: ; 3858c +TextJump_EnemyUsedOn: text_jump Text_EnemyUsedOn db "@" -; 38591 |