Syrup Bomb / Sticky Syrup addition (#3948)

* Syrup Bomb / Sticky Syrup addition

* Update test/battle/move_effect/syrup_bomb.c

Co-authored-by: Eduardo Quezada D'Ottone <eduardo602002@gmail.com>

* Update src/battle_script_commands.c

Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>

---------

Co-authored-by: Eduardo Quezada D'Ottone <eduardo602002@gmail.com>
Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
This commit is contained in:
Alex 2024-01-09 13:37:07 +01:00 committed by GitHub
parent 396f2c9565
commit 5498098438
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 60 additions and 5 deletions

View file

@ -742,6 +742,7 @@ struct BattleStruct
u8 transformZeroToHero[NUM_BATTLE_SIDES]; u8 transformZeroToHero[NUM_BATTLE_SIDES];
u8 intrepidSwordBoost[NUM_BATTLE_SIDES]; u8 intrepidSwordBoost[NUM_BATTLE_SIDES];
u8 dauntlessShieldBoost[NUM_BATTLE_SIDES]; u8 dauntlessShieldBoost[NUM_BATTLE_SIDES];
u8 stickySyrupdBy[MAX_BATTLERS_COUNT];
}; };
// The palaceFlags member of struct BattleStruct contains 1 flag per move to indicate which moves the AI should consider, // The palaceFlags member of struct BattleStruct contains 1 flag per move to indicate which moves the AI should consider,

View file

@ -3124,6 +3124,8 @@ void SwitchInClearSetData(u32 battler)
gBattleMons[i].status2 &= ~STATUS2_INFATUATED_WITH(battler); gBattleMons[i].status2 &= ~STATUS2_INFATUATED_WITH(battler);
if ((gBattleMons[i].status2 & STATUS2_WRAPPED) && *(gBattleStruct->wrappedBy + i) == battler) if ((gBattleMons[i].status2 & STATUS2_WRAPPED) && *(gBattleStruct->wrappedBy + i) == battler)
gBattleMons[i].status2 &= ~STATUS2_WRAPPED; gBattleMons[i].status2 &= ~STATUS2_WRAPPED;
if ((gStatuses4[i] & STATUS4_SYRUP_BOMB) && *(gBattleStruct->stickySyrupdBy + i) == battler)
gStatuses4[i] &= ~STATUS4_SYRUP_BOMB;
} }
gActionSelectionCursor[battler] = 0; gActionSelectionCursor[battler] = 0;
@ -3228,6 +3230,8 @@ const u8* FaintClearSetData(u32 battler)
gBattleMons[i].status2 &= ~STATUS2_INFATUATED_WITH(battler); gBattleMons[i].status2 &= ~STATUS2_INFATUATED_WITH(battler);
if ((gBattleMons[i].status2 & STATUS2_WRAPPED) && *(gBattleStruct->wrappedBy + i) == battler) if ((gBattleMons[i].status2 & STATUS2_WRAPPED) && *(gBattleStruct->wrappedBy + i) == battler)
gBattleMons[i].status2 &= ~STATUS2_WRAPPED; gBattleMons[i].status2 &= ~STATUS2_WRAPPED;
if ((gStatuses4[i] & STATUS4_SYRUP_BOMB) && *(gBattleStruct->stickySyrupdBy + i) == battler)
gStatuses4[i] &= ~STATUS4_SYRUP_BOMB;
} }
gActionSelectionCursor[battler] = 0; gActionSelectionCursor[battler] = 0;
@ -4932,7 +4936,7 @@ static void TurnValuesCleanUp(bool8 var0)
gSideStatuses[B_SIDE_OPPONENT] &= ~(SIDE_STATUS_QUICK_GUARD | SIDE_STATUS_WIDE_GUARD | SIDE_STATUS_CRAFTY_SHIELD | SIDE_STATUS_MAT_BLOCK); gSideStatuses[B_SIDE_OPPONENT] &= ~(SIDE_STATUS_QUICK_GUARD | SIDE_STATUS_WIDE_GUARD | SIDE_STATUS_CRAFTY_SHIELD | SIDE_STATUS_MAT_BLOCK);
gSideTimers[B_SIDE_PLAYER].followmeTimer = 0; gSideTimers[B_SIDE_PLAYER].followmeTimer = 0;
gSideTimers[B_SIDE_OPPONENT].followmeTimer = 0; gSideTimers[B_SIDE_OPPONENT].followmeTimer = 0;
gBattleStruct->pledgeMove = FALSE; // combined pledge move may not have been used due to a canceller gBattleStruct->pledgeMove = FALSE; // combined pledge move may not have been used due to a canceller
} }

View file

@ -1586,8 +1586,8 @@ static bool32 AccuracyCalcHelper(u16 move)
if (WEATHER_HAS_EFFECT) if (WEATHER_HAS_EFFECT)
{ {
if (IsBattlerWeatherAffected(gBattlerTarget, B_WEATHER_RAIN) && if (IsBattlerWeatherAffected(gBattlerTarget, B_WEATHER_RAIN) &&
(gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE || (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE ||
move == MOVE_BLEAKWIND_STORM || move == MOVE_WILDBOLT_STORM || move == MOVE_SANDSEAR_STORM)) move == MOVE_BLEAKWIND_STORM || move == MOVE_WILDBOLT_STORM || move == MOVE_SANDSEAR_STORM))
{ {
// thunder/hurricane/genie moves ignore acc checks in rain unless target is holding utility umbrella // thunder/hurricane/genie moves ignore acc checks in rain unless target is holding utility umbrella
@ -3136,7 +3136,8 @@ void SetMoveEffect(bool32 primary, u32 certain)
gBattlerAbility = gEffectBattler; gBattlerAbility = gEffectBattler;
RecordAbilityBattle(gEffectBattler, ABILITY_INNER_FOCUS); RecordAbilityBattle(gEffectBattler, ABILITY_INNER_FOCUS);
gBattlescriptCurrInstr = BattleScript_FlinchPrevention; gBattlescriptCurrInstr = BattleScript_FlinchPrevention;
} else }
else
{ {
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
} }
@ -3144,7 +3145,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
else if (GetBattlerTurnOrderNum(gEffectBattler) > gCurrentTurnActionNumber else if (GetBattlerTurnOrderNum(gEffectBattler) > gCurrentTurnActionNumber
&& !IsDynamaxed(gEffectBattler)) && !IsDynamaxed(gEffectBattler))
{ {
gBattleMons[gEffectBattler].status2 |= sStatusFlagsForMoveEffects[gBattleScripting.moveEffect]; gBattleMons[gEffectBattler].status2 |= sStatusFlagsForMoveEffects[gBattleScripting.moveEffect];
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
} }
break; break;
@ -3683,6 +3684,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
gStatuses4[gEffectBattler] |= STATUS4_SYRUP_BOMB; gStatuses4[gEffectBattler] |= STATUS4_SYRUP_BOMB;
gDisableStructs[gEffectBattler].syrupBombTimer = 3; gDisableStructs[gEffectBattler].syrupBombTimer = 3;
gDisableStructs[gEffectBattler].syrupBombIsShiny = IsMonShiny(&party[gBattlerPartyIndexes[gBattlerAttacker]]); gDisableStructs[gEffectBattler].syrupBombIsShiny = IsMonShiny(&party[gBattlerPartyIndexes[gBattlerAttacker]]);
gBattleStruct->stickySyrupdBy[gEffectBattler] = gBattlerAttacker;
BattleScriptPush(gBattlescriptCurrInstr + 1); BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_SyrupBombActivates; gBattlescriptCurrInstr = BattleScript_SyrupBombActivates;
} }

View file

@ -164,3 +164,51 @@ SINGLE_BATTLE_TEST("Sticky syrup will not decrease speed further then minus six"
} }
} }
} }
SINGLE_BATTLE_TEST("Sticky Syrup is removed when the user switches out")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_SYRUP_BOMB); }
TURN { SWITCH(player, 1); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SYRUP_BOMB, player);
HP_BAR(opponent);
MESSAGE("Foe Wobbuffet got covered in sticky syrup!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_SYRUP_BOMB_SPEED_DROP, opponent);
MESSAGE("Foe Wobbuffet's Speed fell!");
NONE_OF {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_SYRUP_BOMB_SPEED_DROP, opponent);
MESSAGE("Foe Wobbuffet's Speed fell!");
}
}
}
SINGLE_BATTLE_TEST("Sticky Syrup is removed when the user faints")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { HP(1); }
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_SYRUP_BOMB);
MOVE(opponent, MOVE_TACKLE);
SEND_OUT(player, 1);
}
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SYRUP_BOMB, player);
HP_BAR(opponent);
MESSAGE("Foe Wobbuffet got covered in sticky syrup!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
HP_BAR(player);
MESSAGE("Wobbuffet fainted!");
MESSAGE("Go! Wynaut!");
NONE_OF {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_SYRUP_BOMB_SPEED_DROP, opponent);
MESSAGE("Foe Wobbuffet's Speed fell!");
}
}
}