From da799c80d4f6f3c1b22687b6177ff09fecf6c324 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 13 Aug 2014 19:44:56 -0700 Subject: [PATCH] Better trainer AI comments and finish off trainer attributes. --- battle/ai/items.asm | 456 ++++++++++++++-------------- battle/ai/scoring.asm | 536 +++++++++++++++++---------------- battle/core.asm | 4 +- battle/effect_commands.asm | 116 +++---- constants/battle_constants.asm | 5 +- constants/misc_constants.asm | 15 + main.asm | 313 +++++++++---------- trainers/attributes.asm | 302 +++++++++---------- 8 files changed, 893 insertions(+), 854 deletions(-) diff --git a/battle/ai/items.asm b/battle/ai/items.asm index 58c413b87..a360b1d44 100644 --- a/battle/ai/items.asm +++ b/battle/ai/items.asm @@ -1,37 +1,41 @@ Function38000: ; 38000 and a + ld a, [IsInBattle] dec a ret z + ld a, [InLinkBattle] and a ret nz + callba Function3e8d1 ret nz + ld a, [PlayerSubStatus5] bit SUBSTATUS_CANT_RUN, a jr nz, Function38041 + ld a, [$c731] and a jr nz, Function38041 + ld hl, TrainerClassAttributes + 5 ld a, [$cfc0] and a - jr nz, .asm_38032 + jr nz, .ok ld a, [TrainerClass] dec a ld bc, 7 call AddNTimes - -.asm_38032 - bit 0, [hl] +.ok + bit SWITCH_OFTEN_F, [hl] jp nz, Function38045 - bit 1, [hl] + bit SWITCH_RARELY_F, [hl] jp nz, Function38083 - bit 2, [hl] + bit SWITCH_SOMETIMES_F, [hl] jp nz, Function380c1 ; fallthrough -; 38041 Function38041: ; 38041 call Function38105 @@ -43,32 +47,34 @@ Function38045: ; 38045 ld a, [$c717] and $f0 jp z, Function38041 + cp $10 - jr nz, .asm_38061 + jr nz, .not_10 call Random cp $80 - jr c, .asm_38077 + jr c, .switch jp Function38041 +.not_10 -.asm_38061 cp $20 - jr nz, .asm_3806f + jr nz, .not_20 call Random - cp $c8 - jr c, .asm_38077 + cp 200 + jr c, .switch jp Function38041 +.not_20 -.asm_3806f + ; $30 call Random - cp $a + cp 10 jp c, Function38041 -.asm_38077 +.switch ld a, [$c717] and $f inc a ld [$c718], a - jp Function3844b + jp AI_TrySwitch ; 38083 Function38083: ; 38083 @@ -76,32 +82,34 @@ Function38083: ; 38083 ld a, [$c717] and $f0 jp z, Function38041 + cp $10 - jr nz, .asm_3809f + jr nz, .not_10 call Random - cp $14 - jr c, .asm_380b5 + cp 20 + jr c, .switch jp Function38041 +.not_10 -.asm_3809f cp $20 - jr nz, .asm_380ad + jr nz, .not_20 call Random - cp $1e - jr c, .asm_380b5 + cp 30 + jr c, .switch jp Function38041 +.not_20 -.asm_380ad + ; $30 call Random - cp $c8 + cp 200 jp c, Function38041 -.asm_380b5 +.switch ld a, [$c717] and $f inc a ld [$c718], a - jp Function3844b + jp AI_TrySwitch ; 380c1 Function380c1: ; 380c1 @@ -109,32 +117,34 @@ Function380c1: ; 380c1 ld a, [$c717] and $f0 jp z, Function38041 - cp $10 - jr nz, .asm_380dd - call Random - cp $32 - jr c, .asm_380f3 - jp Function38041 -.asm_380dd + cp $10 + jr nz, .not_10 + call Random + cp 50 + jr c, .switch + jp Function38041 +.not_10 + cp $20 - jr nz, .asm_380eb + jr nz, .not_20 call Random cp $80 - jr c, .asm_380f3 + jr c, .switch jp Function38041 +.not_20 -.asm_380eb + ; $30 call Random - cp $32 + cp 50 jp c, Function38041 -.asm_380f3 +.switch ld a, [$c717] and $f inc a ld [$c718], a - jp Function3844b + jp AI_TrySwitch ; 380ff @@ -204,16 +214,16 @@ Function38105: ; 38105 ld [de], a inc a ld [$c70f], a - ld hl, EnemySubStatus3 ; $c66f + ld hl, EnemySubStatus3 res SUBSTATUS_BIDE, [hl] xor a - ld [EnemyFuryCutterCount], a ; $c680 + ld [EnemyFuryCutterCount], a ld [$c681], a ld [$c72c], a - ld hl, EnemySubStatus4 ; $c670 + ld hl, EnemySubStatus4 res SUBSTATUS_RAGE, [hl] xor a - ld [LastPlayerCounterMove], a ; $c6f9 + ld [LastPlayerCounterMove], a scf ret @@ -249,146 +259,144 @@ Function38170: ; 38170 ; 38196 Unknown_38196: ; 39196 - dbw FULL_RESTORE, Function38208 - dbw MAX_POTION, Function38220 - dbw HYPER_POTION, Function38284 - dbw SUPER_POTION, Function38292 - dbw POTION, Function382a0 - dbw X_ACCURACY, Function382f9 - dbw FULL_HEAL, Function381be - dbw GUARD_SPEC, Function38305 - dbw DIRE_HIT, Function38311 - dbw X_ATTACK, Function3831d - dbw X_DEFEND, Function38329 - dbw X_SPEED, Function38335 - dbw X_SPECIAL, Function38341 + dbw FULL_RESTORE, .FullRestore + dbw MAX_POTION, .MaxPotion + dbw HYPER_POTION, .HyperPotion + dbw SUPER_POTION, .SuperPotion + dbw POTION, .Potion + dbw X_ACCURACY, .XAccuracy + dbw FULL_HEAL, .FullHeal + dbw GUARD_SPEC, .GuardSpec + dbw DIRE_HIT, .DireHit + dbw X_ATTACK, .XAttack + dbw X_DEFEND, .XDefend + dbw X_SPEED, .XSpeed + dbw X_SPECIAL, .XSpecial db $ff ; 381be -Function381be: ; 381be - call Function381ca - jp c, Function38383 +.FullHeal: ; 381be + call .Status + jp c, .DontUse call Function383a3 - jp Function38385 + jp .Use ; 381ca -Function381ca: ; 381ca (e:41ca) - ld a, [EnemyMonStatus] ; $d214 +.Status: ; 381ca (e:41ca) + ld a, [EnemyMonStatus] and a - jp z, Function38383 + jp z, .DontUse ld a, [bc] - bit 6, a + bit CONTEXT_USE_F, a jr nz, .asm_381e7 ld a, [bc] - bit 4, a - jp nz, Function38385 + bit ALWAYS_USE_F, a + jp nz, .Use call Random - cp $32 - jp c, Function38385 - jp Function38383 + cp 50 + jp c, .Use + jp .DontUse .asm_381e7 ld a, [EnemySubStatus5] bit SUBSTATUS_TOXIC, a jr z, .asm_381fd - ld a, [$c67c] - cp $4 + ld a, [EnemyToxicCount] + cp 4 jr c, .asm_381fd call Random cp $80 - jp c, Function38385 + jp c, .Use .asm_381fd ld a, [EnemyMonStatus] and 1 << FRZ | SLP - jp z, Function38383 - jp Function38385 + jp z, .DontUse + jp .Use ; 38208 -Function38208: ; 38208 - call Function3822c - jp nc, Function3821a +.FullRestore: ; 38208 + call .HealItem + jp nc, .asm_3821a ld a, [bc] - bit 6, a - jp z, Function38383 - call Function381ca - jp c, Function38383 + bit CONTEXT_USE_F, a + jp z, .DontUse + call .Status + jp c, .DontUse -Function3821a: ; 3821a (e:421a) +.asm_3821a call Function383b5 - jp Function38385 + jp .Use ; 38220 -Function38220: ; 38220 - call Function3822c - jp c, Function38383 +.MaxPotion: ; 38220 + call .HealItem + jp c, .DontUse call Function383ae - jp Function38385 + jp .Use -Function3822c: ; 3822c (e:422c) +.HealItem: ; 3822c (e:422c) ld a, [bc] - bit 6, a - jr nz, Function38267 + bit CONTEXT_USE_F, a + jr nz, .asm_38267 callab AICheckEnemyHalfHP - jp c, Function38383 + jp c, .DontUse ld a, [bc] - bit 5, a - jp nz, Function38254 + bit UNKNOWN_USE_F, a + jp nz, .asm_38254 callab AICheckEnemyQuarterHP - jp nc, Function38281 + jp nc, .asm_38281 call Random cp $80 - jp c, Function38281 - jp Function38383 + jp c, .asm_38281 + jp .DontUse -Function38254: ; 38254 (e:4254) +.asm_38254: ; 38254 (e:4254) callab AICheckEnemyQuarterHP - jp c, Function38383 + jp c, .DontUse call Random - cp $32 - jp c, Function38383 - jr Function38281 + cp 50 + jp c, .DontUse + jr .asm_38281 -Function38267: ; 38267 (e:4267) +.asm_38267: ; 38267 (e:4267) callab AICheckEnemyHalfHP - jp c, Function38383 + jp c, .DontUse callab AICheckEnemyQuarterHP - jp nc, Function38281 + jp nc, .asm_38281 call Random - cp $32 - jp nc, Function38383 + cp 50 + jp nc, .DontUse -Function38281: ; 38281 (e:4281) - jp Function38385 +.asm_38281: ; 38281 (e:4281) + jp .Use ; 38284 -Function38284: ; 38284 - call Function3822c - jp c, Function38383 +.HyperPotion: ; 38284 + call .HealItem + jp c, .DontUse ld b, 200 call Function383f4 - jp Function38385 + jp .Use ; 38292 (e:4292) -Function38292: ; 38292 - call Function3822c - jp c, Function38383 - -Function38298: ; 38298 +.SuperPotion: ; 38292 + call .HealItem + jp c, .DontUse ld b, 50 call Function383ee - jp Function38385 + jp .Use ; 382a0 -Function382a0: ; 382a0 - call Function3822c - jp c, Function38383 +.Potion: ; 382a0 + call .HealItem + jp c, .DontUse ld b, 20 call Function383e8 - jp Function38385 + jp .Use ; 382ae -Function382ae: ; 382ae +.asm_382ae: ; 382ae callab AICheckEnemyMaxHP jr c, .asm_382e4 push bc @@ -412,111 +420,111 @@ Function382ae: ; 382ae .asm_382d5 pop bc ld a, [bc] - bit 5, a - jp z, Function38385 + bit UNKNOWN_USE_F, a + jp z, .Use call Random cp $80 - jp c, Function38385 + jp c, .Use .asm_382e4 - jp Function38383 + jp .DontUse .asm_382e7 pop bc ld a, [bc] - bit 5, a - jp z, Function38383 + bit UNKNOWN_USE_F, a + jp z, .DontUse call Random - cp $64 - jp c, Function38385 - jp Function38383 + cp 100 + jp c, .Use + jp .DontUse ; 382f9 -Function382f9: ; 382f9 - call Function3834d - jp c, Function38383 +.XAccuracy: ; 382f9 + call .XItem + jp c, .DontUse call Function384f7 - jp Function38385 + jp .Use ; 38305 -Function38305: ; 38305 - call Function3834d - jp c, Function38383 +.GuardSpec: ; 38305 + call .XItem + jp c, .DontUse call Function38504 - jp Function38385 + jp .Use ; 38311 -Function38311: ; 38311 - call Function3834d - jp c, Function38383 +.DireHit: ; 38311 + call .XItem + jp c, .DontUse call Function38511 - jp Function38385 + jp .Use ; 3831d (e:431d) -Function3831d: ; 3831d - call Function3834d - jp c, Function38383 +.XAttack: ; 3831d + call .XItem + jp c, .DontUse call Function38541 - jp Function38385 + jp .Use ; 38329 -Function38329: ; 38329 - call Function3834d - jp c, Function38383 +.XDefend: ; 38329 + call .XItem + jp c, .DontUse call Function38547 - jp Function38385 + jp .Use ; 38335 -Function38335: ; 38335 - call Function3834d - jp c, Function38383 +.XSpeed: ; 38335 + call .XItem + jp c, .DontUse call Function3854d - jp Function38385 + jp .Use ; 38341 -Function38341: ; 38341 - call Function3834d - jp c, Function38383 +.XSpecial: ; 38341 + call .XItem + jp c, .DontUse call Function38553 - jp Function38385 + jp .Use ; 3834d -Function3834d: ; 3834d (e:434d) - ld a, [EnemyTurnsTaken] ; $c6dc +.XItem: ; 3834d (e:434d) + ld a, [EnemyTurnsTaken] and a jr nz, .asm_38372 ld a, [bc] - bit 4, a - jp nz, Function38385 + bit ALWAYS_USE_F, a + jp nz, .Use call Random cp $80 - jp c, Function38383 + jp c, .DontUse ld a, [bc] - bit 6, a - jp nz, Function38385 + bit CONTEXT_USE_F, a + jp nz, .Use call Random cp $80 - jp c, Function38383 - jp Function38385 + jp c, .DontUse + jp .Use .asm_38372 ld a, [bc] - bit 4, a - jp z, Function38383 + bit ALWAYS_USE_F, a + jp z, .DontUse call Random - cp $32 - jp nc, Function38383 - jp Function38385 + cp 50 + jp nc, .DontUse + jp .Use -Function38383: ; 38383 (e:4383) +.DontUse: scf ret -Function38385: ; 38385 (e:4385) +.Use: and a ret -Function38387: ; 38387 +AIUpdateHUD: ; 38387 call UpdateEnemyMonInParty callba UpdateEnemyHUD ld a, $1 @@ -527,7 +535,7 @@ Function38387: ; 38387 ret ; 3839a -Function3839a: ; 3839a +AIUsedItemSound: ; 3839a push de ld de, SFX_FULL_HEAL call PlaySFX @@ -537,44 +545,45 @@ Function3839a: ; 3839a Function383a3: ; 383a3 (e:43a3) - call Function3839a - call Function384e0 + call AIUsedItemSound + call AI_HealStatus ld a, FULL_HEAL jp Function38568 Function383ae: ; 383ae (e:43ae) - ld a, $f + ld a, MAX_POTION ld [$d1f1], a jr asm_383c6 Function383b5: ; 383b5 (e:43b5) - call Function384e0 - ld a, $e + call AI_HealStatus + ld a, FULL_RESTORE ld [$d1f1], a - ld hl, EnemySubStatus3 ; $c66f + ld hl, EnemySubStatus3 res SUBSTATUS_CONFUSED, [hl] xor a - ld [EnemyConfuseCount], a ; $c67b -asm_383c6: ; 383c6 (e:43c6) + ld [EnemyConfuseCount], a + +asm_383c6: ; 383c6 ld de, $d1ec - ld hl, EnemyMonHP + 1 ; $d217 + ld hl, EnemyMonHP + 1 ld a, [hld] ld [de], a inc de ld a, [hl] ld [de], a inc de - ld hl, EnemyMonMaxHP + 1 ; $d219 + ld hl, EnemyMonMaxHP + 1 ld a, [hld] ld [de], a inc de - ld [Buffer1], a ; $d1ea (aliases: MagikarpLength) - ld [EnemyMonHP + 1], a ; $d217 + ld [Buffer1], a + ld [EnemyMonHP + 1], a ld a, [hl] ld [de], a - ld [Buffer2], a ; $d1eb (aliases: MovementType) - ld [EnemyMonHP], a ; $d216 (aliases: EnemyMonHP) - jr asm_38436 + ld [Buffer2], a + ld [EnemyMonHP], a + jr Function38436 ; 383e8 (e:43e8) Function383e8: ; 383e8 @@ -593,34 +602,34 @@ Function383f4: ; 383f4 (e:43f4) Function383f8: ; 383f8 ld [$d1f1], a - ld hl, EnemyMonHP + 1 ; $d217 + ld hl, EnemyMonHP + 1 ld a, [hl] ld [$d1ec], a add b ld [hld], a ld [$d1ee], a ld a, [hl] - ld [$d1ed], a - ld [$d1ef], a + ld [$d1ec + 1], a + ld [$d1ee + 1], a jr nc, .asm_38415 inc a ld [hl], a - ld [$d1ef], a + ld [$d1ee + 1], a .asm_38415 inc hl ld a, [hld] ld b, a - ld de, EnemyMonMaxHP + 1 ; $d219 + ld de, EnemyMonMaxHP + 1 ld a, [de] dec de - ld [Buffer1], a ; $d1ea (aliases: MagikarpLength) + ld [Buffer1], a sub b ld a, [hli] ld b, a ld a, [de] - ld [Buffer2], a ; $d1eb (aliases: MovementType) + ld [Buffer2], a sbc b - jr nc, asm_38436 + jr nc, .asm_38436 inc de ld a, [de] dec de @@ -629,17 +638,19 @@ Function383f8: ; 383f8 ld a, [de] ld [hl], a ld [$d1ef], a -asm_38436: ; 38436 (e:4436) +.asm_38436 + +Function38436: ; 38436 call Function38571 hlcoord 2, 2 xor a ld [$d10a], a - call Function3839a + call AIUsedItemSound predef Functionc6e0 - jp Function38387 + jp AIUpdateHUD -Function3844b: ; 3844b +AI_TrySwitch: ; 3844b ld a, [OTPartyCount] ld c, a ld hl, OTPartyMon1HP @@ -651,7 +662,6 @@ Function3844b: ; 3844b or b jr z, .asm_3845b inc d - .asm_3845b push bc ld bc, PartyMon2 - PartyMon1 @@ -659,14 +669,15 @@ Function3844b: ; 3844b pop bc dec c jr nz, .asm_38454 + ld a, d - cp $2 - jp nc, Function3846c + cp 2 + jp nc, AI_Switch and a ret ; 3846c -Function3846c: ; 3846c +AI_Switch: ; 3846c ld a, $1 ld [$c711], a ld [$c70f], a @@ -689,7 +700,6 @@ Function3846c: ; 3846c jr c, .asm_384a3 ld hl, UnknownText_0x384d0 call PrintText - .asm_384a3 ld a, $1 ld [$d264], a @@ -714,13 +724,13 @@ UnknownText_0x384d0: ; 384d0 ; 384d5 Function384d5: ; 384d5 - call Function3839a - call Function384e0 - ld a, X_SPEED + call AIUsedItemSound + call AI_HealStatus + ld a, FULL_HEAL_RED jp Function38568 ; 384e0 -Function384e0: ; 384e0 +AI_HealStatus: ; 384e0 ld a, [CurOTMon] ld hl, OTPartyMon1Status ld bc, PartyMon2 - PartyMon1 @@ -734,15 +744,15 @@ Function384e0: ; 384e0 ; 384f7 Function384f7: ; 384f7 - call Function3839a + call AIUsedItemSound ld hl, EnemySubStatus4 - set SUBSTATUS_UNLEASH, [hl] + set SUBSTATUS_X_ACCURACY, [hl] ld a, X_ACCURACY jp Function38568 ; 38504 Function38504: ; 38504 - call Function3839a + call AIUsedItemSound ld hl, EnemySubStatus4 set SUBSTATUS_MIST, [hl] ld a, GUARD_SPEC @@ -750,7 +760,7 @@ Function38504: ; 38504 ; 38511 Function38511: ; 38511 - call Function3839a + call AIUsedItemSound ld hl, EnemySubStatus4 set SUBSTATUS_FOCUS_ENERGY, [hl] ld a, DIRE_HIT @@ -805,20 +815,20 @@ Function38553: ; 38553 ld b, SP_ATTACK ld a, X_SPECIAL -Function38557 +Function38557: ld [$d1f1], a push bc call Function38571 pop bc callba Function361ef - jp Function38387 + jp AIUpdateHUD ; 38568 Function38568: ; 38568 ld [$d1f1], a call Function38571 - jp Function38387 + jp AIUpdateHUD ; 38571 Function38571: ; 38571 diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm index e7498886f..5e43470d7 100644 --- a/battle/ai/scoring.asm +++ b/battle/ai/scoring.asm @@ -1,5 +1,7 @@ -AIScoring_RedStatus: ; 38591 -; Don't use status-only moves if the player can't be statused. +AI_Basic: ; 38591 +; Don't do anything redundant: +; -Using status-only moves if the player can't be statused +; -Using moves that fail if they've already been used ld hl, Buffer1 - 1 ld de, EnemyMonMoves @@ -22,7 +24,7 @@ AIScoring_RedStatus: ; 38591 push hl push de push bc - callba Function2c41a + callba AI_Redundant pop bc pop de pop hl @@ -64,7 +66,7 @@ AIScoring_RedStatus: ; 38591 -AIScoring_RedStatMods: ; 385e0 +AI_Setup: ; 385e0 ; Use stat-modifying moves on turn 1. ld hl, Buffer1 - 1 @@ -119,7 +121,7 @@ AIScoring_RedStatMods: ; 385e0 jr nz, .discourage .encourage - call Function39527 + call AI_50_50 jr c, .checkmove dec [hl] @@ -137,7 +139,7 @@ AIScoring_RedStatMods: ; 385e0 -AIScoring_RedSuperEffective: ; 38635 +AI_Types: ; 38635 ; Use super-effective moves. ld hl, Buffer1 - 1 @@ -226,7 +228,7 @@ AIScoring_RedSuperEffective: ; 38635 -AIScoring_Offensive: ; 386a2 +AI_Offensive: ; 386a2 ; Discourage non-damaging moves. ld hl, Buffer1 - 1 @@ -255,7 +257,7 @@ AIScoring_Offensive: ; 386a2 -AIScoring_Smart: ; 386be +AI_Smart: ; 386be ; Context-specific scoring. ld hl, Buffer1 @@ -304,101 +306,101 @@ AIScoring_Smart: ; 386be jr .checkmove .table_386f2 - dbw EFFECT_SLEEP, AIScoring_Sleep - dbw EFFECT_LEECH_HIT, AIScoring_LeechHit - dbw EFFECT_EXPLOSION, AIScoring_Explosion - dbw EFFECT_DREAM_EATER, AIScoring_DreamEater - dbw EFFECT_MIRROR_MOVE, AIScoring_MirrorMove - dbw EFFECT_EVASION_UP, AIScoring_EvasionUp - dbw EFFECT_ALWAYS_HIT, AIScoring_AlwaysHit - dbw EFFECT_ACCURACY_DOWN, AIScoring_AccuracyDown - dbw EFFECT_HAZE, AIScoring_Haze - dbw EFFECT_BIDE, AIScoring_Bide - dbw EFFECT_WHIRLWIND, AIScoring_Whirlwind - dbw EFFECT_HEAL, AIScoring_Heal - dbw EFFECT_TOXIC, AIScoring_Toxic - dbw EFFECT_LIGHT_SCREEN, AIScoring_LightScreen - dbw EFFECT_OHKO, AIScoring_Ohko - dbw EFFECT_RAZOR_WIND, AIScoring_RazorWind - dbw EFFECT_SUPER_FANG, AIScoring_SuperFang - dbw EFFECT_BIND, AIScoring_Bind - dbw EFFECT_UNUSED_2B, AIScoring_Unused2B - dbw EFFECT_CONFUSE, AIScoring_Confuse - dbw EFFECT_SP_DEF_UP_2, AIScoring_SpDefenseUp2 - dbw EFFECT_REFLECT, AIScoring_Reflect - dbw EFFECT_PARALYZE, AIScoring_Paralyze - dbw EFFECT_SPEED_DOWN_HIT, AIScoring_SpeedDownHit - dbw EFFECT_SUBSTITUTE, AIScoring_Substitute - dbw EFFECT_HYPER_BEAM, AIScoring_HyperBeam - dbw EFFECT_RAGE, AIScoring_Rage - dbw EFFECT_MIMIC, AIScoring_Mimic - dbw EFFECT_LEECH_SEED, AIScoring_LeechSeed - dbw EFFECT_DISABLE, AIScoring_Disable - dbw EFFECT_COUNTER, AIScoring_Counter - dbw EFFECT_ENCORE, AIScoring_Encore - dbw EFFECT_PAIN_SPLIT, AIScoring_PainSplit - dbw EFFECT_SNORE, AIScoring_Snore - dbw EFFECT_CONVERSION2, AIScoring_Conversion2 - dbw EFFECT_LOCK_ON, AIScoring_LockOn - dbw EFFECT_DEFROST_OPPONENT, AIScoring_DefrostOpponent - dbw EFFECT_SLEEP_TALK, AIScoring_SleepTalk - dbw EFFECT_DESTINY_BOND, AIScoring_DestinyBond - dbw EFFECT_REVERSAL, AIScoring_Reversal - dbw EFFECT_SPITE, AIScoring_Spite - dbw EFFECT_HEAL_BELL, AIScoring_HealBell - dbw EFFECT_PRIORITY_HIT, AIScoring_PriorityHit - dbw EFFECT_THIEF, AIScoring_Thief - dbw EFFECT_MEAN_LOOK, AIScoring_MeanLook - dbw EFFECT_NIGHTMARE, AIScoring_Nightmare - dbw EFFECT_FLAME_WHEEL, AIScoring_FlameWheel - dbw EFFECT_CURSE, AIScoring_Curse - dbw EFFECT_PROTECT, AIScoring_Protect - dbw EFFECT_FORESIGHT, AIScoring_Foresight - dbw EFFECT_PERISH_SONG, AIScoring_PerishSong - dbw EFFECT_SANDSTORM, AIScoring_Sandstorm - dbw EFFECT_ENDURE, AIScoring_Endure - dbw EFFECT_ROLLOUT, AIScoring_Rollout - dbw EFFECT_SWAGGER, AIScoring_Swagger - dbw EFFECT_FURY_CUTTER, AIScoring_FuryCutter - dbw EFFECT_ATTRACT, AIScoring_Attract - dbw EFFECT_SAFEGUARD, AIScoring_Safeguard - dbw EFFECT_MAGNITUDE, AIScoring_Magnitude - dbw EFFECT_BATON_PASS, AIScoring_BatonPass - dbw EFFECT_PURSUIT, AIScoring_Pursuit - dbw EFFECT_RAPID_SPIN, AIScoring_RapidSpin - dbw EFFECT_MORNING_SUN, AIScoring_MorningSun - dbw EFFECT_SYNTHESIS, AIScoring_Synthesis - dbw EFFECT_MOONLIGHT, AIScoring_Moonlight - dbw EFFECT_HIDDEN_POWER, AIScoring_HiddenPower - dbw EFFECT_RAIN_DANCE, AIScoring_RainDance - dbw EFFECT_SUNNY_DAY, AIScoring_SunnyDay - dbw EFFECT_BELLY_DRUM, AIScoring_BellyDrum - dbw EFFECT_PSYCH_UP, AIScoring_PsychUp - dbw EFFECT_MIRROR_COAT, AIScoring_MirrorCoat - dbw EFFECT_SKULL_BASH, AIScoring_SkullBash - dbw EFFECT_TWISTER, AIScoring_Twister - dbw EFFECT_EARTHQUAKE, AIScoring_Earthquake - dbw EFFECT_FUTURE_SIGHT, AIScoring_FutureSight - dbw EFFECT_GUST, AIScoring_Gust - dbw EFFECT_STOMP, AIScoring_Stomp - dbw EFFECT_SOLARBEAM, AIScoring_Solarbeam - dbw EFFECT_THUNDER, AIScoring_Thunder - dbw EFFECT_FLY, AIScoring_Fly + dbw EFFECT_SLEEP, AI_Smart_Sleep + dbw EFFECT_LEECH_HIT, AI_Smart_LeechHit + dbw EFFECT_EXPLOSION, AI_Smart_Explosion + dbw EFFECT_DREAM_EATER, AI_Smart_DreamEater + dbw EFFECT_MIRROR_MOVE, AI_Smart_MirrorMove + dbw EFFECT_EVASION_UP, AI_Smart_EvasionUp + dbw EFFECT_ALWAYS_HIT, AI_Smart_AlwaysHit + dbw EFFECT_ACCURACY_DOWN, AI_Smart_AccuracyDown + dbw EFFECT_HAZE, AI_Smart_Haze + dbw EFFECT_BIDE, AI_Smart_Bide + dbw EFFECT_WHIRLWIND, AI_Smart_Whirlwind + dbw EFFECT_HEAL, AI_Smart_Heal + dbw EFFECT_TOXIC, AI_Smart_Toxic + dbw EFFECT_LIGHT_SCREEN, AI_Smart_LightScreen + dbw EFFECT_OHKO, AI_Smart_Ohko + dbw EFFECT_RAZOR_WIND, AI_Smart_RazorWind + dbw EFFECT_SUPER_FANG, AI_Smart_SuperFang + dbw EFFECT_BIND, AI_Smart_Bind + dbw EFFECT_UNUSED_2B, AI_Smart_Unused2B + dbw EFFECT_CONFUSE, AI_Smart_Confuse + dbw EFFECT_SP_DEF_UP_2, AI_Smart_SpDefenseUp2 + dbw EFFECT_REFLECT, AI_Smart_Reflect + dbw EFFECT_PARALYZE, AI_Smart_Paralyze + dbw EFFECT_SPEED_DOWN_HIT, AI_Smart_SpeedDownHit + dbw EFFECT_SUBSTITUTE, AI_Smart_Substitute + dbw EFFECT_HYPER_BEAM, AI_Smart_HyperBeam + dbw EFFECT_RAGE, AI_Smart_Rage + dbw EFFECT_MIMIC, AI_Smart_Mimic + dbw EFFECT_LEECH_SEED, AI_Smart_LeechSeed + dbw EFFECT_DISABLE, AI_Smart_Disable + dbw EFFECT_COUNTER, AI_Smart_Counter + dbw EFFECT_ENCORE, AI_Smart_Encore + dbw EFFECT_PAIN_SPLIT, AI_Smart_PainSplit + dbw EFFECT_SNORE, AI_Smart_Snore + dbw EFFECT_CONVERSION2, AI_Smart_Conversion2 + dbw EFFECT_LOCK_ON, AI_Smart_LockOn + dbw EFFECT_DEFROST_OPPONENT, AI_Smart_DefrostOpponent + dbw EFFECT_SLEEP_TALK, AI_Smart_SleepTalk + dbw EFFECT_DESTINY_BOND, AI_Smart_DestinyBond + dbw EFFECT_REVERSAL, AI_Smart_Reversal + dbw EFFECT_SPITE, AI_Smart_Spite + dbw EFFECT_HEAL_BELL, AI_Smart_HealBell + dbw EFFECT_PRIORITY_HIT, AI_Smart_PriorityHit + dbw EFFECT_THIEF, AI_Smart_Thief + dbw EFFECT_MEAN_LOOK, AI_Smart_MeanLook + dbw EFFECT_NIGHTMARE, AI_Smart_Nightmare + dbw EFFECT_FLAME_WHEEL, AI_Smart_FlameWheel + dbw EFFECT_CURSE, AI_Smart_Curse + dbw EFFECT_PROTECT, AI_Smart_Protect + dbw EFFECT_FORESIGHT, AI_Smart_Foresight + dbw EFFECT_PERISH_SONG, AI_Smart_PerishSong + dbw EFFECT_SANDSTORM, AI_Smart_Sandstorm + dbw EFFECT_ENDURE, AI_Smart_Endure + dbw EFFECT_ROLLOUT, AI_Smart_Rollout + dbw EFFECT_SWAGGER, AI_Smart_Swagger + dbw EFFECT_FURY_CUTTER, AI_Smart_FuryCutter + dbw EFFECT_ATTRACT, AI_Smart_Attract + dbw EFFECT_SAFEGUARD, AI_Smart_Safeguard + dbw EFFECT_MAGNITUDE, AI_Smart_Magnitude + dbw EFFECT_BATON_PASS, AI_Smart_BatonPass + dbw EFFECT_PURSUIT, AI_Smart_Pursuit + dbw EFFECT_RAPID_SPIN, AI_Smart_RapidSpin + dbw EFFECT_MORNING_SUN, AI_Smart_MorningSun + dbw EFFECT_SYNTHESIS, AI_Smart_Synthesis + dbw EFFECT_MOONLIGHT, AI_Smart_Moonlight + dbw EFFECT_HIDDEN_POWER, AI_Smart_HiddenPower + dbw EFFECT_RAIN_DANCE, AI_Smart_RainDance + dbw EFFECT_SUNNY_DAY, AI_Smart_SunnyDay + dbw EFFECT_BELLY_DRUM, AI_Smart_BellyDrum + dbw EFFECT_PSYCH_UP, AI_Smart_PsychUp + dbw EFFECT_MIRROR_COAT, AI_Smart_MirrorCoat + dbw EFFECT_SKULL_BASH, AI_Smart_SkullBash + dbw EFFECT_TWISTER, AI_Smart_Twister + dbw EFFECT_EARTHQUAKE, AI_Smart_Earthquake + dbw EFFECT_FUTURE_SIGHT, AI_Smart_FutureSight + dbw EFFECT_GUST, AI_Smart_Gust + dbw EFFECT_STOMP, AI_Smart_Stomp + dbw EFFECT_SOLARBEAM, AI_Smart_Solarbeam + dbw EFFECT_THUNDER, AI_Smart_Thunder + dbw EFFECT_FLY, AI_Smart_Fly db $ff ; 387e3 -AIScoring_Sleep: ; 387e3 +AI_Smart_Sleep: ; 387e3 ld b, EFFECT_DREAM_EATER - call AIHasMove + call AIHasMoveEffect jr c, .asm_387f0 ld b, EFFECT_NIGHTMARE - call AIHasMove + call AIHasMoveEffect ret nc .asm_387f0 - call Function39527 + call AI_50_50 ret c dec [hl] dec [hl] @@ -406,7 +408,7 @@ AIScoring_Sleep: ; 387e3 ; 387f7 -AIScoring_LeechHit: ; 387f7 +AI_Smart_LeechHit: ; 387f7 push hl ld a, 1 ld [hBattleTurn], a @@ -416,28 +418,28 @@ AIScoring_LeechHit: ; 387f7 ld a, [$d265] cp 10 ; 1.0 jr c, .asm_38815 - ret z + call AICheckEnemyMaxHP - ret c - call Function39521 + call AI_80_20 ret c + dec [hl] ret .asm_38815 call Random - - cp $64 + cp 100 ret c + inc [hl] ret ; 3881d -AIScoring_LockOn: ; 3881d +AI_Smart_LockOn: ; 3881d ld a, [PlayerSubStatus5] bit SUBSTATUS_LOCK_ON, a jr nz, .asm_38882 @@ -504,7 +506,7 @@ AIScoring_LockOn: ; 3881d .asm_3887a pop hl - call Function39527 + call AI_50_50 ret c dec [hl] @@ -543,9 +545,9 @@ AIScoring_LockOn: ; 3881d ; 388a6 -AIScoring_Explosion: ; 388a6 +AI_Smart_Explosion: ; 388a6 push hl - callba Function349f4 + callba CountEnemyAliveMons pop hl jr nc, .asm_388b7 @@ -573,7 +575,7 @@ AIScoring_Explosion: ; 388a6 ; 388ca -AIScoring_DreamEater: ; 388ca +AI_Smart_DreamEater: ; 388ca call Random cp $19 @@ -585,7 +587,7 @@ AIScoring_DreamEater: ; 388ca ; 388d4 -AIScoring_EvasionUp: ; 388d4 +AI_Smart_EvasionUp: ; 388d4 ld a, [EnemyEvaLevel] cp $d jp nc, AIDiscourageMove @@ -617,12 +619,12 @@ AIScoring_EvasionUp: ; 388d4 call AICheckEnemyHalfHP jr nc, .asm_3890a - call Function39521 + call AI_80_20 jr c, .asm_388ef jr .asm_38911 .asm_3890a - call Function39527 + call AI_50_50 jr c, .asm_38911 .asm_3890f @@ -666,7 +668,7 @@ AIScoring_EvasionUp: ; 388d4 ret .asm_38941 - call Function39527 + call AI_50_50 ret c dec [hl] @@ -674,7 +676,7 @@ AIScoring_EvasionUp: ; 388d4 ; 38947 -AIScoring_AlwaysHit: ; 38947 +AI_Smart_AlwaysHit: ; 38947 ld a, [EnemyAccLevel] cp $5 jr c, .asm_38954 @@ -684,16 +686,16 @@ AIScoring_AlwaysHit: ; 38947 ret c .asm_38954 - call Function39521 - + call AI_80_20 ret c + dec [hl] dec [hl] ret ; 3895b -AIScoring_MirrorMove: ; 3895b +AI_Smart_MirrorMove: ; 3895b ld a, [LastEnemyCounterMove] and a jr nz, .asm_38968 @@ -705,13 +707,13 @@ AIScoring_MirrorMove: ; 3895b .asm_38968 push hl - ld hl, Table_0x39301 + ld hl, GoodMoves ld de, 1 call IsInArray pop hl ret nc - call Function39527 + call AI_50_50 ret c dec [hl] @@ -727,7 +729,7 @@ AIScoring_MirrorMove: ; 3895b ; 38985 -AIScoring_AccuracyDown: ; 38985 +AI_Smart_AccuracyDown: ; 38985 call AICheckPlayerMaxHP jr nc, .asm_389a0 @@ -758,12 +760,12 @@ AIScoring_AccuracyDown: ; 38985 call AICheckPlayerHalfHP jr nc, .asm_389b8 - call Function39521 + call AI_80_20 jr c, .asm_3899d jr .asm_389bf .asm_389b8 - call Function39527 + call AI_50_50 jr c, .asm_389bf .asm_389bd @@ -806,7 +808,7 @@ AIScoring_AccuracyDown: ; 38985 ret .asm_389ef - call Function39527 + call AI_50_50 ret c dec [hl] @@ -814,7 +816,7 @@ AIScoring_AccuracyDown: ; 38985 ; 389f5 -AIScoring_Haze: ; 389f5 +AI_Smart_Haze: ; 389f5 push hl ld hl, EnemyAtkLevel ld c, $8 @@ -851,7 +853,7 @@ AIScoring_Haze: ; 389f5 ; 38a1e -AIScoring_Bide: ; 38a1e +AI_Smart_Bide: ; 38a1e call AICheckEnemyMaxHP ret c call Random @@ -862,7 +864,7 @@ AIScoring_Bide: ; 38a1e ; 38a2a -AIScoring_Whirlwind: ; 38a2a +AI_Smart_Whirlwind: ; 38a2a push hl callab Function3484e ld a, [$c716] @@ -874,10 +876,10 @@ AIScoring_Whirlwind: ; 38a2a ; 38a3a -AIScoring_Heal: -AIScoring_MorningSun: -AIScoring_Synthesis: -AIScoring_Moonlight: ; 38a3a +AI_Smart_Heal: +AI_Smart_MorningSun: +AI_Smart_Synthesis: +AI_Smart_Moonlight: ; 38a3a call AICheckEnemyQuarterHP jr nc, .asm_38a45 call AICheckEnemyHalfHP @@ -895,8 +897,8 @@ AIScoring_Moonlight: ; 38a3a ; 38a4e -AIScoring_Toxic: -AIScoring_LeechSeed: ; 38a4e +AI_Smart_Toxic: +AI_Smart_LeechSeed: ; 38a4e call AICheckPlayerHalfHP ret c inc [hl] @@ -904,8 +906,8 @@ AIScoring_LeechSeed: ; 38a4e ; 38a54 -AIScoring_LightScreen: -AIScoring_Reflect: ; 38a54 +AI_Smart_LightScreen: +AI_Smart_Reflect: ; 38a54 call AICheckEnemyMaxHP ret c call Random @@ -916,7 +918,7 @@ AIScoring_Reflect: ; 38a54 ; 38a60 -AIScoring_Ohko: ; 38a60 +AI_Smart_Ohko: ; 38a60 ld a, [BattleMonLevel] ld b, a ld a, [EnemyMonLevel] @@ -929,7 +931,7 @@ AIScoring_Ohko: ; 38a60 ; 38a71 -AIScoring_Bind: ; 38a71 +AI_Smart_Bind: ; 38a71 ld a, [$c730] and a jr nz, .asm_38a8b @@ -947,7 +949,7 @@ AIScoring_Bind: ; 38a71 jr z, .asm_38a91 .asm_38a8b - call Function39527 + call AI_50_50 ret c inc [hl] ret @@ -955,7 +957,7 @@ AIScoring_Bind: ; 38a71 .asm_38a91 call AICheckEnemyQuarterHP ret nc - call Function39527 + call AI_50_50 ret c dec [hl] dec [hl] @@ -963,8 +965,8 @@ AIScoring_Bind: ; 38a71 ; 38a9c -AIScoring_RazorWind: -AIScoring_Unused2B: ; 38a9c +AI_Smart_RazorWind: +AI_Smart_Unused2B: ; 38a9c ld a, [EnemySubStatus1] bit SUBSTATUS_PERISH, a jr z, .asm_38aaa @@ -1018,7 +1020,7 @@ AIScoring_Unused2B: ; 38a9c ; 38adb -AIScoring_Confuse: ; 38adb +AI_Smart_Confuse: ; 38adb call AICheckPlayerHalfHP ret c call Random @@ -1033,7 +1035,7 @@ AIScoring_Confuse: ; 38adb ; 38aed -AIScoring_SpDefenseUp2: ; 38aed +AI_Smart_SpDefenseUp2: ; 38aed call AICheckEnemyHalfHP jr nc, .asm_38b10 @@ -1051,7 +1053,7 @@ AIScoring_SpDefenseUp2: ; 38aed ret c .asm_38b09 - call Function39521 + call AI_80_20 ret c dec [hl] dec [hl] @@ -1063,7 +1065,7 @@ AIScoring_SpDefenseUp2: ; 38aed ; 38b12 -AIScoring_Fly: ; 38b12 +AI_Smart_Fly: ; 38b12 ld a, [PlayerSubStatus3] and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND ret z @@ -1076,7 +1078,7 @@ AIScoring_Fly: ; 38b12 ; 38b20 -AIScoring_SuperFang: ; 38b20 +AI_Smart_SuperFang: ; 38b20 call AICheckPlayerQuarterHP ret c inc [hl] @@ -1084,28 +1086,28 @@ AIScoring_SuperFang: ; 38b20 ; 38b26 -AIScoring_Paralyze: ; 38b26 +AI_Smart_Paralyze: ; 38b26 call AICheckPlayerQuarterHP jr nc, .asm_38b3a call AICompareSpeed ret c call AICheckEnemyQuarterHP ret nc - call Function39521 + call AI_80_20 ret c dec [hl] dec [hl] ret .asm_38b3a - call Function39527 + call AI_50_50 ret c inc [hl] ret ; 38b40 -AIScoring_SpeedDownHit: ; 38b40 +AI_Smart_SpeedDownHit: ; 38b40 ld a, [wEnemyMoveStruct + MOVE_ANIM] cp ICY_WIND ret nz @@ -1125,19 +1127,19 @@ AIScoring_SpeedDownHit: ; 38b40 ; 38b5c -AIScoring_Substitute: ; 38b5c +AI_Smart_Substitute: ; 38b5c call AICheckEnemyHalfHP ret c jp AIDiscourageMove ; 38b63 -AIScoring_HyperBeam: ; 38b63 +AI_Smart_HyperBeam: ; 38b63 call AICheckEnemyHalfHP jr c, .asm_38b72 call AICheckEnemyQuarterHP ret c - call Function39527 + call AI_50_50 ret c dec [hl] ret @@ -1147,19 +1149,19 @@ AIScoring_HyperBeam: ; 38b63 cp 40 ret c inc [hl] - call Function39527 + call AI_50_50 ret c inc [hl] ret ; 38b7f -AIScoring_Rage: ; 38b7f +AI_Smart_Rage: ; 38b7f ld a, [EnemySubStatus4] bit SUBSTATUS_RAGE, a jr z, .asm_38b9b - call Function39527 + call AI_50_50 jr c, .asm_38b8c dec [hl] @@ -1179,7 +1181,7 @@ AIScoring_Rage: ; 38b7f call AICheckEnemyHalfHP jr nc, .asm_38ba6 - call Function39521 + call AI_80_20 ret nc dec [hl] ret @@ -1190,7 +1192,7 @@ AIScoring_Rage: ; 38b7f ; 38ba8 -AIScoring_Mimic: ; 38ba8 +AI_Smart_Mimic: ; 38ba8 ld a, [LastEnemyCounterMove] and a jr z, .asm_38be9 @@ -1212,7 +1214,7 @@ AIScoring_Mimic: ; 38ba8 jr c, .asm_38bef jr z, .asm_38bd4 - call Function39527 + call AI_50_50 jr c, .asm_38bd4 dec [hl] @@ -1220,13 +1222,13 @@ AIScoring_Mimic: ; 38ba8 .asm_38bd4 ld a, [LastEnemyCounterMove] push hl - ld hl, Table_0x39301 + ld hl, GoodMoves ld de, 1 call IsInArray pop hl ret nc - call Function39527 + call AI_50_50 ret c dec [hl] ret @@ -1241,7 +1243,7 @@ AIScoring_Mimic: ; 38ba8 ; 38bf1 -AIScoring_Counter: ; 38bf1 +AI_Smart_Counter: ; 38bf1 push hl ld hl, PlayerUsedMoves ld c, 4 @@ -1307,7 +1309,7 @@ AIScoring_Counter: ; 38bf1 ; 38c3b -AIScoring_Encore: ; 38c3b +AI_Smart_Encore: ; 38c3b call AICompareSpeed jr nc, .asm_38c81 @@ -1393,7 +1395,7 @@ AIScoring_Encore: ; 38c3b ; 38ca4 -AIScoring_PainSplit: ; 38ca4 +AI_Smart_PainSplit: ; 38ca4 push hl ld hl, EnemyMonHP ld b, [hl] @@ -1413,8 +1415,8 @@ AIScoring_PainSplit: ; 38ca4 ; 38cba -AIScoring_Snore: -AIScoring_SleepTalk: ; 38cba +AI_Smart_Snore: +AI_Smart_SleepTalk: ; 38cba ld a, [EnemyMonStatus] and $7 cp $1 @@ -1433,7 +1435,7 @@ AIScoring_SleepTalk: ; 38cba ; 38ccb -AIScoring_DefrostOpponent: ; 38ccb +AI_Smart_DefrostOpponent: ; 38ccb ld a, [EnemyMonStatus] and $20 ret z @@ -1444,7 +1446,7 @@ AIScoring_DefrostOpponent: ; 38ccb ; 38cd5 -AIScoring_Spite: ; 38cd5 +AI_Smart_Spite: ; 38cd5 ld a, [LastEnemyCounterMove] and a jr nz, .asm_38ce7 @@ -1452,7 +1454,7 @@ AIScoring_Spite: ; 38cd5 call AICompareSpeed jp c, AIDiscourageMove - call Function39527 + call AI_50_50 ret c inc [hl] ret @@ -1507,9 +1509,9 @@ Function_0x38d16; 38d16 ; 38d19 -AIScoring_DestinyBond: -AIScoring_Reversal: -AIScoring_SkullBash: ; 38d19 +AI_Smart_DestinyBond: +AI_Smart_Reversal: +AI_Smart_SkullBash: ; 38d19 call AICheckEnemyQuarterHP ret nc inc [hl] @@ -1517,7 +1519,7 @@ AIScoring_SkullBash: ; 38d19 ; 38d1f -AIScoring_HealBell: ; 38d1f +AI_Smart_HealBell: ; 38d1f push hl ld a, [OTPartyCount] ld b, a @@ -1556,7 +1558,7 @@ AIScoring_HealBell: ; 38d1f .ok and 1 << FRZ | SLP ret z - call Function39527 + call AI_50_50 ret c dec [hl] dec [hl] @@ -1571,7 +1573,7 @@ AIScoring_HealBell: ; 38d1f ; 38d5a -AIScoring_PriorityHit: ; 38d5a +AI_Smart_PriorityHit: ; 38d5a call AICompareSpeed ret c @@ -1602,7 +1604,7 @@ AIScoring_PriorityHit: ; 38d5a ; 38d93 -AIScoring_Thief: ; 38d93 +AI_Smart_Thief: ; 38d93 ld a, [hl] add $1e ld [hl], a @@ -1610,7 +1612,7 @@ AIScoring_Thief: ; 38d93 ; 38d98 -AIScoring_Conversion2: ; 38d98 +AI_Smart_Conversion2: ; 38d98 ld a, [LastPlayerMove] and a jr nz, .asm_38dc9 @@ -1634,31 +1636,30 @@ AIScoring_Conversion2: ; 38d98 cp $a pop hl jr c, .asm_38dc9 - ret z - call Function39527 + call AI_50_50 ret c + dec [hl] ret .asm_38dc9 call Random - - cp $19 + cp 25 ret c inc [hl] ret ; 38dd1 -AIScoring_Disable: ; 38dd1 +AI_Smart_Disable: ; 38dd1 call AICompareSpeed jr nc, .asm_38df3 push hl ld a, [LastEnemyCounterMove] - ld hl, Table_0x39301 + ld hl, GoodMoves ld de, 1 call IsInArray @@ -1685,7 +1686,7 @@ AIScoring_Disable: ; 38dd1 ; 38dfb -AIScoring_MeanLook: ; 38dfb +AI_Smart_MeanLook: ; 38dfb call AICheckEnemyHalfHP jr nc, .asm_38e24 @@ -1714,7 +1715,7 @@ AIScoring_MeanLook: ; 38dfb ret .asm_38e26 - call Function39521 + call AI_80_20 ret c dec [hl] dec [hl] @@ -1750,15 +1751,15 @@ AICheckLastPlayerMon: ; 38e2e ; 38e4a -AIScoring_Nightmare: ; 38e4a - call Function39527 +AI_Smart_Nightmare: ; 38e4a + call AI_50_50 ret c dec [hl] ret ; 38e50 -AIScoring_FlameWheel: ; 38e50 +AI_Smart_FlameWheel: ; 38e50 ld a, [EnemyMonStatus] bit FRZ, a ret z @@ -1771,7 +1772,7 @@ AIScoring_FlameWheel: ; 38e50 ; 38e5c -AIScoring_Curse: ; 38e5c +AI_Smart_Curse: ; 38e5c ld a, [EnemyMonType1] cp GHOST jr z, .ghostcurse @@ -1796,7 +1797,7 @@ AIScoring_Curse: ; 38e5c ld a, [BattleMonType2] cp SPECIAL ret nc - call Function39521 + call AI_80_20 ret c dec [hl] dec [hl] @@ -1817,7 +1818,7 @@ AIScoring_Curse: ; 38e5c jp nz, AIDiscourageMove push hl - callba Function349f4 + callba CountEnemyAliveMons pop hl jr nc, .asm_38eb0 @@ -1851,16 +1852,16 @@ AIScoring_Curse: ; 38e5c ret nz .asm_38ecb - call Function39527 - + call AI_50_50 ret c + dec [hl] dec [hl] ret ; 38ed2 -AIScoring_Protect: ; 38ed2 +AI_Smart_Protect: ; 38ed2 ld a, [$c681] and a jr nz, .asm_38f13 @@ -1895,7 +1896,7 @@ AIScoring_Protect: ; 38ed2 jr c, .asm_38f14 .asm_38f0d - call Function39521 + call AI_80_20 ret c dec [hl] ret @@ -1913,7 +1914,7 @@ AIScoring_Protect: ; 38ed2 ; 38f1d -AIScoring_Foresight: ; 38f1d +AI_Smart_Foresight: ; 38f1d ld a, [EnemyAccLevel] cp $5 jr c, .asm_38f41 @@ -1944,11 +1945,11 @@ AIScoring_Foresight: ; 38f1d ; 38f4a -AIScoring_PerishSong: ; 38f4a +AI_Smart_PerishSong: ; 38f4a push hl - callab Function349f4 + callab CountEnemyAliveMons pop hl - jr c, .asm_38f75 + jr c, .no ld a, [PlayerSubStatus5] bit SUBSTATUS_CANT_RUN, a @@ -1961,20 +1962,20 @@ AIScoring_PerishSong: ; 38f4a pop hl ret c - call Function39527 + call AI_50_50 ret c inc [hl] ret .asm_38f6f - call Function39527 + call AI_50_50 ret c dec [hl] ret -.asm_38f75 +.no ld a, [hl] add 5 ld [hl], a @@ -1982,7 +1983,7 @@ AIScoring_PerishSong: ; 38f4a ; 38f7a -AIScoring_Sandstorm: ; 38f7a +AI_Smart_Sandstorm: ; 38f7a ld a, [BattleMonType1] push hl ld hl, .SandstormImmuneTypes @@ -2002,7 +2003,7 @@ AIScoring_Sandstorm: ; 38f7a call AICheckPlayerHalfHP jr nc, .asm_38fa6 - call Function39527 + call AI_50_50 ret c dec [hl] @@ -2023,7 +2024,7 @@ AIScoring_Sandstorm: ; 38f7a ; 38fac -AIScoring_Endure: ; 38fac +AI_Smart_Endure: ; 38fac ld a, [$c681] and a jr nz, .asm_38fd8 @@ -2035,10 +2036,10 @@ AIScoring_Endure: ; 38fac jr c, .asm_38fd9 ld b, EFFECT_REVERSAL - call AIHasMove + call AIHasMoveEffect jr nc, .asm_38fcb - call Function39521 + call AI_80_20 ret c dec [hl] @@ -2050,9 +2051,10 @@ AIScoring_Endure: ; 38fac ld a, [EnemySubStatus5] bit SUBSTATUS_LOCK_ON, a ret z - call Function39527 + call AI_50_50 ret c + dec [hl] dec [hl] ret @@ -2066,7 +2068,7 @@ AIScoring_Endure: ; 38fac ; 38fdb -AIScoring_FuryCutter: ; 38fdb +AI_Smart_FuryCutter: ; 38fdb ld a, [EnemyFuryCutterCount] and a jr z, .end @@ -2089,7 +2091,7 @@ AIScoring_FuryCutter: ; 38fdb ; 38fef -AIScoring_Rollout: ; 38fef +AI_Smart_Rollout: ; 38fef ld a, [EnemySubStatus1] bit SUBSTATUS_IN_LOVE, a jr nz, .asm_39020 @@ -2120,20 +2122,20 @@ AIScoring_Rollout: ; 38fef ret .asm_39020 - call Function39521 + call AI_80_20 ret c inc [hl] ret ; 39026 -AIScoring_Swagger: -AIScoring_Attract: ; 39026 +AI_Smart_Swagger: +AI_Smart_Attract: ; 39026 ld a, [PlayerTurnsTaken] and a jr z, .first_turn - call Function39521 + call AI_80_20 ret c inc [hl] ret @@ -2147,18 +2149,18 @@ AIScoring_Attract: ; 39026 ; 3903a -AIScoring_Safeguard: ; 3903a +AI_Smart_Safeguard: ; 3903a call AICheckPlayerHalfHP ret c - call Function39521 + call AI_80_20 ret c inc [hl] ret ; 39044 -AIScoring_Magnitude: -AIScoring_Earthquake: ; 39044 +AI_Smart_Magnitude: +AI_Smart_Earthquake: ; 39044 ld a, [LastEnemyCounterMove] cp DIG ret nz @@ -2178,14 +2180,14 @@ AIScoring_Earthquake: ; 39044 ; will use Dig this turn. call AICompareSpeed ret c - call Function39527 + call AI_50_50 ret c dec [hl] ret ; 39062 -AIScoring_BatonPass: ; 39062 +AI_Smart_BatonPass: ; 39062 push hl callab Function3484e ld a, [$c716] @@ -2197,16 +2199,16 @@ AIScoring_BatonPass: ; 39062 ; 39072 -AIScoring_Pursuit: ; 39072 +AI_Smart_Pursuit: ; 39072 call AICheckPlayerQuarterHP jr nc, .asm_3907d - call Function39521 + call AI_80_20 ret c inc [hl] ret .asm_3907d - call Function39527 + call AI_50_50 ret c dec [hl] dec [hl] @@ -2214,7 +2216,7 @@ AIScoring_Pursuit: ; 39072 ; 39084 -AIScoring_RapidSpin: ; 39084 +AI_Smart_RapidSpin: ; 39084 ld a, [$c731] and a jr nz, .asm_39097 @@ -2228,16 +2230,16 @@ AIScoring_RapidSpin: ; 39084 ret z .asm_39097 - call Function39521 - + call AI_80_20 ret c + dec [hl] dec [hl] ret ; 3909e -AIScoring_HiddenPower: ; 3909e +AI_Smart_HiddenPower: ; 3909e push hl ld a, 1 ld [hBattleTurn], a @@ -2246,32 +2248,32 @@ AIScoring_HiddenPower: ; 3909e pop hl ld a, [$d265] - cp $a - jr c, .asm_390c9 + cp 10 + jr c, .bad ld a, d cp 50 - jr c, .asm_390c9 + jr c, .bad ld a, [$d265] - cp $b - jr nc, .asm_390c7 + cp 11 + jr nc, .good ld a, d cp 70 ret c -.asm_390c7 +.good dec [hl] ret -.asm_390c9 +.bad inc [hl] ret ; 390cb -AIScoring_RainDance: ; 390cb +AI_Smart_RainDance: ; 390cb ld a, [BattleMonType1] cp WATER jr z, AIBadWeatherType @@ -2286,7 +2288,7 @@ AIScoring_RainDance: ; 390cb push hl ld hl, RainDanceMoves - jr AIScoring_WeatherMove + jr AI_Smart_WeatherMove ; 390e7 RainDanceMoves: ; 390e7 @@ -2305,7 +2307,7 @@ RainDanceMoves: ; 390e7 ; 390f3 -AIScoring_SunnyDay: ; 390f3 +AI_Smart_SunnyDay: ; 390f3 ld a, [BattleMonType1] cp FIRE jr z, AIBadWeatherType @@ -2325,7 +2327,7 @@ AIScoring_SunnyDay: ; 390f3 ; 3910d -AIScoring_WeatherMove: ; 3910d +AI_Smart_WeatherMove: ; 3910d call AIHasMoveInArray pop hl jr nc, AIBadWeatherType @@ -2333,7 +2335,7 @@ AIScoring_WeatherMove: ; 3910d call AICheckPlayerHalfHP jr nc, AIBadWeatherType - call Function39527 + call AI_50_50 ret c dec [hl] @@ -2379,7 +2381,7 @@ SunnyDayMoves: ; 39134 ; 3913d -AIScoring_BellyDrum: ; 3913d +AI_Smart_BellyDrum: ; 3913d ld a, [EnemyAtkLevel] cp $a jr nc, .asm_3914d @@ -2400,7 +2402,7 @@ AIScoring_BellyDrum: ; 3913d ; 39152 -AIScoring_PsychUp: ; 39152 +AI_Smart_PsychUp: ; 39152 push hl ld hl, EnemyAtkLevel ld b, $8 @@ -2437,8 +2439,7 @@ AIScoring_PsychUp: ; 39152 ld a, [EnemyEvaLevel] cp $8 ret nc - call Function39521 - + call AI_80_20 ret c dec [hl] ret @@ -2450,7 +2451,7 @@ AIScoring_PsychUp: ; 39152 ; 3918b -AIScoring_MirrorCoat: ; 3918b +AI_Smart_MirrorCoat: ; 3918b push hl ld hl, PlayerUsedMoves ld c, $4 @@ -2515,8 +2516,8 @@ AIScoring_MirrorCoat: ; 3918b ; 391d5 -AIScoring_Twister: -AIScoring_Gust: ; 391d5 +AI_Smart_Twister: +AI_Smart_Gust: ; 391d5 ld a, [LastEnemyCounterMove] cp FLY ret nz @@ -2535,14 +2536,14 @@ AIScoring_Gust: ; 391d5 .asm_391e9 call AICompareSpeed ret c - call Function39527 + call AI_50_50 ret c dec [hl] ret ; 391f3 -AIScoring_FutureSight: ; 391f3 +AI_Smart_FutureSight: ; 391f3 call AICompareSpeed ret nc @@ -2556,12 +2557,12 @@ AIScoring_FutureSight: ; 391f3 ; 39200 -AIScoring_Stomp: ; 39200 +AI_Smart_Stomp: ; 39200 ld a, [$c6fe] and a ret z - call Function39521 + call AI_80_20 ret c dec [hl] @@ -2569,7 +2570,7 @@ AIScoring_Stomp: ; 39200 ; 3920b -AIScoring_Solarbeam: ; 3920b +AI_Smart_Solarbeam: ; 3920b ld a, [Weather] cp WEATHER_SUN jr z, .asm_3921e @@ -2586,7 +2587,7 @@ AIScoring_Solarbeam: ; 3920b ret .asm_3921e - call Function39521 + call AI_80_20 ret c dec [hl] @@ -2595,7 +2596,7 @@ AIScoring_Solarbeam: ; 3920b ; 39225 -AIScoring_Thunder: ; 39225 +AI_Smart_Thunder: ; 39225 ld a, [Weather] cp WEATHER_SUN ret nz @@ -2759,7 +2760,7 @@ AICheckPlayerQuarterHP: ; 392b3 ; 392ca -AIHasMove: ; 392ca +AIHasMoveEffect: ; 392ca ; Return carry if the enemy has move b. push hl ld hl, EnemyMonMoves @@ -2768,23 +2769,23 @@ AIHasMove: ; 392ca .checkmove ld a, [hli] and a - jr z, .asm_392e0 + jr z, .no call AIGetEnemyMove ld a, [wEnemyMoveStruct + MOVE_EFFECT] cp b - jr z, .asm_392e3 + jr z, .yes dec c jr nz, .checkmove -.asm_392e0 +.no pop hl and a ret -.asm_392e3 +.yes pop hl scf ret @@ -2798,27 +2799,27 @@ AIHasMoveInArray: ; 392e6 push de push bc -.asm_392e9 +.next ld a, [hli] cp $ff - jr z, .asm_392fd + jr z, .done ld b, a ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 ld de, EnemyMonMoves -.asm_392f4 +.check dec c - jr z, .asm_392e9 + jr z, .next ld a, [de] inc de cp b - jr nz, .asm_392f4 + jr nz, .check scf -.asm_392fd +.done pop bc pop de pop hl @@ -2826,7 +2827,8 @@ AIHasMoveInArray: ; 392e6 ; 39301 -Table_0x39301: ; 39301 +GoodMoves: ; 39301 +; Moves that are usable all-around. db DOUBLE_EDGE db SING db FLAMETHROWER @@ -2850,7 +2852,7 @@ Table_0x39301: ; 39301 ; 39315 -AIScoring_Opportunist: ; 39315 +AI_Opportunist: ; 39315 ; Don't use stall moves when the player's HP is low. call AICheckEnemyHalfHP @@ -2859,7 +2861,7 @@ AIScoring_Opportunist: ; 39315 call AICheckEnemyQuarterHP jr nc, .asm_39322 - call Function39527 + call AI_50_50 ret c .asm_39322 @@ -2932,7 +2934,7 @@ AIScoring_Opportunist: ; 39315 -AIScoring_Aggressive: ; 39369 +AI_Aggressive: ; 39369 ; Use whatever does the most damage. ; Figure out which attack does the most damage and put it in c. @@ -3061,7 +3063,7 @@ AIDamageCalc: ; 393e7 ; 39418 -AIScoring_Cautious: ; 39418 +AI_Cautious: ; 39418 ; Don't use moves with residual effects after turn 1. ld a, [EnemyTurnsTaken] @@ -3118,7 +3120,7 @@ AIScoring_Cautious: ; 39418 -AIScoring_StatusImmunity: ; 39453 +AI_Status: ; 39453 ; Don't use status moves that don't affect the player. ld hl, Buffer1 - 1 @@ -3182,7 +3184,7 @@ AIScoring_StatusImmunity: ; 39453 -AIScoring_Risky: ; 394a9 +AI_Risky: ; 394a9 ; Use any move that will KO the opponent. ld hl, Buffer1 - 1 @@ -3256,7 +3258,7 @@ AIScoring_Risky: ; 394a9 -AIScoring_None: ; 39502 +AI_None: ; 39502 ret ; 39503 @@ -3289,14 +3291,14 @@ AIGetEnemyMove: ; 39508 ; 39521 -Function39521: ; 39521 +AI_80_20: ; 39521 call Random cp 50 ; 1/5 ret ; 39527 -Function39527: ; 39527 +AI_50_50: ; 39527 call Random cp $80 ; 1/2 ret diff --git a/battle/core.asm b/battle/core.asm index e550d4480..03eb40b85 100644 --- a/battle/core.asm +++ b/battle/core.asm @@ -480,7 +480,7 @@ Function3c314: ; 3c314 jp .asm_3c3f1 .asm_3c34c - callab Function3846c + callab AI_Switch call SetEnemyTurn call SpikesDamage jp Function3c3f3 @@ -5454,7 +5454,7 @@ Function3e3ad: ; 3e3ad ; 3e3ff Function3e3ff: ; 3e3ff - callab Function3846c + callab AI_Switch call SetEnemyTurn jp SpikesDamage ; 3e40b diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 39b36c0af..21d005bc6 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -1041,6 +1041,7 @@ BattleCommand04: ; 34555 ld bc, EnemyTurnsTaken .asm_34570 + ; If we've gotten this far, this counts as a turn. ld a, [bc] inc a @@ -1052,7 +1053,7 @@ BattleCommand04: ; 34555 ret z ld a, [de] - and %111 ; rollout | bide | ??? + and 1 << SUBSTATUS_IN_LOOP | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_BIDE ret nz call .asm_345ad @@ -1060,7 +1061,7 @@ BattleCommand04: ; 34555 and a jp nz, EndMoveEffect -; SubStatus5 + ; SubStatus5 inc de inc de @@ -1542,28 +1543,28 @@ Function347d3: ; 347d3 .asm_347e7 ld a, [hli] cp $ff - jr z, .asm_3482f ; 0x347ea $43 + jr z, .asm_3482f cp $fe - jr nz, .asm_347fb ; 0x347ee $b + jr nz, .asm_347fb ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVar bit SUBSTATUS_IDENTIFIED, a - jr nz, .asm_3482f ; 0x347f7 $36 - jr .asm_347e7 ; 0x347f9 $ec + jr nz, .asm_3482f + jr .asm_347e7 .asm_347fb cp d - jr nz, .asm_34807 ; 0x347fc $9 + jr nz, .asm_34807 ld a, [hli] cp b - jr z, .asm_3480b ; 0x34800 $9 + jr z, .asm_3480b cp c - jr z, .asm_3480b ; 0x34803 $6 - jr .asm_34808 ; 0x34805 $1 + jr z, .asm_3480b + jr .asm_34808 .asm_34807 inc hl .asm_34808 inc hl - jr .asm_347e7 ; 0x34809 $dc + jr .asm_347e7 .asm_3480b xor a ld [$ffb3], a @@ -1572,17 +1573,18 @@ Function347d3: ; 347d3 ld a, [hli] ld [$ffb6], a ld a, [$d265] - ld [$ffb7], a + ld [hMultiplier], a call Multiply - ld a, $a - ld [$ffb7], a + ld a, 10 + ld [hDivisor], a push bc - ld b, $4 + ld b, 4 call Divide pop bc ld a, [$ffb6] ld [$d265], a - jr .asm_347e7 ; 0x3482d $b8 + jr .asm_347e7 + .asm_3482f pop bc pop de @@ -1613,7 +1615,7 @@ Function3484e: ; 3484e push hl push de push bc - ld a, $a + ld a, 10 ld [$c716], a ld hl, PlayerUsedMoves ld a, [hl] @@ -1795,24 +1797,26 @@ Function34939: ; 34939 Function34941: ; 34941 xor a ld [$c717], a - call Function349f4 + call CountEnemyAliveMons ret c ld a, [EnemySubStatus1] bit SUBSTATUS_PERISH, a - jr z, .asm_34986 + jr z, .no_perish ld a, [EnemyPerishCount] cp 1 - jr nz, .asm_34986 + jr nz, .no_perish - call Function349f4 + ; Perish count is 1 + + call CountEnemyAliveMons call Function34b77 call Function34b20 call Function34a85 ld a, e - cp $2 + cp 2 jr nz, .asm_34971 ld a, [$c716] @@ -1821,7 +1825,7 @@ Function34941: ; 34941 ret .asm_34971 - call Function349f4 + call CountEnemyAliveMons sla c sla c ld b, $ff @@ -1836,10 +1840,11 @@ Function34941: ; 34941 ld [$c717], a ret -.asm_34986 +.no_perish + call Function3484e ld a, [$c716] - cp $b + cp 11 ret nc ld a, [LastEnemyCounterMove] @@ -1859,12 +1864,12 @@ Function34941: ; 34941 ld b, a ld a, e - cp $2 + cp 2 jr z, .asm_349be call Function3484e ld a, [$c716] - cp $a + cp 10 ret nc ld a, b @@ -1876,7 +1881,7 @@ Function34941: ; 34941 ld c, $10 call Function3484e ld a, [$c716] - cp $a + cp 10 jr nc, .asm_349cc ld c, $20 @@ -1889,10 +1894,10 @@ Function34941: ; 34941 .asm_349d2 call Function3484e ld a, [$c716] - cp $a + cp 10 ret nc - call Function349f4 + call CountEnemyAliveMons call Function34b77 call Function34b20 call Function34a85 @@ -1908,7 +1913,7 @@ Function34941: ; 34941 ; 349f4 -Function349f4: ; 349f4 +CountEnemyAliveMons: ; 349f4 ld a, [OTPartyCount] cp 2 jr c, .only_one @@ -1964,7 +1969,7 @@ Function34a2a: ; 34a2a ld hl, OTPartyMon1 ld a, [OTPartyCount] ld b, a - ld c, $20 + ld c, 1 << (PARTY_LENGTH - 1) ld d, 0 xor a ld [$c716], a @@ -2027,8 +2032,8 @@ Function34a85: ; 34a85 ld a, [OTPartyCount] ld e, a ld hl, OTPartyMon1HP - ld b, $20 - ld c, $0 + ld b, 1 << (PARTY_LENGTH - 1) + ld c, 0 .asm_34a91 ld a, [hli] or [hl] @@ -2061,9 +2066,9 @@ Function34aa7: ; 34aa7 ld a, $ff ld [$c716], a ld hl, OTPartyMon1Moves - ld b, $20 - ld d, $0 - ld e, $0 + ld b, 1 << (PARTY_LENGTH - 1) + ld d, 0 + ld e, 0 .asm_34ab5 ld a, b and c @@ -2072,7 +2077,7 @@ Function34aa7: ; 34aa7 push hl push bc ld b, NUM_MOVES - ld c, $0 + ld c, 0 .asm_34abf ld a, [hli] and a @@ -2090,14 +2095,14 @@ Function34aa7: ; 34aa7 ld hl, BattleMonType1 call Function347d3 ld a, [$d265] - cp $a + cp 10 jr c, .asm_34ae9 - ld e, $1 - cp $b + ld e, 1 + cp 11 jr c, .asm_34ae9 - ld e, $2 + ld e, 2 jr .asm_34aef .asm_34ae9 @@ -2157,8 +2162,8 @@ Function34aa7: ; 34aa7 Function34b20: ; 34b20 push bc ld hl, OTPartySpecies - ld b, $20 - ld c, $0 + ld b, 1 << (PARTY_LENGTH - 1) + ld c, 0 .asm_34b28 ld a, [hli] @@ -2350,7 +2355,7 @@ BattleCommand09: ; 34d32 call .ThunderRain ret z - call .UnleashedEnergy + call .XAccuracy ret nz ; Perfect-accuracy moves @@ -2545,11 +2550,10 @@ BattleCommand09: ; 34d32 ret -.UnleashedEnergy -; Return nz if unleashing energy from Bide. +.XAccuracy ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVar - bit SUBSTATUS_UNLEASH, a + bit SUBSTATUS_X_ACCURACY, a ret @@ -6915,8 +6919,9 @@ BattleCommand21: ; 36671 ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVar - bit 0, a + bit SUBSTATUS_BIDE, a ret z + ld hl, PlayerRolloutCount ld a, [hBattleTurn] and a @@ -6925,9 +6930,10 @@ BattleCommand21: ; 36671 .asm_36684 dec [hl] jr nz, .asm_366dc + ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr - res 0, [hl] + res SUBSTATUS_BIDE, [hl] ld hl, UnleashedEnergyText call StdBattleTextBox @@ -6988,13 +6994,13 @@ BattleCommand22: ; 366e5 ld bc, PlayerRolloutCount ld a, [hBattleTurn] and a - jr z, .asm_366f6 ; 366ee $6 + jr z, .asm_366f6 ld de, $c684 ld bc, EnemyRolloutCount .asm_366f6 ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr - set 0, [hl] + set SUBSTATUS_BIDE, [hl] xor a ld [de], a inc de @@ -7002,11 +7008,11 @@ BattleCommand22: ; 366e5 ld [wPlayerMoveStruct + MOVE_EFFECT], a ld [wEnemyMoveStruct + MOVE_EFFECT], a call BattleRandom - and $1 + and 1 inc a inc a ld [bc], a - ld a, $1 + ld a, 1 ld [$c689], a call AnimateCurrentMove jp EndMoveEffect @@ -7219,7 +7225,7 @@ BattleCommand23: ; 3680f ld a, [wPlayerMoveStruct + MOVE_ANIM] jp .asm_36975 .asm_36869 - call Function349f4 + call CountEnemyAliveMons jr c, .asm_368ca ; 3686c $5c ld a, [$c70f] and a diff --git a/constants/battle_constants.asm b/constants/battle_constants.asm index f5dbe0b42..7615fbbce 100644 --- a/constants/battle_constants.asm +++ b/constants/battle_constants.asm @@ -109,15 +109,18 @@ SUBSTATUS_LEECH_SEED EQU 7 SUBSTATUS_RAGE EQU 6 SUBSTATUS_RECHARGE EQU 5 SUBSTATUS_SUBSTITUTE EQU 4 +; EQU 3 SUBSTATUS_FOCUS_ENERGY EQU 2 SUBSTATUS_MIST EQU 1 -SUBSTATUS_UNLEASH EQU 0 +SUBSTATUS_X_ACCURACY EQU 0 SUBSTATUS_CANT_RUN EQU 7 SUBSTATUS_DESTINY_BOND EQU 6 SUBSTATUS_LOCK_ON EQU 5 SUBSTATUS_ENCORED EQU 4 SUBSTATUS_TRANSFORMED EQU 3 +; EQU 2 +; EQU 1 SUBSTATUS_TOXIC EQU 0 ; environmental diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index 5b291f6e8..5ad9826f4 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -73,3 +73,18 @@ STEP_TURN EQU 5 STEP_BACK_LEDGE EQU 6 STEP_WALK_IN_PLACE EQU 7 + +; ai +CONTEXT_USE_F EQU 6 +UNKNOWN_USE_F EQU 5 +ALWAYS_USE_F EQU 4 +SWITCH_SOMETIMES_F EQU 2 +SWITCH_RARELY_F EQU 1 +SWITCH_OFTEN_F EQU 0 + +CONTEXT_USE EQU 1 << CONTEXT_USE_F +UNKNOWN_USE EQU 1 << UNKNOWN_USE_F +ALWAYS_USE EQU 1 << ALWAYS_USE_F +SWITCH_SOMETIMES EQU 1 << SWITCH_SOMETIMES_F +SWITCH_RARELY EQU 1 << SWITCH_RARELY_F +SWITCH_OFTEN EQU 1 << SWITCH_OFTEN_F diff --git a/main.asm b/main.asm index ec1305748..e1a923115 100644 --- a/main.asm +++ b/main.asm @@ -41681,202 +41681,204 @@ TrainerClassNames:: ; 2c1ef -Function2c41a: ; 2c41a (b:441a) -; More move AI. +AI_Redundant: ; 2c41a +; Check if move effect c will fail because it's already been used. ld a, c ld de, 3 - ld hl, Unknown_2c42c + ld hl, .Moves call IsInArray - jp nc, Function2c545 + jp nc, .NotRedundant inc hl ld a, [hli] ld h, [hl] ld l, a jp [hl] -; 2c42c (b:442c) -Unknown_2c42c: ; 2c42c - dbw EFFECT_DREAM_EATER, Function2c524 - dbw EFFECT_HEAL, Function2c539 - dbw EFFECT_LIGHT_SCREEN, Function2c487 - dbw EFFECT_MIST, Function2c48d - dbw EFFECT_FOCUS_ENERGY, Function2c493 - dbw EFFECT_CONFUSE, Function2c499 - dbw EFFECT_TRANSFORM, Function2c4a5 - dbw EFFECT_REFLECT, Function2c4ab - dbw EFFECT_SUBSTITUTE, Function2c4b1 - dbw EFFECT_LEECH_SEED, Function2c4b7 - dbw EFFECT_DISABLE, Function2c4bd - dbw EFFECT_ENCORE, Function2c4c2 - dbw EFFECT_SNORE, Function2c4c8 - dbw EFFECT_SLEEP_TALK, Function2c4c8 - dbw EFFECT_MEAN_LOOK, Function2c4d1 - dbw EFFECT_NIGHTMARE, Function2c4d7 - dbw EFFECT_SPIKES, Function2c4e3 - dbw EFFECT_FORESIGHT, Function2c4e9 - dbw EFFECT_PERISH_SONG, Function2c4ef - dbw EFFECT_SANDSTORM, Function2c4f5 - dbw EFFECT_ATTRACT, Function2c4fe - dbw EFFECT_SAFEGUARD, Function2c50c - dbw EFFECT_RAIN_DANCE, Function2c512 - dbw EFFECT_SUNNY_DAY, Function2c51b - dbw EFFECT_TELEPORT, Function2c541 - dbw EFFECT_MORNING_SUN, Function2c539 - dbw EFFECT_SYNTHESIS, Function2c539 - dbw EFFECT_MOONLIGHT, Function2c539 - dbw EFFECT_SWAGGER, Function2c52d - dbw EFFECT_FUTURE_SIGHT, Function2c533 - db $ff -; 2c487 +.Moves: ; 2c42c + dbw EFFECT_DREAM_EATER, .DreamEater + dbw EFFECT_HEAL, .Heal + dbw EFFECT_LIGHT_SCREEN, .LightScreen + dbw EFFECT_MIST, .Mist + dbw EFFECT_FOCUS_ENERGY, .FocusEnergy + dbw EFFECT_CONFUSE, .Confuse + dbw EFFECT_TRANSFORM, .Transform + dbw EFFECT_REFLECT, .Reflect + dbw EFFECT_SUBSTITUTE, .Substitute + dbw EFFECT_LEECH_SEED, .LeechSeed + dbw EFFECT_DISABLE, .Disable + dbw EFFECT_ENCORE, .Encore + dbw EFFECT_SNORE, .Snore + dbw EFFECT_SLEEP_TALK, .SleepTalk + dbw EFFECT_MEAN_LOOK, .MeanLook + dbw EFFECT_NIGHTMARE, .Nightmare + dbw EFFECT_SPIKES, .Spikes + dbw EFFECT_FORESIGHT, .Foresight + dbw EFFECT_PERISH_SONG, .PerishSong + dbw EFFECT_SANDSTORM, .Sandstorm + dbw EFFECT_ATTRACT, .Attract + dbw EFFECT_SAFEGUARD, .Safeguard + dbw EFFECT_RAIN_DANCE, .RainDance + dbw EFFECT_SUNNY_DAY, .SunnyDay + dbw EFFECT_TELEPORT, .Teleport + dbw EFFECT_MORNING_SUN, .MorningSun + dbw EFFECT_SYNTHESIS, .Synthesis + dbw EFFECT_MOONLIGHT, .Moonlight + dbw EFFECT_SWAGGER, .Swagger + dbw EFFECT_FUTURE_SIGHT, .FutureSight + db -1 -Function2c487: ; 2c487 - ld a, [EnemyScreens] ; $c700 - bit 3, a +.LightScreen: ; 2c487 + ld a, [EnemyScreens] + bit SCREENS_LIGHT_SCREEN, a ret -Function2c48d: ; 2c48d - ld a, [EnemySubStatus4] ; $c670 - bit 1, a - ret - -Function2c493: ; 2c493 - ld a, [EnemySubStatus4] ; $c670 - bit 2, a - ret - -Function2c499: ; 2c499 - ld a, [PlayerSubStatus3] ; $c66a - bit 7, a - ret nz - ld a, [PlayerScreens] ; $c6ff - bit 2, a - ret - -Function2c4a5: ; 2c4a5 - ld a, [EnemySubStatus5] ; $c671 - bit 3, a - ret - -Function2c4ab: ; 2c4ab - ld a, [EnemyScreens] ; $c700 - bit 4, a - ret -; 2c4b1 (b:44b1) - -Function2c4b1: ; 2c4b1 +.Mist: ; 2c48d ld a, [EnemySubStatus4] - bit 4, a + bit SUBSTATUS_MIST, a ret -Function2c4b7: ; 2c4b7 - ld a, [PlayerSubStatus4] ; $c66b - bit 7, a +.FocusEnergy: ; 2c493 + ld a, [EnemySubStatus4] + bit SUBSTATUS_FOCUS_ENERGY, a ret -Function2c4bd: ; 2c4bd - ld a, [PlayerDisableCount] ; $c675 +.Confuse: ; 2c499 + ld a, [PlayerSubStatus3] + bit SUBSTATUS_CONFUSED, a + ret nz + ld a, [PlayerScreens] + bit SCREENS_SAFEGUARD, a + ret + +.Transform: ; 2c4a5 + ld a, [EnemySubStatus5] + bit SUBSTATUS_TRANSFORMED, a + ret + +.Reflect: ; 2c4ab + ld a, [EnemyScreens] + bit SCREENS_REFLECT, a + ret + +.Substitute: ; 2c4b1 + ld a, [EnemySubStatus4] + bit SUBSTATUS_SUBSTITUTE, a + ret + +.LeechSeed: ; 2c4b7 + ld a, [PlayerSubStatus4] + bit SUBSTATUS_LEECH_SEED, a + ret + +.Disable: ; 2c4bd + ld a, [PlayerDisableCount] and a ret -Function2c4c2: ; 2c4c2 - ld a, [PlayerSubStatus5] ; $c66c - bit 4, a +.Encore: ; 2c4c2 + ld a, [PlayerSubStatus5] + bit SUBSTATUS_ENCORED, a ret -Function2c4c8: ; 2c4c8 - ld a, [EnemyMonStatus] ; $d214 - and $7 - jr z, Function2c541 - jr Function2c545 +.Snore: +.SleepTalk: ; 2c4c8 + ld a, [EnemyMonStatus] + and SLP + jr z, .Redundant + jr .NotRedundant -Function2c4d1: ; 2c4d1 - ld a, [EnemySubStatus5] ; $c671 - bit 7, a +.MeanLook: ; 2c4d1 + ld a, [EnemySubStatus5] + bit SUBSTATUS_CANT_RUN, a ret -; 2c4d7 (b:44d7) -Function2c4d7: ; 2c4d7 +.Nightmare: ; 2c4d7 ld a, [BattleMonStatus] and a - jr z, Function2c541 + jr z, .Redundant ld a, [PlayerSubStatus1] - bit 0, a + bit SUBSTATUS_NIGHTMARE, a ret -Function2c4e3: ; 2c4e3 - ld a, [PlayerScreens] ; $c6ff - bit 0, a +.Spikes: ; 2c4e3 + ld a, [PlayerScreens] + bit SCREENS_SPIKES, a ret -Function2c4e9: ; 2c4e9 - ld a, [PlayerSubStatus1] ; $c668 - bit 3, a +.Foresight: ; 2c4e9 + ld a, [PlayerSubStatus1] + bit SUBSTATUS_IDENTIFIED, a ret -Function2c4ef: ; 2c4ef - ld a, [PlayerSubStatus1] ; $c668 - bit 4, a +.PerishSong: ; 2c4ef + ld a, [PlayerSubStatus1] + bit SUBSTATUS_PERISH, a ret -Function2c4f5: ; 2c4f5 - ld a, [Weather] ; $c70a - cp $3 - jr z, Function2c541 - jr Function2c545 +.Sandstorm: ; 2c4f5 + ld a, [Weather] + cp WEATHER_SANDSTORM + jr z, .Redundant + jr .NotRedundant -Function2c4fe: ; 2c4fe +.Attract: ; 2c4fe callba Function377f5 - jr c, Function2c541 - ld a, [PlayerSubStatus1] ; $c668 - bit 7, a + jr c, .Redundant + ld a, [PlayerSubStatus1] + bit SUBSTATUS_IN_LOVE, a ret -Function2c50c: ; 2c50c - ld a, [EnemyScreens] ; $c700 - bit 2, a +.Safeguard: ; 2c50c + ld a, [EnemyScreens] + bit SCREENS_SAFEGUARD, a ret -Function2c512: ; 2c512 - ld a, [Weather] ; $c70a - cp $1 - jr z, Function2c541 - jr Function2c545 +.RainDance: ; 2c512 + ld a, [Weather] + cp WEATHER_RAIN + jr z, .Redundant + jr .NotRedundant -Function2c51b: ; 2c51b - ld a, [Weather] ; $c70a - cp $2 - jr z, Function2c541 - jr Function2c545 +.SunnyDay: ; 2c51b + ld a, [Weather] + cp WEATHER_SUN + jr z, .Redundant + jr .NotRedundant -Function2c524: ; 2c524 - ld a, [BattleMonStatus] ; $c63a - and $7 - jr z, Function2c541 - jr Function2c545 +.DreamEater: ; 2c524 + ld a, [BattleMonStatus] + and SLP + jr z, .Redundant + jr .NotRedundant -Function2c52d: ; 2c52d - ld a, [PlayerSubStatus3] ; $c66a - bit 7, a +.Swagger: ; 2c52d + ld a, [PlayerSubStatus3] + bit SUBSTATUS_CONFUSED, a ret -Function2c533: ; 2c533 - ld a, [EnemyScreens] ; $c700 +.FutureSight: ; 2c533 + ld a, [EnemyScreens] bit 5, a ret -Function2c539: ; 2c539 +.Heal: +.MorningSun: +.Synthesis: +.Moonlight: ; 2c539 callba AICheckEnemyMaxHP - jr nc, Function2c545 + jr nc, .NotRedundant -Function2c541: ; 2c541 - ld a, $1 +.Teleport: +.Redundant: ; 2c541 + ld a, 1 and a ret -Function2c545: ; 2c545 (b:4545) +.NotRedundant: ; 2c545 xor a ret + Function2c547: ; 2c547 ld hl, UnknownText_0x2c5ef call PrintText @@ -47151,7 +47153,7 @@ AIChooseMove: ; 440ce jr z, .asm_4415e push bc - ld d, $e ; BANK(TrainerAI) + ld d, BANK(TrainerClassAttributes) predef FlagPredef ld d, c pop bc @@ -47182,6 +47184,7 @@ AIChooseMove: ; 440ce ld de, EnemyMonMoves ld c, EnemyMonMovesEnd - EnemyMonMoves .asm_44166 + ; If the enemy has no moves, this will infinite. ld a, [de] inc de and a @@ -47247,22 +47250,22 @@ AIChooseMove: ; 440ce AIScoringPointers: ; 441af - dw AIScoring_RedStatus - dw AIScoring_RedStatMods - dw AIScoring_RedSuperEffective - dw AIScoring_Offensive - dw AIScoring_Smart - dw AIScoring_Opportunist - dw AIScoring_Aggressive - dw AIScoring_Cautious - dw AIScoring_StatusImmunity - dw AIScoring_Risky - dw AIScoring_None - dw AIScoring_None - dw AIScoring_None - dw AIScoring_None - dw AIScoring_None - dw AIScoring_None + dw AI_Basic + dw AI_Setup + dw AI_Types + dw AI_Offensive + dw AI_Smart + dw AI_Opportunist + dw AI_Aggressive + dw AI_Cautious + dw AI_Status + dw AI_Risky + dw AI_None + dw AI_None + dw AI_None + dw AI_None + dw AI_None + dw AI_None ; 441cf diff --git a/trainers/attributes.asm b/trainers/attributes.asm index 15fd48591..c6d4037da 100644 --- a/trainers/attributes.asm +++ b/trainers/attributes.asm @@ -1,20 +1,20 @@ - -AI_STATUS_RED EQU 1 << 0 -AI_STAT_MODS_RED EQU 1 << 1 -AI_TYPES_RED EQU 1 << 2 -AI_OFFENSIVE EQU 1 << 3 -AI_SMART EQU 1 << 4 -AI_OPPORTUNIST EQU 1 << 5 -AI_AGGRESSIVE EQU 1 << 6 -AI_CAUTIOUS EQU 1 << 7 -AI_STATUS_IMMUNE EQU 1 << 8 -AI_RISKY EQU 1 << 9 -AI_10 EQU 1 << 10 -AI_11 EQU 1 << 11 -AI_12 EQU 1 << 12 -AI_13 EQU 1 << 13 -AI_14 EQU 1 << 14 -AI_15 EQU 1 << 15 +NO_AI EQU 0 +AI_BASIC EQU 1 << 0 +AI_SETUP EQU 1 << 1 +AI_TYPES EQU 1 << 2 +AI_OFFENSIVE EQU 1 << 3 +AI_SMART EQU 1 << 4 +AI_OPPORTUNIST EQU 1 << 5 +AI_AGGRESSIVE EQU 1 << 6 +AI_CAUTIOUS EQU 1 << 7 +AI_STATUS EQU 1 << 8 +AI_RISKY EQU 1 << 9 +AI_10 EQU 1 << 10 +AI_11 EQU 1 << 11 +AI_12 EQU 1 << 12 +AI_13 EQU 1 << 13 +AI_14 EQU 1 << 14 +AI_15 EQU 1 << 15 TrainerClassAttributes: ; 3959c @@ -22,404 +22,404 @@ TrainerClassAttributes: ; 3959c ; Falkner db NONE, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Whitney db NONE, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Bugsy db NONE, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Morty db NONE, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Pryce db HYPER_POTION, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Jasmine db HYPER_POTION, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Chuck db FULL_HEAL, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Clair db FULL_HEAL, HYPER_POTION ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Rival1 db NONE, NONE ; items db 15 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Pokemon Prof db NONE, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_AGGRESSIVE | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_AGGRESSIVE + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Will db MAX_POTION, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Cal db NONE, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Bruno db MAX_POTION, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Karen db FULL_HEAL, MAX_POTION ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Koga db FULL_HEAL, FULL_RESTORE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Champion db FULL_HEAL, FULL_RESTORE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Brock db HYPER_POTION, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Misty db FULL_HEAL, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Lt Surge db HYPER_POTION, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Scientist db NONE, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_TYPES_RED | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_TYPES + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Erika db HYPER_POTION, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Youngster db NONE, NONE ; items db 4 ; base reward - dw AI_STATUS_RED | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Schoolboy db NONE, NONE ; items db 8 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_TYPES_RED | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS_IMMUNE - db $41, $00 + dw AI_BASIC + AI_SETUP + AI_TYPES + AI_OPPORTUNIST + AI_CAUTIOUS + AI_STATUS + dw CONTEXT_USE + SWITCH_OFTEN ; Bird Keeper db NONE, NONE ; items db 6 ; base reward - dw AI_STATUS_RED | AI_TYPES_RED | AI_OFFENSIVE | AI_OPPORTUNIST | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_TYPES + AI_OFFENSIVE + AI_OPPORTUNIST + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Lass db NONE, NONE ; items db 6 ; base reward - dw AI_STATUS_RED | AI_CAUTIOUS | AI_STATUS_IMMUNE - db $41, $00 + dw AI_BASIC + AI_CAUTIOUS + AI_STATUS + dw CONTEXT_USE + SWITCH_OFTEN ; Janine db DIRE_HIT, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Cooltrainerm db NONE, NONE ; items db 12 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Cooltrainerf db NONE, NONE ; items db 12 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Beauty db NONE, NONE ; items db 22 ; base reward - dw AI_STATUS_RED | AI_TYPES_RED | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_TYPES + AI_OPPORTUNIST + AI_CAUTIOUS + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Pokemaniac db NONE, NONE ; items db 15 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_OFFENSIVE | AI_AGGRESSIVE | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_OFFENSIVE + AI_AGGRESSIVE + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Gruntm db NONE, NONE ; items db 10 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_TYPES_RED | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_TYPES + AI_OPPORTUNIST + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Gentleman db NONE, NONE ; items db 18 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_AGGRESSIVE | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_AGGRESSIVE + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Skier db NONE, NONE ; items db 18 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_TYPES_RED | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_TYPES + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Teacher db NONE, NONE ; items db 18 ; base reward - dw AI_STATUS_RED | AI_OPPORTUNIST | AI_AGGRESSIVE | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_OPPORTUNIST + AI_AGGRESSIVE + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Sabrina db HYPER_POTION, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Bug Catcher db NONE, NONE ; items db 4 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Fisher db NONE, NONE ; items db 10 ; base reward - dw AI_STATUS_RED | AI_TYPES_RED | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS_IMMUNE - db $41, $00 + dw AI_BASIC + AI_TYPES + AI_OPPORTUNIST + AI_CAUTIOUS + AI_STATUS + dw CONTEXT_USE + SWITCH_OFTEN ; Swimmerm db NONE, NONE ; items db 2 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_TYPES_RED | AI_OFFENSIVE | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_TYPES + AI_OFFENSIVE + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Swimmerf db NONE, NONE ; items db 5 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_TYPES_RED | AI_CAUTIOUS | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_TYPES + AI_CAUTIOUS + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Sailor db NONE, NONE ; items db 10 ; base reward - dw AI_STATUS_RED | AI_OFFENSIVE | AI_OPPORTUNIST | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_OFFENSIVE + AI_OPPORTUNIST + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Super Nerd db NONE, NONE ; items db 8 ; base reward - dw AI_STATUS_RED | AI_TYPES_RED | AI_SMART | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_TYPES + AI_SMART + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Rival2 db NONE, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Guitarist db NONE, NONE ; items db 8 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_TYPES_RED | AI_CAUTIOUS | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_TYPES + AI_CAUTIOUS + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Hiker db NONE, NONE ; items db 8 ; base reward - dw AI_STATUS_RED | AI_OFFENSIVE | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_OFFENSIVE + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Biker db NONE, NONE ; items db 8 ; base reward - dw AI_STATUS_RED | AI_TYPES_RED | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_TYPES + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Blaine db MAX_POTION, FULL_HEAL ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Burglar db NONE, NONE ; items db 22 ; base reward - dw AI_STATUS_RED | AI_OFFENSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_OFFENSIVE + AI_CAUTIOUS + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Firebreather db NONE, NONE ; items db 12 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_OFFENSIVE | AI_OPPORTUNIST | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_OFFENSIVE + AI_OPPORTUNIST + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Juggler db NONE, NONE ; items db 10 ; base reward - dw AI_STATUS_RED | AI_TYPES_RED | AI_SMART | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_TYPES + AI_SMART + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Blackbelt T db NONE, NONE ; items db 6 ; base reward - dw AI_STATUS_RED | AI_OFFENSIVE | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_OFFENSIVE + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Executivem db NONE, NONE ; items db 18 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_TYPES_RED | AI_SMART | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_TYPES + AI_SMART + AI_OPPORTUNIST + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Psychic T db NONE, NONE ; items db 8 ; base reward - dw AI_STATUS_RED | AI_TYPES_RED | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_TYPES + AI_OPPORTUNIST + AI_CAUTIOUS + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Picnicker db NONE, NONE ; items db 5 ; base reward - dw AI_STATUS_RED | AI_CAUTIOUS | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_CAUTIOUS + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Camper db NONE, NONE ; items db 5 ; base reward - dw AI_STATUS_RED | AI_CAUTIOUS | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_CAUTIOUS + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Executivef db NONE, NONE ; items db 18 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_TYPES_RED | AI_SMART | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_TYPES + AI_SMART + AI_OPPORTUNIST + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Sage db NONE, NONE ; items db 8 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_TYPES_RED | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_TYPES + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Medium db NONE, NONE ; items db 10 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_TYPES_RED | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_TYPES + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Boarder db NONE, NONE ; items db 18 ; base reward - dw AI_STATUS_RED | AI_TYPES_RED | AI_OPPORTUNIST | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_TYPES + AI_OPPORTUNIST + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Pokefanm db NONE, NONE ; items db 20 ; base reward - dw AI_STATUS_RED | AI_TYPES_RED | AI_SMART | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_TYPES + AI_SMART + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Kimono Girl db NONE, NONE ; items db 18 ; base reward - dw AI_STATUS_RED | AI_TYPES_RED | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_TYPES + AI_OPPORTUNIST + AI_CAUTIOUS + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Twins db NONE, NONE ; items db 5 ; base reward - dw NONE - db $41, $00 + dw NO_AI + dw CONTEXT_USE + SWITCH_OFTEN ; Pokefanf db NONE, NONE ; items db 20 ; base reward - dw AI_STATUS_RED | AI_TYPES_RED | AI_SMART | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_TYPES + AI_SMART + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Red db FULL_RESTORE, FULL_RESTORE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Blue db FULL_RESTORE, FULL_RESTORE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Officer db NONE, NONE ; items db 10 ; base reward - dw AI_STATUS_RED | AI_TYPES_RED | AI_OPPORTUNIST | AI_STATUS_IMMUNE - db $44, $00 + dw AI_BASIC + AI_TYPES + AI_OPPORTUNIST + AI_STATUS + dw CONTEXT_USE + SWITCH_SOMETIMES ; Gruntf db NONE, NONE ; items db 10 ; base reward - dw AI_STATUS_RED | AI_TYPES_RED | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_TYPES + AI_OPPORTUNIST + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; Mysticalman db NONE, NONE ; items db 25 ; base reward - dw AI_STATUS_RED | AI_STAT_MODS_RED | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS_IMMUNE | AI_RISKY - db $44, $00 + dw AI_BASIC + AI_SETUP + AI_SMART + AI_AGGRESSIVE + AI_CAUTIOUS + AI_STATUS + AI_RISKY + dw CONTEXT_USE + SWITCH_SOMETIMES ; 39771