pokeemerald/test/battle
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
..
ability Adds ability Zero to Hero (#3542) 2023-11-09 08:25:46 -03:00
form_change Add species defines for base forms with names (#3248) 2023-10-23 12:59:15 +01:00
hold_effect Merge branch 'RHH/master' into RHH/upcoming 2023-10-30 11:00:24 -03:00
item_effect Fix Battle/Shell Armor + crit chance Tests (#3377) 2023-10-04 16:46:42 +02:00
move_effect Merge branch 'RHH/master' into RHH/upcoming 2023-11-03 21:59:08 -03:00
move_flags Add new move flags and update all flags for every move (#3425) 2023-10-19 20:16:37 -03:00
status1 Test improvements (#3408) 2023-10-12 12:14:07 +02:00
terrain fix psychic terrain blocking moves it shouldnt block (#3521) 2023-11-03 21:01:02 +01:00
weather Remove all trailing whitespace (upcoming) (#3473) 2023-10-27 13:54:55 -03:00
ai_check_viability.c Remove function GetMoveDamageResult (#3536) 2023-11-09 20:53:14 +01:00
ai_trytofaint.c Remove function GetMoveDamageResult (#3536) 2023-11-09 20:53:14 +01:00
ai.c Smarter SwitchAI Mon Choices | HasBadOdds Switch Check (#3253) 2023-11-11 14:37:35 +01:00
crit_chance.c Fix Battle/Shell Armor + crit chance Tests (#3377) 2023-10-04 16:46:42 +02:00
damage_formula.c Fix Syrup Bomb and change Octolock 2023-10-13 14:08:44 +02:00
exp.c Fix Wall Werrors on modern (#3412) 2023-10-13 18:39:35 +02:00
move.c Merge branch 'RHH/master' into RHH/upcoming 2023-08-12 16:31:44 -04:00
trainer_control.c fix -Wmaybe-uninitialized for ModifyPersonalityForNature test 2023-10-24 01:02:02 +02:00