diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index ce841e4a24..e101540851 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -860,6 +860,21 @@ gBattleAnims_Moves:: .4byte Move_MATCHA_GOTCHA .4byte Move_SYRUP_BOMB .4byte Move_IVY_CUDGEL + .4byte Move_833 + .4byte Move_834 + .4byte Move_835 + .4byte Move_836 + .4byte Move_837 + .4byte Move_838 + .4byte Move_839 + .4byte Move_840 + .4byte Move_841 + .4byte Move_842 + .4byte Move_843 + .4byte Move_844 + .4byte Move_845 + .4byte Move_846 + .4byte Move_847 @@@@ Z MOVES .4byte Move_BREAKNECK_BLITZ .4byte Move_ALL_OUT_PUMMELING @@ -16963,6 +16978,21 @@ Move_IVY_CUDGEL:: Move_NONE: Move_MIRROR_MOVE: Move_POUND: +Move_833: +Move_834: +Move_835: +Move_836: +Move_837: +Move_838: +Move_839: +Move_840: +Move_841: +Move_842: +Move_843: +Move_844: +Move_845: +Move_846: +Move_847: loadspritegfx ANIM_TAG_IMPACT monbg ANIM_TARGET setalpha 12, 8 diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 7e95ea785b..4899d37036 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -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 diff --git a/src/battle_main.c b/src/battle_main.c index 4c28f3ffd4..26a6380efe 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -2962,6 +2962,10 @@ static void BattleStartClearSetData(void) memset(&gSideTimers, 0, sizeof(gSideTimers)); memset(&gWishFutureKnock, 0, sizeof(gWishFutureKnock)); memset(&gBattleResults, 0, sizeof(gBattleResults)); + memset(&gBattleScripting, 0, sizeof(gBattleScripting)); + + gBattleScripting.battleStyle = gSaveBlock2Ptr->optionsBattleStyle; + gBattleScripting.expOnCatch = (B_EXP_CATCH >= GEN_6); for (i = 0; i < MAX_BATTLERS_COUNT; i++) { @@ -2998,7 +3002,6 @@ static void BattleStartClearSetData(void) gBattlerAttacker = 0; gBattlerTarget = 0; gEffectBattler = 0; - gBattleScripting.battler = 0; gBattlerAbility = 0; gBattleWeather = 0; gHitMarker = 0; @@ -3013,12 +3016,7 @@ static void BattleStartClearSetData(void) gHitMarker |= HITMARKER_NO_ANIMATIONS; } - gBattleScripting.battleStyle = gSaveBlock2Ptr->optionsBattleStyle; - gBattleScripting.expOnCatch = (B_EXP_CATCH >= GEN_6); - gBattleScripting.monCaught = FALSE; - gMultiHitCounter = 0; - gBattleScripting.savedDmg = 0; gBattleOutcome = 0; gBattleControllerExecFlags = 0; gPaydayMoney = 0; @@ -3031,8 +3029,6 @@ static void BattleStartClearSetData(void) gPauseCounterBattle = 0; gBattleMoveDamage = 0; gIntroSlideFlags = 0; - gBattleScripting.animTurn = 0; - gBattleScripting.animTargetsHit = 0; gLeveledUpInBattle = 0; gAbsentBattlerFlags = 0; gBattleStruct->runTries = 0; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 3e48794eb1..a95f948c7e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1859,13 +1859,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) @@ -6052,6 +6048,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; diff --git a/test/battle/hold_effect/metronome.c b/test/battle/hold_effect/metronome.c index 63a0bb3eae..5b089703e9 100644 --- a/test/battle/hold_effect/metronome.c +++ b/test/battle/hold_effect/metronome.c @@ -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); @@ -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 {