diff options
author | Cheng Hann Gan <chenghanngan.us@gmail.com> | 2021-10-28 12:01:07 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-28 09:01:07 -0700 |
commit | dd128d78c6da20395edcbe8dab8a224aa6679146 (patch) | |
tree | deec8715283a26754ec64e7dabdeca25faf7e361 /src/charge_move.c | |
parent | c98fb2c11272680a20b9cfb9efe2ce482d3779dd (diff) |
Decomped more dungeon AI (#67)
* Decomped IsMovingClient()
* Fixed typos in boss dialogue
* Fixed spelling of Pelipper
* Decomped CannotUseItems
* Decomped ShouldAvoidEnemies()
* Decomped HasAbility()
* Decomped HasTactic()
* Decomped CannotMove
* Decomped CannotAct() and IsCharging()
Diffstat (limited to 'src/charge_move.c')
-rw-r--r-- | src/charge_move.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/charge_move.c b/src/charge_move.c new file mode 100644 index 0000000..c17db2b --- /dev/null +++ b/src/charge_move.c @@ -0,0 +1,43 @@ +#include "global.h" +#include "charge_move.h" + +#include "constants/status.h" +#include "dungeon_util.h" + +extern u32 gMultiTurnChargingStatuses[]; + +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; + } +} |