Fix and rename GetMoveTargetType

Change name to GetBattlerMoveTargetType and make it actually use the battlerId argument.
This commit is contained in:
BuffelSaft 2021-11-24 12:09:54 +13:00
parent fd4414fe62
commit cca7ec8c58
10 changed files with 35 additions and 35 deletions

View File

@ -163,7 +163,7 @@ bool32 IsBattlerWeatherAffected(u8 battlerId, u32 weatherFlags);
void TryToApplyMimicry(u8 battlerId, bool8 various); void TryToApplyMimicry(u8 battlerId, bool8 various);
void TryToRevertMimicry(void); void TryToRevertMimicry(void);
void RestoreBattlerOriginalTypes(u8 battlerId); void RestoreBattlerOriginalTypes(u8 battlerId);
u32 GetMoveTargetType(u8 battlerId, u16 move); u32 GetBattlerMoveTargetType(u8 battlerId, u16 move);
// Ability checks // Ability checks
bool32 IsRolePlayBannedAbilityAtk(u16 ability); bool32 IsRolePlayBannedAbilityAtk(u16 ability);
bool32 IsRolePlayBannedAbility(u16 ability); bool32 IsRolePlayBannedAbility(u16 ability);

View File

@ -484,7 +484,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
u8 atkPriority = GetMovePriority(battlerAtk, move); u8 atkPriority = GetMovePriority(battlerAtk, move);
u16 moveEffect = gBattleMoves[move].effect; u16 moveEffect = gBattleMoves[move].effect;
s32 moveType; s32 moveType;
u16 moveTarget = GetMoveTargetType(battlerAtk, move); u16 moveTarget = GetBattlerMoveTargetType(battlerAtk, move);
u16 accuracy = AI_GetMoveAccuracy(battlerAtk, battlerDef, AI_DATA->atkAbility, AI_DATA->defAbility, AI_DATA->atkHoldEffect, AI_DATA->defHoldEffect, move); u16 accuracy = AI_GetMoveAccuracy(battlerAtk, battlerDef, AI_DATA->atkAbility, AI_DATA->defAbility, AI_DATA->atkHoldEffect, AI_DATA->defHoldEffect, move);
u8 effectiveness = AI_GetMoveEffectiveness(move, battlerAtk, battlerDef); u8 effectiveness = AI_GetMoveEffectiveness(move, battlerAtk, battlerDef);
bool32 isDoubleBattle = IsValidDoubleBattle(battlerAtk); bool32 isDoubleBattle = IsValidDoubleBattle(battlerAtk);
@ -2299,7 +2299,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
} }
else else
{ {
if (GetMoveTargetType(battlerDef, instructedMove) & (MOVE_TARGET_SELECTED if (GetBattlerMoveTargetType(battlerDef, instructedMove) & (MOVE_TARGET_SELECTED
| MOVE_TARGET_DEPENDS | MOVE_TARGET_DEPENDS
| MOVE_TARGET_RANDOM | MOVE_TARGET_RANDOM
| MOVE_TARGET_BOTH | MOVE_TARGET_BOTH
@ -2496,7 +2496,7 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
// move data // move data
u8 moveType = gBattleMoves[move].type; u8 moveType = gBattleMoves[move].type;
u16 effect = gBattleMoves[move].effect; u16 effect = gBattleMoves[move].effect;
u16 moveTarget = GetMoveTargetType(battlerAtk, move); u16 moveTarget = GetBattlerMoveTargetType(battlerAtk, move);
// ally data // ally data
u8 battlerAtkPartner = AI_DATA->battlerAtkPartner; u8 battlerAtkPartner = AI_DATA->battlerAtkPartner;
u16 atkPartnerAbility = AI_DATA->atkPartnerAbility; u16 atkPartnerAbility = AI_DATA->atkPartnerAbility;
@ -2803,7 +2803,7 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
if (instructedMove != MOVE_NONE if (instructedMove != MOVE_NONE
&& !IS_MOVE_STATUS(instructedMove) && !IS_MOVE_STATUS(instructedMove)
&& (GetMoveTargetType(battlerAtkPartner, instructedMove) & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))) // Use instruct on multi-target moves && (GetBattlerMoveTargetType(battlerAtkPartner, instructedMove) & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))) // Use instruct on multi-target moves
{ {
RETURN_SCORE_PLUS(1); RETURN_SCORE_PLUS(1);
} }
@ -3603,24 +3603,24 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
ProtectChecks(battlerAtk, battlerDef, move, predictedMove, &score); ProtectChecks(battlerAtk, battlerDef, move, predictedMove, &score);
break; break;
case MOVE_WIDE_GUARD: case MOVE_WIDE_GUARD:
if (predictedMove != MOVE_NONE && GetMoveTargetType(battlerDef, predictedMove) & (MOVE_TARGET_FOES_AND_ALLY | MOVE_TARGET_BOTH)) if (predictedMove != MOVE_NONE && GetBattlerMoveTargetType(battlerDef, predictedMove) & (MOVE_TARGET_FOES_AND_ALLY | MOVE_TARGET_BOTH))
{ {
ProtectChecks(battlerAtk, battlerDef, move, predictedMove, &score); ProtectChecks(battlerAtk, battlerDef, move, predictedMove, &score);
} }
else if (isDoubleBattle && GetMoveTargetType(AI_DATA->battlerAtkPartner, AI_DATA->partnerMove) & MOVE_TARGET_FOES_AND_ALLY) else if (isDoubleBattle && GetBattlerMoveTargetType(AI_DATA->battlerAtkPartner, AI_DATA->partnerMove) & MOVE_TARGET_FOES_AND_ALLY)
{ {
if (AI_DATA->atkAbility != ABILITY_TELEPATHY) if (AI_DATA->atkAbility != ABILITY_TELEPATHY)
ProtectChecks(battlerAtk, battlerDef, move, predictedMove, &score); ProtectChecks(battlerAtk, battlerDef, move, predictedMove, &score);
} }
break; break;
case MOVE_CRAFTY_SHIELD: case MOVE_CRAFTY_SHIELD:
if (predictedMove != MOVE_NONE && IS_MOVE_STATUS(predictedMove) && !(GetMoveTargetType(battlerDef, predictedMove) & MOVE_TARGET_USER)) if (predictedMove != MOVE_NONE && IS_MOVE_STATUS(predictedMove) && !(GetBattlerMoveTargetType(battlerDef, predictedMove) & MOVE_TARGET_USER))
ProtectChecks(battlerAtk, battlerDef, move, predictedMove, &score); ProtectChecks(battlerAtk, battlerDef, move, predictedMove, &score);
break; break;
case MOVE_MAT_BLOCK: case MOVE_MAT_BLOCK:
if (gDisableStructs[battlerAtk].isFirstTurn && predictedMove != MOVE_NONE if (gDisableStructs[battlerAtk].isFirstTurn && predictedMove != MOVE_NONE
&& !IS_MOVE_STATUS(predictedMove) && !(GetMoveTargetType(battlerDef, predictedMove) & MOVE_TARGET_USER)) && !IS_MOVE_STATUS(predictedMove) && !(GetBattlerMoveTargetType(battlerDef, predictedMove) & MOVE_TARGET_USER))
ProtectChecks(battlerAtk, battlerDef, move, predictedMove, &score); ProtectChecks(battlerAtk, battlerDef, move, predictedMove, &score);
break; break;
case MOVE_KINGS_SHIELD: case MOVE_KINGS_SHIELD:
@ -4065,7 +4065,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
score += 10; score += 10;
break; break;
case EFFECT_MAGIC_COAT: case EFFECT_MAGIC_COAT:
if (IS_MOVE_STATUS(predictedMove) && GetMoveTargetType(battlerDef, predictedMove) & (MOVE_TARGET_SELECTED | MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_BOTH)) if (IS_MOVE_STATUS(predictedMove) && GetBattlerMoveTargetType(battlerDef, predictedMove) & (MOVE_TARGET_SELECTED | MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_BOTH))
score += 3; score += 3;
break; break;
case EFFECT_RECYCLE: case EFFECT_RECYCLE:

View File

@ -1921,7 +1921,7 @@ bool32 HasMoveWithLowAccuracy(u8 battlerAtk, u8 battlerDef, u8 accCheck, bool32
if (ignoreStatus && IS_MOVE_STATUS(moves[i])) if (ignoreStatus && IS_MOVE_STATUS(moves[i]))
continue; continue;
else if ((!IS_MOVE_STATUS(moves[i]) && gBattleMoves[moves[i]].accuracy == 0) else if ((!IS_MOVE_STATUS(moves[i]) && gBattleMoves[moves[i]].accuracy == 0)
|| GetMoveTargetType(battlerAtk, moves[i]) & (MOVE_TARGET_USER | MOVE_TARGET_OPPONENTS_FIELD)) || GetBattlerMoveTargetType(battlerAtk, moves[i]) & (MOVE_TARGET_USER | MOVE_TARGET_OPPONENTS_FIELD))
continue; continue;
if (AI_GetMoveAccuracy(battlerAtk, battlerDef, atkAbility, defAbility, atkHoldEffect, defHoldEffect, moves[i]) <= accCheck) if (AI_GetMoveAccuracy(battlerAtk, battlerDef, atkAbility, defAbility, atkHoldEffect, defHoldEffect, moves[i]) <= accCheck)
return TRUE; return TRUE;

View File

@ -2195,7 +2195,7 @@ void DoMoveAnim(u16 move)
gBattleAnimAttacker = gBattlerAttacker; gBattleAnimAttacker = gBattlerAttacker;
gBattleAnimTarget = gBattlerTarget; gBattleAnimTarget = gBattlerTarget;
// Make sure the anim target of moves hitting everyone is at the opposite side. // Make sure the anim target of moves hitting everyone is at the opposite side.
if (GetMoveTargetType(gBattlerAttacker, move) & MOVE_TARGET_FOES_AND_ALLY && IsDoubleBattle()) if (GetBattlerMoveTargetType(gBattlerAttacker, move) & MOVE_TARGET_FOES_AND_ALLY && IsDoubleBattle())
{ {
while (GET_BATTLER_SIDE(gBattleAnimAttacker) == GET_BATTLER_SIDE(gBattleAnimTarget)) while (GET_BATTLER_SIDE(gBattleAnimAttacker) == GET_BATTLER_SIDE(gBattleAnimTarget))
{ {

View File

@ -1574,9 +1574,9 @@ static void OpponentHandleChooseAction(void)
BtlController_EmitTwoReturnValues(1, B_ACTION_RUN, 0); BtlController_EmitTwoReturnValues(1, B_ACTION_RUN, 0);
break; break;
default: default:
if (GetMoveTargetType(gActiveBattler, moveInfo.moves[chosenMoveId]) & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER)) if (GetBattlerMoveTargetType(gActiveBattler, moveInfo.moves[chosenMoveId]) & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER))
gBattlerTarget = gActiveBattler; gBattlerTarget = gActiveBattler;
if (GetMoveTargetType(gActiveBattler, moveInfo.moves[chosenMoveId]) & MOVE_TARGET_BOTH) if (GetBattlerMoveTargetType(gActiveBattler, moveInfo.moves[chosenMoveId]) & MOVE_TARGET_BOTH)
{ {
gBattlerTarget = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); gBattlerTarget = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
if (gAbsentBattlerFlags & gBitTable[gBattlerTarget]) if (gAbsentBattlerFlags & gBitTable[gBattlerTarget])
@ -1600,7 +1600,7 @@ static void OpponentHandleChooseAction(void)
move = moveInfo.moves[chosenMoveId]; move = moveInfo.moves[chosenMoveId];
} while (move == MOVE_NONE); } while (move == MOVE_NONE);
if (GetMoveTargetType(gActiveBattler, move) & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER)) if (GetBattlerMoveTargetType(gActiveBattler, move) & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER))
BtlController_EmitTwoReturnValues(1, B_ACTION_USE_MOVE, (chosenMoveId) | (gActiveBattler << 8)); BtlController_EmitTwoReturnValues(1, B_ACTION_USE_MOVE, (chosenMoveId) | (gActiveBattler << 8));
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
BtlController_EmitTwoReturnValues(1, B_ACTION_USE_MOVE, (chosenMoveId) | (GetBattlerAtPosition(Random() & 2) << 8)); BtlController_EmitTwoReturnValues(1, B_ACTION_USE_MOVE, (chosenMoveId) | (GetBattlerAtPosition(Random() & 2) << 8));

View File

@ -360,7 +360,7 @@ static void HandleInputChooseTarget(void)
s32 i; s32 i;
static const u8 identities[MAX_BATTLERS_COUNT] = {B_POSITION_PLAYER_LEFT, B_POSITION_PLAYER_RIGHT, B_POSITION_OPPONENT_RIGHT, B_POSITION_OPPONENT_LEFT}; static const u8 identities[MAX_BATTLERS_COUNT] = {B_POSITION_PLAYER_LEFT, B_POSITION_PLAYER_RIGHT, B_POSITION_OPPONENT_RIGHT, B_POSITION_OPPONENT_LEFT};
u16 move = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBattler]); u16 move = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBattler]);
u16 moveTarget = GetMoveTargetType(gActiveBattler, move); u16 moveTarget = GetBattlerMoveTargetType(gActiveBattler, move);
DoBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX, 15, 1); DoBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX, 15, 1);
for (i = 0; i < gBattlersCount; i++) for (i = 0; i < gBattlersCount; i++)
@ -612,7 +612,7 @@ static void HandleInputChooseMove(void)
} }
else else
{ {
moveTarget = GetMoveTargetType(gActiveBattler, moveInfo->moves[gMoveSelectionCursor[gActiveBattler]]); moveTarget = GetBattlerMoveTargetType(gActiveBattler, moveInfo->moves[gMoveSelectionCursor[gActiveBattler]]);
} }
if (moveTarget & MOVE_TARGET_USER) if (moveTarget & MOVE_TARGET_USER)

View File

@ -251,7 +251,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
} }
else else
{ {
moveTarget = GetMoveTargetType(gActiveBattler, moveInfo->moves[chosenMoveId]); moveTarget = GetBattlerMoveTargetType(gActiveBattler, moveInfo->moves[chosenMoveId]);
} }
if (moveTarget & MOVE_TARGET_USER) if (moveTarget & MOVE_TARGET_USER)
@ -275,7 +275,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
static u8 GetBattlePalaceMoveGroup(u8 battlerId, u16 move) static u8 GetBattlePalaceMoveGroup(u8 battlerId, u16 move)
{ {
switch (GetMoveTargetType(battlerId, move)) switch (GetBattlerMoveTargetType(battlerId, move))
{ {
case MOVE_TARGET_SELECTED: case MOVE_TARGET_SELECTED:
case MOVE_TARGET_USER_OR_SELECTED: case MOVE_TARGET_USER_OR_SELECTED:

View File

@ -1318,7 +1318,7 @@ static bool32 NoTargetPresent(u8 battlerId, u32 move)
if (!IsBattlerAlive(gBattlerTarget)) if (!IsBattlerAlive(gBattlerTarget))
gBattlerTarget = GetMoveTarget(move, 0); gBattlerTarget = GetMoveTarget(move, 0);
switch (GetMoveTargetType(battlerId, move)) switch (GetBattlerMoveTargetType(battlerId, move))
{ {
case MOVE_TARGET_SELECTED: case MOVE_TARGET_SELECTED:
case MOVE_TARGET_DEPENDS: case MOVE_TARGET_DEPENDS:
@ -1741,7 +1741,7 @@ u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move)
static void Cmd_accuracycheck(void) static void Cmd_accuracycheck(void)
{ {
u16 type, move = T2_READ_16(gBattlescriptCurrInstr + 5); u16 type, move = T2_READ_16(gBattlescriptCurrInstr + 5);
u16 moveTarget = GetMoveTargetType(gBattlerAttacker, move); u16 moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, move);
if (move == ACC_CURR_MOVE) if (move == ACC_CURR_MOVE)
move = gCurrentMove; move = gCurrentMove;
@ -1805,7 +1805,7 @@ static void Cmd_ppreduce(void)
if (!gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure) if (!gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure)
{ {
switch (GetMoveTargetType(gBattlerAttacker, gCurrentMove)) switch (GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove))
{ {
case MOVE_TARGET_FOES_AND_ALLY: case MOVE_TARGET_FOES_AND_ALLY:
for (i = 0; i < gBattlersCount; i++) for (i = 0; i < gBattlersCount; i++)
@ -2104,7 +2104,7 @@ static void Cmd_multihitresultmessage(void)
static void Cmd_attackanimation(void) static void Cmd_attackanimation(void)
{ {
u16 moveTarget = GetMoveTargetType(gBattlerAttacker, gCurrentMove); u16 moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove);
if (gBattleControllerExecFlags) if (gBattleControllerExecFlags)
return; return;
@ -5241,7 +5241,7 @@ static void Cmd_moveend(void)
break; break;
case MOVEEND_NEXT_TARGET: // For moves hitting two opposing Pokemon. case MOVEEND_NEXT_TARGET: // For moves hitting two opposing Pokemon.
{ {
u16 moveTarget = GetMoveTargetType(gBattlerAttacker, gCurrentMove); u16 moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove);
// Set a flag if move hits either target (for throat spray that can't check damage) // Set a flag if move hits either target (for throat spray that can't check damage)
if (!(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE) if (!(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE)
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
@ -9522,7 +9522,7 @@ static void Cmd_jumpifnexttargetvalid(void)
for (gBattlerTarget++; gBattlerTarget < gBattlersCount; gBattlerTarget++) for (gBattlerTarget++; gBattlerTarget < gBattlersCount; gBattlerTarget++)
{ {
if (gBattlerTarget == gBattlerAttacker && !(GetMoveTargetType(gBattlerAttacker, gCurrentMove) & MOVE_TARGET_USER)) if (gBattlerTarget == gBattlerAttacker && !(GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove) & MOVE_TARGET_USER))
continue; continue;
if (IsBattlerAlive(gBattlerTarget)) if (IsBattlerAlive(gBattlerTarget))
break; break;
@ -12018,7 +12018,7 @@ static void Cmd_selectfirstvalidtarget(void)
{ {
for (gBattlerTarget = 0; gBattlerTarget < gBattlersCount; gBattlerTarget++) for (gBattlerTarget = 0; gBattlerTarget < gBattlersCount; gBattlerTarget++)
{ {
if (gBattlerTarget == gBattlerAttacker && !(GetMoveTargetType(gBattlerAttacker, gCurrentMove) & MOVE_TARGET_USER)) if (gBattlerTarget == gBattlerAttacker && !(GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove) & MOVE_TARGET_USER))
continue; continue;
if (IsBattlerAlive(gBattlerTarget)) if (IsBattlerAlive(gBattlerTarget))
break; break;

View File

@ -237,7 +237,7 @@ bool32 IsAffectedByFollowMe(u32 battlerAtk, u32 defSide, u32 move)
void HandleAction_UseMove(void) void HandleAction_UseMove(void)
{ {
u32 i, side, moveType, var = 4; u32 i, side, moveType, var = 4;
u16 moveTarget = GetMoveTargetType(gBattlerAttacker, gCurrentMove); u16 moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove);
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber]; gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
if (gBattleStruct->field_91 & gBitTable[gBattlerAttacker] || !IsBattlerAlive(gBattlerAttacker)) if (gBattleStruct->field_91 & gBitTable[gBattlerAttacker] || !IsBattlerAlive(gBattlerAttacker))
@ -4674,7 +4674,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
break; break;
case ABILITYEFFECT_MOVES_BLOCK: // 2 case ABILITYEFFECT_MOVES_BLOCK: // 2
{ {
u16 moveTarget = GetMoveTargetType(battler, move); u16 moveTarget = GetBattlerMoveTargetType(battler, move);
if ((gLastUsedAbility == ABILITY_SOUNDPROOF && gBattleMoves[move].flags & FLAG_SOUND && !(moveTarget & MOVE_TARGET_USER)) if ((gLastUsedAbility == ABILITY_SOUNDPROOF && gBattleMoves[move].flags & FLAG_SOUND && !(moveTarget & MOVE_TARGET_USER))
|| (gLastUsedAbility == ABILITY_BULLETPROOF && gBattleMoves[move].flags & FLAG_BALLISTIC)) || (gLastUsedAbility == ABILITY_BULLETPROOF && gBattleMoves[move].flags & FLAG_BALLISTIC))
@ -7265,7 +7265,7 @@ u32 GetMoveTarget(u16 move, u8 setTarget)
if (setTarget) if (setTarget)
moveTarget = setTarget - 1; moveTarget = setTarget - 1;
else else
moveTarget = GetMoveTargetType(gBattlerAttacker, move); moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, move);
// Special cases // Special cases
if (move == MOVE_CURSE && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_GHOST)) if (move == MOVE_CURSE && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_GHOST))
@ -7538,7 +7538,7 @@ bool32 IsBattlerProtected(u8 battlerId, u16 move)
else if (gProtectStructs[battlerId].protected) else if (gProtectStructs[battlerId].protected)
return TRUE; return TRUE;
else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_WIDE_GUARD else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_WIDE_GUARD
&& GetMoveTargetType(gBattlerAttacker, move) & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY)) && GetBattlerMoveTargetType(gBattlerAttacker, move) & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))
return TRUE; return TRUE;
else if (gProtectStructs[battlerId].banefulBunkered) else if (gProtectStructs[battlerId].banefulBunkered)
return TRUE; return TRUE;
@ -7664,7 +7664,7 @@ u32 CountBattlerStatIncreases(u8 battlerId, bool32 countEvasionAcc)
u32 GetMoveTargetCount(u16 move, u8 battlerAtk, u8 battlerDef) u32 GetMoveTargetCount(u16 move, u8 battlerAtk, u8 battlerDef)
{ {
switch (GetMoveTargetType(gBattlerAttacker, move)) switch (GetBattlerMoveTargetType(gBattlerAttacker, move))
{ {
case MOVE_TARGET_BOTH: case MOVE_TARGET_BOTH:
return IsBattlerAlive(battlerDef) return IsBattlerAlive(battlerDef)
@ -9828,7 +9828,7 @@ bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 chec
return FALSE; return FALSE;
if (GetBattlerSide(battlerPrankster) == GetBattlerSide(battlerDef)) if (GetBattlerSide(battlerPrankster) == GetBattlerSide(battlerDef))
return FALSE; return FALSE;
if (checkTarget && (GetMoveTargetType(battlerPrankster, move) & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS))) if (checkTarget && (GetBattlerMoveTargetType(battlerPrankster, move) & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS)))
return FALSE; return FALSE;
if (!IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK)) if (!IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK))
return FALSE; return FALSE;
@ -9863,12 +9863,12 @@ bool32 IsBattlerWeatherAffected(u8 battlerId, u32 weatherFlags)
// Gets move target before redirection effects etc. are applied // Gets move target before redirection effects etc. are applied
// Possible return values are defined in battle.h following MOVE_TARGET_SELECTED // Possible return values are defined in battle.h following MOVE_TARGET_SELECTED
u32 GetMoveTargetType(u8 battlerId, u16 move) u32 GetBattlerMoveTargetType(u8 battlerId, u16 move)
{ {
u32 target; u32 target;
if (gBattleMoves[move].effect == EFFECT_EXPANDING_FORCE if (gBattleMoves[move].effect == EFFECT_EXPANDING_FORCE
&& IsBattlerTerrainAffected(gActiveBattler, STATUS_FIELD_PSYCHIC_TERRAIN)) && IsBattlerTerrainAffected(battlerId, STATUS_FIELD_PSYCHIC_TERRAIN))
return MOVE_TARGET_BOTH; return MOVE_TARGET_BOTH;
else else
return gBattleMoves[move].target; return gBattleMoves[move].target;

View File

@ -5388,7 +5388,7 @@ static void SetBattleTargetSpritePosition(void)
static void SetMoveTargetPosition(u16 move) static void SetMoveTargetPosition(u16 move)
{ {
switch (GetMoveTargetType(gBattlerAttacker, move)) switch (GetBattlerMoveTargetType(gBattlerAttacker, move))
{ {
case MOVE_TARGET_USER_OR_SELECTED: case MOVE_TARGET_USER_OR_SELECTED:
case MOVE_TARGET_USER: case MOVE_TARGET_USER: