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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
#include "global.h"
#include "charge_move.h"
#include "constants/move_id.h"
#include "constants/status.h"
#include "dungeon_util.h"
struct MultiTurnChargeMove
{
u16 moveID;
u8 chargingStatus;
};
const struct MultiTurnChargeMove gMultiTurnChargeMoves[10] = {
{MOVE_SOLARBEAM, CHARGING_STATUS_SOLARBEAM},
{MOVE_SKY_ATTACK, CHARGING_STATUS_SKY_ATTACK},
{MOVE_RAZOR_WIND, CHARGING_STATUS_RAZOR_WIND},
{MOVE_FOCUS_PUNCH, CHARGING_STATUS_FOCUS_PUNCH},
{MOVE_SKULL_BASH, CHARGING_STATUS_SKULL_BASH},
{MOVE_FLY, CHARGING_STATUS_FLY},
{MOVE_BOUNCE, CHARGING_STATUS_BOUNCE},
{MOVE_DIVE, CHARGING_STATUS_DIVE},
{MOVE_DIG, CHARGING_STATUS_DIG},
{MOVE_NONE, CHARGING_STATUS_NONE}
};
const u32 gMultiTurnChargingStatuses[10] = {
CHARGING_STATUS_SOLARBEAM,
CHARGING_STATUS_SKY_ATTACK,
CHARGING_STATUS_RAZOR_WIND,
CHARGING_STATUS_FOCUS_PUNCH,
CHARGING_STATUS_SKULL_BASH,
CHARGING_STATUS_FLY,
CHARGING_STATUS_BOUNCE,
CHARGING_STATUS_DIVE,
CHARGING_STATUS_DIG,
CHARGING_STATUS_NONE
};
ALIGNED(4) const char chargingStatusFill[] = "pksdir0";
bool8 MoveMatchesChargingStatus(struct DungeonEntity *pokemon, struct PokemonMove *move)
{
if (!EntityExists(pokemon))
{
return FALSE;
}
else
{
struct DungeonEntityData *pokemonData = pokemon->entityData;
s32 i;
for (i = 0; i < 100; i++)
{
if (gMultiTurnChargeMoves[i].moveID == MOVE_NONE)
{
return FALSE;
}
if (move->moveID == gMultiTurnChargeMoves[i].moveID &&
pokemonData->chargingStatus == gMultiTurnChargeMoves[i].chargingStatus)
{
return TRUE;
}
}
return FALSE;
}
}
bool8 IsCharging(struct DungeonEntity *pokemon, bool8 checkCharge)
{
if (!EntityExists(pokemon))
{
return FALSE;
}
else
{
struct DungeonEntityData *pokemonData = pokemon->entityData;
int i = 0;
u8 *chargingStatusPointer = &pokemonData->chargingStatus;
u8 *chargingStatusPointer2;
u8 chargeStatus = CHARGING_STATUS_CHARGE;
for (; i < 100; i++)
{
u8 currentStatus = gMultiTurnChargingStatuses[i];
u8 chargingStatus;
if (currentStatus == CHARGING_STATUS_NONE)
{
return FALSE;
}
chargingStatus = *chargingStatusPointer;
chargingStatusPointer2 = &pokemonData->chargingStatus;
if (chargingStatus == currentStatus)
{
return TRUE;
}
}
if (checkCharge && *chargingStatusPointer2 == chargeStatus)
{
return TRUE;
}
return FALSE;
}
}
|