Commit Graph

58 Commits

Author SHA1 Message Date
DizzyEggg
bb9501449c final ai optimizations 2023-09-14 11:05:00 +02:00
DizzyEggg
38dcb3c66c ai weather optimization 2023-09-13 17:28:26 +02:00
DizzyEggg
9031f5a063 get battlers' speed only once 2023-09-13 14:04:25 +02:00
DizzyEggg
1a64938c9b optimize dmg move result and ai who is faster 2023-09-13 13:23:19 +02:00
DizzyEggg
406209f738 score to s32 2023-09-13 09:27:49 +02:00
DizzyEggg
44bd830d2a optimize dmg calc and ai dmg calc to reduce lag 2023-09-12 23:20:09 +02:00
DizzyEggg
fec8f14fff IsAiAiBattle function 2023-08-09 15:57:22 +02:00
DizzyEggg
f4dc5e931f some more stuff 2023-07-18 12:01:25 +02:00
DizzyEggg
1bd4f9c7a8 rework incoming surviability 2023-07-18 11:36:09 +02:00
Martin Griffin
17f8f50a59 Merge remote-tracking branch 'rhh/master' into upcoming 2023-07-16 07:46:34 +01:00
DizzyEggg
3c5c68ac58
Fix how AI categorizes Weak moves and give priority to always hits moves when needed (#3109)
* ai weak move fix and always hits move prioritarizing
2023-07-16 07:24:59 +01:00
sbird
6482279fa3 [battle, math] refactor damage calculation to use proper fp type and inlined multiplication 2023-07-07 18:51:23 +02:00
Eduardo Quezada D'Ottone
1fa9a05470
Convert move flags and bans into GCC bitfields (#2952)
* Slicing moves to new bitfield

* Wind moves to new bitfield

* Two-strike moves to new bitfield

* Forgot to add flagTwoStrikes to battle_moves.h

* Removed "flag" from field names

* FLAG_HIT_IN_SUBSTITUTE and FLAG_THAW_USER

* Airborne moves

* FLAG_POWDER, FLAG_TARGET_ABILITY_IGNORED and FLAG_DANCE

* FLAG_BALLISTIC and FLAG_PROTECTION_MOVE

* Fixed missing uses of MOVE_UNAVAILABLE in battle_ai_util.c

* FLAG_SOUND

* FLAG_DMG_UNDERGROUND and FLAG_DMG_UNDERWATER

* FLAG_DMG_MINIMIZE

* Cleanup

* FLAG_STAT_STAGES_IGNORED

* Updated Pollen Puff's ballistic flag

* FLAG_STRONG_JAW_BOOST and FLAG_MEGA_LAUNCHER_BOOST

* thaw

* FLAG_THREE_STRIKES

* FLAG_IRON_FIST_BOOST

* FLAG_RECKLESS_BOOST

* FLAG_HIGH_CRIT

* Removed empty flags

* Moves that fail when called by Me First + added missing Shell Trap

* Moves that fail when Gravity is active

* Better names for banned fields

* Moves that fail when called by Instruct

* Cleanup

* Contact Moves + Fixed Wandering Spirit skipping contact checks

* Inverted FLAG_PROTECT_AFFECTED so that there's a flag for moves that SKIP protect.

* Simplified B_MOVE_FLAGS configs

* FORBIDDEN_METRONOME

* Renamed hitsPastSubstitute to ignoresSubstitute

* FORBIDDEN_PARENTAL_BOND

* Struggle uncallable by Metronome

* FORBIDDEN_MIMIC

* FLAG_KINGS_ROCK_AFFECTED

* Made a single config for move flags

* Macro for checking move flags

* FLAG_MAGIC_COAT_AFFECTED

* Fixed HasMagicCoatAffectedMove

* FLAG_SNATCH_AFFECTED

* Removed unused EFFECT_FLINCH_MINIMIZE_HIT

* Fixed Stench/King's Rock interaction

* Removed sMovesNotAffectedByStench in favor of checking move effects

* Removed EFFECT_TWISTER, which was a repeat of EFFECT_FLINCH_HIT

* Changed Gen2 configs to less than Gen 3

* FORBIDDEN_SLEEP_TALK

* Cleanup

* Inverted FLAG_MIRROR_MOVE_AFFECTED

* FLAG_SHEER_FORCE_BOOST

* Ordered

* FORBIDDEN_ASSIST and FORBIDDEN_COPYCAT

* Removed TestMoveFlags and TestMoveFlagsInMoveset + flags field

* Fixed Triple Arrows test
2023-07-03 10:01:59 +02:00
Eduardo Quezada D'Ottone
d0e6ea7612
Optimized battle gender checks (#3020)
* Optimized battle gender checks

* Apply suggestions from code review

Co-authored-by: AgustinGDLV <103095241+AgustinGDLV@users.noreply.github.com>

---------

Co-authored-by: AgustinGDLV <103095241+AgustinGDLV@users.noreply.github.com>
2023-05-27 17:23:02 -04:00
CallmeEchoo
76721b16f8 add snow weather 2023-05-02 16:25:26 +02:00
Bassoonian
a2bc21d902 Update battle_ai_util.h
Co-Authored-By: Salem <65783283+callmeechoo@users.noreply.github.com>
2023-04-24 14:05:35 +02:00
Bassoonian
0b8d148c26 Let AI take Frostbite into account 2023-04-23 20:53:51 +02:00
ghoulslash
e3ca217d64 rename IsBattlerAIControlled 2023-04-10 11:36:17 -04:00
ghoulslash
5f4bfd9bb4 Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-expansion into be/aiflag 2023-04-10 09:48:49 -04:00
ghoulslash
00d695ac2b add AI_FLAG_OMNISCIENT 2023-03-28 10:38:48 -04:00
Eduardo Quezada
0b8285737a Fixed Comatose AI checks 2023-03-27 09:19:48 -03:00
Eduardo Quezada
03498d7240 Applied remaining instances of BATTLE_OPPOSITE and BATTLE_PARTNER 2022-09-02 23:57:43 -04:00
ghoulslash
6b84a9f0b3 merge w be 2022-07-17 12:40:43 -04:00
ghoulslash
e4bf99d777 merge w be 2022-07-03 16:20:05 -04:00
ghoulslash
b33a8b0cb4 move ai score calc to STATE_TURN_START_RECORD so AI can consider move selection for item use 2022-06-05 11:09:04 -04:00
ghoulslash
c694e0cb90 merge w be 2022-06-05 08:22:24 -04:00
sneed
2e855b204a ai accounts for a third type 2022-05-29 04:55:37 +03:00
BuffelSaft
746d9ea6c5 Add AI_GetBattlerMoveTargetType()
Add AI version of the function that handles move target selection, as it needs to have ability and item info that it may not have access to.
2022-04-27 22:23:20 +12:00
ExpoSeed
5fd468f507 Review comments. Commented code removed, ShouldAIUseZMove moved to battle_ai_util and renamed to be consistent with other fns 2022-03-22 13:10:24 -05:00
ghoulslash
035b2332af cache ai damage, effectiveness calcs 2022-01-13 11:28:27 -05:00
ExpoSeed
d6747527da Merge branch 'battle_engine' of https://github.com/rh-hideout/pokeemerald-expansion into BE/z-moves 2021-12-16 21:44:01 -06:00
Eduardo Quezada D'Ottone
dee7f97a8d
Merge branch 'battle_engine' into battle_ai 2021-11-21 14:46:09 -03:00
ghoulslash
2fac38cc83 merge w be 2021-11-11 16:16:26 -05:00
ghoulslash
e635930a15 fixes 2021-11-08 21:33:00 -05:00
ghoulslash
01cf8e6452 add AI_MoveMakesContact, dissuade multi-hit attacks against rocky helmet 2021-11-08 11:55:06 -05:00
ghoulslash
8f320a8d33 some ai updates, recycle + ripen logic 2021-11-08 11:37:41 -05:00
BuffelSaft
d3a845d511 Fix CanAIFaintTarget
Rename CanAIFaintTarget to CanIndexMoveFaintTarget and create a new function, CanAIFaintTarget, that checks if any known move can KO the target.
2021-11-08 20:37:28 +13:00
ghoulslash
6b10801ee8 convert AI_IsabilityOnSide to bool 2021-11-04 10:43:33 -04:00
ghoulslash
4466fbd930 ai version of CanPoisonType, CanBePoisoned and IsAbilityOnSide 2021-11-03 21:36:33 -04:00
ghoulslash
e75a8fb67c merge ai move and item decisions. AI will prefer to defeat player over healing 2021-09-27 21:03:27 -04:00
ExpoSeed
0f99d9d4c6 Merge branch 'battle_engine' of https://github.com/rh-hideout/pokeemerald-expansion into BE/z-moves 2021-08-30 13:26:40 -05:00
ghoulslash
c7c0fbc296 merge with be, make AI CanBeStatused functions separate from general util ones 2021-08-12 13:37:53 -06:00
ghoulslash
59c16ff1cf AI_IsTerrainAffected checks 2021-07-10 16:41:41 -06:00
ghoulslash
c356ffaed4 merge with be. fix null ptr check in GetBattleMoveSplit 2021-05-24 10:46:53 -06:00
Evan
d65d5cb8fd add AI_FLAG_SMART_SWITCHING, some burn checks 2021-02-14 09:37:04 -07:00
Evan
0664daf384 fix some post-merge errors 2021-02-12 11:02:10 -07:00
Evan
4782f713f2 update semi invulnerable state check 2021-02-12 08:57:57 -07:00
Evan
c003f1c023 check move effectiveness with status effects 2021-01-26 15:41:59 -07:00
Evan
09dc1b7e89 fix double battle ai logic 2021-01-13 11:08:43 -07:00
Evan
f21b0140b9 revert to CheckViability and stat change effect viabilities 2021-01-04 19:39:59 -07:00