diff options
Diffstat (limited to 'engine/battle/ai/switch.asm')
-rw-r--r-- | engine/battle/ai/switch.asm | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/engine/battle/ai/switch.asm b/engine/battle/ai/switch.asm index d397c8d32..b9bd2ea60 100644 --- a/engine/battle/ai/switch.asm +++ b/engine/battle/ai/switch.asm @@ -1,4 +1,4 @@ -CheckPlayerMoveTypeMatchups: ; 3484e +CheckPlayerMoveTypeMatchups: ; Check how well the moves you've already used ; fare against the enemy's Pokemon. Used to ; score a potential switch. @@ -95,10 +95,8 @@ CheckPlayerMoveTypeMatchups: ; 3484e pop de pop hl ret -; 348de - -.CheckEnemyMoveMatchups: ; 348de +.CheckEnemyMoveMatchups: ld de, wEnemyMonMoves ld b, NUM_MOVES + 1 ld c, 0 @@ -163,21 +161,19 @@ CheckPlayerMoveTypeMatchups: ; 3484e .doubledown call .DecreaseScore -.DecreaseScore: ; 34931 +.DecreaseScore: ld a, [wEnemyAISwitchScore] dec a ld [wEnemyAISwitchScore], a ret -; 34939 -.IncreaseScore: ; 34939 +.IncreaseScore: ld a, [wEnemyAISwitchScore] inc a ld [wEnemyAISwitchScore], a ret -; 34941 -CheckAbleToSwitch: ; 34941 +CheckAbleToSwitch: xor a ld [wEnemySwitchMonParam], a call FindAliveEnemyMons @@ -292,10 +288,8 @@ CheckAbleToSwitch: ; 34941 add $10 ld [wEnemySwitchMonParam], a ret -; 349f4 - -FindAliveEnemyMons: ; 349f4 +FindAliveEnemyMons: ld a, [wOTPartyCount] cp 2 jr c, .only_one @@ -344,10 +338,8 @@ FindAliveEnemyMons: ; 349f4 .more_than_one and a ret -; 34a2a - -FindEnemyMonsImmuneToLastCounterMove: ; 34a2a +FindEnemyMonsImmuneToLastCounterMove: ld hl, wOTPartyMon1 ld a, [wOTPartyCount] ld b, a @@ -412,10 +404,8 @@ FindEnemyMonsImmuneToLastCounterMove: ; 34a2a inc d srl c jr .loop -; 34a85 - -FindAliveEnemyMonsWithASuperEffectiveMove: ; 34a85 +FindAliveEnemyMonsWithASuperEffectiveMove: push bc ld a, [wOTPartyCount] ld e, a @@ -445,8 +435,9 @@ FindAliveEnemyMonsWithASuperEffectiveMove: ; 34a85 and c ld c, a -FindEnemyMonsWithASuperEffectiveMove: ; 34aa7 + ; fallthrough +FindEnemyMonsWithASuperEffectiveMove: ld a, -1 ld [wEnemyAISwitchScore], a ld hl, wOTPartyMon1Moves @@ -551,10 +542,8 @@ FindEnemyMonsWithASuperEffectiveMove: ; 34aa7 ld [wEnemyAISwitchScore], a pop bc ret -; 34b20 - -FindEnemyMonsThatResistPlayer: ; 34b20 +FindEnemyMonsThatResistPlayer: push bc ld hl, wOTPartySpecies ld b, 1 << (PARTY_LENGTH - 1) @@ -613,10 +602,8 @@ FindEnemyMonsThatResistPlayer: ; 34b20 and c ld c, a ret -; 34b77 - -FindEnemyMonsWithAtLeastQuarterMaxHP: ; 34b77 +FindEnemyMonsWithAtLeastQuarterMaxHP: push bc ld de, wOTPartySpecies ld b, 1 << (PARTY_LENGTH - 1) @@ -669,4 +656,3 @@ FindEnemyMonsWithAtLeastQuarterMaxHP: ; 34b77 and c ld c, a ret -; 34bb1 |