Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add supersweet syrup #4115

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions include/battle.h
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the idea here and it mostly works, but doesn't unifying this into a single field mean that if you Skill Swap Intrepid Sword onto a Pokémon with an activated Dauntless Shield, Intrepid Sword won't activate? Or, for example, if a Ditto transforms into Zacian and then subsequently Zamazenta, Dauntless Shield won't activate? I don't believe that that's canon behaviour, although I can't actually test to confirm. These may unfortunately need to remain separate fields.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skill swap should probably reset abilityActivated, yeah

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what it sounds like. We need to confirm canon behavior.

Copy link
Collaborator

@AlexOn1ine AlexOn1ine Feb 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the idea here and it mostly works, but doesn't unifying this into a single field mean that if you Skill Swap Intrepid Sword onto a Pokémon with an activated Dauntless Shield, Intrepid Sword won't activate? Or, for example, if a Ditto transforms into Zacian and then subsequently Zamazenta, Dauntless Shield won't activate? I don't believe that that's canon behaviour, although I can't actually test to confirm. These may unfortunately need to remain separate fields.

Since Party Indexes for each side are checked why would this be the case? Nvm I see it now.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what it sounds like. We need to confirm canon behavior.

It's unfortunately not as simple as just having Ability-manipulating effects reset it. As per this post, Intrepid Sword only activates a single time per battle even if the Ability is obtained in multiple ways, such as via Transform, Skill Swap, or Role Play.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unfortunately not as simple as just having Ability-manipulating effects reset it. As per this post, Intrepid Sword only activates a single time per battle even if the Ability is obtained in multiple ways, such as via Transform, Skill Swap, or Role Play.

I was agreeing with you, ghoul just commented right before I did ^^;

Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions include/battle_scripts.h
Original file line number Diff line number Diff line change
@@ -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[];
Expand Down
3 changes: 2 additions & 1 deletion include/constants/battle_string_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/battle_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
19 changes: 15 additions & 4 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Loading