Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Smarter SwitchAI Mon Choices | HasBadOdds Switch Check (#3253)
* SwitchAI makes much smarter mon choices * Add HasHadOdds check to ShouldSwitch decision * Remove early return * Rework Baton Pass check as per discussion with Alex * Forgot to adjust a comment * Don't program before breakfast lol (if / else if fix) * Switch AI_CalcDamage for AI_DATA->simulatedDmg in HasBadOdds Thanks Alex! :D * Typo in a hitToKO comparison * Remove and replace AI_CalcPartyMonBestMoveDamage and IsAiPartyMonOHKOBy from #3146 See https://discord.com/channels/419213663107416084/1144447521960251472 for details * Major refactor, new struct, switchin considers damage / healing from hazards / status / held item / weather * Forgot Snow exists and heals Ice Body, haven't played Switch games lol * (766a1a2) Compatibility, use new struct field instead of function call * Fixing oversight from previous upstream merge * Improve TSpikes handling to make GetSwitchinHazardDamage more applicable Small fixes: - EFFECT_EXPLOSION typo (!= to ==) - Order of if statements near bestResistEffective - Spacing of terms in big HasBadOdds if statements * Forgot to uncomment blocks disabled for debugging what turned out to be vanilla behaviour lol * Remove another holdover from debugging, sorry :/ * Lastly, undoing my debug trainer * Type matchup based on species type rather than current type Suggested by BLourenco on Discord, the idea is that a mon that's had its type affected by a move like Soak will still have moves as though it was its regular typing, and so prioritizing the temporary typing wouldn't be ideal. https://discord.com/channels/419213663107416084/1144447521960251472/1146644578141736970 * gActiveBattler upcoming merge fixes * Egg changes part 1 * Egg changes part 2, just need to address EWRAM still * Move SwitchinCandidate struct to AiLogicData * Consider Steel type when checking TSpikes * Comment about CanBePoisoned compatibility * Changes for Egg's 2nd review * Put period back in comment, whoops lol * Latest upcoming merge fixes * Missed a few u32 updates * Combine GetBestMonIntegrate functions / flags, some modularization * Fix merge error * Make modern fixes * Two tests done, two to go * Accidentally pushed reference test, removing it * Type matchup switching tests * Tests for defensive vs offense switches --------- Co-authored-by: DizzyEggg <[email protected]>
- Loading branch information