From a5659f3339e0836ba90ff4f05bcdd0462f684521 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sat, 4 Dec 2021 23:00:57 -0300 Subject: [PATCH 1/5] AI partners no longer get exp. --- src/battle_script_commands.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index fcac028945..f5fb72e687 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3920,7 +3920,8 @@ static void Cmd_getexp(void) gBattleScripting.getexpState = 5; gBattleMoveDamage = 0; // used for exp } - else if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL) == MAX_LEVEL) + else if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gBattleStruct->expGetterMonId >= 3) + || GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL) == MAX_LEVEL) { *(&gBattleStruct->sentInPokes) >>= 1; gBattleScripting.getexpState = 5; From ffe35fbb069c4afe7789a31b83a59a2c839487ee Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sun, 5 Dec 2021 10:34:18 -0300 Subject: [PATCH 2/5] Updated defeat condition on multi battles --- data/battle_scripts_1.s | 1 + include/constants/battle_config.h | 5 +++-- src/battle_script_commands.c | 28 +++++++++++++++++++++++++++- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index e9d019e430..e4c628d76c 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -5925,6 +5925,7 @@ BattleScript_PayDayMoneyAndPickUpItems:: end2 BattleScript_LocalBattleLost:: + jumpifbattletype BATTLE_TYPE_INGAME_PARTNER, BattleScript_LocalBattleLostPrintWhiteOut jumpifbattletype BATTLE_TYPE_DOME, BattleScript_CheckDomeDrew jumpifbattletype BATTLE_TYPE_FRONTIER, BattleScript_LocalBattleLostPrintTrainersWinText jumpifbattletype BATTLE_TYPE_TRAINER_HILL, BattleScript_LocalBattleLostPrintTrainersWinText diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 29b7b57503..65f85af957 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -226,8 +226,9 @@ #define B_LAST_USED_BALL TRUE // If TRUE, the "last used ball" feature from Gen 7 will be implemented #define B_LAST_USED_BALL_BUTTON R_BUTTON // If last used ball is implemented, this button (or button combo) will trigger throwing the last used ball. -// Other -#define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter. +// Other settings +#define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter. +#define B_NEW_MULTI_BATTLE_DEFEAT_CONDITION TRUE // In Gen5+, multi battles end when the Player and also their Partner don't have any more Pokémon to fight. // Animation Settings #define B_NEW_SWORD_PARTICLE FALSE // If set to TRUE, it updates Swords Dance's particle. diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index f5fb72e687..6b1f5a6ff2 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -4113,6 +4113,28 @@ static void Cmd_getexp(void) } } +#ifdef B_NEW_MULTI_BATTLE_DEFEAT_CONDITION == TRUE +static bool32 NoAliveMonsForPlayerAndPartner(void) +{ + u32 i; + u32 HP_count = 0; + + if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && (gPartnerTrainerId == TRAINER_STEVEN_PARTNER || gPartnerTrainerId >= TRAINER_CUSTOM_PARTNER)) + { + for (i = 0; i < PARTY_SIZE; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG) + && (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->arenaLostPlayerMons & gBitTable[i]))) + { + HP_count += GetMonData(&gPlayerParty[i], MON_DATA_HP); + } + } + } + + return (HP_count == 0); +} +#endif + static bool32 NoAliveMonsForPlayer(void) { u32 i; @@ -4168,7 +4190,11 @@ static void Cmd_unknown_24(void) if (gBattleControllerExecFlags) return; - if (NoAliveMonsForPlayer()) + #ifdef B_NEW_MULTI_BATTLE_DEFEAT_CONDITION == TRUE + if (gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER) && NoAliveMonsForPlayerAndPartner()) + gBattleOutcome |= B_OUTCOME_LOST; + #endif + if (!(gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER)) && NoAliveMonsForPlayer()) gBattleOutcome |= B_OUTCOME_LOST; if (NoAliveMonsForOpponent()) gBattleOutcome |= B_OUTCOME_WON; From cb44de13b3a524ee054730a6f1f322d8610d30c5 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sun, 19 Dec 2021 20:53:57 -0300 Subject: [PATCH 3/5] B_NEW_MULTI_BATTLE_DEFEAT_CONDITION -> B_MULTI_BATTLE_WHITEOUT --- include/constants/battle_config.h | 4 ++-- src/battle_script_commands.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 65f85af957..f68646bb81 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -227,8 +227,8 @@ #define B_LAST_USED_BALL_BUTTON R_BUTTON // If last used ball is implemented, this button (or button combo) will trigger throwing the last used ball. // Other settings -#define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter. -#define B_NEW_MULTI_BATTLE_DEFEAT_CONDITION TRUE // In Gen5+, multi battles end when the Player and also their Partner don't have any more Pokémon to fight. +#define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter. +#define B_MULTI_BATTLE_WHITEOUT GEN_8 // In Gen4+, multi battles end when the Player and also their Partner don't have any more Pokémon to fight. // Animation Settings #define B_NEW_SWORD_PARTICLE FALSE // If set to TRUE, it updates Swords Dance's particle. diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 6b1f5a6ff2..d41084ca7a 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -4113,7 +4113,7 @@ static void Cmd_getexp(void) } } -#ifdef B_NEW_MULTI_BATTLE_DEFEAT_CONDITION == TRUE +#ifdef B_MULTI_BATTLE_WHITEOUT >= GEN_4 static bool32 NoAliveMonsForPlayerAndPartner(void) { u32 i; @@ -4190,7 +4190,7 @@ static void Cmd_unknown_24(void) if (gBattleControllerExecFlags) return; - #ifdef B_NEW_MULTI_BATTLE_DEFEAT_CONDITION == TRUE + #ifdef B_MULTI_BATTLE_WHITEOUT >= GEN_4 if (gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER) && NoAliveMonsForPlayerAndPartner()) gBattleOutcome |= B_OUTCOME_LOST; #endif From 713d97891f4db7ac06959192e552cacbdaf7970d Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 22 Dec 2021 21:32:10 -0300 Subject: [PATCH 4/5] Update include/constants/battle_config.h Co-authored-by: Eduardo Quezada D'Ottone --- include/constants/battle_config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index f68646bb81..041a3ddc84 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -227,8 +227,8 @@ #define B_LAST_USED_BALL_BUTTON R_BUTTON // If last used ball is implemented, this button (or button combo) will trigger throwing the last used ball. // Other settings -#define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter. -#define B_MULTI_BATTLE_WHITEOUT GEN_8 // In Gen4+, multi battles end when the Player and also their Partner don't have any more Pokémon to fight. +#define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter. +#define B_MULTI_BATTLE_WHITEOUT GEN_8 // In Gen4+, multi battles end when the Player and also their Partner don't have any more Pokémon to fight. // Animation Settings #define B_NEW_SWORD_PARTICLE FALSE // If set to TRUE, it updates Swords Dance's particle. From cc1a2431452403d36f6997d96092c14cfc7b233a Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Tue, 28 Dec 2021 12:18:44 -0300 Subject: [PATCH 5/5] Update src/battle_script_commands.c Co-authored-by: Eduardo Quezada D'Ottone --- src/battle_script_commands.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d41084ca7a..07e68e5bc3 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -4190,12 +4190,21 @@ static void Cmd_unknown_24(void) if (gBattleControllerExecFlags) return; - #ifdef B_MULTI_BATTLE_WHITEOUT >= GEN_4 - if (gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER) && NoAliveMonsForPlayerAndPartner()) - gBattleOutcome |= B_OUTCOME_LOST; - #endif - if (!(gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER)) && NoAliveMonsForPlayer()) +#ifdef B_MULTI_BATTLE_WHITEOUT >= GEN_4 + if (gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER)) + { + if (NoAliveMonsForPlayerAndPartner()) + gBattleOutcome |= B_OUTCOME_LOST; + } + else + { + if (NoAliveMonsForPlayer()) + gBattleOutcome |= B_OUTCOME_LOST; + } +#else + if (NoAliveMonsForPlayer()) gBattleOutcome |= B_OUTCOME_LOST; +#endif if (NoAliveMonsForOpponent()) gBattleOutcome |= B_OUTCOME_WON;