sovereignx/include/constants/battle_ai.h

60 lines
3 KiB
C
Raw Normal View History

2018-02-07 23:35:13 +00:00
#ifndef GUARD_CONSTANTS_BATTLE_AI_H
#define GUARD_CONSTANTS_BATTLE_AI_H
2017-12-30 15:04:31 +00:00
2018-02-07 21:53:40 +00:00
// battlers
2017-12-30 15:04:31 +00:00
#define AI_TARGET 0
#define AI_USER 1
#define AI_TARGET_PARTNER 2
#define AI_USER_PARTNER 3
// get_type command
#define AI_TYPE1_TARGET 0
#define AI_TYPE1_USER 1
#define AI_TYPE2_TARGET 2
#define AI_TYPE2_USER 3
#define AI_TYPE_MOVE 4
// type effectiveness
2022-07-03 21:28:34 +01:00
#define AI_EFFECTIVENESS_x8 7
#define AI_EFFECTIVENESS_x4 6
#define AI_EFFECTIVENESS_x2 5
#define AI_EFFECTIVENESS_x1 4
#define AI_EFFECTIVENESS_x0_5 3
#define AI_EFFECTIVENESS_x0_25 2
#define AI_EFFECTIVENESS_x0_125 1
2017-12-30 15:04:31 +00:00
#define AI_EFFECTIVENESS_x0 0
2020-12-13 22:02:21 +00:00
// AI Flags. Most run specific functions to update score, new flags are used for internal logic in other scripts
#define AI_FLAG_CHECK_BAD_MOVE (1 << 0)
#define AI_FLAG_TRY_TO_FAINT (1 << 1)
#define AI_FLAG_CHECK_VIABILITY (1 << 2)
#define AI_FLAG_SETUP_FIRST_TURN (1 << 3)
#define AI_FLAG_RISKY (1 << 4)
#define AI_FLAG_PREFER_STRONGEST_MOVE (1 << 5)
#define AI_FLAG_PREFER_BATON_PASS (1 << 6)
#define AI_FLAG_DOUBLE_BATTLE (1 << 7) // removed, split between AI_FLAG_CHECK_BAD_MOVE & AI_FLAG_CHECK_GOOD_MOVE
#define AI_FLAG_HP_AWARE (1 << 8)
#define AI_FLAG_POWERFUL_STATUS (1 << 9) // AI prefers moves that set up field effects or side statuses, even if the user can faint the target
2020-12-20 21:47:20 +00:00
// New, Trainer Handicap Flags
#define AI_FLAG_NEGATE_UNAWARE (1 << 10) // AI is NOT aware of negating effects like wonder room, mold breaker, etc
#define AI_FLAG_WILL_SUICIDE (1 << 11) // AI will use explosion / self destruct / final gambit / etc
2020-12-20 21:47:20 +00:00
// New, Trainer Strategy Flags
#define AI_FLAG_HELP_PARTNER (1 << 12) // AI can try to help partner. If not set, will tend not to target partner
#define AI_FLAG_PREFER_STATUS_MOVES (1 << 13) // AI gets a score bonus for status moves. Should be combined with AI_FLAG_CHECK_BAD_MOVE to prevent using only status moves
#define AI_FLAG_STALL (1 << 14) // AI stalls battle and prefers secondary damage/trapping/etc. TODO not finished
#define AI_FLAG_SMART_SWITCHING (1 << 15) // AI includes a lot more switching checks. Automatically includes AI_FLAG_SMART_MON_CHOICES for better results.
2022-09-18 04:50:21 +01:00
#define AI_FLAG_ACE_POKEMON (1 << 16) // AI has an Ace Pokemon. The last Pokemon in the party will not be used until it's the last one remaining.
2023-03-28 15:38:48 +01:00
#define AI_FLAG_OMNISCIENT (1 << 17) // AI has full knowledge of player moves, abilities, hold items
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 * (https://github.com/rh-hideout/pokeemerald-expansion/commit/766a1a27a7298e50dd89c5fecc1989b3dd8b8ce3) 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 13:37:35 +00:00
#define AI_FLAG_SMART_MON_CHOICES (1 << 18) // AI will make smarter decisions when choosing which mon to send out mid-battle and after a KO, which are separate decisions. Pairs very well with AI_FLAG_SMART_SWITCHING.
2020-12-13 22:02:21 +00:00
#define AI_FLAG_COUNT 19
Ported TheXaman's latest changes to the Debug Menu (#2815) * Added option for generating incrementing pokemon in pc boxes # Conflicts: # src/debug.c * added submenu arrows, increased menu high to full screen # Conflicts: # src/debug.c * combined flags and vars into one submenu # Conflicts: # src/debug.c * added new window to flags/vars showing the current state and added submenu indicator # Conflicts: # src/debug.c * added alligned arrows for debug submenus # Conflicts: # src/debug.c * used {CLEAR_TO X} instead of manual spaces # Conflicts: # src/debug.c * renamed gDebugText to proper sDebugText # Conflicts: # src/debug.c * added Fill submenu, added fill function for PC items and all bag pockets @LOuroboros # Conflicts: # src/debug.c * put cheat start into utility # Conflicts: # src/debug.c * put fill submenu into main menu # Conflicts: # src/debug.c * tiny fix * renaming and reordering # Conflicts: # src/debug.c * Added reset pokedex flags for @AsparagusEduardo * made flag toggle list dynamic # Conflicts: # src/debug.c * initial battle debug menu WIP # Conflicts: # src/debug.c # src/wild_encounter.c * fix visual bug * added battle start # Conflicts: # include/debug.h # src/battle_ai_script_commands.c * Added faster way to add initial movesets to mon * Added waiting music for the slow box filling * Simplified the call to scripts * Simplified debug scripts * Disabled Battle Test for now * Fixed personality on fast PC fill being always 0 * Removed BATTLE_ENGINE instances + added AI_FLAG_COUNT * Added missing return TRUE * Sets nickname * Changed how GetSpeciesName to how it's used upstream --------- Co-authored-by: TheXaman <48356183+TheXaman@users.noreply.github.com>
2023-07-18 08:17:03 +01:00
2020-12-13 22:02:21 +00:00
// 'other' ai logic flags
#define AI_FLAG_ROAMING (1 << 29)
#define AI_FLAG_SAFARI (1 << 30)
#define AI_FLAG_FIRST_BATTLE (1 << 31)
2017-12-30 15:04:31 +00:00
#define AI_SCORE_DEFAULT 100 // Default score for all AI moves.
2018-02-07 23:35:13 +00:00
#endif // GUARD_CONSTANTS_BATTLE_AI_H