From 70ce2c1642376305f26ad0eaebad26d7d3fe9ac9 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Mon, 28 Feb 2022 21:17:15 -0500 Subject: Decomped LastUsedMoveOutOfPP() --- src/status_checker.c | 37 +++++++++++++++++++++++++++++++++---- src/status_checker_1.c | 21 --------------------- 2 files changed, 33 insertions(+), 25 deletions(-) delete mode 100644 src/status_checker_1.c (limited to 'src') diff --git a/src/status_checker.c b/src/status_checker.c index e835acf..5dfe0f0 100644 --- a/src/status_checker.c +++ b/src/status_checker.c @@ -13,7 +13,6 @@ #include "map.h" #include "moves.h" #include "number_util.h" -#include "status_checker_1.h" #include "status_checks_1.h" #include "tile_types.h" #include "trap.h" @@ -99,8 +98,6 @@ const u8 gDungeonCamouflageTypes[76] = { TYPE_ROCK }; -extern bool8 LastMoveOutOfPP(struct PokemonMove *moves); - bool8 CanUseOnSelfWithStatusChecker(struct DungeonEntity *pokemon, struct PokemonMove *move) { struct DungeonEntityData *pokemonData = pokemon->entityData; @@ -639,7 +636,7 @@ bool8 CanUseOnTargetWithStatusChecker(struct DungeonEntity *user, struct Dungeon } break; case MOVE_SPITE: - if (LastMoveOutOfPP(targetData->moves)) + if (LastUsedMoveOutOfPP(targetData->moves)) { return FALSE; } @@ -919,3 +916,35 @@ bool8 HasDisabledMove(struct PokemonMove *moves) } return FALSE; } + +bool8 LastUsedMoveOutOfPP(struct PokemonMove *moves) +{ + s32 i; + for (i = 0; i < MAX_MON_MOVES; i++) + { + if (moves[i].moveFlags & MOVE_FLAG_EXISTS && + moves[i].moveFlags & MOVE_FLAG_LAST_USED && + moves[i].PP == 0) + { + return TRUE; + } + } + return FALSE; +} + +bool8 HasLastUsedMove(struct PokemonMove *moves) +{ + s32 i; + for (i = 0; i < MAX_MON_MOVES; i++) + { + if (moves[i].moveFlags & MOVE_FLAG_EXISTS && moves[i].moveFlags & MOVE_FLAG_LAST_USED) + { + return TRUE; + } + } + if (moves[STRUGGLE_MOVE_INDEX].moveFlags & MOVE_FLAG_LAST_USED) + { + return TRUE; + } + return FALSE; +} diff --git a/src/status_checker_1.c b/src/status_checker_1.c deleted file mode 100644 index ebe6db6..0000000 --- a/src/status_checker_1.c +++ /dev/null @@ -1,21 +0,0 @@ -#include "global.h" -#include "status_checker_1.h" - -#include "dungeon_entity.h" - -bool8 HasLastUsedMove(struct PokemonMove *moves) -{ - s32 i; - for (i = 0; i < MAX_MON_MOVES; i++) - { - if (moves[i].moveFlags & MOVE_FLAG_EXISTS && moves[i].moveFlags & MOVE_FLAG_LAST_USED) - { - return TRUE; - } - } - if (moves[STRUGGLE_MOVE_INDEX].moveFlags & MOVE_FLAG_LAST_USED) - { - return TRUE; - } - return FALSE; -} -- cgit v1.2.3