From bb9818e3c34bf0e413e67bdf6e0fc0fd17476a7c Mon Sep 17 00:00:00 2001 From: xCrystal Date: Wed, 22 Oct 2014 17:36:42 +0200 Subject: [PATCH] More AI commentary/labels --- battle/ai/scoring.asm | 99 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 81 insertions(+), 18 deletions(-) diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm index c45db759c..f12da12aa 100644 --- a/battle/ai/scoring.asm +++ b/battle/ai/scoring.asm @@ -70,8 +70,8 @@ AIScoring_RedStatus: ; 38591 AIScoring_RedStatMods: ; 385e0 -; 50% chance to greatly encourage stat-up moves during enemy's first turn. -; 50% chance to greatly encourage stat-down moves during player's first turn. +; 50% chance to greatly encourage stat-up moves during the first turn of enemy's Pokemon. +; 50% chance to greatly encourage stat-down moves during the first turn of player's Pokemon. ; Almost 90% chance to greatly discourage stat-modifying moves otherwise. ld hl, Buffer1 - 1 @@ -561,6 +561,7 @@ AIScoring_LockOn: ; 3881d AIScoring_Explosion: ; 388a6 +; Selfdestruct, Explosion ; Unless this is the enemy's last Pokemon... push hl @@ -954,14 +955,16 @@ AIScoring_Bide: ; 38a1e AIScoring_Whirlwind: ; 38a2a +; Whirlwind, Roar. + ; Discourage this move if the player has not shown ; a super-effective move against the enemy. -; Consider player's type if its moves are unknown. +; Consider player's type(s) if its moves are unknown. push hl callab Function3484e ld a, [$c716] - cp $a + cp 10 ; neutral pop hl ret c inc [hl] @@ -1020,7 +1023,7 @@ AIScoring_Reflect: ; 38a54 AIScoring_Ohko: ; 38a60 -; Dismiss this move if player's level is higher than enemy's level +; Dismiss this move if player's level is higher than enemy's level. ; Otherwise, discourage this move is player's HP is below 50%. ld a, [BattleMonLevel] @@ -1036,6 +1039,8 @@ AIScoring_Ohko: ; 38a60 AIScoring_Bind: ; 38a71 +; Bind, Wrap, Fire Spin, Clamp + ld a, [$c730] and a jr nz, .asm_38a8b @@ -1144,15 +1149,20 @@ AIScoring_Confuse: ; 38adb AIScoring_SpDefenseUp2: ; 38aed + +; Discourage this move if enemy's HP is lower than 50%. call AICheckEnemyHalfHP jr nc, .asm_38b10 +; Discourage this move if enemy's special defense level is higher than +3. ld a, [EnemySDefLevel] cp $b jr nc, .asm_38b10 + +; 80% chance to greatly encourage this move if +; enemy's Special Defense level is lower than +2, and the player is of a special type. cp $9 ret nc - ld a, [BattleMonType1] cp SPECIAL jr nc, .asm_38b09 @@ -1226,6 +1236,13 @@ AIScoring_Paralyze: ; 38b26 AIScoring_SpeedDownHit: ; 38b40 +; Icy Wind + +; Almost 90% chance to greatly encourage this move if the following conditions all meet: +; Enemy's HP is higher than 25%. +; It's the first turn of player's Pokemon. +; Player is faster than enemy. + ld a, [wEnemyMoveStruct + MOVE_ANIM] cp ICY_WIND ret nz @@ -1284,11 +1301,12 @@ AIScoring_Rage: ; 38b7f bit SUBSTATUS_RAGE, a jr z, .asm_38b9b +; If enemy's Rage is building, 50% chance to encourage this move. call Function39527 jr c, .asm_38b8c - dec [hl] +; Encourage this move based on Rage's counter. .asm_38b8c ld a, [$c72c] cp $2 @@ -1301,9 +1319,11 @@ AIScoring_Rage: ; 38b7f ret .asm_38b9b +; If enemy's Rage is not building, discourage this move if enemy's HP is below 50%. call AICheckEnemyHalfHP jr nc, .asm_38ba6 +; 50% chance to encourage this move otherwise. call Function39521 ret nc dec [hl] @@ -1463,7 +1483,7 @@ AIScoring_Encore: ; 38c3b .asm_38c68 push hl ld a, [LastEnemyCounterMove] - ld hl, .table_38c85 + ld hl, .encoremoves ld de, 1 call IsInArray pop hl @@ -1483,7 +1503,7 @@ AIScoring_Encore: ; 38c3b inc [hl] ret -.table_38c85 +.encoremoves db SWORDS_DANCE db WHIRLWIND db LEER @@ -1519,6 +1539,8 @@ AIScoring_Encore: ; 38c3b AIScoring_PainSplit: ; 38ca4 +; Discourage this move if [enemy's current HP * 2 > player's current HP]. + push hl ld hl, EnemyMonHP ld b, [hl] @@ -1540,6 +1562,9 @@ AIScoring_PainSplit: ; 38ca4 AIScoring_Snore: AIScoring_SleepTalk: ; 38cba +; Greatly encourage this move if enemy is fast asleep. +; Greatly discourage this move otherwise. + ld a, [EnemyMonStatus] and $7 cp $1 @@ -1559,6 +1584,9 @@ AIScoring_SleepTalk: ; 38cba AIScoring_DefrostOpponent: ; 38ccb +; Greatly encourage this move if enemy is frozen. +; No move has EFFECT_DEFROST_OPPONENT, so this layer is unused. + ld a, [EnemyMonStatus] and $20 ret z @@ -1635,6 +1663,8 @@ Function_0x38d16; 38d16 AIScoring_DestinyBond: AIScoring_Reversal: AIScoring_SkullBash: ; 38d19 +; Discourage this move if enemy's HP is above 25%. + call AICheckEnemyQuarterHP ret nc inc [hl] @@ -1643,6 +1673,10 @@ AIScoring_SkullBash: ; 38d19 AIScoring_HealBell: ; 38d1f +; Dismiss this move if none of the opponent's Pokemon is statused. +; Encourage this move if the enemy is statused. +; 50% chance to greatly encourage this move if the enemy is fast asleep or frozen. + push hl ld a, [OTPartyCount] ld b, a @@ -1658,8 +1692,8 @@ AIScoring_HealBell: ; 38d1f dec hl dec hl - dec hl - ld a, [hl] + dec hl ; status + ld a, [hl] or c ld c, a @@ -1698,12 +1732,14 @@ AIScoring_HealBell: ; 38d1f AIScoring_PriorityHit: ; 38d5a call AICompareSpeed - ret c + +; Dismiss this move if the player is flying or underground. ld a, [PlayerSubStatus3] and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND jp nz, AIDiscourageMove +; Greatly encourage this move if it will KO the player. ld a, $1 ld [hBattleTurn], a push hl @@ -1821,18 +1857,22 @@ AIScoring_MeanLook: ; 38dfb pop hl jp z, AIDiscourageMove +; 80% chance to greatly encourage this move if the enemy is badly poisoned (weird). ld a, [EnemySubStatus5] bit SUBSTATUS_TOXIC, a jr nz, .asm_38e26 +; 80% chance to greatly encourage this move if the player is either +; in love, identified, stuck in Rollout, or has a Nightmare. ld a, [PlayerSubStatus1] and 1<