diff options
author | AnonymousRandomPerson <chenghanngan.us@gmail.com> | 2022-01-07 23:32:32 -0600 |
---|---|---|
committer | AnonymousRandomPerson <chenghanngan.us@gmail.com> | 2022-01-07 23:32:32 -0600 |
commit | cbf41c6bf31e16fa0ec0b60fc067429e387b5943 (patch) | |
tree | 4c5bd756ad73fc8dc49ba4fcbee6906c28b9131a /src | |
parent | 3cdde2a92a187d437dc7d24273177b59ab5b9511 (diff) |
Decomped HasNegativeStatus()
Diffstat (limited to 'src')
-rw-r--r-- | src/dungeon_ai_item_weight.c | 5 | ||||
-rw-r--r-- | src/status_checks.c | 44 |
2 files changed, 46 insertions, 3 deletions
diff --git a/src/dungeon_ai_item_weight.c b/src/dungeon_ai_item_weight.c index 2f497cc..34e3440 100644 --- a/src/dungeon_ai_item_weight.c +++ b/src/dungeon_ai_item_weight.c @@ -9,8 +9,7 @@ #include "dungeon_util.h" #include "moves.h" #include "number_util.h" - -extern bool8 HasNegativeStatus(struct DungeonEntity*); +#include "status_checks.h" u32 EvaluateItem(struct DungeonEntity *targetPokemon, struct ItemSlot *item, u32 itemTargetFlags) { @@ -96,7 +95,7 @@ u32 EvaluateItem(struct DungeonEntity *targetPokemon, struct ItemSlot *item, u32 } } } - if (itemWeight > 98) + if (itemWeight >= 99) { itemWeight = 99; } diff --git a/src/status_checks.c b/src/status_checks.c new file mode 100644 index 0000000..346afb5 --- /dev/null +++ b/src/status_checks.c @@ -0,0 +1,44 @@ +#include "global.h" +#include "status_checks.h" + +#include "constants/status.h" + +bool8 HasNegativeStatus(struct DungeonEntity *pokemon) +{ + struct DungeonEntityData *pokemonData = pokemon->entityData; + s32 i; + if (pokemonData->sleepStatus == SLEEP_STATUS_SLEEP || + pokemonData->sleepStatus == SLEEP_STATUS_NIGHTMARE || + pokemonData->sleepStatus == SLEEP_STATUS_YAWNING || + pokemonData->nonVolatileStatus != NON_VOLATILE_STATUS_NONE || + (pokemonData->immobilizeStatus != IMMOBILIZE_STATUS_INGRAIN && pokemonData->immobilizeStatus != IMMOBILIZE_STATUS_NONE) || + pokemonData->volatileStatus != VOLATILE_STATUS_NONE || + pokemonData->waitingStatus == WAITING_STATUS_CURSED || + pokemonData->waitingStatus == WAITING_STATUS_DECOY || + pokemonData->linkedStatus == LINKED_STATUS_LEECH_SEED || + pokemonData->moveStatus == MOVE_STATUS_WHIFFER || + pokemonData->eyesightStatus == EYESIGHT_STATUS_BLINKER || + pokemonData->eyesightStatus == EYESIGHT_STATUS_CROSS_EYED || + pokemonData->muzzledStatus == MUZZLED_STATUS_MUZZLED || + pokemonData->exposedStatus || + pokemonData->perishSongTimer != 0) + { + return TRUE; + } + for (i = 0; i < MAX_MON_MOVES; i++) + { + struct PokemonMove *moves = pokemonData->moves; + if (moves[i].moveFlags & MOVE_FLAG_EXISTS && moves[i].sealed & TRUE) + { + return TRUE; + } + } + for (i = 0; i < NUM_SPEED_TURN_COUNTERS; i++) + { + if (pokemonData->slowTurnsLeft[i] != 0) + { + return TRUE; + } + } + return FALSE; +} |