# Advanced AI System - Patch Notes
## Version 1.5.3 (Hotfix & Logic Update)
- Crash Fix (Field Effects): Resolved
undefined method 'priority' error by safely checking move properties.
- Crash Fix (Mechanics Hooks): Fixed
undefined method 'pbRegisterEnemySpecialAction' compatibility issue with Essentials v21.1.
- Switch Intelligence:
-
Ping-Pong Prevention: Increased the penalty for switching immediately after entering battle (-20 -> -40) to stop the AI from rapidly switching back and forth.
-
ReserveLastPokemon: Added robust trainer detection and debug logging to ensure the Ace is correctly reserved until the end.
-
Setup Logic:
-
Curse Support: Added proper support for non-standard setup moves like
Curse using the internal move database.
-
Safety Check: Fixed a syntax error in the setup safety check.
## Switch Intelligence
- ReserveLastPokemon Support: Fixed an issue where the AI would switch into its Ace (last Pokemon) prematurely. It now respects the
ReserveLastPokemon trainer flag.
- Switch Loop Fix: Implemented stability checks to prevent the AI from endlessly switching between two Pokemon with similar matchups.
remember if i use the reservelastpokemon option you need to add teh flag in trainers.txt
[LEADER_BROCK,Brock,1]
Items = FULLRESTORE,FULLRESTORE
LoseText = "Good match!"
Skill = 100
Flags = ReserveLastPokemon
Pokemon = GEODUDE,12
Pokemon = VULPIX,12
Moves = EMBER,QUICKATTACK
Pokemon = ONIX,14
Moves = ROCKTOMB,BIND,TACKLE