Skip to content

Commit

Permalink
Add Earth Eater AI code (#4352)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bassoonian authored Apr 5, 2024
1 parent 520efa0 commit e4d8115
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/battle_ai_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2779,6 +2779,7 @@ static s32 AI_DoubleBattle(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
break;
case ABILITY_WATER_ABSORB:
case ABILITY_DRY_SKIN:
case ABILITY_EARTH_EATER:
if (!(AI_THINKING_STRUCT->aiFlags[battlerAtk] & AI_FLAG_HP_AWARE))
{
RETURN_SCORE_MINUS(10);
Expand Down Expand Up @@ -4886,6 +4887,7 @@ static s32 AI_HPAware(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
{
if ((effect == EFFECT_HEAL_PULSE || effect == EFFECT_HIT_ENEMY_HEAL_ALLY)
|| (moveType == TYPE_ELECTRIC && AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)] == ABILITY_VOLT_ABSORB)
|| (moveType == TYPE_GROUND && AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)] == ABILITY_EARTH_EATER)
|| (moveType == TYPE_WATER && (AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)] == ABILITY_DRY_SKIN || AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)] == ABILITY_WATER_ABSORB)))
{
if (gStatuses3[battlerDef] & STATUS3_HEAL_BLOCK)
Expand Down
5 changes: 5 additions & 0 deletions src/battle_ai_switch_items.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,11 @@ static bool32 FindMonThatAbsorbsOpponentsMove(u32 battler, bool32 emitResult)
absorbingTypeAbilities[0] = ABILITY_SAP_SIPPER;
numAbsorbingAbilities = 1;
}
else if (gMovesInfo[gLastLandedMoves[battler]].type == TYPE_GROUND)
{
absorbingTypeAbilities[0] = ABILITY_EARTH_EATER;
numAbsorbingAbilities = 1;
}
else
{
return FALSE;
Expand Down
4 changes: 4 additions & 0 deletions src/battle_ai_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,10 @@ bool32 IsDamageMoveUsable(u32 move, u32 battlerAtk, u32 battlerDef)
if (moveType == TYPE_GRASS)
return TRUE;
break;
case ABILITY_EARTH_EATER:
if (moveType == TYPE_GROUND)
return TRUE;
break;
}

switch (gMovesInfo[move].effect)
Expand Down

0 comments on commit e4d8115

Please sign in to comment.