diff --git a/include/constants/battle.h b/include/constants/battle.h index 31d77f3aee..5448b1ab8a 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -79,6 +79,8 @@ #define BATTLE_TYPE_FRONTIER (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID) #define BATTLE_TYPE_FRONTIER_NO_PYRAMID (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE) +#define WILD_DOUBLE_BATTLE ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE && !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_TRAINER)))) + // Battle Outcome defines #define B_OUTCOME_WON 0x1 #define B_OUTCOME_LOST 0x2 diff --git a/src/battle_main.c b/src/battle_main.c index 13f90aa053..eb260a196b 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -2633,7 +2633,10 @@ void oac_poke_opponent(struct Sprite *sprite) { sprite->callback = sub_803980C; StartSpriteAnimIfDifferent(sprite, 0); - BeginNormalPaletteFade(0x20000, 0, 10, 10, RGB(8, 8, 8)); + if (WILD_DOUBLE_BATTLE) + BeginNormalPaletteFade((0x10000 << sprite->sBattler) | (0x10000 << BATTLE_PARTNER(sprite->sBattler)), 0, 10, 10, RGB(8, 8, 8)); + else + BeginNormalPaletteFade((0x10000 << sprite->sBattler), 0, 10, 10, RGB(8, 8, 8)); } static void sub_803980C(struct Sprite *sprite) @@ -2656,7 +2659,10 @@ static void sub_8039838(struct Sprite *sprite) SetHealthboxSpriteVisible(gHealthboxSpriteIds[sprite->sBattler]); sprite->callback = sub_8039894; StartSpriteAnimIfDifferent(sprite, 0); - BeginNormalPaletteFade(0x20000, 0, 10, 0, RGB(8, 8, 8)); + if (WILD_DOUBLE_BATTLE) + BeginNormalPaletteFade((0x10000 << sprite->sBattler) | (0x10000 << BATTLE_PARTNER(sprite->sBattler)), 0, 10, 0, RGB(8, 8, 8)); + else + BeginNormalPaletteFade((0x10000 << sprite->sBattler), 0, 10, 0, RGB(8, 8, 8)); } } @@ -4068,9 +4074,7 @@ u8 IsRunningFromBattleImpossible(void) gBattleCommunication[MULTISTRING_CHOOSER] = 1; return 1; } - if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT - && gBattleTypeFlags & BATTLE_TYPE_DOUBLE - && !(gBattleTypeFlags & (BATTLE_TYPE_TRAINER | BATTLE_TYPE_LINK))) // The second pokemon cannot run from a double wild battle. + if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT && WILD_DOUBLE_BATTLE) // The second pokemon cannot run from a double wild battle. { gBattleCommunication[MULTISTRING_CHOOSER] = 0; return 1; @@ -4205,7 +4209,8 @@ static void HandleTurnActionSelectionState(void) gChosenActionByBattler[gActiveBattler] = B_ACTION_USE_MOVE; gBattleCommunication[gActiveBattler] = STATE_WAIT_ACTION_CONFIRMED_STANDBY; } - else if (position == B_POSITION_PLAYER_RIGHT + else if (WILD_DOUBLE_BATTLE + && position == B_POSITION_PLAYER_RIGHT && (gBattleStruct->throwingPokeBall || gChosenActionByBattler[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)] == B_ACTION_RUN)) { gBattleStruct->throwingPokeBall = FALSE; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index ef8c0b582e..8f96a2692d 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3196,8 +3196,12 @@ static void atk23_getexp(void) } else { - // music change in wild battle after fainting a poke - if (!(gBattleTypeFlags & BATTLE_TYPE_TRAINER) && gBattleMons[0].hp && !gBattleStruct->wildVictorySong) + // Music change in a wild battle after fainting opposing pokemon. + if (!(gBattleTypeFlags & BATTLE_TYPE_TRAINER) + && (gBattleMons[0].hp || (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && gBattleMons[2].hp)) + && !IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)) + && !IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT)) + && !gBattleStruct->wildVictorySong) { BattleStopLowHpSound(); PlayBGM(MUS_KACHI2);