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

All "errors" found by yours truly in src/battle_ai_util (no past issues are included here, to be updated) #6126

Open
ShadowzLmao2 opened this issue Jan 26, 2025 · 0 comments
Labels
bug Bug category: battle-ai Pertains to Battle Engine Upgrade's AI status: unconfirmed This bug has not been reproduced yet

Comments

@ShadowzLmao2
Copy link

ShadowzLmao2 commented Jan 26, 2025

Ping or DM me on discord to lmk when one or more of these have been PR'd so i can edit them out
In case you're wondering about battle_ai_switch_items, that has already been looked through by me and battle_ai_main has been looked through and outside of the TODOs it is fine

Image
Steelsurge is not included in IsHazardMoveEffect

bool32 IsSemiInvulnerable(u32 battlerDef, u32 move)
{
    if (gBattleStruct->commandingDondozo & (1u << battlerDef))
        return TRUE;
    else if ((!gMovesInfo[move].damagesAirborne && gStatuses3[battlerDef] & STATUS3_ON_AIR)
            ||(!gMovesInfo[move].damagesUnderwater && gStatuses3[battlerDef] & STATUS3_UNDERWATER)
            ||(!gMovesInfo[move].damagesUnderground && gStatuses3[battlerDef] & STATUS3_UNDERGROUND)
            ||(gStatuses3[battlerDef] & STATUS3_PHANTOM_FORCE))
        return TRUE;
    else
        return FALSE;
}

Refactored IsSemiInvulnerable

Request: Change the ShouldSet[insert weather] functions to also check if a different weather is up and the opponent is using it
Also: Remove TYPE_STEEL and TYPE_GROUND from set sandstorm and TYPE_ICE from hail as they do not benefit from the weather

Why does HasThawingMove exist when you can just run CHECK_MOVE_FLAG(thawsUser)?

Make IsUngroundingEffect check for Skill Swap and Levitate on the opp

Image

Image

Added Sleep Talk in the sleep check in both functions

Image
Added a check for a special move if the user has quick feet (pointless to burn if it halves your damage, not worth speed), can be argued that in a double battle with support moves or just hazard moves the added code should be removed

{
    ITEM_CHESTO_BERRY,
    ITEM_LUM_BERRY,
    ITEM_STARF_BERRY,
    ITEM_SALAC_BERRY,
    ITEM_LIECHI_BERRY,
    ITEM_SITRUS_BERRY,
    ITEM_MICLE_BERRY,
    ITEM_CUSTAP_BERRY,
    ITEM_MENTAL_HERB,
    ITEM_FOCUS_SASH,
    ITEM_AGUAV_BERRY,
    ITEM_FIGY_BERRY,
    ITEM_IAPAPA_BERRY,
    ITEM_MAGO_BERRY,
    ITEM_WIKI_BERRY,
    ITEM_MENTAL_HERB,
    ITEM_POWER_HERB,
    ITEM_BERRY_JUICE,
    ITEM_WEAKNESS_POLICY,
    ITEM_BLUNDER_POLICY,
    ITEM_KEE_BERRY,
    ITEM_MARANGA_BERRY,
};

list expanded

Request: Have accuracy check if the user has any inaccurate moves in the image below

Image

For future reference: in the image below, only check for magic bounce
It has been changed to include magic coat

Image

Not tested, worth looking over: Added punching glove

s32 AI_WhichMoveBetter(u32 move1, u32 move2, u32 battlerAtk, u32 battlerDef, s32 noOfHitsToKo)
{
    bool32 effect1, effect2;
    u32 defAbility = AI_DATA->abilities[battlerDef];
    u32 atkAbility = AI_DATA->abilities[battlerAtk];

    // Check if physical moves hurt.
    if (AI_DATA->holdEffects[battlerAtk] != HOLD_EFFECT_PROTECTIVE_PADS && atkAbility != ABILITY_LONG_REACH
        && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_ROCKY_HELMET
        || defAbility == ABILITY_IRON_BARBS || defAbility == ABILITY_ROUGH_SKIN))
    { 
        if ((gMovesInfo[move1].makesContact && 
            (gMovesInfo[move2].punchingMove && AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_PUNCHING_GLOVE))
            && !gMovesInfo[move2].makesContact)
            return -1;
        if ((gMovesInfo[move2].makesContact && 
            (gMovesInfo[move1].punchingMove && AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_PUNCHING_GLOVE))
            && !gMovesInfo[move1].makesContact)
            return 1;
    }

ROM successfully compiles with all changes above
SShadowzLmao#3643

@ShadowzLmao2 ShadowzLmao2 added bug Bug category: battle-ai Pertains to Battle Engine Upgrade's AI status: unconfirmed This bug has not been reproduced yet labels Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug category: battle-ai Pertains to Battle Engine Upgrade's AI status: unconfirmed This bug has not been reproduced yet
Projects
None yet
Development

No branches or pull requests

1 participant