diff options
author | Seth Barberee <seth.barberee@gmail.com> | 2022-01-20 15:26:19 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-20 15:26:19 -0800 |
commit | 408fe77d7b9440d7eb5d46eda5f920572d516d67 (patch) | |
tree | 38953616b74da130bd832635bed1c605d4b0e322 /src/status_checks_1.c | |
parent | 3cdde2a92a187d437dc7d24273177b59ab5b9511 (diff) | |
parent | c5cd6e137fbad180a21ec24a50fde76633db0c20 (diff) |
Merge pull request #93 from AnonymousRandomPerson/master
More AI decomp
Diffstat (limited to 'src/status_checks_1.c')
-rw-r--r-- | src/status_checks_1.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/status_checks_1.c b/src/status_checks_1.c new file mode 100644 index 0000000..9d0bfe8 --- /dev/null +++ b/src/status_checks_1.c @@ -0,0 +1,55 @@ +#include "global.h" +#include "status_checks_1.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; +} + +bool8 IsSleeping(struct DungeonEntity *pokemon) +{ + if (pokemon->entityData->sleepStatus != SLEEP_STATUS_SLEEP && + pokemon->entityData->sleepStatus != SLEEP_STATUS_NAPPING && + pokemon->entityData->sleepStatus != SLEEP_STATUS_NIGHTMARE) + { + return FALSE; + } + return TRUE; +} |