diff options
author | AnonymousRandomPerson <chenghanngan.us@gmail.com> | 2022-03-05 00:00:01 -0500 |
---|---|---|
committer | AnonymousRandomPerson <chenghanngan.us@gmail.com> | 2022-03-10 22:32:17 -0500 |
commit | f7a73281cfdfe36af057d1700cc046b80da98f70 (patch) | |
tree | 59fdbec6129b7257b134d057bf27422d4952cd74 /src | |
parent | 9a4864c1cf8c0a6da847f3b8977aaca23b712a5a (diff) |
Decomped GetFlashFireStatus()
Diffstat (limited to 'src')
-rw-r--r-- | src/status.c | 19 | ||||
-rw-r--r-- | src/type_effectiveness.c | 8 |
2 files changed, 21 insertions, 6 deletions
diff --git a/src/status.c b/src/status.c new file mode 100644 index 0000000..dc8a812 --- /dev/null +++ b/src/status.c @@ -0,0 +1,19 @@ +#include "global.h" +#include "status.h" + +#include "constants/ability.h" +#include "dungeon_pokemon_attributes.h" +#include "dungeon_util.h" + +u8 GetFlashFireStatus(struct DungeonEntity *pokemon) +{ + if (!EntityExists(pokemon) || !HasAbility(pokemon, ABILITY_FLASH_FIRE)) + { + return FLASH_FIRE_STATUS_NONE; + } + if (pokemon->entityData->flashFireBoost > 1) + { + return FLASH_FIRE_STATUS_MAXED; + } + return FLASH_FIRE_STATUS_NOT_MAXED; +} diff --git a/src/type_effectiveness.c b/src/type_effectiveness.c index efc1ef9..8a9ee04 100644 --- a/src/type_effectiveness.c +++ b/src/type_effectiveness.c @@ -7,15 +7,12 @@ #include "dungeon_global_data.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_util.h" +#include "status.h" #include "type_chart.h" #include "weather.h" -#define FLASH_FIRE_STATUS_NONE 0 - u32 gTypeEffectivenessMultipliers[] = {0, 1, 2, 4}; -extern u8 GetFlashFireStatus(struct DungeonEntity *pokemon); - s32 WeightWeakTypePicker(struct DungeonEntity *user, struct DungeonEntity *target, u8 moveType) { s32 weight = 1; @@ -79,8 +76,7 @@ s32 WeightWeakTypePicker(struct DungeonEntity *user, struct DungeonEntity *targe if (weight == 0) { // BUG: If the Pokémon's first type resists the move, the second type is ignored. - // This can cause type effectiveness to be calculated incorrectly - // if the first type resists the move and the second type is weak to the move. + // This calculates type effectiveness incorrectly if the first type resists the move and the second type is weak to the move. // For example, a Fire-type move is considered not very effective against a Rock/Bug-type like Anorith. return 2; } |