Skip to content

Commit

Permalink
More (very small) AI improvements
Browse files Browse the repository at this point in the history
- Fixed a bug where the Elite 4 wouldn't use Full Restores. Apparently the game only allows one item per trainer.

- Gave Oak and Chief custom AI found from proto assets (then changed to be less ass)

- Small amount of balancing

- Minor text fixes

- Figured out roughly how the current high-level AI works (Stat boosting moves are only used sometimes on the first turn, Recover is only used sometimes when below half health, otherwise just attack with a move that isn't ineffective. More testing needed for stat lowering moves and things like Barrier)
  • Loading branch information
MementoMartha committed Jan 6, 2024
1 parent 8a59ed4 commit c8f27d8
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 37 deletions.
18 changes: 9 additions & 9 deletions data/trainers/ai_pointers.asm
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,28 @@ TrainerAIPointers:
dbw 3, GenericAI
dbw 2, BlackbeltAI ; blackbelt
dbw 3, GenericAI ; rival1
dbw 3, GenericAI
dbw 1, GenericAI ; chief
dbw 2, OakAI
dbw 3, ChiefAI ; chief
dbw 3, GenericAI
dbw 1, GiovanniAI ; giovanni
dbw 3, GenericAI
dbw 2, CooltrainerMAI ; cooltrainerm
dbw 1, CooltrainerFAI ; cooltrainerf
dbw 2, BrunoAI ; bruno
dbw 1, BrunoAI ; bruno
dbw 5, BrockAI ; brock
dbw 1, MistyAI ; misty
dbw 2, MistyAI ; misty
dbw 1, LtSurgeAI ; surge
dbw 1, ErikaAI ; erika
dbw 2, KogaAI ; koga
dbw 2, BlaineAI ; blaine
dbw 1, SabrinaAI ; sabrina
dbw 3, GenericAI
dbw 1, Rival2AI ; rival2
dbw 1, Rival3AI ; rival3
dbw 2, LoreleiAI ; lorelei
dbw 2, Rival2AI ; rival2
dbw 3, Rival3AI ; rival3
dbw 1, LoreleiAI ; lorelei
dbw 3, GenericAI
dbw 2, AgathaAI ; agatha
dbw 1, LanceAI ; lance
dbw 1, AgathaAI ; agatha
dbw 2, LanceAI ; lance
dbw 3, GenericAI ; Yujirou
dbw 3, GenericAI ; Student
dbw 3, GenericAI ; Firefighter
Expand Down
56 changes: 30 additions & 26 deletions engine/battle/trainer_ai.asm
Original file line number Diff line number Diff line change
Expand Up @@ -725,8 +725,8 @@ JugglerAI:
ret nc
jp AISwitchIfEnoughMons

BlackbeltAI:
cp 13 percent - 1
BlackbeltAI: ; Fun fact! Jacky uses this same AI routine in the proto assets, but only 6% of the time.
cp 25 percent + 1
ret nc
jp AIUseXAttack

Expand Down Expand Up @@ -763,50 +763,50 @@ BrockAI:
MistyAI:
cp 25 percent + 1
ret nc
ld a, 10
ld a, 5
call AICheckIfHPBelowFraction
ret nc
jp AIUseSuperPotion ; Replicates Starmie using Recover. Unlike other trainers that heal, Misty will do this 26% of the time instead of 51%.
jp AIUsePotion ; Replicates Starmie using Recover. Unlike other trainers that heal, Misty will do this 26% of the time instead of 51%.

LtSurgeAI:
cp 20 percent + 1
ret nc
jp AIUseXSpecial

ErikaAI:
cp 50 percent + 1
cp 25 percent + 1
ret nc
ld a, 10
ld a, 5
call AICheckIfHPBelowFraction
ret nc
jp AIUseSuperPotion

KogaAI:
cp 50 percent + 1
cp 25 percent + 1
ret nc
ld a, 10
ld a, 5
call AICheckIfHPBelowFraction
ret nc
jp AIUseSuperPotion ; Koga is weird - I don't think anything fits. X Attack is certainly not the move though...

BlaineAI:
cp 25 percent + 1
cp 40 percent + 1
ret nc
ld a, 10
ld a, 5
call AICheckIfHPBelowFraction
ret nc ; this fixes the super potion thing - PvK
jp AIUseHyperPotion ; Instead of a Super Potion though, let's give him this. More impactful for the sixth gym while staying true to the meme that everyone knows Gen 1 Blaine for.

SabrinaAI:
cp 25 percent + 1
ret nc
ld a, 10
ld a, 5
call AICheckIfHPBelowFraction
ret nc
jp AIUseHyperPotion

Rival2AI:
cp 13 percent - 1
cp 20 percent - 1
ret nc
ld a, 5
call AICheckIfHPBelowFraction
Expand All @@ -822,9 +822,6 @@ Rival3AI:
jp AIUseFullRestore

LoreleiAI:
cp 15 percent + 1
ret nc
jp AIUseXSpecial
cp 40 percent + 1
ret nc
ld a, 5
Expand All @@ -833,9 +830,6 @@ LoreleiAI:
jp AIUseFullRestore

BrunoAI:
cp 15 percent + 1
ret nc
jp AIUseXAttack
cp 40 percent + 1
ret nc
ld a, 5
Expand All @@ -844,11 +838,8 @@ BrunoAI:
jp AIUseFullRestore

AgathaAI:
cp 8 percent
cp 10 percent
jp c, AISwitchIfEnoughMons
cp 15 percent + 1
ret nc
jp AIUseXAccuracy ; hahahahahahahaha
cp 40 percent + 1
ret nc
ld a, 5
Expand All @@ -857,15 +848,28 @@ AgathaAI:
jp AIUseFullRestore

LanceAI:
cp 15 percent + 1
ret nc
jp AIUseXSpecial
cp 50 percent + 1
ret nc
ld a, 10
ld a, 4
call AICheckIfHPBelowFraction
ret nc
jp AIUseFullRestore
OakAI:
cp 25 percent + 1
ret nc
ld a, 5
call AICheckIfHPBelowFraction
ret nc
jp AIUseFullRestore
ChiefAI:
cp 25 percent + 1
ret nc
ld a, 5
call AICheckIfHPBelowFraction
ret nc
jp AIUseFullRestore ; this was a Dire Hit in the proto assets but we all know how useful that item is in Gen 1

GenericAI:
and a ; clear carry
Expand Down
4 changes: 2 additions & 2 deletions text/GiovannisRoom.asm
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ _GiovannisRoomText3::
para "PROTECTOR: ¥3,000" ; Giovanni discovered the Protector's use with Rhyperior.

para "DIRE HIT: ¥5,200" ; Giovanni uses this in battle.
para "X ATTACK: ¥8,000" ; Giovanni uses this in battle.

para "TM27 R&D: ¥15,000" ; Giovanni is confirmed to have created Fissure in vanilla RBY. He also says he made Earthquake in FRLG, but it feels contrived.

para "Business: ¥100,000"
para "Business: ¥250,000"
para "It keeps going..."
Expand Down

0 comments on commit c8f27d8

Please sign in to comment.