diff --git a/include/battle.h b/include/battle.h index 94f0fab716..130a23e5b5 100644 --- a/include/battle.h +++ b/include/battle.h @@ -677,7 +677,7 @@ struct BattleStruct u8 battleBondTransformed[NUM_BATTLE_SIDES]; // Bitfield for each party. u8 storedHealingWish:4; // Each battler as a bit. u8 storedLunarDance:4; // Each battler as a bit. - u8 sideCritStages[NUM_BATTLE_SIDES]; // G-Max Chi Strike boosts crit stages of allies. + u8 bonusCritStages[MAX_BATTLERS_COUNT]; // G-Max Chi Strike boosts crit stages of allies. }; #define F_DYNAMIC_TYPE_1 (1 << 6) diff --git a/src/battle_dynamax.c b/src/battle_dynamax.c index edb41c6e5c..727bd6a2f2 100644 --- a/src/battle_dynamax.c +++ b/src/battle_dynamax.c @@ -512,7 +512,8 @@ u16 SetMaxMoveEffect(u16 move) effect++; break; case MAX_EFFECT_CRIT_PLUS: - gBattleStruct->sideCritStages[GetBattlerSide(gBattlerAttacker)]++; + gBattleStruct->bonusCritStages[gBattlerAttacker]++; + gBattleStruct->bonusCritStages[BATTLE_PARTNER(gBattlerAttacker)]++; BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_EffectRaiseCritAlliesAnim; effect++; diff --git a/src/battle_main.c b/src/battle_main.c index d6b5b2459c..15414d7221 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3166,6 +3166,9 @@ void SwitchInClearSetData(void) gSpecialStatuses[gActiveBattler].physicalDmg = 0; gSpecialStatuses[gActiveBattler].specialDmg = 0; + // Reset G-Max Chi Strike boosts. + gBattleStruct->bonusCritStages[gActiveBattler] = 0; + gBattleStruct->overwrittenAbilities[gActiveBattler] = ABILITY_NONE; Ai_UpdateSwitchInData(gActiveBattler); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index acde0e0089..e79403a10f 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2055,7 +2055,7 @@ s32 CalcCritChanceStage(u8 battlerAtk, u8 battlerDef, u32 move, bool32 recordAbi + 2 * (GetBattlerFriendshipScore(gBattlerAttacker) >= FRIENDSHIP_200_TO_254) #endif + (abilityAtk == ABILITY_SUPER_LUCK) - + gBattleStruct->sideCritStages[GetBattlerSide(gBattlerAttacker)]; + + gBattleStruct->bonusCritStages[gBattlerAttacker]; if (critChance >= ARRAY_COUNT(sCriticalHitChance)) critChance = ARRAY_COUNT(sCriticalHitChance) - 1; @@ -8614,7 +8614,6 @@ static bool32 CourtChangeSwapSideStatuses(void) u32 temp; // TODO: add Pledge-related effects - // TODO: add Gigantamax-related effects // Swap timers and statuses COURTCHANGE_SWAP(SIDE_STATUS_REFLECT, reflectTimer, temp) @@ -8629,7 +8628,8 @@ static bool32 CourtChangeSwapSideStatuses(void) COURTCHANGE_SWAP(SIDE_STATUS_STEALTH_ROCK, stealthRockAmount, temp); COURTCHANGE_SWAP(SIDE_STATUS_TOXIC_SPIKES, toxicSpikesAmount, temp); COURTCHANGE_SWAP(SIDE_STATUS_STICKY_WEB, stickyWebAmount, temp); - COURTCHANGE_SWAP(SIDE_STATUS_STEELSURGE, stickyWebAmount, temp); + COURTCHANGE_SWAP(SIDE_STATUS_STEELSURGE, steelsurgeAmount, temp); + COURTCHANGE_SWAP(SIDE_STATUS_DAMAGE_NON_TYPES, damageNonTypesTimer, temp); // Change battler IDs of swapped effects. Needed for the correct string when they expire // E.g. "Foe's Reflect wore off!" @@ -8646,6 +8646,9 @@ static bool32 CourtChangeSwapSideStatuses(void) // Track which side originally set the Sticky Web SWAP(sideTimerPlayer->stickyWebBattlerSide, sideTimerOpp->stickyWebBattlerSide, temp); + + // Swap what type set the Gigantamax damage over time effect + SWAP(sideTimerPlayer->damageNonTypesType, sideTimerOpp->damageNonTypesType, temp); } static bool32 CanTeleport(u8 battlerId)