Add func GetChosenMoveFromPosition (#7810)
This commit is contained in:
parent
1518c7a207
commit
b2c5a82003
@ -1246,4 +1246,9 @@ static inline bool32 IsBattlerInvalidForSpreadMove(u32 battlerAtk, u32 battlerDe
|
|||||||
|| (battlerDef == BATTLE_PARTNER(battlerAtk) && (moveTarget == MOVE_TARGET_BOTH));
|
|| (battlerDef == BATTLE_PARTNER(battlerAtk) && (moveTarget == MOVE_TARGET_BOTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline u32 GetChosenMoveFromPosition(u32 battler)
|
||||||
|
{
|
||||||
|
return gBattleMons[battler].moves[gBattleStruct->chosenMovePositions[battler]];
|
||||||
|
}
|
||||||
|
|
||||||
#endif // GUARD_BATTLE_H
|
#endif // GUARD_BATTLE_H
|
||||||
|
|||||||
@ -3983,7 +3983,7 @@ u32 GetAllyChosenMove(u32 battlerId)
|
|||||||
else if (partnerBattler > battlerId) // Battler with the lower id chooses the move first.
|
else if (partnerBattler > battlerId) // Battler with the lower id chooses the move first.
|
||||||
return gLastMoves[partnerBattler];
|
return gLastMoves[partnerBattler];
|
||||||
else
|
else
|
||||||
return gBattleMons[partnerBattler].moves[gBattleStruct->chosenMovePositions[partnerBattler]];
|
return GetChosenMoveFromPosition(partnerBattler);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 AreMovesEquivalent(u32 battlerAtk, u32 battlerAtkPartner, u32 move, u32 partnerMove)
|
bool32 AreMovesEquivalent(u32 battlerAtk, u32 battlerAtkPartner, u32 move, u32 partnerMove)
|
||||||
|
|||||||
@ -1990,7 +1990,7 @@ static void PlayerHandleChooseAction(u32 battler)
|
|||||||
if (B_SHOW_PARTNER_TARGET && gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && IsBattlerAlive(B_POSITION_PLAYER_RIGHT))
|
if (B_SHOW_PARTNER_TARGET && gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && IsBattlerAlive(B_POSITION_PLAYER_RIGHT))
|
||||||
{
|
{
|
||||||
StringCopy(gStringVar1, COMPOUND_STRING("Partner will use:\n"));
|
StringCopy(gStringVar1, COMPOUND_STRING("Partner will use:\n"));
|
||||||
u32 move = gBattleMons[B_POSITION_PLAYER_RIGHT].moves[gBattleStruct->chosenMovePositions[B_POSITION_PLAYER_RIGHT]];
|
u32 move = GetChosenMoveFromPosition(B_POSITION_PLAYER_RIGHT);
|
||||||
StringAppend(gStringVar1, GetMoveName(move));
|
StringAppend(gStringVar1, GetMoveName(move));
|
||||||
u32 moveTarget = GetBattlerMoveTargetType(B_POSITION_PLAYER_RIGHT, move);
|
u32 moveTarget = GetBattlerMoveTargetType(B_POSITION_PLAYER_RIGHT, move);
|
||||||
if (moveTarget == MOVE_TARGET_SELECTED)
|
if (moveTarget == MOVE_TARGET_SELECTED)
|
||||||
|
|||||||
@ -4500,7 +4500,7 @@ static void HandleTurnActionSelectionState(void)
|
|||||||
|
|
||||||
// Get the chosen move position (and thus the chosen move) and target from the returned buffer.
|
// Get the chosen move position (and thus the chosen move) and target from the returned buffer.
|
||||||
gBattleStruct->chosenMovePositions[battler] = gBattleResources->bufferB[battler][2] & ~RET_GIMMICK;
|
gBattleStruct->chosenMovePositions[battler] = gBattleResources->bufferB[battler][2] & ~RET_GIMMICK;
|
||||||
gChosenMoveByBattler[battler] = gBattleMons[battler].moves[gBattleStruct->chosenMovePositions[battler]];
|
gChosenMoveByBattler[battler] = GetChosenMoveFromPosition(battler);
|
||||||
gBattleStruct->moveTarget[battler] = gBattleResources->bufferB[battler][3];
|
gBattleStruct->moveTarget[battler] = gBattleResources->bufferB[battler][3];
|
||||||
if (IsBattleMoveStatus(gChosenMoveByBattler[battler]) && GetBattlerAbility(battler) == ABILITY_MYCELIUM_MIGHT)
|
if (IsBattleMoveStatus(gChosenMoveByBattler[battler]) && GetBattlerAbility(battler) == ABILITY_MYCELIUM_MIGHT)
|
||||||
gProtectStructs[battler].myceliumMight = TRUE;
|
gProtectStructs[battler].myceliumMight = TRUE;
|
||||||
@ -4514,7 +4514,7 @@ static void HandleTurnActionSelectionState(void)
|
|||||||
// Max Move check
|
// Max Move check
|
||||||
if (GetActiveGimmick(battler) == GIMMICK_DYNAMAX || IsGimmickSelected(battler, GIMMICK_DYNAMAX))
|
if (GetActiveGimmick(battler) == GIMMICK_DYNAMAX || IsGimmickSelected(battler, GIMMICK_DYNAMAX))
|
||||||
{
|
{
|
||||||
gBattleStruct->dynamax.baseMoves[battler] = gBattleMons[battler].moves[gBattleStruct->chosenMovePositions[battler]];
|
gBattleStruct->dynamax.baseMoves[battler] = GetChosenMoveFromPosition(battler);
|
||||||
}
|
}
|
||||||
gBattleCommunication[battler]++;
|
gBattleCommunication[battler]++;
|
||||||
|
|
||||||
@ -4824,7 +4824,7 @@ s32 GetChosenMovePriority(u32 battler, u32 ability)
|
|||||||
if (gProtectStructs[battler].noValidMoves)
|
if (gProtectStructs[battler].noValidMoves)
|
||||||
move = MOVE_STRUGGLE;
|
move = MOVE_STRUGGLE;
|
||||||
else
|
else
|
||||||
move = gBattleMons[battler].moves[gBattleStruct->chosenMovePositions[battler]];
|
move = GetChosenMoveFromPosition(battler);
|
||||||
|
|
||||||
return GetBattleMovePriority(battler, ability, move);
|
return GetBattleMovePriority(battler, ability, move);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15084,7 +15084,7 @@ void BS_SetPledge(void)
|
|||||||
NATIVE_ARGS(const u8 *jumpInstr);
|
NATIVE_ARGS(const u8 *jumpInstr);
|
||||||
|
|
||||||
u32 partner = BATTLE_PARTNER(gBattlerAttacker);
|
u32 partner = BATTLE_PARTNER(gBattlerAttacker);
|
||||||
u32 partnerMove = gBattleMons[partner].moves[gBattleStruct->chosenMovePositions[partner]];
|
u32 partnerMove = GetChosenMoveFromPosition(partner);
|
||||||
u32 i = 0;
|
u32 i = 0;
|
||||||
u32 k = 0;
|
u32 k = 0;
|
||||||
|
|
||||||
|
|||||||
@ -1905,7 +1905,7 @@ static inline bool32 TryFormChangeBeforeMove(void)
|
|||||||
|
|
||||||
static inline bool32 TryActivatePowderStatus(u32 move)
|
static inline bool32 TryActivatePowderStatus(u32 move)
|
||||||
{
|
{
|
||||||
u32 partnerMove = gBattleMons[BATTLE_PARTNER(gBattlerAttacker)].moves[gBattleStruct->chosenMovePositions[BATTLE_PARTNER(gBattlerAttacker)]];
|
u32 partnerMove = GetChosenMoveFromPosition(BATTLE_PARTNER(gBattlerAttacker));
|
||||||
if (!gBattleMons[gBattlerAttacker].volatiles.powder)
|
if (!gBattleMons[gBattlerAttacker].volatiles.powder)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (GetBattleMoveType(move) == TYPE_FIRE && !gBattleStruct->pledgeMove)
|
if (GetBattleMoveType(move) == TYPE_FIRE && !gBattleStruct->pledgeMove)
|
||||||
@ -2641,7 +2641,7 @@ static enum MoveCanceller CancellerMoveFailure(struct BattleContext *ctx)
|
|||||||
break;
|
break;
|
||||||
case EFFECT_SUCKER_PUNCH:
|
case EFFECT_SUCKER_PUNCH:
|
||||||
if (HasBattlerActedThisTurn(ctx->battlerDef)
|
if (HasBattlerActedThisTurn(ctx->battlerDef)
|
||||||
|| (IsBattleMoveStatus(gBattleMons[ctx->battlerDef].moves[gBattleStruct->chosenMovePositions[ctx->battlerDef]]) && !gProtectStructs[ctx->battlerDef].noValidMoves))
|
|| (IsBattleMoveStatus(GetChosenMoveFromPosition(ctx->battlerDef)) && !gProtectStructs[ctx->battlerDef].noValidMoves))
|
||||||
battleScript = BattleScript_ButItFailed;
|
battleScript = BattleScript_ButItFailed;
|
||||||
break;
|
break;
|
||||||
case EFFECT_SNORE:
|
case EFFECT_SNORE:
|
||||||
@ -8565,7 +8565,7 @@ static inline u32 CalcMoveBasePower(struct DamageContext *ctx)
|
|||||||
basePower = uq4_12_multiply(basePower, UQ_4_12(1.5));
|
basePower = uq4_12_multiply(basePower, UQ_4_12(1.5));
|
||||||
break;
|
break;
|
||||||
case EFFECT_MAX_MOVE:
|
case EFFECT_MAX_MOVE:
|
||||||
basePower = GetMaxMovePower(gBattleMons[battlerAtk].moves[gBattleStruct->chosenMovePositions[battlerAtk]]);
|
basePower = GetMaxMovePower(GetChosenMoveFromPosition(battlerAtk));
|
||||||
break;
|
break;
|
||||||
case EFFECT_RAGE_FIST:
|
case EFFECT_RAGE_FIST:
|
||||||
basePower += 50 * GetBattlerPartyState(battlerAtk)->timesGotHit;
|
basePower += 50 * GetBattlerPartyState(battlerAtk)->timesGotHit;
|
||||||
@ -12355,7 +12355,7 @@ static u32 GetCopyCatMove(void)
|
|||||||
|
|
||||||
static u32 GetMeFirstMove(void)
|
static u32 GetMeFirstMove(void)
|
||||||
{
|
{
|
||||||
u32 move = gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]];
|
u32 move = GetChosenMoveFromPosition(gBattlerTarget);
|
||||||
|
|
||||||
if (IsBattleMoveStatus(move)
|
if (IsBattleMoveStatus(move)
|
||||||
|| IsMoveMeFirstBanned(move)
|
|| IsMoveMeFirstBanned(move)
|
||||||
|
|||||||
@ -779,7 +779,7 @@ void RecordedBattle_CheckMovesetChanges(u8 mode)
|
|||||||
|
|
||||||
SetMonData(mon, MON_DATA_PP_BONUSES, &ppBonusSet);
|
SetMonData(mon, MON_DATA_PP_BONUSES, &ppBonusSet);
|
||||||
}
|
}
|
||||||
gChosenMoveByBattler[battler] = gBattleMons[battler].moves[gBattleStruct->chosenMovePositions[battler]];
|
gChosenMoveByBattler[battler] = GetChosenMoveFromPosition(battler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user