Fix braces style (#4023)

* Fix braces style

* Unified 2 conditions

---------

Co-authored-by: DizzyEggg <jajkodizzy@wp.pl>
Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
This commit is contained in:
Eduardo Quezada D'Ottone 2024-01-31 06:26:44 -03:00 committed by GitHub
parent a64e1c63c1
commit 7afa20029c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 47 additions and 29 deletions

View file

@ -546,9 +546,9 @@ static u32 ChooseMoveOrAction_Singles(u32 battlerAi)
AI_THINKING_STRUCT->aiLogicId++;
}
for (i = 0; i < MAX_MON_MOVES; i++) {
for (i = 0; i < MAX_MON_MOVES; i++)
{
gBattleStruct->aiFinalScore[battlerAi][gBattlerTarget][i] = AI_THINKING_STRUCT->score[i];
}
// Check special AI actions.
@ -674,7 +674,8 @@ static u32 ChooseMoveOrAction_Doubles(u32 battlerAi)
}
}
for (j = 0; j < MAX_MON_MOVES; j++) {
for (j = 0; j < MAX_MON_MOVES; j++)
{
gBattleStruct->aiFinalScore[battlerAi][gBattlerTarget][j] = AI_THINKING_STRUCT->score[j];
}
}

View file

@ -597,7 +597,8 @@ static bool32 ShouldSwitchIfAbilityBenefit(u32 battler, bool32 emitResult)
||IsNeutralizingGasOnField())
return FALSE;
switch(AI_DATA->abilities[battler]) {
switch(AI_DATA->abilities[battler])
{
case ABILITY_NATURAL_CURE:
moduloChance = 4; //25%
//Attempt to cure bad ailment
@ -1999,7 +2000,8 @@ static bool32 AiExpectsToFaintPlayer(u32 battler)
if (GetBattlerSide(target) != GetBattlerSide(battler)
&& CanIndexMoveFaintTarget(battler, target, gBattleStruct->aiMoveOrAction[battler], 0)
&& AI_WhoStrikesFirst(battler, target, GetAIChosenMove(battler)) == AI_IS_FASTER) {
&& AI_WhoStrikesFirst(battler, target, GetAIChosenMove(battler)) == AI_IS_FASTER)
{
// We expect to faint the target and move first -> dont use an item
return TRUE;
}
@ -2125,7 +2127,8 @@ static bool32 AI_ShouldHeal(u32 battler, u32 healAmount)
if (gBattleMons[battler].hp < gBattleMons[battler].maxHP / 4
|| gBattleMons[battler].hp == 0
|| (healAmount != 0 && gBattleMons[battler].maxHP - gBattleMons[battler].hp > healAmount)) {
|| (healAmount != 0 && gBattleMons[battler].maxHP - gBattleMons[battler].hp > healAmount))
{
// We have low enough HP to consider healing
shouldHeal = !AI_OpponentCanFaintAiWithMod(battler, healAmount); // if target can kill us even after we heal, why bother
}
@ -2137,12 +2140,12 @@ static bool32 AI_OpponentCanFaintAiWithMod(u32 battler, u32 healAmount)
{
u32 i;
// Check special cases to NOT heal
for (i = 0; i < gBattlersCount; i++) {
if (GetBattlerSide(i) == B_SIDE_PLAYER) {
if (CanTargetFaintAiWithMod(i, battler, healAmount, 0)) {
// Target is expected to faint us
return TRUE;
}
for (i = 0; i < gBattlersCount; i++)
{
if (GetBattlerSide(i) == B_SIDE_PLAYER && CanTargetFaintAiWithMod(i, battler, healAmount, 0))
{
// Target is expected to faint us
return TRUE;
}
}
return FALSE;

View file

@ -469,7 +469,8 @@ s32 AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectivenes
u32 i;
gBattleStruct->beatUpSlot = 0;
dmg = 0;
for (i = 0; i < partyCount; i++) {
for (i = 0; i < partyCount; i++)
{
dmg += CalculateMoveDamage(move, battlerAtk, battlerDef, moveType, 0, FALSE, FALSE, FALSE);
}
gBattleStruct->beatUpSlot = 0;

View file

@ -447,18 +447,21 @@ static u8 GetBattleAnimMoveTargets(u8 battlerArgIndex, u8 *targets)
switch (GetBattlerMoveTargetType(gBattleAnimAttacker, gAnimMoveIndex))
{
case MOVE_TARGET_FOES_AND_ALLY:
if (IS_ALIVE_AND_PRESENT(BATTLE_PARTNER(BATTLE_OPPOSITE(battler)))) {
if (IS_ALIVE_AND_PRESENT(BATTLE_PARTNER(BATTLE_OPPOSITE(battler))))
{
targets[idx++] = BATTLE_PARTNER(BATTLE_OPPOSITE(battler));
numTargets++;
}
// fallthrough
case MOVE_TARGET_BOTH:
if (IS_ALIVE_AND_PRESENT(battler)) {
if (IS_ALIVE_AND_PRESENT(battler))
{
targets[idx++] = battler;
numTargets++;
}
battler = BATTLE_PARTNER(battler);
if (IS_ALIVE_AND_PRESENT(battler)) {
if (IS_ALIVE_AND_PRESENT(battler))
{
targets[idx++] = battler;
numTargets++;
}
@ -555,8 +558,8 @@ static void CreateSpriteOnTargets(const struct SpriteTemplate *template, u8 argV
if (ntargets == 0)
return;
for (i = 0; i < ntargets; i++) {
for (i = 0; i < ntargets; i++)
{
if (overwriteAnimTgt)
gBattleAnimArgs[battlerArgIndex] = targets[i];
@ -673,7 +676,8 @@ static void Cmd_createvisualtaskontargets(void)
sBattleAnimScriptPtr++;
// copy task arguments
for (i = 0; i < numArgs; i++) {
for (i = 0; i < numArgs; i++)
{
gBattleAnimArgs[i] = T1_READ_16(sBattleAnimScriptPtr);
sBattleAnimScriptPtr += 2;
}

View file

@ -418,12 +418,14 @@ u32 UnpackSelectedBattlePalettes(s16 selector)
switch (moveTarget)
{
case MOVE_TARGET_BOTH:
if (target) {
if (target)
{
targetPartner |= 1;
}
break;
case MOVE_TARGET_FOES_AND_ALLY:
if (target) {
if (target)
{
targetPartner |= 1;
attackerPartner |= 1;
}

View file

@ -5638,7 +5638,8 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
switch (GetBattlerAbility(battler))
{
case ABILITY_OPPORTUNIST:
if (gProtectStructs[battler].activateOpportunist == 2) {
if (gProtectStructs[battler].activateOpportunist == 2)
{
gBattleScripting.savedBattler = gBattlerAttacker;
gBattleScripting.battler = gBattlerAttacker = gBattlerAbility = battler;
gProtectStructs[battler].activateOpportunist--;
@ -6624,14 +6625,18 @@ static u8 TryConsumeMirrorHerb(u32 battler, bool32 execute)
{
u8 effect = 0;
if (gProtectStructs[battler].eatMirrorHerb) {
if (gProtectStructs[battler].eatMirrorHerb)
{
gLastUsedItem = gBattleMons[battler].item;
gBattleScripting.savedBattler = gBattlerAttacker;
gBattleScripting.battler = gBattlerAttacker = battler;
gProtectStructs[battler].eatMirrorHerb = 0;
if (execute) {
if (execute)
{
BattleScriptExecute(BattleScript_MirrorHerbCopyStatChangeEnd2);
} else {
}
else
{
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_MirrorHerbCopyStatChange;
}
@ -6885,7 +6890,8 @@ u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn)
u8 atkHoldEffectParam;
u16 atkItem;
if (caseID != ITEMEFFECT_USE_LAST_ITEM) {
if (caseID != ITEMEFFECT_USE_LAST_ITEM)
{
gLastUsedItem = gBattleMons[battler].item;
battlerHoldEffect = GetBattlerHoldEffect(battler, TRUE);
}

View file

@ -490,8 +490,8 @@ static s32 GetParentToInheritNature(struct DayCare *daycare)
for (i = 0; i < DAYCARE_MON_COUNT; i++)
{
if (ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[i].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE
&& (P_NATURE_INHERITANCE != GEN_3 || GetBoxMonGender(&daycare->mons[i].mon) == MON_FEMALE || IS_DITTO(GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SPECIES)))
) {
&& (P_NATURE_INHERITANCE != GEN_3 || GetBoxMonGender(&daycare->mons[i].mon) == MON_FEMALE || IS_DITTO(GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SPECIES))))
{
slot = i;
numWithEverstone++;
}

View file

@ -3956,7 +3956,8 @@ static void UseVsSeeker_DoPlayerAnimation(struct Task *task)
task->data[0]++;
}
static void UseVsSeeker_ResetPlayerGraphics(struct Task *task) {
static void UseVsSeeker_ResetPlayerGraphics(struct Task *task)
{
struct ObjectEvent* playerObj = &gObjectEvents[gPlayerAvatar.objectEventId];
if (!ObjectEventClearHeldMovementIfFinished(playerObj))