mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-26 13:31:03 +01:00
Merge pull request #1355 from ghoulslash/mental_herb
Update Mental herb to Gen5
This commit is contained in:
commit
a4d3cf27ad
@ -7614,6 +7614,19 @@ BattleScript_BerryCureChosenStatusRet::
|
||||
removeitem BS_SCRIPTING
|
||||
return
|
||||
|
||||
BattleScript_MentalHerbCureRet::
|
||||
playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL
|
||||
printfromtable gMentalHerbCureStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
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
|
||||
|
@ -379,5 +379,7 @@ extern const u8 BattleScript_EjectButtonActivates[];
|
||||
extern const u8 BattleScript_EjectPackActivate_Ret[];
|
||||
extern const u8 BattleScript_EjectPackActivate_End2[];
|
||||
extern const u8 BattleScript_EjectPackActivates[];
|
||||
extern const u8 BattleScript_MentalHerbCureRet[];
|
||||
extern const u8 BattleScript_MentalHerbCureEnd2[];
|
||||
|
||||
#endif // GUARD_BATTLE_SCRIPTS_H
|
||||
|
@ -130,7 +130,7 @@
|
||||
#define B_HP_BERRIES GEN_7 // 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_7 // 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+, mental herb cures Taunt, Encore, Heal Block, and Disable
|
||||
#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.
|
||||
|
@ -575,8 +575,11 @@
|
||||
#define STRINGID_PKMNBURNHEALED 571
|
||||
#define STRINGID_REDCARDACTIVATE 572
|
||||
#define STRINGID_EJECTBUTTONACTIVATE 573
|
||||
#define STRINGID_ATKGOTOVERINFATUATION 574
|
||||
#define STRINGID_TORMENTEDNOMORE 575
|
||||
#define STRINGID_HEALBLOCKEDNOMORE 576
|
||||
|
||||
#define BATTLESTRINGS_COUNT 574
|
||||
#define BATTLESTRINGS_COUNT 577
|
||||
|
||||
// The below IDs are all indexes into battle message tables,
|
||||
// used to determine which of a set of messages to print.
|
||||
@ -812,4 +815,12 @@
|
||||
#define B_MSG_SWITCHIN_ASONE 13
|
||||
#define B_MSG_SWITCHIN_CURIOUS_MEDICINE 14
|
||||
|
||||
// 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
|
||||
|
@ -29,7 +29,7 @@
|
||||
#define HOLD_EFFECT_EXP_SHARE 25
|
||||
#define HOLD_EFFECT_QUICK_CLAW 26
|
||||
#define HOLD_EFFECT_FRIENDSHIP_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
|
||||
|
@ -1204,7 +1204,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
break;
|
||||
case EFFECT_DISABLE:
|
||||
if (gDisableStructs[battlerDef].disableTimer == 0
|
||||
&& (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect != HOLD_EFFECT_CURE_ATTRACT)
|
||||
&& (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect != HOLD_EFFECT_MENTAL_HERB)
|
||||
&& !PartnerHasSameMoveEffectWithoutTarget(AI_DATA->battlerAtkPartner, move, AI_DATA->partnerMove))
|
||||
{
|
||||
if (GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) == 0) // attacker should go first
|
||||
@ -1224,7 +1224,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
break;
|
||||
case EFFECT_ENCORE:
|
||||
if (gDisableStructs[battlerDef].encoreTimer == 0
|
||||
&& (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect != HOLD_EFFECT_CURE_ATTRACT)
|
||||
&& (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect != HOLD_EFFECT_MENTAL_HERB)
|
||||
&& !DoesPartnerHaveSameMoveEffect(AI_DATA->battlerAtkPartner, battlerDef, move, AI_DATA->partnerMove))
|
||||
{
|
||||
if (GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) == 0) // attacker should go first
|
||||
@ -1458,7 +1458,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
break;
|
||||
}
|
||||
|
||||
if (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect == HOLD_EFFECT_CURE_ATTRACT)
|
||||
if (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect == HOLD_EFFECT_MENTAL_HERB)
|
||||
score -= 6;
|
||||
break;
|
||||
case EFFECT_WILL_O_WISP:
|
||||
@ -3408,7 +3408,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
break;
|
||||
case EFFECT_DISABLE:
|
||||
if (gDisableStructs[battlerDef].disableTimer == 0
|
||||
&& (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect != HOLD_EFFECT_CURE_ATTRACT)) // mental herb
|
||||
&& (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect != HOLD_EFFECT_MENTAL_HERB)) // mental herb
|
||||
{
|
||||
if (GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) == 0) // AI goes first
|
||||
{
|
||||
@ -3430,7 +3430,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
break;
|
||||
case EFFECT_ENCORE:
|
||||
if (gDisableStructs[battlerDef].encoreTimer == 0
|
||||
&& (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect != HOLD_EFFECT_CURE_ATTRACT)) // mental herb
|
||||
&& (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect != HOLD_EFFECT_MENTAL_HERB)) // mental herb
|
||||
{
|
||||
if (IsEncoreEncouragedEffect(gBattleMoves[gLastMoves[battlerDef]].effect))
|
||||
score += 3;
|
||||
|
@ -701,9 +701,16 @@ static const u8 sText_StickyBarbTransfer[] = _("The {B_LAST_ITEM} attached itsel
|
||||
static const u8 sText_PkmnBurnHealed[] = _("{B_DEF_NAME_WITH_PREFIX}'s\nburn was healed.");
|
||||
static const u8 sText_RedCardActivate[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} held up its {B_LAST_ITEM}\nagainst {B_ATK_NAME_WITH_PREFIX}!");
|
||||
static const u8 sText_EjectButtonActivate[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} is switched\nout with the {B_LAST_ITEM}!");
|
||||
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_EJECTBUTTONACTIVATE - 12] = sText_EjectButtonActivate,
|
||||
[STRINGID_REDCARDACTIVATE - 12] = sText_RedCardActivate,
|
||||
[STRINGID_PKMNBURNHEALED - 12] = sText_PkmnBurnHealed,
|
||||
@ -1268,6 +1275,16 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||
[STRINGID_SCREENCLEANERENTERS - 12] = sText_ScreenCleanerActivates,
|
||||
};
|
||||
|
||||
const u16 gMentalHerbCureStringIds[] =
|
||||
{
|
||||
[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[] =
|
||||
{
|
||||
STRINGID_TERRAINBECOMESMISTY, STRINGID_TERRAINBECOMESGRASSY, STRINGID_TERRAINBECOMESELECTRIC, STRINGID_TERRAINBECOMESPSYCHIC
|
||||
|
@ -5626,6 +5626,61 @@ 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] = B_MSG_MENTALHERBCURE_INFATUATION; // STRINGID_TARGETGOTOVERINFATUATION
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn);
|
||||
ret = TRUE;
|
||||
}
|
||||
#if B_MENTAL_HERB >= GEN_5
|
||||
// Check taunt
|
||||
if (gDisableStructs[battlerId].tauntTimer != 0)
|
||||
{
|
||||
gDisableStructs[battlerId].tauntTimer = gDisableStructs[battlerId].tauntTimer2 = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TAUNT;
|
||||
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT);
|
||||
ret = TRUE;
|
||||
}
|
||||
// Check encore
|
||||
if (gDisableStructs[battlerId].encoreTimer != 0)
|
||||
{
|
||||
gDisableStructs[battlerId].encoredMove = 0;
|
||||
gDisableStructs[battlerId].encoreTimerStartValue = gDisableStructs[battlerId].encoreTimer = 0;
|
||||
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] = B_MSG_MENTALHERBCURE_TORMENT;
|
||||
ret = TRUE;
|
||||
}
|
||||
// Check heal block
|
||||
if (gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)
|
||||
{
|
||||
gStatuses3[battlerId] &= ~(STATUS3_HEAL_BLOCK);
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_HEALBLOCK;
|
||||
ret = TRUE;
|
||||
}
|
||||
// Check disable
|
||||
if (gDisableStructs[battlerId].disableTimer != 0)
|
||||
{
|
||||
gDisableStructs[battlerId].disableTimer = gDisableStructs[battlerId].disableTimerStartValue = 0;
|
||||
gDisableStructs[battlerId].disabledMove = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_DISABLE;
|
||||
ret = TRUE;
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
{
|
||||
int i = 0, moveType;
|
||||
@ -6119,13 +6174,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] = B_MSG_CURED_PROBLEM;
|
||||
gBattleScripting.savedBattler = gBattlerAttacker;
|
||||
gBattlerAttacker = battlerId;
|
||||
BattleScriptExecute(BattleScript_MentalHerbCureEnd2);
|
||||
effect = ITEM_EFFECT_OTHER;
|
||||
}
|
||||
break;
|
||||
@ -6270,14 +6324,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] = B_MSG_CURED_PROBLEM;
|
||||
gBattlescriptCurrInstr = BattleScript_BerryCureChosenStatusRet;
|
||||
gBattlescriptCurrInstr = BattleScript_MentalHerbCureRet;
|
||||
effect = ITEM_EFFECT_OTHER;
|
||||
}
|
||||
break;
|
||||
|
@ -2262,7 +2262,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 = ITEM_USE_BAG_MENU,
|
||||
|
Loading…
x
Reference in New Issue
Block a user