Attackstring hitmarker clean up (#8136)

This commit is contained in:
Alex 2025-11-04 19:35:48 +01:00 committed by GitHub
parent 80b5d81a9a
commit 41aba41838
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 22 deletions

View File

@ -3013,7 +3013,6 @@ BattleScript_PowerHerbActivation:
BattleScript_EffectTwoTurnsAttack::
jumpifvolatile BS_ATTACKER, VOLATILE_MULTIPLETURNS, BattleScript_TwoTurnMovesSecondTurn
tryfiretwoturnmovewithoutcharging BS_ATTACKER, BattleScript_EffectHit @ e.g. Solar Beam
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_ATTACKSTRING_PRINTED, BattleScript_EffectHit @ if it's not the first hit
call BattleScript_FirstChargingTurn
tryfiretwoturnmoveaftercharging BS_ATTACKER, BattleScript_TwoTurnMovesSecondTurn @ e.g. Electro Shot
jumpifholdeffect BS_ATTACKER, HOLD_EFFECT_POWER_HERB, BattleScript_TwoTurnMovesSecondPowerHerbActivates, TRUE

View File

@ -246,10 +246,9 @@ enum SemiInvulnerableExclusion
EXCLUDE_COMMANDER,
};
#define HITMARKER_DESTINYBOND (1 << 6)
#define HITMARKER_NO_ANIMATIONS (1 << 7) // set from battleSceneOff. Never changed during battle
#define HITMARKER_UNUSED_8 (1 << 8)
#define HITMARKER_ATTACKSTRING_PRINTED (1 << 9)
#define HITMARKER_UNUSED_9 (1 << 9)
#define HITMARKER_UNUSED_10 (1 << 10)
#define HITMARKER_UNUSED_11 (1 << 11)
#define HITMARKER_UNUSED_12 (1 << 12)

View File

@ -4006,7 +4006,6 @@ void BattleTurnPassed(void)
TurnValuesCleanUp(FALSE);
gHitMarker &= ~HITMARKER_UNABLE_TO_USE_MOVE;
gHitMarker &= ~HITMARKER_ATTACKSTRING_PRINTED;
gHitMarker &= ~HITMARKER_PLAYER_FAINTED;
gBattleScripting.animTurn = 0;
gBattleScripting.animTargetsHit = 0;
@ -5408,10 +5407,7 @@ static void RunTurnActionsFunctions(void)
else
{
if (gBattleStruct->savedTurnActionNumber != gCurrentTurnActionNumber) // action turn has been done, clear hitmarker bits for another battler
{
gHitMarker &= ~HITMARKER_ATTACKSTRING_PRINTED;
gHitMarker &= ~HITMARKER_UNABLE_TO_USE_MOVE;
}
}
}

View File

@ -6314,13 +6314,6 @@ static void Cmd_moveend(void)
{
gDisableStructs[gBattlerAttacker].usedMoves |= 1u << gCurrMovePos;
gBattleStruct->lastMoveTarget[gBattlerAttacker] = gBattlerTarget;
if (gHitMarker & HITMARKER_ATTACKSTRING_PRINTED)
{
gLastPrintedMoves[gBattlerAttacker] = gChosenMove;
gLastUsedMove = gCurrentMove;
if (IsMaxMove(gCurrentMove))
gBattleStruct->dynamax.lastUsedBaseMove = gBattleStruct->dynamax.baseMoves[gBattlerAttacker];
}
}
enum BattleMoveEffects originalEffect = GetMoveEffect(originallyUsedMove);
if (!(gAbsentBattlerFlags & (1u << gBattlerAttacker))
@ -6356,6 +6349,12 @@ static void Cmd_moveend(void)
{
gLastLandedMoves[gBattlerTarget] = gCurrentMove;
gLastHitByType[gBattlerTarget] = GetBattleMoveType(gCurrentMove);
if (!gSpecialStatuses[gBattlerAttacker].dancerUsedMove)
{
gLastUsedMove = gCurrentMove;
if (IsMaxMove(gCurrentMove))
gBattleStruct->dynamax.lastUsedBaseMove = gBattleStruct->dynamax.baseMoves[gBattlerAttacker];
}
}
}
else
@ -6431,7 +6430,8 @@ static void Cmd_moveend(void)
if (moveEffect == EFFECT_EXPLOSION
|| moveEffect == EFFECT_MISTY_EXPLOSION
|| moveEffect == EFFECT_MAGNITUDE
|| moveEffect == EFFECT_SYNCHRONOISE)
|| moveEffect == EFFECT_SYNCHRONOISE
|| gBattleMoveEffects[moveEffect].battleScript == BattleScript_EffectTwoTurnsAttack)
BattleScriptPush(gBattleMoveEffects[EFFECT_HIT].battleScript);
else
BattleScriptPush(GetMoveBattleScript(gCurrentMove));

View File

@ -914,9 +914,7 @@ void HandleAction_NothingIsFainted(void)
gCurrentTurnActionNumber++;
gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber];
gBattleStruct->synchronizeMoveEffect = MOVE_EFFECT_NONE;
gHitMarker &= ~(HITMARKER_ATTACKSTRING_PRINTED
| HITMARKER_STATUS_ABILITY_EFFECT
| HITMARKER_OBEYS);
gHitMarker &= ~(HITMARKER_STATUS_ABILITY_EFFECT | HITMARKER_OBEYS);
}
void HandleAction_ActionFinished(void)
@ -927,9 +925,7 @@ void HandleAction_ActionFinished(void)
gCurrentTurnActionNumber++;
gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber];
memset(&gSpecialStatuses, 0, sizeof(gSpecialStatuses));
gHitMarker &= ~(HITMARKER_ATTACKSTRING_PRINTED
| HITMARKER_STATUS_ABILITY_EFFECT
| HITMARKER_OBEYS);
gHitMarker &= ~(HITMARKER_STATUS_ABILITY_EFFECT | HITMARKER_OBEYS);
ClearDamageCalcResults();
gCurrentMove = 0;
@ -2475,8 +2471,9 @@ static enum MoveCanceller CancellerStanceChangeTwo(struct BattleContext *ctx)
static enum MoveCanceller CancellerAttackstring(struct BattleContext *ctx)
{
gHitMarker |= HITMARKER_ATTACKSTRING_PRINTED;
BattleScriptCall(BattleScript_Attackstring);
if (!gSpecialStatuses[gBattlerAttacker].dancerUsedMove)
gLastPrintedMoves[gBattlerAttacker] = gChosenMove;
return MOVE_STEP_BREAK;
}