Pawkkie b93dfb9d59
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 https://github.com/rh-hideout/pokeemerald-expansion/pull/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

* (766a1a27a7) 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 <jajkodizzy@wp.pl>
2023-11-11 14:37:35 +01:00
..
2019-03-02 03:18:08 -05:00
2022-08-15 15:18:12 -04:00
2022-10-27 11:26:09 -03:00
2020-12-23 13:16:01 -03:00
2023-08-07 10:29:02 +02:00
2023-10-23 11:39:22 +01:00
2018-11-11 16:44:27 +01:00
2018-11-12 14:36:31 +01:00
2019-03-03 16:50:51 -05:00
2018-02-27 20:40:09 +01:00
2021-03-18 15:18:23 -04:00
2018-02-04 16:11:00 +01:00
2019-03-24 14:50:16 -05:00
2018-02-02 16:09:17 +01:00
2021-03-18 15:18:23 -04:00
2019-02-15 18:24:55 -05:00
2021-04-06 16:55:43 -04:00
2018-02-04 16:11:00 +01:00
2020-06-18 18:14:30 -04:00
2023-09-09 10:59:44 +05:30
2018-08-15 11:43:57 +02:00
2020-08-16 02:50:35 -04:00
2021-04-22 15:51:04 -04:00
2023-01-07 11:39:56 -03:00
2023-08-10 20:11:07 -04:00
2021-11-04 17:28:41 -04:00
2023-10-02 17:28:37 -03:00
2020-03-06 09:47:20 +00:00
2023-08-10 20:11:07 -04:00
2021-03-31 16:08:42 -04:00
2020-05-27 16:41:23 -04:00
2022-03-31 12:54:07 -04:00
2021-10-14 15:10:41 -04:00
2021-05-04 01:21:50 -04:00
2022-06-14 09:37:39 -04:00
2023-03-08 12:00:30 -05:00
2020-01-26 09:40:35 -06:00
2022-09-12 21:14:15 -03:00
2020-06-06 16:10:03 -04:00
2019-10-06 20:04:30 -04:00
2018-05-19 18:02:43 +02:00
2021-10-31 01:44:18 -04:00
2023-03-08 12:00:30 -05:00
2023-09-07 23:18:18 -03:00
2020-06-17 03:39:03 -04:00
2023-02-09 23:12:29 +01:00
2021-02-28 10:06:07 -06:00
2021-08-10 22:13:02 -04:00
2017-12-26 21:20:29 -06:00
2020-07-17 15:49:46 -04:00
2021-04-02 01:49:38 -04:00
2023-07-24 19:42:56 +01:00
2022-11-09 15:16:46 -05:00
2022-09-07 14:37:03 +02:00
2017-09-07 19:45:32 +02:00
2018-12-31 19:39:41 -06:00
2023-01-07 11:39:56 -03:00
2018-04-09 12:52:28 +05:30
2021-04-01 03:29:15 -04:00
2020-05-24 08:28:02 -05:00
2022-09-12 21:14:15 -03:00
2020-04-08 17:23:32 -04:00
2017-09-18 09:23:06 -04:00
2018-01-16 18:59:06 +01:00
2017-08-31 16:48:24 +02:00
2021-08-02 13:58:40 -04:00
2023-09-09 10:16:14 +05:30
2021-02-26 17:26:39 -05:00
2017-09-08 22:23:14 +02:00
2022-09-11 14:14:49 -04:00
2017-09-28 20:52:36 +02:00
2020-08-04 14:25:13 -04:00
2019-01-02 19:46:15 -06:00
2017-11-28 23:02:09 +01:00
2020-04-13 08:42:31 -04:00
2022-08-05 10:42:31 -04:00
2022-08-15 15:18:12 -04:00
2023-08-10 20:11:07 -04:00
2023-09-20 19:04:50 -03:00
2020-05-24 08:24:20 -05:00
2022-07-29 15:38:23 -04:00
2023-10-22 03:26:24 +02:00
2021-02-24 11:03:25 -05:00
2022-09-27 17:23:26 -04:00
2022-09-27 17:23:26 -04:00
2018-01-29 15:55:34 +01:00
2023-02-11 22:36:42 -03:00
2020-03-06 09:47:20 +00:00
2017-09-19 14:27:46 +02:00
2020-05-31 13:11:18 -04:00
2022-09-11 14:14:49 -04:00
2021-09-26 17:01:39 -04:00
2022-11-22 02:17:03 -05:00