From 453618864e685eacae640dc2b317a645422264e2 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Thu, 13 Jan 2022 22:56:30 -0500 Subject: Decomped HasStatusAffectingActions() --- src/status_checks_1.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/status_checks_1.c (limited to 'src/status_checks_1.c') diff --git a/src/status_checks_1.c b/src/status_checks_1.c new file mode 100644 index 0000000..32ed6bf --- /dev/null +++ b/src/status_checks_1.c @@ -0,0 +1,44 @@ +#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; +} -- cgit v1.2.3 From c5cd6e137fbad180a21ec24a50fde76633db0c20 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Thu, 20 Jan 2022 18:12:17 -0500 Subject: Decomped IsSleeping() -Function provided by SethBarberee. --- src/status_checks_1.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/status_checks_1.c') diff --git a/src/status_checks_1.c b/src/status_checks_1.c index 32ed6bf..9d0bfe8 100644 --- a/src/status_checks_1.c +++ b/src/status_checks_1.c @@ -42,3 +42,14 @@ bool8 HasNegativeStatus(struct DungeonEntity *pokemon) } 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; +} -- cgit v1.2.3