diff options
Diffstat (limited to 'src/dungeon_capabilities_1.c')
-rw-r--r-- | src/dungeon_capabilities_1.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/dungeon_capabilities_1.c b/src/dungeon_capabilities_1.c new file mode 100644 index 0000000..956c6e1 --- /dev/null +++ b/src/dungeon_capabilities_1.c @@ -0,0 +1,56 @@ +#include "global.h" +#include "dungeon_capabilities_1.h" + +#include "constants/dungeon.h" +#include "constants/status.h" +#include "charge_move.h" +#include "dungeon_ai.h" +#include "dungeon_capabilities.h" + +static inline bool8 JoinLocationCannotUseItems(struct DungeonEntityData *pokemonData) +{ + if (pokemonData->joinLocation == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON) + { + return TRUE; + } + if (pokemonData->joinLocation == DUNGEON_RESCUE_TEAM_BASE) + { + return TRUE; + } + return FALSE; +} + +bool8 CannotUseItems(struct DungeonEntity *pokemon) +{ + struct DungeonEntityData *pokemonData = pokemon->entityData; + if (pokemonData->clientType == CLIENT_TYPE_CLIENT + || JoinLocationCannotUseItems(pokemonData) + || (!pokemonData->isLeader && ShouldAvoidEnemies(pokemon)) + || CannotMove(pokemon, FALSE) + || CannotAct(pokemon)) + { + return TRUE; + } + if (IsCharging(pokemon, FALSE)) + { + return TRUE; + } + return FALSE; +} + +bool8 CannotAct(struct DungeonEntity *pokemon) +{ + struct DungeonEntityData *pokemonData = pokemon->entityData; + if ((pokemonData->sleepStatus != SLEEP_STATUS_SLEEPLESS + && pokemonData->sleepStatus != SLEEP_STATUS_NONE) + || pokemonData->immobilizeStatus == IMMOBILIZE_STATUS_FROZEN + || pokemonData->immobilizeStatus == IMMOBILIZE_STATUS_PETRIFIED) + { + return TRUE; + } + if (pokemonData->chargingStatus == CHARGING_STATUS_BIDE) + { + return TRUE; + } + return FALSE; +} |