Skip to content

Commit

Permalink
same lists for healing moves (#3787)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex <[email protected]>
  • Loading branch information
DizzyEggg and AlexOn1ine authored Dec 21, 2023
1 parent fcdc515 commit cd0b4db
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 30 deletions.
2 changes: 1 addition & 1 deletion include/battle_ai_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ bool32 ShouldSetSnow(u32 battler, u32 ability, u32 holdEffect);
bool32 ShouldSetRain(u32 battlerAtk, u32 ability, u32 holdEffect);
bool32 ShouldSetSun(u32 battlerAtk, u32 atkAbility, u32 holdEffect);
bool32 HasSleepMoveWithLowAccuracy(u32 battlerAtk, u32 battlerDef);
bool32 IsHealingMoveEffect(u32 effect);
bool32 IsHealingMove(u32 move);
bool32 HasHealingEffect(u32 battler);
bool32 IsTrappingMoveEffect(u32 effect);
bool32 HasTrappingMoveEffect(u32 battler);
Expand Down
2 changes: 1 addition & 1 deletion src/battle_ai_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4715,7 +4715,7 @@ static s32 AI_CheckViability(u32 battlerAtk, u32 battlerDef, u32 move, s32 score
ADJUST_SCORE(3);
break;
case EFFECT_HEAL_BLOCK:
if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER && predictedMove != MOVE_NONE && IsHealingMoveEffect(gBattleMoves[predictedMove].effect))
if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER && predictedMove != MOVE_NONE && IsHealingMove(predictedMove))
ADJUST_SCORE(3); // Try to cancel healing move
else if (HasHealingEffect(battlerDef) || aiData->holdEffects[battlerDef] == HOLD_EFFECT_LEFTOVERS
|| (aiData->holdEffects[battlerDef] == HOLD_EFFECT_BLACK_SLUDGE && IS_BATTLER_OF_TYPE(battlerDef, TYPE_POISON)))
Expand Down
25 changes: 3 additions & 22 deletions src/battle_ai_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -2017,28 +2017,9 @@ bool32 HasSleepMoveWithLowAccuracy(u32 battlerAtk, u32 battlerDef)
return FALSE;
}

bool32 IsHealingMoveEffect(u32 effect)
bool32 IsHealingMove(u32 move)
{
switch (effect)
{
case EFFECT_RESTORE_HP:
case EFFECT_MORNING_SUN:
case EFFECT_SYNTHESIS:
case EFFECT_MOONLIGHT:
case EFFECT_SOFTBOILED:
case EFFECT_ROOST:
case EFFECT_SWALLOW:
case EFFECT_WISH:
case EFFECT_HEALING_WISH:
case EFFECT_HEAL_PULSE:
case EFFECT_REST:
case EFFECT_JUNGLE_HEALING:
case EFFECT_ABSORB:
case EFFECT_DREAM_EATER:
return TRUE;
default:
return FALSE;
}
return gBattleMoves[move].healBlockBanned;
}

bool32 HasHealingEffect(u32 battlerId)
Expand All @@ -2048,7 +2029,7 @@ bool32 HasHealingEffect(u32 battlerId)

for (i = 0; i < MAX_MON_MOVES; i++)
{
if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE && IsHealingMoveEffect(gBattleMoves[moves[i]].effect))
if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE && IsHealingMove(moves[i]))
return TRUE;
}

Expand Down
10 changes: 5 additions & 5 deletions src/battle_dome.c
Original file line number Diff line number Diff line change
Expand Up @@ -3928,12 +3928,12 @@ static u8 Task_GetInfoCardInput(u8 taskId)

#undef tUsingAlternateSlot

static bool32 IsDomeHealingMoveEffect(u32 effect)
static bool32 IsDomeHealingMove(u32 move)
{
if (IsHealingMoveEffect(effect))
if (IsHealingMove(move))
return TRUE;
// Check extra effects not considered plain healing by AI
switch(effect)
switch (gBattleMoves[move].effect)
{
case EFFECT_INGRAIN:
case EFFECT_REFRESH:
Expand Down Expand Up @@ -4343,7 +4343,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId)
move = gSaveBlock2Ptr->frontier.domePlayerPartyData[i].moves[j];
else
move = gFacilityTrainerMons[DOME_MONS[trainerTourneyId][i]].moves[j];

switch (k)
{
case MOVE_POINTS_COMBO:
Expand All @@ -4359,7 +4359,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId)
allocatedArray[k] = IsDomeRareMove(move) ? 1 : 0;
break;
case MOVE_POINTS_HEAL:
allocatedArray[k] = IsDomeHealingMoveEffect(gBattleMoves[move].effect) ? 1 : 0;
allocatedArray[k] = IsDomeHealingMove(move) ? 1 : 0;
break;
case MOVE_POINTS_RISKY:
allocatedArray[k] = IsDomeRiskyMoveEffect(gBattleMoves[move].effect) ? 1 : 0;
Expand Down
2 changes: 1 addition & 1 deletion src/battle_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4687,7 +4687,7 @@ s8 GetMovePriority(u32 battler, u16 move)
{
priority++;
}
else if (ability == ABILITY_TRIAGE && IsHealingMoveEffect(gBattleMoves[move].effect))
else if (ability == ABILITY_TRIAGE && IsHealingMove(move))
priority += 3;

if (gProtectStructs[battler].quash)
Expand Down

0 comments on commit cd0b4db

Please sign in to comment.