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 PCG06 committed Dec 8, 2023
1 parent 9629f87 commit 7383bcc
Show file tree
Hide file tree
Showing 5 changed files with 319 additions and 428 deletions.
28 changes: 14 additions & 14 deletions include/constants/battle_dome.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,22 @@
#define DOME_TEXT_SPEED 12
#define DOME_TEXT_SPATK 14

// Move point indexes for sBattleStyleMovePoints[][], to determine Battle Dome trainers battle styles
#define MOVE_POINTS_COMBO 0 // Moves that work well in combination (e.g. Rain Dance + Hydro Pump)
// Determine Battle Dome trainers battle styles
#define MOVE_POINTS_COMBO 0 // Moves that work well in combination: moves that cause or are affected by weather/terrain, Stockpile+, entry hazards, sleep inflictions & effects benefiting from it, offensive boosts of a single stat with at least two stages or at least two stats, and several other effects
#define MOVE_POINTS_STAT_RAISE 1
#define MOVE_POINTS_STAT_LOWER 2
#define MOVE_POINTS_RARE 3 // Uncommon moves. Mostly arbitrary
#define MOVE_POINTS_HEAL 4
#define MOVE_POINTS_RISKY 5
#define MOVE_POINTS_STATUS 6
#define MOVE_POINTS_DMG 7
#define MOVE_POINTS_DEF 8 // Defensive moves, like Amnesia, Light Screen, or accuracy-lowers
#define MOVE_POINTS_ACCURATE 9
#define MOVE_POINTS_POWERFUL 10 // Most of the moves that are >= 100 power
#define MOVE_POINTS_POPULAR 11 // Group seems arbitrary. All using it are TM/HMs, but its only 11/58
#define MOVE_POINTS_LUCK 12
#define MOVE_POINTS_STRONG 13 // Most of the moves that are >= 90 power
#define MOVE_POINTS_LOW_PP 14
#define MOVE_POINTS_RARE 3 // Moves that appear in less than 5% of levelup learnsets
#define MOVE_POINTS_HEAL 4 // Moves that heal
#define MOVE_POINTS_RISKY 5 // Move effects deemed risky by the Emerald developers (excluding High Jump Kick and others for some reason)
#define MOVE_POINTS_STATUS 6 // Moves that cause status effects without dealing damage
#define MOVE_POINTS_DMG 7 // Moves that deal damage (BP > 0)
#define MOVE_POINTS_DEF 8 // Moves like screens, accuracy-lowers or evasiveness-raisers, (special) defense raisers, protect etc.
#define MOVE_POINTS_ACCURATE 9 // Moves with 100% accuracy (or that are guaranteed hits)
#define MOVE_POINTS_POWERFUL 10 // Moves with 100 BP or more
#define MOVE_POINTS_POPULAR 11 // TM/HM moves with 90 BP or more or those that raise a single offensive stat by at least 2 stages
#define MOVE_POINTS_LUCK 12 // Move effects that depend on luck and moves with Accuracy of <= 50%
#define MOVE_POINTS_STRONG 13 // Moves with 90 BP or more
#define MOVE_POINTS_LOW_PP 14 // Moves with 5 PP or less
#define MOVE_POINTS_EFFECT 15 // Moves with additional effects
#define NUM_MOVE_POINT_TYPES 16

Expand Down
10 changes: 5 additions & 5 deletions src/battle_ai_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -851,21 +851,21 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
RETURN_SCORE_MINUS(10);
break;
case ABILITY_FLOWER_VEIL:
if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_GRASS) && (IsNonVolatileStatusMoveEffect(moveEffect) || IsStatLoweringMoveEffect(moveEffect)))
if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_GRASS) && (IsNonVolatileStatusMoveEffect(moveEffect) || IsStatLoweringEffect(moveEffect)))
RETURN_SCORE_MINUS(10);
break;
case ABILITY_MAGIC_BOUNCE:
if (gBattleMoves[move].magicCoatAffected)
RETURN_SCORE_MINUS(20);
break;
case ABILITY_CONTRARY:
if (IsStatLoweringMoveEffect(moveEffect))
if (IsStatLoweringEffect(moveEffect))
RETURN_SCORE_MINUS(20);
break;
case ABILITY_CLEAR_BODY:
case ABILITY_FULL_METAL_BODY:
case ABILITY_WHITE_SMOKE:
if (IsStatLoweringMoveEffect(moveEffect))
if (IsStatLoweringEffect(moveEffect))
RETURN_SCORE_MINUS(10);
break;
case ABILITY_HYPER_CUTTER:
Expand All @@ -887,7 +887,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
break;
case ABILITY_DEFIANT:
case ABILITY_COMPETITIVE:
if (IsStatLoweringMoveEffect(moveEffect) && !IS_TARGETING_PARTNER(battlerAtk, battlerDef))
if (IsStatLoweringEffect(moveEffect) && !IS_TARGETING_PARTNER(battlerAtk, battlerDef))
RETURN_SCORE_MINUS(8);
break;
case ABILITY_COMATOSE:
Expand Down Expand Up @@ -928,7 +928,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
RETURN_SCORE_MINUS(20);
break;
case ABILITY_FLOWER_VEIL:
if ((IS_BATTLER_OF_TYPE(battlerDef, TYPE_GRASS)) && (IsNonVolatileStatusMoveEffect(moveEffect) || IsStatLoweringMoveEffect(moveEffect)))
if ((IS_BATTLER_OF_TYPE(battlerDef, TYPE_GRASS)) && (IsNonVolatileStatusMoveEffect(moveEffect) || IsStatLoweringEffect(moveEffect)))
RETURN_SCORE_MINUS(10);
break;
case ABILITY_AROMA_VEIL:
Expand Down
26 changes: 2 additions & 24 deletions src/battle_ai_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1507,30 +1507,6 @@ bool32 IsConfusionMoveEffect(u32 moveEffect)
}
}

bool32 IsStatLoweringMoveEffect(u32 moveEffect)
{
switch (moveEffect)
{
case EFFECT_ATTACK_DOWN:
case EFFECT_DEFENSE_DOWN:
case EFFECT_SPEED_DOWN:
case EFFECT_SPECIAL_ATTACK_DOWN:
case EFFECT_SPECIAL_DEFENSE_DOWN:
case EFFECT_ACCURACY_DOWN:
case EFFECT_EVASION_DOWN:
case EFFECT_ATTACK_DOWN_2:
case EFFECT_DEFENSE_DOWN_2:
case EFFECT_SPEED_DOWN_2:
case EFFECT_SPECIAL_ATTACK_DOWN_2:
case EFFECT_SPECIAL_DEFENSE_DOWN_2:
case EFFECT_ACCURACY_DOWN_2:
case EFFECT_EVASION_DOWN_2:
return TRUE;
default:
return FALSE;
}
}

bool32 IsHazardMoveEffect(u32 moveEffect)
{
switch (moveEffect)
Expand Down Expand Up @@ -2147,6 +2123,8 @@ bool32 IsHealingMoveEffect(u32 effect)
case EFFECT_HEAL_PULSE:
case EFFECT_REST:
case EFFECT_JUNGLE_HEALING:
case EFFECT_ABSORB:
case EFFECT_DREAM_EATER:
return TRUE;
default:
return FALSE;
Expand Down
Loading

0 comments on commit 7383bcc

Please sign in to comment.