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

Add AI_FLAG_OMNISCIENT #2872

Merged
merged 5 commits into from
Apr 10, 2023
Merged

Conversation

ghoulslash
Copy link
Collaborator

Creates an AI_FLAG_OMNISCIENT ai flag where trainer knows your full party's moves, abilities, and hold items.

src/battle_ai_util.c Outdated Show resolved Hide resolved
src/battle_ai_util.c Outdated Show resolved Hide resolved
src/battle_main.c Outdated Show resolved Hide resolved
Comment on lines 4098 to +4099
if ((gBattleTypeFlags & BATTLE_TYPE_HAS_AI || IsWildMonSmart())
&& (IsBattlerAIControlled(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_PALACE))) {
&& (BattlerHasAi(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_PALACE)))
Copy link
Collaborator

@LOuroboros LOuroboros Mar 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suggestion was to stack the conditions so the 2nd line's checks could be read right below the if statement and the checks in its same line. You only added even more spacing which is not what I suggested 😂 ...

            if ((gBattleTypeFlags & BATTLE_TYPE_HAS_AI || IsWildMonSmart())
             && (BattlerHasAi(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_PALACE)))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per discord discussion it doesn't seem like there is a universal formatting for things like this so I would prefer to leave it as is

@@ -473,6 +473,14 @@ bool32 IsBattlerAIControlled(u32 battlerId)
}
}

bool32 IsBattlerAIControlled(u32 battlerId)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this cause issues with how AI detects if a Pokémon is not controlled by a player?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not used in that many places. And the relevant places have been replaced with BattlerHasAi

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better now, but the name doesn't sit well for me.
If I call this function with a player-controlled battlerId and the omniscient flag is on, the function name should conceptually still return FALSE do to that battler not being player-controlled, but it's not doing that currently.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed to IsAiBattlerAware

@AsparagusEduardo AsparagusEduardo merged commit e4656f3 into rh-hideout:upcoming Apr 10, 2023
@ghoulslash ghoulslash deleted the be/aiflag branch April 10, 2023 17:28
@AsparagusEduardo AsparagusEduardo mentioned this pull request May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants