From 0d8f804194cbcacc9e2937f4c711b409763a6016 Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 15 Jan 2021 18:11:55 -0700 Subject: [PATCH 01/14] update mental herb to gen 5 --- data/battle_scripts_1.s | 13 +++++ include/battle_scripts.h | 2 + include/constants/battle_string_ids.h | 13 ++++- include/constants/hold_effects.h | 2 +- src/battle_message.c | 16 ++++++ src/battle_util.c | 74 ++++++++++++++++++++++----- src/data/items.h | 2 +- src/data/text/item_descriptions.h | 7 +++ 8 files changed, 114 insertions(+), 15 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index bff609d59..f256430ef 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7508,6 +7508,19 @@ BattleScript_BerryCureChosenStatusRet:: removeitem BS_SCRIPTING return +BattleScript_MentalHerbCureRet:: + playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL + printfromtable gMentalHerbCureStringIds + waitmessage 0x40 + updatestatusicon BS_SCRIPTING + removeitem BS_SCRIPTING + copybyte gBattlerAttacker, sSAVED_BATTLER @ restore the original attacker just to be safe + return + +BattleScript_MentalHerbCureEnd2:: + call BattleScript_MentalHerbCureRet + end2 + BattleScript_WhiteHerbEnd2:: call BattleScript_WhiteHerbRet end2 diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 009590f3a..3b30d5bbd 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -357,5 +357,7 @@ extern const u8 BattleScript_CottonDownActivates[]; extern const u8 BattleScript_BallFetch[]; extern const u8 BattleScript_SandSpitActivates[]; extern const u8 BattleScript_PerishBodyActivates[]; +extern const u8 BattleScript_MentalHerbCureRet[]; +extern const u8 BattleScript_MentalHerbCureEnd2[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 73b91c708..9f02662e5 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -564,8 +564,11 @@ #define STRINGID_PKMNSWILLPERISHIN3TURNS 560 #define STRINGID_ABILITYRAISEDSTATDRASTICALLY 561 #define STRINGID_AURAFLAREDTOLIFE 562 +#define STRINGID_ATKGOTOVERINFATUATION 563 +#define STRINGID_TORMENTEDNOMORE 564 +#define STRINGID_HEALBLOCKEDNOMORE 565 -#define BATTLESTRINGS_COUNT 563 +#define BATTLESTRINGS_COUNT 566 //// multichoice message IDs // switch in ability message @@ -583,4 +586,12 @@ #define MULTI_SWITCHIN_COMATOSE 11 #define MULTI_SWITCHIN_SCREENCLEANER 12 +// mental herb +#define MULTI_CUREINFATUATION 0 +#define MULTI_CURETAUNT 1 +#define MULTI_CUREENCORE 2 +#define MULTI_CURETORMENT 3 +#define MULTI_CUREHEALBLOCK 4 +#define MULTI_CUREDISABLE 5 + #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H diff --git a/include/constants/hold_effects.h b/include/constants/hold_effects.h index 85017cb40..9afe5ef81 100644 --- a/include/constants/hold_effects.h +++ b/include/constants/hold_effects.h @@ -29,7 +29,7 @@ #define HOLD_EFFECT_EXP_SHARE 25 #define HOLD_EFFECT_QUICK_CLAW 26 #define HOLD_EFFECT_HAPPINESS_UP 27 -#define HOLD_EFFECT_CURE_ATTRACT 28 +#define HOLD_EFFECT_MENTAL_HERB 28 #define HOLD_EFFECT_CHOICE_BAND 29 #define HOLD_EFFECT_FLINCH 30 #define HOLD_EFFECT_BUG_POWER 31 diff --git a/src/battle_message.c b/src/battle_message.c index 90e8c8967..ee97ffbba 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -691,9 +691,15 @@ static const u8 sText_BattlerAbilityRaisedStat[] = _("{B_SCR_ACTIVE_NAME_WITH_PR static const u8 sText_ASandstormKickedUp[] = _("A sandstorm kicked up!"); static const u8 sText_PkmnsWillPerishIn3Turns[] = _("Both Pokémon will perish\nin three turns!"); static const u8 sText_AbilityRaisedStatDrastically[] = _("{B_DEF_ABILITY} raised {B_DEF_NAME_WITH_PREFIX}'s\n{B_BUFF1} drastically!"); +static const u8 sText_AttackerGotOverInfatuation[] =_("{B_ATK_NAME_WITH_PREFIX} got over\nits infatuation!"); +static const u8 sText_TormentedNoMore[] = _("{B_ATK_NAME_WITH_PREFIX} is\ntormented no more!"); +static const u8 sText_HealBlockedNoMore[] = _("{B_ATK_NAME_WITH_PREFIX} is cured of\nits heal block!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_HEALBLOCKEDNOMORE - 12] = sText_HealBlockedNoMore, + [STRINGID_TORMENTEDNOMORE - 12] = sText_TormentedNoMore, + [STRINGID_ATKGOTOVERINFATUATION - 12] = sText_AttackerGotOverInfatuation, [STRINGID_ABILITYRAISEDSTATDRASTICALLY - 12] = sText_AbilityRaisedStatDrastically, [STRINGID_PKMNSWILLPERISHIN3TURNS - 12] = sText_PkmnsWillPerishIn3Turns, [STRINGID_ASANDSTORMKICKEDUP - 12] = sText_ASandstormKickedUp, @@ -1247,6 +1253,16 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_SCREENCLEANERENTERS - 12] = sText_ScreenCleanerActivates, }; +const u16 gMentalHerbCureStringIds[] = +{ + [MULTI_CUREINFATUATION] = STRINGID_ATKGOTOVERINFATUATION, + [MULTI_CURETAUNT] = STRINGID_BUFFERENDS, + [MULTI_CUREENCORE] = STRINGID_PKMNENCOREENDED, + [MULTI_CURETORMENT] = STRINGID_TORMENTEDNOMORE, + [MULTI_CUREHEALBLOCK] = STRINGID_HEALBLOCKEDNOMORE, + [MULTI_CUREDISABLE] = STRINGID_PKMNMOVEDISABLEDNOMORE, +}; + const u16 gTerrainStringIds[] = { STRINGID_TERRAINBECOMESMISTY, STRINGID_TERRAINBECOMESGRASSY, STRINGID_TERRAINBECOMESELECTRIC, STRINGID_TERRAINBECOMESPSYCHIC diff --git a/src/battle_util.c b/src/battle_util.c index 210f00b27..a0633f6cf 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5202,6 +5202,58 @@ static bool32 UnnerveOn(u32 battlerId, u32 itemId) return FALSE; } +static bool32 GetMentalHerbEffect(u8 battlerId) +{ + bool32 ret = FALSE; + // check infatuation + if (gBattleMons[battlerId].status2 & STATUS2_INFATUATION) + { + gBattleMons[battlerId].status2 &= ~(STATUS2_INFATUATION); + gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREINFATUATION; //STRINGID_TARGETGOTOVERINFATUATION + StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn); + ret = TRUE; + } + // check taunt + if (gDisableStructs[gBattlerTarget].tauntTimer != 0) + { + gDisableStructs[gBattlerTarget].tauntTimer = gDisableStructs[gBattlerTarget].tauntTimer2 = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CURETAUNT; + PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT); + ret = TRUE; + } + // check encore + if (gDisableStructs[gBattlerTarget].encoreTimer != 0) + { + gDisableStructs[gActiveBattler].encoredMove = 0; + gDisableStructs[gBattlerTarget].encoreTimerStartValue = gDisableStructs[gBattlerTarget].encoreTimer = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREENCORE; //STRINGID_PKMNENCOREENDED + ret = TRUE; + } + // check torment + if (gBattleMons[battlerId].status2 & STATUS2_TORMENT) + { + gBattleMons[battlerId].status2 &= ~(STATUS2_TORMENT); + gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CURETORMENT; + ret = TRUE; + } + // check heal block + if (gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) + { + gStatuses3[battlerId] & ~(STATUS3_HEAL_BLOCK); + gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREHEALBLOCK; + ret = TRUE; + } + // disable + if (gDisableStructs[gBattlerTarget].disableTimer != 0) + { + gDisableStructs[gBattlerTarget].disableTimer = gDisableStructs[gBattlerTarget].disableTimerStartValue = 0; + gDisableStructs[gBattlerTarget].disabledMove = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREDISABLE; + ret = TRUE; + } + return ret; +} + u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) { int i = 0, moveType; @@ -5658,13 +5710,12 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) effect = ITEM_STATUS_CHANGE; } break; - case HOLD_EFFECT_CURE_ATTRACT: - if (gBattleMons[battlerId].status2 & STATUS2_INFATUATION) + case HOLD_EFFECT_MENTAL_HERB: + if (GetMentalHerbEffect(battlerId)) { - gBattleMons[battlerId].status2 &= ~(STATUS2_INFATUATION); - StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn); - BattleScriptExecute(BattleScript_BerryCureChosenStatusEnd2); - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleScripting.savedBattler = gBattlerAttacker; + gBattlerAttacker = battlerId; + BattleScriptExecute(BattleScript_MentalHerbCureEnd2); effect = ITEM_EFFECT_OTHER; } break; @@ -5757,14 +5808,13 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) effect = ITEM_EFFECT_OTHER; } break; - case HOLD_EFFECT_CURE_ATTRACT: - if (gBattleMons[battlerId].status2 & STATUS2_INFATUATION) + case HOLD_EFFECT_MENTAL_HERB: + if (GetMentalHerbEffect(battlerId)) { - gBattleMons[battlerId].status2 &= ~(STATUS2_INFATUATION); - StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn); + gBattleScripting.savedBattler = gBattlerAttacker; + gBattlerAttacker = battlerId; BattleScriptPushCursor(); - gBattleCommunication[MULTISTRING_CHOOSER] = 0; - gBattlescriptCurrInstr = BattleScript_BerryCureChosenStatusRet; + gBattlescriptCurrInstr = BattleScript_MentalHerbCureRet; effect = ITEM_EFFECT_OTHER; } break; diff --git a/src/data/items.h b/src/data/items.h index 30beb5352..aa06dea33 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -2423,7 +2423,7 @@ const struct Item gItems[] = .name = _("MENTAL HERB"), .itemId = ITEM_MENTAL_HERB, .price = 100, - .holdEffect = HOLD_EFFECT_CURE_ATTRACT, + .holdEffect = HOLD_EFFECT_MENTAL_HERB, .description = sMentalHerbDesc, .pocket = POCKET_ITEMS, .type = 4, diff --git a/src/data/text/item_descriptions.h b/src/data/text/item_descriptions.h index 5f79efc57..d47152f7f 100644 --- a/src/data/text/item_descriptions.h +++ b/src/data/text/item_descriptions.h @@ -743,10 +743,17 @@ static const u8 sSootheBellDesc[] = _( "calms spirits and\n" "fosters friendship."); +#if B_MENTAL_HERB < GEN_5 static const u8 sMentalHerbDesc[] = _( "A hold item that\n" "snaps POKéMON out\n" "of infatuation."); +#else +static const u8 sMentalHerbDesc[] = _( + "Snaps Pokémon out\n" + "of move-binding\n" + "effects."); +#endif static const u8 sChoiceBandDesc[] = _( "Raises a move's\n" From 449c2bcc34dd5918736a45d4e17f2df27383893f Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 15 Jan 2021 18:28:10 -0700 Subject: [PATCH 02/14] add config option --- include/constants/battle_config.h | 1 + src/battle_util.c | 78 ++++++++++++++++--------------- 2 files changed, 41 insertions(+), 38 deletions(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 2c179f9d5..38cf4ea1b 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -127,6 +127,7 @@ #define B_HP_BERRIES GEN_6 // In Gen4+, berries which restore hp activate immediately after hp drops to half. In gen3, the effect occurs at the end of the turn. #define B_BERRIES_INSTANT GEN_6 // In Gen4+, most berries activate on battle start/switch-in if applicable. In gen3, they only activate either at the move end or turn end. #define B_X_ITEMS_BUFF GEN_7 // In Gen7+, the X Items raise a stat by 2 stages instead of 1. +#define B_MENTAL_HERB GEN_5 // In Gen5+, the Mental Herb cures Infatuation, Taunt, Encore, Torment, Heal Block, and Disable // Flag settings // To use the following features in scripting, replace the 0s with the flag ID you're assigning it to. diff --git a/src/battle_util.c b/src/battle_util.c index a0633f6cf..b095ca0fb 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5213,44 +5213,46 @@ static bool32 GetMentalHerbEffect(u8 battlerId) StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn); ret = TRUE; } - // check taunt - if (gDisableStructs[gBattlerTarget].tauntTimer != 0) - { - gDisableStructs[gBattlerTarget].tauntTimer = gDisableStructs[gBattlerTarget].tauntTimer2 = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CURETAUNT; - PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT); - ret = TRUE; - } - // check encore - if (gDisableStructs[gBattlerTarget].encoreTimer != 0) - { - gDisableStructs[gActiveBattler].encoredMove = 0; - gDisableStructs[gBattlerTarget].encoreTimerStartValue = gDisableStructs[gBattlerTarget].encoreTimer = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREENCORE; //STRINGID_PKMNENCOREENDED - ret = TRUE; - } - // check torment - if (gBattleMons[battlerId].status2 & STATUS2_TORMENT) - { - gBattleMons[battlerId].status2 &= ~(STATUS2_TORMENT); - gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CURETORMENT; - ret = TRUE; - } - // check heal block - if (gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) - { - gStatuses3[battlerId] & ~(STATUS3_HEAL_BLOCK); - gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREHEALBLOCK; - ret = TRUE; - } - // disable - if (gDisableStructs[gBattlerTarget].disableTimer != 0) - { - gDisableStructs[gBattlerTarget].disableTimer = gDisableStructs[gBattlerTarget].disableTimerStartValue = 0; - gDisableStructs[gBattlerTarget].disabledMove = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREDISABLE; - ret = TRUE; - } + #if B_MENTAL_HERB >= GEN_5 + // check taunt + if (gDisableStructs[gBattlerTarget].tauntTimer != 0) + { + gDisableStructs[gBattlerTarget].tauntTimer = gDisableStructs[gBattlerTarget].tauntTimer2 = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CURETAUNT; + PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT); + ret = TRUE; + } + // check encore + if (gDisableStructs[gBattlerTarget].encoreTimer != 0) + { + gDisableStructs[gActiveBattler].encoredMove = 0; + gDisableStructs[gBattlerTarget].encoreTimerStartValue = gDisableStructs[gBattlerTarget].encoreTimer = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREENCORE; //STRINGID_PKMNENCOREENDED + ret = TRUE; + } + // check torment + if (gBattleMons[battlerId].status2 & STATUS2_TORMENT) + { + gBattleMons[battlerId].status2 &= ~(STATUS2_TORMENT); + gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CURETORMENT; + ret = TRUE; + } + // check heal block + if (gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) + { + gStatuses3[battlerId] & ~(STATUS3_HEAL_BLOCK); + gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREHEALBLOCK; + ret = TRUE; + } + // disable + if (gDisableStructs[gBattlerTarget].disableTimer != 0) + { + gDisableStructs[gBattlerTarget].disableTimer = gDisableStructs[gBattlerTarget].disableTimerStartValue = 0; + gDisableStructs[gBattlerTarget].disabledMove = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREDISABLE; + ret = TRUE; + } + #endif return ret; } From 492b5718e780628c8dadeeaddec0412d7131aae5 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Mon, 29 Mar 2021 08:02:21 -0600 Subject: [PATCH 03/14] Update src/battle_util.c Co-authored-by: ultima-soul <33333039+ultima-soul@users.noreply.github.com> --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index b095ca0fb..f62228c46 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5205,7 +5205,7 @@ static bool32 UnnerveOn(u32 battlerId, u32 itemId) static bool32 GetMentalHerbEffect(u8 battlerId) { bool32 ret = FALSE; - // check infatuation + // Check infatuation if (gBattleMons[battlerId].status2 & STATUS2_INFATUATION) { gBattleMons[battlerId].status2 &= ~(STATUS2_INFATUATION); From d0f5528abb15b8580a5b7aea68b11c20f42ef1da Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Mon, 29 Mar 2021 08:02:34 -0600 Subject: [PATCH 04/14] Update src/battle_util.c Co-authored-by: ultima-soul <33333039+ultima-soul@users.noreply.github.com> --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index f62228c46..bc3418a91 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5209,7 +5209,7 @@ static bool32 GetMentalHerbEffect(u8 battlerId) if (gBattleMons[battlerId].status2 & STATUS2_INFATUATION) { gBattleMons[battlerId].status2 &= ~(STATUS2_INFATUATION); - gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREINFATUATION; //STRINGID_TARGETGOTOVERINFATUATION + gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREINFATUATION; // STRINGID_TARGETGOTOVERINFATUATION StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn); ret = TRUE; } From 31cdf043ccfb4f8a7ad2a96ec05dd852c37db3d6 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Mon, 29 Mar 2021 08:02:41 -0600 Subject: [PATCH 05/14] Update src/battle_util.c Co-authored-by: ultima-soul <33333039+ultima-soul@users.noreply.github.com> --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index bc3418a91..aecdb445d 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5214,7 +5214,7 @@ static bool32 GetMentalHerbEffect(u8 battlerId) ret = TRUE; } #if B_MENTAL_HERB >= GEN_5 - // check taunt + // Check taunt if (gDisableStructs[gBattlerTarget].tauntTimer != 0) { gDisableStructs[gBattlerTarget].tauntTimer = gDisableStructs[gBattlerTarget].tauntTimer2 = 0; From 97428b6e10668e2f1e2b6879f416574c9518e6cc Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Mon, 29 Mar 2021 08:02:46 -0600 Subject: [PATCH 06/14] Update src/battle_util.c Co-authored-by: ultima-soul <33333039+ultima-soul@users.noreply.github.com> --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index aecdb445d..da9cae886 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5227,7 +5227,7 @@ static bool32 GetMentalHerbEffect(u8 battlerId) { gDisableStructs[gActiveBattler].encoredMove = 0; gDisableStructs[gBattlerTarget].encoreTimerStartValue = gDisableStructs[gBattlerTarget].encoreTimer = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREENCORE; //STRINGID_PKMNENCOREENDED + gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREENCORE; // STRINGID_PKMNENCOREENDED ret = TRUE; } // check torment From d7c7f808b8b8073fe09bdcb889f006a6935f3dcd Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Mon, 29 Mar 2021 08:02:51 -0600 Subject: [PATCH 07/14] Update src/battle_util.c Co-authored-by: ultima-soul <33333039+ultima-soul@users.noreply.github.com> --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index da9cae886..e71db412e 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5222,7 +5222,7 @@ static bool32 GetMentalHerbEffect(u8 battlerId) PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT); ret = TRUE; } - // check encore + // Check encore if (gDisableStructs[gBattlerTarget].encoreTimer != 0) { gDisableStructs[gActiveBattler].encoredMove = 0; From 332286ce0390e490518f0fcba4ffc345f83d719a Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Mon, 29 Mar 2021 08:02:56 -0600 Subject: [PATCH 08/14] Update src/battle_util.c Co-authored-by: ultima-soul <33333039+ultima-soul@users.noreply.github.com> --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index e71db412e..f56a37a36 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5230,7 +5230,7 @@ static bool32 GetMentalHerbEffect(u8 battlerId) gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREENCORE; // STRINGID_PKMNENCOREENDED ret = TRUE; } - // check torment + // Check torment if (gBattleMons[battlerId].status2 & STATUS2_TORMENT) { gBattleMons[battlerId].status2 &= ~(STATUS2_TORMENT); From a8c40a8d6f60640b12d9216bc7c8edf8110587ad Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Mon, 29 Mar 2021 08:03:00 -0600 Subject: [PATCH 09/14] Update src/battle_util.c Co-authored-by: ultima-soul <33333039+ultima-soul@users.noreply.github.com> --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index f56a37a36..f44146f11 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5237,7 +5237,7 @@ static bool32 GetMentalHerbEffect(u8 battlerId) gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CURETORMENT; ret = TRUE; } - // check heal block + // Check heal block if (gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) { gStatuses3[battlerId] & ~(STATUS3_HEAL_BLOCK); From 856781ce56fbc852cb08587a0108f01d5c5b3fe5 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Mon, 29 Mar 2021 08:03:05 -0600 Subject: [PATCH 10/14] Update src/battle_util.c Co-authored-by: ultima-soul <33333039+ultima-soul@users.noreply.github.com> --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index f44146f11..661f7068e 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5244,7 +5244,7 @@ static bool32 GetMentalHerbEffect(u8 battlerId) gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREHEALBLOCK; ret = TRUE; } - // disable + // Check disable if (gDisableStructs[gBattlerTarget].disableTimer != 0) { gDisableStructs[gBattlerTarget].disableTimer = gDisableStructs[gBattlerTarget].disableTimerStartValue = 0; From e475813799a4311d06a3403335494ee1ef4acd01 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Sat, 4 Sep 2021 08:18:38 -0400 Subject: [PATCH 11/14] revert mental herb desc --- src/data/text/item_descriptions.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/data/text/item_descriptions.h b/src/data/text/item_descriptions.h index d47152f7f..5f79efc57 100644 --- a/src/data/text/item_descriptions.h +++ b/src/data/text/item_descriptions.h @@ -743,17 +743,10 @@ static const u8 sSootheBellDesc[] = _( "calms spirits and\n" "fosters friendship."); -#if B_MENTAL_HERB < GEN_5 static const u8 sMentalHerbDesc[] = _( "A hold item that\n" "snaps POKéMON out\n" "of infatuation."); -#else -static const u8 sMentalHerbDesc[] = _( - "Snaps Pokémon out\n" - "of move-binding\n" - "effects."); -#endif static const u8 sChoiceBandDesc[] = _( "Raises a move's\n" From a9cbaa5966c7a0f5a23517318bad485e08357c80 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Sat, 4 Sep 2021 08:40:43 -0400 Subject: [PATCH 12/14] fix mental herb encore, heal block --- src/battle_util.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index adb0c70ad..81f9cfaf9 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5605,6 +5605,7 @@ static bool32 UnnerveOn(u32 battlerId, u32 itemId) static bool32 GetMentalHerbEffect(u8 battlerId) { bool32 ret = FALSE; + // Check infatuation if (gBattleMons[battlerId].status2 & STATUS2_INFATUATION) { @@ -5615,18 +5616,18 @@ static bool32 GetMentalHerbEffect(u8 battlerId) } #if B_MENTAL_HERB >= GEN_5 // Check taunt - if (gDisableStructs[gBattlerTarget].tauntTimer != 0) + if (gDisableStructs[battlerId].tauntTimer != 0) { - gDisableStructs[gBattlerTarget].tauntTimer = gDisableStructs[gBattlerTarget].tauntTimer2 = 0; + gDisableStructs[battlerId].tauntTimer = gDisableStructs[battlerId].tauntTimer2 = 0; gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CURETAUNT; PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT); ret = TRUE; } // Check encore - if (gDisableStructs[gBattlerTarget].encoreTimer != 0) + if (gDisableStructs[battlerId].encoreTimer != 0) { - gDisableStructs[gActiveBattler].encoredMove = 0; - gDisableStructs[gBattlerTarget].encoreTimerStartValue = gDisableStructs[gBattlerTarget].encoreTimer = 0; + gDisableStructs[battlerId].encoredMove = 0; + gDisableStructs[battlerId].encoreTimerStartValue = gDisableStructs[battlerId].encoreTimer = 0; gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREENCORE; // STRINGID_PKMNENCOREENDED ret = TRUE; } @@ -5645,10 +5646,10 @@ static bool32 GetMentalHerbEffect(u8 battlerId) ret = TRUE; } // Check disable - if (gDisableStructs[gBattlerTarget].disableTimer != 0) + if (gDisableStructs[battlerId].disableTimer != 0) { - gDisableStructs[gBattlerTarget].disableTimer = gDisableStructs[gBattlerTarget].disableTimerStartValue = 0; - gDisableStructs[gBattlerTarget].disabledMove = 0; + gDisableStructs[battlerId].disableTimer = gDisableStructs[battlerId].disableTimerStartValue = 0; + gDisableStructs[battlerId].disabledMove = 0; gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREDISABLE; ret = TRUE; } From 0bca01cb743d96a4a36165604c9971691b7b917d Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 15 Sep 2021 12:56:58 -0400 Subject: [PATCH 13/14] mental herb fixes --- data/battle_scripts_1.s | 2 +- include/constants/battle_string_ids.h | 14 +++++++------- src/battle_message.c | 12 ++++++------ src/battle_util.c | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 4f30b3f30..a0e7b9445 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7547,7 +7547,7 @@ BattleScript_BerryCureChosenStatusRet:: BattleScript_MentalHerbCureRet:: playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL printfromtable gMentalHerbCureStringIds - waitmessage 0x40 + waitmessage B_WAIT_TIME_LONG updatestatusicon BS_SCRIPTING removeitem BS_SCRIPTING copybyte gBattlerAttacker, sSAVED_BATTLER @ restore the original attacker just to be safe diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 344d1c596..4ddae6990 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -813,12 +813,12 @@ #define B_MSG_SWITCHIN_ASONE 13 #define B_MSG_SWITCHIN_CURIOUS_MEDICINE 14 -// mental herb -#define MULTI_CUREINFATUATION 0 -#define MULTI_CURETAUNT 1 -#define MULTI_CUREENCORE 2 -#define MULTI_CURETORMENT 3 -#define MULTI_CUREHEALBLOCK 4 -#define MULTI_CUREDISABLE 5 +// gMentalHerbCureStringIds +#define B_MSG_MENTALHERBCURE_INFATUATION 0 +#define B_MSG_MENTALHERBCURE_TAUNT 1 +#define B_MSG_MENTALHERBCURE_ENCORE 2 +#define B_MSG_MENTALHERBCURE_TORMENT 3 +#define B_MSG_MENTALHERBCURE_HEALBLOCK 4 +#define B_MSG_MENTALHERBCURE_DISABLE 5 #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H diff --git a/src/battle_message.c b/src/battle_message.c index 3c21604d8..bec1bf9a8 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1272,12 +1272,12 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = const u16 gMentalHerbCureStringIds[] = { - [MULTI_CUREINFATUATION] = STRINGID_ATKGOTOVERINFATUATION, - [MULTI_CURETAUNT] = STRINGID_BUFFERENDS, - [MULTI_CUREENCORE] = STRINGID_PKMNENCOREENDED, - [MULTI_CURETORMENT] = STRINGID_TORMENTEDNOMORE, - [MULTI_CUREHEALBLOCK] = STRINGID_HEALBLOCKEDNOMORE, - [MULTI_CUREDISABLE] = STRINGID_PKMNMOVEDISABLEDNOMORE, + [B_MSG_MENTALHERBCURE_INFATUATION] = STRINGID_ATKGOTOVERINFATUATION, + [B_MSG_MENTALHERBCURE_TAUNT] = STRINGID_BUFFERENDS, + [B_MSG_MENTALHERBCURE_ENCORE] = STRINGID_PKMNENCOREENDED, + [B_MSG_MENTALHERBCURE_TORMENT] = STRINGID_TORMENTEDNOMORE, + [B_MSG_MENTALHERBCURE_HEALBLOCK] = STRINGID_HEALBLOCKEDNOMORE, + [B_MSG_MENTALHERBCURE_DISABLE] = STRINGID_PKMNMOVEDISABLEDNOMORE, }; const u16 gTerrainStringIds[] = diff --git a/src/battle_util.c b/src/battle_util.c index 5027e48b9..27b4521f4 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5643,7 +5643,7 @@ static bool32 GetMentalHerbEffect(u8 battlerId) // Check heal block if (gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) { - gStatuses3[battlerId] & ~(STATUS3_HEAL_BLOCK); + gStatuses3[battlerId] &= ~(STATUS3_HEAL_BLOCK); gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREHEALBLOCK; ret = TRUE; } From 705b76506701e7870314c8017ff0a7210fb799fb Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 15 Sep 2021 14:51:24 -0400 Subject: [PATCH 14/14] update multistring chooser labels in GetMentalHerbEffect --- src/battle_util.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index 27b4521f4..c880c7fdd 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5612,7 +5612,7 @@ static bool32 GetMentalHerbEffect(u8 battlerId) if (gBattleMons[battlerId].status2 & STATUS2_INFATUATION) { gBattleMons[battlerId].status2 &= ~(STATUS2_INFATUATION); - gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREINFATUATION; // STRINGID_TARGETGOTOVERINFATUATION + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_INFATUATION; // STRINGID_TARGETGOTOVERINFATUATION StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn); ret = TRUE; } @@ -5621,7 +5621,7 @@ static bool32 GetMentalHerbEffect(u8 battlerId) if (gDisableStructs[battlerId].tauntTimer != 0) { gDisableStructs[battlerId].tauntTimer = gDisableStructs[battlerId].tauntTimer2 = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CURETAUNT; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TAUNT; PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT); ret = TRUE; } @@ -5630,21 +5630,21 @@ static bool32 GetMentalHerbEffect(u8 battlerId) { gDisableStructs[battlerId].encoredMove = 0; gDisableStructs[battlerId].encoreTimerStartValue = gDisableStructs[battlerId].encoreTimer = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREENCORE; // STRINGID_PKMNENCOREENDED + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_ENCORE; // STRINGID_PKMNENCOREENDED ret = TRUE; } // Check torment if (gBattleMons[battlerId].status2 & STATUS2_TORMENT) { gBattleMons[battlerId].status2 &= ~(STATUS2_TORMENT); - gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CURETORMENT; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TORMENT; ret = TRUE; } // Check heal block if (gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) { gStatuses3[battlerId] &= ~(STATUS3_HEAL_BLOCK); - gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREHEALBLOCK; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_HEALBLOCK; ret = TRUE; } // Check disable @@ -5652,7 +5652,7 @@ static bool32 GetMentalHerbEffect(u8 battlerId) { gDisableStructs[battlerId].disableTimer = gDisableStructs[battlerId].disableTimerStartValue = 0; gDisableStructs[battlerId].disabledMove = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_CUREDISABLE; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_DISABLE; ret = TRUE; } #endif