diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h index 454b6ab345..14ed1ebb87 100644 --- a/include/battle_script_commands.h +++ b/include/battle_script_commands.h @@ -26,6 +26,7 @@ u32 IsFlowerVeilProtected(u32 battler); u32 IsLeafGuardProtected(u32 battler); bool32 IsShieldsDownProtected(u32 battler); u32 IsAbilityStatusProtected(u32 battler); +void ResetBattlerStatChanges(u8 battler); extern void (* const gBattleScriptingCommandsTable[])(void); extern const u8 gBattlePalaceNatureToMoveGroupLikelihood[NUM_NATURES][4]; diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 10562bd988..665d47c273 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -559,8 +559,9 @@ #define STRINGID_COMATOSEENTERS 555 #define STRINGID_SCREENCLEANERENTERS 556 #define STRINGID_ASONEENTERS 557 +#define STRINGID_CURIOUSMEDICINEENTERS 558 -#define BATTLESTRINGS_COUNT 558 +#define BATTLESTRINGS_COUNT 559 //// multichoice message IDs // switch in ability message @@ -578,5 +579,6 @@ #define MULTI_SWITCHIN_COMATOSE 11 #define MULTI_SWITCHIN_SCREENCLEANER 12 #define MULTI_SWITCHIN_ASONE 13 +#define MULTI_SWITCHIN_CURIOUS_MEDICINE 14 #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H diff --git a/src/battle_message.c b/src/battle_message.c index c629d30927..48c297d72e 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -686,9 +686,11 @@ static const u8 sText_AuraBreakActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} static const u8 sText_ComatoseActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} is drowsing!"); static const u8 sText_ScreenCleanerActivates[] = _("All screens on the field were\ncleansed!"); static const u8 sText_AsOneEnters[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} has two Abilities!"); +static const u8 sText_CuriousMedicineEnters[] = _("{B_EFF_NAME_WITH_PREFIX}'s\nstat changes were reset!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_CURIOUSMEDICINEENTERS - 12] = sText_CuriousMedicineEnters, [STRINGID_ASONEENTERS - 12] = sText_AsOneEnters, [STRINGID_STATWASNOTLOWERED - 12] = sText_StatWasNotLowered, [STRINGID_CLOAKEDINAFREEZINGLIGHT - 12] = sText_CloakedInAFreezingLight, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 0857b1c5e9..61a54e3d85 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9074,17 +9074,22 @@ static void Cmd_statbuffchange(void) gBattlescriptCurrInstr = jumpPtr; } +void ResetBattlerStatChanges(u8 battler) +{ + u32 j; + + gDisableStructs[battler].stockpileDef = 0; + gDisableStructs[battler].stockpileSpDef = 0; + for (j = 0; j < NUM_BATTLE_STATS; j++) + gBattleMons[battler].statStages[j] = DEFAULT_STAT_STAGE; +} + static void Cmd_normalisebuffs(void) // haze { s32 i, j; for (i = 0; i < gBattlersCount; i++) - { - gDisableStructs[i].stockpileDef = 0; - gDisableStructs[i].stockpileSpDef = 0; - for (j = 0; j < NUM_BATTLE_STATS; j++) - gBattleMons[i].statStages[j] = DEFAULT_STAT_STAGE; - } + ResetBattlerStatChanges(i); gBattlescriptCurrInstr++; } diff --git a/src/battle_util.c b/src/battle_util.c index f7804851c4..10a38a26bc 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3712,6 +3712,18 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_CURIOUS_MEDICINE: + if (!gSpecialStatuses[battler].switchInAbilityDone && IsDoubleBattle() && IsBattlerAlive(BATTLE_PARTNER(battler))) + { + u32 i; + gEffectBattler = BATTLE_PARTNER(battler); + ResetBattlerStatChanges(gEffectBattler); + gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_SWITCHIN_CURIOUS_MEDICINE; + gSpecialStatuses[battler].switchInAbilityDone = 1; + BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); + effect++; + } + break; case ABILITY_ANTICIPATION: if (!gSpecialStatuses[battler].switchInAbilityDone) { @@ -7891,3 +7903,4 @@ static bool32 IsUnnerveAbilityOnOpposingSide(u8 battlerId) return TRUE; return FALSE; } +