Skip to content

Commit

Permalink
Battle Dome Automation (rh-hideout#3596)
Browse files Browse the repository at this point in the history
* MOVE_POINTS_STRONG

* MOVE_POINTS_POWERFUL

* MOVE_POINTS_LOW_PP

* MOVE_POINTS_STAT_RAISE

* Removed duplicate function

* MOVE_POINTS_STAT_LOWER

* MOVE_POINTS_DMG

* MOVE_POINTS_ACCURATE

* MOVE_POINTS_HEAL

* MOVE_POINTS_DEF

* MOVE_POINTS_RISKY

* MOVE_POINTS_EFFECT

* MOVE_POINTS_LUCK

* MOVE_POINTS_POPULAR

* MOVE_POINTS_STATUS

* MOVE_POINTS_RARE

* MOVE_POINTS_COMBO

* Apply review suggestions

* More implemented review suggestions

---------

Co-authored-by: Eduardo Quezada <[email protected]>
  • Loading branch information
2 people authored and Pawkkie committed May 14, 2024
1 parent 2390fe7 commit b85c9f4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
22 changes: 21 additions & 1 deletion src/battle_ai_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,7 @@ bool32 IsConfusionMoveEffect(u32 moveEffect)
case EFFECT_CONFUSE:
case EFFECT_SWAGGER:
case EFFECT_FLATTER:
case EFFECT_TEETER_DANCE:
return TRUE;
default:
return FALSE;
Expand Down Expand Up @@ -2022,7 +2023,26 @@ bool32 HasSleepMoveWithLowAccuracy(u32 battlerAtk, u32 battlerDef)

bool32 IsHealingMove(u32 move)
{
return gBattleMoves[move].healBlockBanned;
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;
}
}

bool32 HasHealingEffect(u32 battlerId)
Expand Down
15 changes: 7 additions & 8 deletions src/battle_dome.c
Original file line number Diff line number Diff line change
Expand Up @@ -3935,12 +3935,12 @@ static u8 Task_GetInfoCardInput(u8 taskId)

#undef tUsingAlternateSlot

static bool32 IsDomeHealingMove(u32 move)
static bool32 IsDomeHealingMoveEffect(u32 effect)
{
if (IsHealingMove(move))
if (IsHealingMoveEffect(effect))
return TRUE;
// Check extra effects not considered plain healing by AI
switch (gBattleMoves[move].effect)
switch(effect)
{
case EFFECT_INGRAIN:
case EFFECT_REFRESH:
Expand Down Expand Up @@ -4080,10 +4080,9 @@ static bool32 IsDomeRareMove(u32 move)
u16 species = 0;
for(i = 0; i < NUM_SPECIES; i++)
{
const struct LevelUpMove *learnset = GetSpeciesLevelUpLearnset(i);
for(j = 0; learnset[j].move != LEVEL_UP_MOVE_END; j++)
for(j = 0; gLevelUpLearnsets[i][j].move != LEVEL_UP_MOVE_END; j++)
{
if (learnset[j].move == move)
if (gLevelUpLearnsets[i][j].move == move)
{
species++;
break;
Expand Down Expand Up @@ -4350,7 +4349,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 @@ -4366,7 +4365,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId)
allocatedArray[k] = IsDomeRareMove(move) ? 1 : 0;
break;
case MOVE_POINTS_HEAL:
allocatedArray[k] = IsDomeHealingMove(move) ? 1 : 0;
allocatedArray[k] = IsDomeHealingMoveEffect(gBattleMoves[move].effect) ? 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 @@ -4683,7 +4683,7 @@ s8 GetMovePriority(u32 battler, u16 move)
{
priority++;
}
else if (ability == ABILITY_TRIAGE && IsHealingMove(move))
else if (ability == ABILITY_TRIAGE && IsHealingMoveEffect(gBattleMoves[move].effect))
priority += 3;

if (gProtectStructs[battler].quash)
Expand Down

0 comments on commit b85c9f4

Please sign in to comment.