Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battle Dome Move Point Automation #3596

Merged
merged 21 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Bassoonian marked this conversation as resolved.
Show resolved Hide resolved
#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 @@ -850,21 +850,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 @@ -886,7 +886,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 @@ -927,7 +927,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 @@ -1422,30 +1422,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 @@ -2055,6 +2031,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
Loading