Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed ACE_POKEMON_FUNCTIONALITY #2334

Merged
merged 3 commits into from
Sep 18, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/constants/battle_ai.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#define AI_FLAG_STALL (1 << 13) // AI stalls battle and prefers secondary damage/trapping/etc. TODO not finished
#define AI_FLAG_SCREENER (1 << 14) // AI prefers screening effects like reflect, mist, etc. TODO unfinished
#define AI_FLAG_SMART_SWITCHING (1 << 15) // AI includes a lot more switching checks
#define AI_FLAG_ACE_POKEMON (1 << 16) // AI has Ace Pokemon. The last Pokemon in the party will not used until last remaining.
#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.

// 'other' ai logic flags
#define AI_FLAG_ROAMING (1 << 29)
Expand Down
4 changes: 2 additions & 2 deletions src/battle_ai_switch_items.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,8 +957,8 @@ u8 GetMostSuitableMonToSwitchInto(void)
|| i == *(gBattleStruct->monToSwitchIntoId + battlerIn1)
|| i == *(gBattleStruct->monToSwitchIntoId + battlerIn2)
|| (GetMonAbility(&party[i]) == ABILITY_TRUANT && IsTruantMonVulnerable(gActiveBattler, opposingBattler)) // While not really invalid per say, not really wise to switch into this mon.
|| (AI_THINKING_STRUCT->aiFlags & AI_FLAG_ACE_POKEMON
&& i == (CalculateEnemyPartyCount()-1))) //Save Ace Pokemon for last
|| ((AI_THINKING_STRUCT->aiFlags & AI_FLAG_ACE_POKEMON)
&& i == (CalculateEnemyPartyCount() - 1))) //Save Ace Pokemon for last
invalidMons |= gBitTable[i];
else
aliveCount++;
Expand Down
6 changes: 3 additions & 3 deletions src/battle_controller_opponent.c
Original file line number Diff line number Diff line change
Expand Up @@ -1699,9 +1699,9 @@ static void OpponentHandleChoosePokemon(void)
if (GetMonData(&gEnemyParty[chosenMonId], MON_DATA_HP) != 0
&& chosenMonId != gBattlerPartyIndexes[battler1]
&& chosenMonId != gBattlerPartyIndexes[battler2]
&& (AI_THINKING_STRUCT->aiFlags & AI_FLAG_ACE_POKEMON
&& (!(chosenMonId == (CalculateEnemyPartyCount()-1))
|| CountAIAliveNonEggMonsExcept(PARTY_SIZE) == pokemonInBattle)))
&& (!(AI_THINKING_STRUCT->aiFlags & AI_FLAG_ACE_POKEMON)
|| chosenMonId != CalculateEnemyPartyCount() - 1
|| CountAIAliveNonEggMonsExcept(PARTY_SIZE) == pokemonInBattle))
AsparagusEduardo marked this conversation as resolved.
Show resolved Hide resolved
{
break;
}
Expand Down