### Critical Fixes
### Technical Details
- Move Scoring Integration: Fixed a major bug where
score_move_advancedwas defined but never called. The AI now correctly uses the intended comprehensive scoring logic (defined inMove_Scorer.rb) instead of falling back to vanilla behavior.- AIMove Reliability: Patched
Battle::AI::AIMovewithmethod_missingdelegation to prevent persistentNoMethodErrorcrashes (e.g.,power,multiHitMove?,battler) by forwarding all checks to the underlying move object.- Accuracy Crash: Resolved a crash in
Move_Scorer.rbrelated toaccuracychecks by accessing the move's raw integer accuracy instead of the context-dependentAIMove#accuracy.
- Core.rb Hook: Explicitly connectedpbGetMoveScoretoscore_move_advancedfor qualified skill levels.
### Critical Fixes
### New Features
- Wild Pokemon Visuals: Fixed glitches where Dynamax/Tera sprites reverted immediately after animation.
- DBK Compatibility: Patched placeholders overriding
tera?/dynamax?methods.- Crash Fixes: Resolved
pbCalcTypeModMethod Error and missing icon crashes.
### Improvements
- Smart Wild AI: Wild Pokemon now use Advanced AI logic (Level 85+).
- Wild Gimmicks: Wild Pokemon can now use Dynamax.
- Event-Only Wild Tera: Wild Pokemon only Terastallize if explicitly configured (e.g.
setBattleRule("editWildPokemon", { :tera_type => :WATER })).
- KO Detection: AI heavily penalizes switching if it can secure a KO (-60 score penalty).
- Switch Safety: Improved damage calculation logic for defensive switching decisions.
- Debug Mode: Advanced AI automatically activates when
DEBUG_MODEis on.
### Added
- KO Opportunity Detection: AI now recognizes when it can secure a knockout and heavily discourages switching in these scenarios
- Newcan_ko_opponent?method calculates damage estimates for all moves
- Applies -60 point penalty to switch score when KO is available
- Accounts for STAB, type effectiveness, and damage roll variance (85% threshold)
- Prevents AI from losing momentum by switching away from guaranteed KOs
### Fixed
- Console Output Method: Corrected console logging method fromConsole.echo_litoConsole.echoln_li
- Fixes debug messages not appearing during battles
- All AAI debug output now displays correctly with proper formatting
- Colons and category labels now visible in console
### Changed
- Switch Scoring System: Expanded from 10 to 11 evaluation factors
- Factor 11: "Can Secure KO" penalty ensures AI prioritizes finishing weakened opponents
- Debug console now shows[11/11]for the new KO detection factor
### Technical Details
Files Modified:
Switch Intelligence Improvements:
[001] Settings.rb- Fixed console method, added DEBUG_MODE activation[012] Switch_Intelligence.rb- Added KO detection and switch penalty
- KO detection checks all damaging moves against all opponents
- Conservative damage formula:
(Attack * Power / Defense) * STAB * Effectiveness / 100- 85% HP threshold accounts for random damage rolls
- Ignores type-immune moves (can't KO with 0x effectiveness)
# Advanced AI System - Patch Notes
## Version 1.5.3 (Hotfix & Logic Update)
- Ping-Pong Prevention: Increased the penalty for switching immediately after entering battle (-20 -> -40) to stop the AI from rapidly switching back and forth.
- 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:
- 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 likeCurseusing 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
ReserveLastPokemontrainer 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
Switch Intelligence
ReserveLastPokemon Support**: Fixed an issue where the AI would switch into its Ace (last Pokemon) prematurely. It now respects theReserveLastPokemontrainer flag.
Switch Loop Fix**: Implemented stability checks to prevent the AI from endlessly switching between two Pokemon with similar matchups.
Added a new Rule in Settings
RESPECT_RESERVE_LAST_POKEMON = true
You can turn it off with falsee
Move Scoring (Critical Hits)
Always Critical Hits*: Moves like *Flower Trick and Wiked Blow now correctly calculate their damage with a 1.5x multiplier.
Focus Energy Synergy**: The AI now heavily prioritizes usingFocus Energy+High Crit Ratemoves to guarantee critical hits.
Smart Stat Bypassing**: The AI now recognizes that critical hits ignore:
The Target's positive Defense/Sp.Def boosts (e.g. counter to Iron Defense).
The User's negative Attack/Sp.Atk drops (e.g. counter to Intimidate).
Immunity Awareness*: The AI will no longer attempt critical hit strategies against targets with *Battle Armor, Shell Armor, or Lucky Chant.
Sticky Web support
Better Crit logic
Smarter Screens (No redundancy + Context awareness)
Code Refactoring (Simpler, cleaner code)
Translated some german leftovers
added support type changing stuff like illusion/soak