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

Fixes Item Metronome damage #3767

Merged
merged 2 commits into from
Dec 20, 2023
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
5 changes: 3 additions & 2 deletions include/constants/battle_script_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,9 @@
#define MOVEEND_EMERGENCY_EXIT 33
#define MOVEEND_SYMBIOSIS 34
#define MOVEEND_OPPORTUNIST 35 // Occurs after other stat change items/abilities to try and copy the boosts
#define MOVEEND_CLEAR_BITS 36
#define MOVEEND_COUNT 37
#define MOVEEND_SAME_MOVE_TURNS 36
#define MOVEEND_CLEAR_BITS 37
#define MOVEEND_COUNT 38

// switch cases
#define B_SWITCH_NORMAL 0
Expand Down
15 changes: 9 additions & 6 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -1858,13 +1858,9 @@ static void Cmd_ppreduce(void)
if (!(gHitMarker & (HITMARKER_NO_PPDEDUCT | HITMARKER_NO_ATTACKSTRING)) && gBattleMons[gBattlerAttacker].pp[gCurrMovePos])
{
gProtectStructs[gBattlerAttacker].notFirstStrike = TRUE;

// For item Metronome, echoed voice
if (gCurrentMove == gLastResultingMoves[gBattlerAttacker]
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& !WasUnableToUseMove(gBattlerAttacker)
&& gSpecialStatuses[gBattlerAttacker].parentalBondState != PARENTAL_BOND_1ST_HIT) // Don't increment counter on first hit
gBattleStruct->sameMoveTurns[gBattlerAttacker]++;
else
if (gCurrentMove != gLastResultingMoves[gBattlerAttacker] || WasUnableToUseMove(gBattlerAttacker))
gBattleStruct->sameMoveTurns[gBattlerAttacker] = 0;

if (gBattleMons[gBattlerAttacker].pp[gCurrMovePos] > ppToDeduct)
Expand Down Expand Up @@ -6079,6 +6075,13 @@ static void Cmd_moveend(void)
}
gBattleScripting.moveendState++;
break;
case MOVEEND_SAME_MOVE_TURNS:
if (gCurrentMove != gLastResultingMoves[gBattlerAttacker] || gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
gBattleStruct->sameMoveTurns[gBattlerAttacker] = 0;
else if (gCurrentMove == gLastResultingMoves[gBattlerAttacker] && gSpecialStatuses[gBattlerAttacker].parentalBondState != PARENTAL_BOND_1ST_HIT)
gBattleStruct->sameMoveTurns[gBattlerAttacker]++;
gBattleScripting.moveendState++;
break;
case MOVEEND_CLEAR_BITS: // Clear/Set bits for things like using a move for all targets and all hits.
if (gSpecialStatuses[gBattlerAttacker].instructedChosenTarget)
*(gBattleStruct->moveTarget + gBattlerAttacker) = gSpecialStatuses[gBattlerAttacker].instructedChosenTarget & 0x3;
Expand Down
2 changes: 0 additions & 2 deletions test/battle/hold_effect/metronome.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ SINGLE_BATTLE_TEST("Metronome Item's boost is reset if the attacker uses a diffe
SINGLE_BATTLE_TEST("Metronome Item's boost is reset if the move fails")
{
s16 damage[2];
KNOWN_FAILING; //https://github.com/rh-hideout/pokeemerald-expansion/issues/3251
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_METRONOME); }
OPPONENT(SPECIES_WOBBUFFET);
Expand Down Expand Up @@ -110,7 +109,6 @@ SINGLE_BATTLE_TEST("Metronome Item counts charging turn of moves for its attacki
{
u32 item;

KNOWN_FAILING; // https://github.com/rh-hideout/pokeemerald-expansion/issues/3250
PARAMETRIZE {item = ITEM_NONE; }
PARAMETRIZE {item = ITEM_METRONOME; }
GIVEN {
Expand Down
Loading