summaryrefslogtreecommitdiff
path: root/src/status_checks_1.c
blob: 7070acded5528c70bfbffdae7433cc4f19301ad3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#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].moveFlags2 & MOVE_FLAG_SEALED)
        {
            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;
}

bool8 HasQuarterHPOrLess(struct DungeonEntity* pokemon)
{
    struct DungeonEntityData *pokemonData = pokemon->entityData;
    struct DungeonEntityData *pokemonData2 = pokemon->entityData;
    s32 maxHP = pokemonData->maxHP;
    if (maxHP < 0)
    {
        maxHP += 3;
    }
    if (pokemonData2->HP <= maxHP >> 2)
    {
        return TRUE;
    }
    return FALSE;
}