diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 74e61bbdc252..685378df8f14 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7983,6 +7983,49 @@ BattleScript_IntimidateInReverse: call BattleScript_TryAdrenalineOrb goto BattleScript_IntimidateLoopIncrement +BattleScript_SupersweetSyrupActivates:: + showabilitypopup BS_ATTACKER + pause B_WAIT_TIME_LONG + destroyabilitypopup + printstring STRINGID_SUPERSWEETAROMAWAFTS + waitmessage B_WAIT_TIME_LONG + setbyte gBattlerTarget, 0 +BattleScript_SupersweetSyrupLoop: + jumpifbyteequal gBattlerTarget, gBattlerAttacker, BattleScript_SupersweetSyrupLoopIncrement + jumpiftargetally BattleScript_SupersweetSyrupLoopIncrement + jumpifabsent BS_TARGET, BattleScript_SupersweetSyrupLoopIncrement + jumpifstatus2 BS_TARGET, STATUS2_SUBSTITUTE, BattleScript_SupersweetSyrupLoopIncrement +BattleScript_SupersweetSyrupEffect: + copybyte sBATTLER, gBattlerAttacker + setstatchanger STAT_EVASION, 1, TRUE + statbuffchange STAT_CHANGE_NOT_PROTECT_AFFECTED | STAT_CHANGE_ALLOW_PTR, BattleScript_SupersweetSyrupLoopIncrement + setgraphicalstatchangevalues + jumpifability BS_TARGET, ABILITY_CONTRARY, BattleScript_SupersweetSyrupContrary + playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 + printfromtable gStatDownStringIds +BattleScript_SupersweetSyrupEffect_WaitString: + waitmessage B_WAIT_TIME_LONG + copybyte sBATTLER, gBattlerTarget + call BattleScript_TryAdrenalineOrb +BattleScript_SupersweetSyrupLoopIncrement: + addbyte gBattlerTarget, 1 + jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_SupersweetSyrupLoop +BattleScript_SupersweetSyrupEnd: + copybyte sBATTLER, gBattlerAttacker + destroyabilitypopup + pause B_WAIT_TIME_MED + end3 + +BattleScript_SupersweetSyrupContrary: + call BattleScript_AbilityPopUpTarget + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_SupersweetSyrupContrary_WontIncrease + playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 + printfromtable gStatUpStringIds + goto BattleScript_SupersweetSyrupEffect_WaitString +BattleScript_SupersweetSyrupContrary_WontIncrease: + printstring STRINGID_TARGETSTATWONTGOHIGHER + goto BattleScript_SupersweetSyrupEffect_WaitString + BattleScript_DroughtActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp diff --git a/include/battle.h b/include/battle.h index 9ace3656c88e..5f18b5dcf21f 100644 --- a/include/battle.h +++ b/include/battle.h @@ -767,9 +767,8 @@ struct BattleStruct u8 timesGotHit[NUM_BATTLE_SIDES][PARTY_SIZE]; u8 enduredDamage; u8 transformZeroToHero[NUM_BATTLE_SIDES]; - u8 intrepidSwordBoost[NUM_BATTLE_SIDES]; - u8 dauntlessShieldBoost[NUM_BATTLE_SIDES]; u8 stickySyrupdBy[MAX_BATTLERS_COUNT]; + u8 abilityActivated[NUM_BATTLE_SIDES]; }; // The palaceFlags member of struct BattleStruct contains 1 flag per move to indicate which moves the AI should consider, diff --git a/include/battle_scripts.h b/include/battle_scripts.h index e53eae56ebf8..44db02987f1f 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -1,6 +1,7 @@ #ifndef GUARD_BATTLE_SCRIPTS_H #define GUARD_BATTLE_SCRIPTS_H +extern const u8 BattleScript_SupersweetSyrupActivates[]; extern const u8 BattleScript_OpportunistCopyStatChange[]; extern const u8 BattleScript_MirrorHerbCopyStatChange[]; extern const u8 BattleScript_MirrorHerbCopyStatChangeEnd2[]; diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 07a4af185401..dc971b7f21db 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -701,8 +701,9 @@ #define STRINGID_ITEMWASUSEDUP 699 #define STRINGID_ATTACKERLOSTITSTYPE 700 #define STRINGID_SHEDITSTAIL 701 +#define STRINGID_SUPERSWEETAROMAWAFTS 702 -#define BATTLESTRINGS_COUNT 702 +#define BATTLESTRINGS_COUNT 703 // This is the string id that gBattleStringsTable starts with. // String ids before this (e.g. STRINGID_INTROMSG) are not in the table, diff --git a/src/battle_message.c b/src/battle_message.c index ac48b83012a5..28318b385055 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -838,9 +838,11 @@ static const u8 sText_ElectroShockCharging[] = _("{B_ATK_NAME_WITH_PREFIX} absor static const u8 sText_ItemWasUsedUp[] = _("The {B_LAST_ITEM}\nwas used up..."); static const u8 sText_AttackerLostItsType[] = _("{B_ATK_NAME_WITH_PREFIX} lost\nits {B_BUFF1} type!"); static const u8 sText_ShedItsTail[] = _("{B_ATK_NAME_WITH_PREFIX} shed its tail\nto create a decoy!"); +static const u8 sText_SupersweetAromaWafts[] = _("A supersweet aroma is wafting from\nthe syrup covering {B_ATK_NAME_WITH_PREFIX}!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_SUPERSWEETAROMAWAFTS - BATTLESTRINGS_TABLE_START] = sText_SupersweetAromaWafts, [STRINGID_SHEDITSTAIL - BATTLESTRINGS_TABLE_START] = sText_ShedItsTail, [STRINGID_ELECTROSHOCKCHARGING - BATTLESTRINGS_TABLE_START] = sText_ElectroShockCharging, [STRINGID_HOSPITALITYRESTORATION - BATTLESTRINGS_TABLE_START] = sText_HospitalityRestoration, diff --git a/src/battle_util.c b/src/battle_util.c index 3b9b7b0536aa..4385dc3ecb2e 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4446,6 +4446,17 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 effect++; } break; + case ABILITY_SUPERSWEET_SYRUP: + if (!gSpecialStatuses[battler].switchInAbilityDone + && !(gBattleStruct->abilityActivated[GetBattlerSide(battler)] & gBitTable[gBattlerPartyIndexes[battler]])) + { + gBattleStruct->abilityActivated[GetBattlerSide(battler)] |= gBitTable[gBattlerPartyIndexes[battler]]; + gBattlerAttacker = battler; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; + BattleScriptPushCursorAndCallback(BattleScript_SupersweetSyrupActivates); + effect++; + } + break; case ABILITY_TRACE: if (!(gSpecialStatuses[battler].traced)) { @@ -4477,12 +4488,12 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 break; case ABILITY_INTREPID_SWORD: if (!gSpecialStatuses[battler].switchInAbilityDone && CompareStat(battler, STAT_ATK, MAX_STAT_STAGE, CMP_LESS_THAN) - && !(gBattleStruct->intrepidSwordBoost[GetBattlerSide(battler)] & gBitTable[gBattlerPartyIndexes[battler]])) + && !(gBattleStruct->abilityActivated[GetBattlerSide(battler)] & gBitTable[gBattlerPartyIndexes[battler]])) { gBattleScripting.savedBattler = gBattlerAttacker; gBattlerAttacker = battler; if (B_INTREPID_SWORD == GEN_9) - gBattleStruct->intrepidSwordBoost[GetBattlerSide(battler)] |= gBitTable[gBattlerPartyIndexes[battler]]; + gBattleStruct->abilityActivated[GetBattlerSide(battler)] |= gBitTable[gBattlerPartyIndexes[battler]]; gSpecialStatuses[battler].switchInAbilityDone = TRUE; SET_STATCHANGER(STAT_ATK, 1, FALSE); BattleScriptPushCursorAndCallback(BattleScript_BattlerAbilityStatRaiseOnSwitchIn); @@ -4491,12 +4502,12 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 break; case ABILITY_DAUNTLESS_SHIELD: if (!gSpecialStatuses[battler].switchInAbilityDone && CompareStat(battler, STAT_DEF, MAX_STAT_STAGE, CMP_LESS_THAN) - && !(gBattleStruct->dauntlessShieldBoost[GetBattlerSide(battler)] & gBitTable[gBattlerPartyIndexes[battler]])) + && !(gBattleStruct->abilityActivated[GetBattlerSide(battler)] & gBitTable[gBattlerPartyIndexes[battler]])) { gBattleScripting.savedBattler = gBattlerAttacker; gBattlerAttacker = battler; if (B_DAUNTLESS_SHIELD == GEN_9) - gBattleStruct->dauntlessShieldBoost[GetBattlerSide(battler)] |= gBitTable[gBattlerPartyIndexes[battler]]; + gBattleStruct->abilityActivated[GetBattlerSide(battler)] |= gBitTable[gBattlerPartyIndexes[battler]]; gSpecialStatuses[battler].switchInAbilityDone = TRUE; SET_STATCHANGER(STAT_DEF, 1, FALSE); BattleScriptPushCursorAndCallback(BattleScript_BattlerAbilityStatRaiseOnSwitchIn);