diff options
author | Seth Barberee <seth.barberee@gmail.com> | 2022-02-27 08:43:59 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-27 08:43:59 -0800 |
commit | ea1aa9c0c5c3a4167912d1078fffdd5e69cbbe98 (patch) | |
tree | 1d3f29615f1683fae77ade7d8713e7bfe5a11c26 /include | |
parent | 0dd38993f6a4383d6d5743fd0ae0abc01210ae25 (diff) | |
parent | a5296a2f994a0f8e4421c4afd6bac1cedcfb72be (diff) |
Merge pull request #97 from AnonymousRandomPerson/master
More attack AI decomp
Diffstat (limited to 'include')
-rw-r--r-- | include/constants/move.h | 18 | ||||
-rw-r--r-- | include/constants/weather.h | 2 | ||||
-rw-r--r-- | include/dungeon_ai_attack_1.h | 6 | ||||
-rw-r--r-- | include/dungeon_ai_attack_2.h | 9 | ||||
-rw-r--r-- | include/dungeon_ai_targeting.h | 9 | ||||
-rw-r--r-- | include/dungeon_ai_targeting_1.h (renamed from include/dungeon_ai.h) | 4 | ||||
-rw-r--r-- | include/dungeon_ai_targeting_2.h (renamed from include/dungeon_ai_1.h) | 4 | ||||
-rw-r--r-- | include/dungeon_engine.h | 2 | ||||
-rw-r--r-- | include/dungeon_entity.h | 3 | ||||
-rw-r--r-- | include/dungeon_global_data.h | 2 | ||||
-rw-r--r-- | include/dungeon_map_access.h | 9 | ||||
-rw-r--r-- | include/dungeon_util.h | 2 | ||||
-rw-r--r-- | include/moves.h | 2 | ||||
-rw-r--r-- | include/status_checker.h | 10 | ||||
-rw-r--r-- | include/status_checks_1.h | 2 | ||||
-rw-r--r-- | include/targeting_flags.h | 2 | ||||
-rw-r--r-- | include/tile_types.h | 15 | ||||
-rw-r--r-- | include/trap.h | 9 | ||||
-rw-r--r-- | include/weather.h | 9 |
19 files changed, 103 insertions, 16 deletions
diff --git a/include/constants/move.h b/include/constants/move.h index 15ae1b9..0601969 100644 --- a/include/constants/move.h +++ b/include/constants/move.h @@ -11,6 +11,18 @@ enum MoveFlags MOVE_FLAG_DISABLED = 1 << 5 // Disabled by an effect like Taunt. }; +enum AccuracyType +{ + // Accuracy used for all moves. + ACCURACY_TYPE_GLOBAL, + // Multiplied with the global accuracy for offensive moves (i.e., not status moves). + ACCURACY_TYPE_OFFENSIVE, + // Used by the AI to determine how often to use Spikes. + // Values exist for all other moves, though they seem to be unused. + ACCURACY_TYPE_USE_CHANCE, + NUM_ACCURACY_TYPES +}; + struct MoveData { u8 *namePointer; @@ -22,10 +34,8 @@ struct MoveData // The AI consider certain moves to have different range than they actually do. /* 0xC */ u8 maxPP; /* 0xD */ u8 weight; - /* 0xE */ u8 accuracy[2]; - // Used by the AI to determine how often to use Spikes. - // Values exist for all other moves, though they seem to be unused. - /* 0x10 */ u8 useChance; + // There are multiple accuracy values. These are define with the AccuracyType enum. + /* 0xE */ u8 accuracy[NUM_ACCURACY_TYPES]; /* 0x11 */ u8 hitCount; // Maximum number of times the move will hit. Used for multi-hit moves like Fury Attack. u8 unk12; /* 0x13 */ u8 criticalHitChance; diff --git a/include/constants/weather.h b/include/constants/weather.h index e7225b9..2a8cf42 100644 --- a/include/constants/weather.h +++ b/include/constants/weather.h @@ -4,7 +4,7 @@ #define WEATHER_CLEAR 0 #define WEATHER_SUNNY 1 #define WEATHER_SANDSTORM 2 -#define WEATHER_CLOUDY` 3 +#define WEATHER_CLOUDY 3 #define WEATHER_RAIN 4 #define WEATHER_HAIL 5 #define WEATHER_FOG 6 diff --git a/include/dungeon_ai_attack_1.h b/include/dungeon_ai_attack_1.h index 89a1f0d..7272256 100644 --- a/include/dungeon_ai_attack_1.h +++ b/include/dungeon_ai_attack_1.h @@ -3,7 +3,9 @@ #include "dungeon_entity.h" -// 0x7C9F8 -bool8 IsTargetStraightAhead(struct DungeonEntity *pokemon, struct DungeonEntity *targetPokemon, s32 facingDir, s32 maxRange); +// 0x7C580 +s32 WeightMoveIfUsable(s32 numPotentialTargets, s32 targetingFlags, struct DungeonEntity *user, struct DungeonEntity *target, struct PokemonMove *move, u32 hasStatusChecker); +// 0x7C648 +bool8 CanUseStatusMove(s32 targetingFlags, struct DungeonEntity *user, struct DungeonEntity *target, struct PokemonMove *move, bool32 hasStatusChecker); #endif diff --git a/include/dungeon_ai_attack_2.h b/include/dungeon_ai_attack_2.h new file mode 100644 index 0000000..00711b6 --- /dev/null +++ b/include/dungeon_ai_attack_2.h @@ -0,0 +1,9 @@ +#ifndef GUARD_DUNGEON_AI_ATTACK_2_H +#define GUARD_DUNGEON_AI_ATTACK_2_H + +#include "dungeon_entity.h" + +// 0x7C9F8 +bool8 IsTargetStraightAhead(struct DungeonEntity *pokemon, struct DungeonEntity *targetPokemon, s32 facingDir, s32 maxRange); + +#endif diff --git a/include/dungeon_ai_targeting.h b/include/dungeon_ai_targeting.h new file mode 100644 index 0000000..945c490 --- /dev/null +++ b/include/dungeon_ai_targeting.h @@ -0,0 +1,9 @@ +#ifndef GUARD_DUNGEON_AI_TARGETING_H +#define GUARD_DUNGEON_AI_TARGETING_H + +#include "dungeon_entity.h" + +// 0x71138 +bool8 CanAttackInFront(struct DungeonEntity *pokemon, s32 direction); + +#endif diff --git a/include/dungeon_ai.h b/include/dungeon_ai_targeting_1.h index e3f7a37..49b700f 100644 --- a/include/dungeon_ai.h +++ b/include/dungeon_ai_targeting_1.h @@ -1,5 +1,5 @@ -#ifndef GUARD_DUNGEON_AI_H -#define GUARD_DUNGEON_AI_H +#ifndef GUARD_DUNGEON_AI_TARGETING_1_H +#define GUARD_DUNGEON_AI_TARGETING_1_H #include "dungeon_entity.h" diff --git a/include/dungeon_ai_1.h b/include/dungeon_ai_targeting_2.h index dace65a..c314646 100644 --- a/include/dungeon_ai_1.h +++ b/include/dungeon_ai_targeting_2.h @@ -1,5 +1,5 @@ -#ifndef GUARD_DUNGEON_AI_1_H -#define GUARD_DUNGEON_AI_1_H +#ifndef GUARD_DUNGEON_AI_TARGETING_2_H +#define GUARD_DUNGEON_AI_TARGETING_2_H #include "dungeon_entity.h" diff --git a/include/dungeon_engine.h b/include/dungeon_engine.h index f987b11..d2be40b 100644 --- a/include/dungeon_engine.h +++ b/include/dungeon_engine.h @@ -1,6 +1,8 @@ #ifndef GUARD_DUNGEON_ENGINE_H #define GUARD_DUNGEON_ENGINE_H +// 0x441BC +bool8 IsBossBattle(); // 0x441E8 bool8 IsFixedDungeon(); diff --git a/include/dungeon_entity.h b/include/dungeon_entity.h index 9e9f1f7..2567f79 100644 --- a/include/dungeon_entity.h +++ b/include/dungeon_entity.h @@ -6,6 +6,9 @@ #include "item.h" #include "position.h" +#define MAX_STAT_STAGE 20 +#define MAX_MOVEMENT_SPEED 4 +#define MAX_STOCKPILE_COUNT 3 #define NUM_SPEED_TURN_COUNTERS 5 struct DungeonActionContainer diff --git a/include/dungeon_global_data.h b/include/dungeon_global_data.h index 948603e..74e052e 100644 --- a/include/dungeon_global_data.h +++ b/include/dungeon_global_data.h @@ -71,7 +71,7 @@ struct DungeonGlobalData /* 0xE277 */ u8 mudSportTurnsLeft; /* 0xE278 */ u8 waterSportTurnsLeft; u8 fillE279[0xE8C0 - 0xE279]; - /* 0xE8C0 */ struct MapTile* mapEntityPointers[DUNGEON_MAX_SIZE_Y][DUNGEON_MAX_SIZE_X]; + /* 0xE8C0 */ struct MapTile* mapTilePointers[DUNGEON_MAX_SIZE_Y][DUNGEON_MAX_SIZE_X]; u8 fill104C0[0x104C4 - 0x104C0]; /* 0x104C4 */ struct MapRoom roomData[MAX_ROOM_COUNT]; u8 fill10764[0x10844 - 0x10764]; diff --git a/include/dungeon_map_access.h b/include/dungeon_map_access.h index 5e4e3da..c715483 100644 --- a/include/dungeon_map_access.h +++ b/include/dungeon_map_access.h @@ -3,7 +3,14 @@ #include "map.h" +struct unkStruct_202F190 +{ + struct MapTile* unk0[6]; +}; + // 0x4954C -struct MapTile* GetMapTileAtPosition(s32 x, s32 y); +struct MapTile* GetMapTile_1(s32 x, s32 y); +// 0x49590 +struct MapTile* GetMapTile_2(s32 x, s32 y); #endif diff --git a/include/dungeon_util.h b/include/dungeon_util.h index 4d91b29..b32b85d 100644 --- a/include/dungeon_util.h +++ b/include/dungeon_util.h @@ -15,6 +15,6 @@ u32 GetEntityType(struct DungeonEntity *entity); struct DungeonEntityData *GetTrapData(struct DungeonEntity *entity); // 0x45108 struct ItemSlot *GetItemData(struct DungeonEntity *entity); -struct MapTile *GetMapEntityForDungeonEntity(struct DungeonEntity *entity); +struct MapTile *GetMapTileForDungeonEntity_2(struct DungeonEntity *entity); #endif diff --git a/include/moves.h b/include/moves.h index a5db8d0..44b324b 100644 --- a/include/moves.h +++ b/include/moves.h @@ -14,7 +14,7 @@ u8 GetMoveType(struct PokemonMove *move); u8 GetMoveWeight(struct PokemonMove *move); u8 GetMoveHitCount(struct PokemonMove *move); s32 GetMovePower(struct PokemonMove *move); -u8 GetMoveAccuracy(struct PokemonMove *move, u32 r1); +s32 GetMoveAccuracy(struct PokemonMove *move, u32 accuracyType); u32 GetMoveMaxPP(struct PokemonMove *move); u8 GetMoveUnk12(struct PokemonMove *move); u8 GetMoveCriticalHitChance(struct PokemonMove *move); diff --git a/include/status_checker.h b/include/status_checker.h new file mode 100644 index 0000000..1b65030 --- /dev/null +++ b/include/status_checker.h @@ -0,0 +1,10 @@ +#ifndef GUARD_STATUS_CHECKER_H +#define GUARD_STATUS_CHECKER_H + +#include "constants/move.h" +#include "dungeon_entity.h" + +// 0x5C498 +bool8 CanUseOnSelfWithStatusChecker(struct DungeonEntity *pokemon, struct PokemonMove *move); + +#endif diff --git a/include/status_checks_1.h b/include/status_checks_1.h index 486adb2..a90bdb0 100644 --- a/include/status_checks_1.h +++ b/include/status_checks_1.h @@ -7,5 +7,7 @@ bool8 HasNegativeStatus(struct DungeonEntity *pokemon); // 0x70B28 bool8 IsSleeping(struct DungeonEntity *pokemon); +// 0x70B48 +bool8 HasQuarterHPOrLess(struct DungeonEntity* pokemon); #endif diff --git a/include/targeting_flags.h b/include/targeting_flags.h index 54e7063..d7d4737 100644 --- a/include/targeting_flags.h +++ b/include/targeting_flags.h @@ -5,6 +5,6 @@ #include "dungeon_entity.h" // 0x7CD64 -s16 GetMoveTargetingFlagsForPokemon(struct DungeonEntity *pokemon, struct PokemonMove *move, u32 isAI); +s16 GetMoveTargetingFlagsForPokemon(struct DungeonEntity *pokemon, struct PokemonMove *move, bool32 isAI); #endif diff --git a/include/tile_types.h b/include/tile_types.h new file mode 100644 index 0000000..f1bc412 --- /dev/null +++ b/include/tile_types.h @@ -0,0 +1,15 @@ +#ifndef GUARD_TILE_TYPES_H +#define GUARD_TILE_TYPES_H + +#include "map.h" + +#define DUNGEON_WATER_TYPE_NONE 0 +#define DUNGEON_WATER_TYPE_LAVA 1 +#define DUNGEON_WATER_TYPE_WATER 2 + +// 0x4AF20 +bool8 IsTileGround(struct MapTile* tile); +// 0x4AF74 +bool8 IsWaterTileset(); + +#endif diff --git a/include/trap.h b/include/trap.h new file mode 100644 index 0000000..49a5216 --- /dev/null +++ b/include/trap.h @@ -0,0 +1,9 @@ +#ifndef GUARD_TRAP_H +#define GUARD_TRAP_H + +#include "position.h" + +// 0x4AF74 +bool8 CanLayTrap(struct Position *pos); + +#endif diff --git a/include/weather.h b/include/weather.h new file mode 100644 index 0000000..b7fa725 --- /dev/null +++ b/include/weather.h @@ -0,0 +1,9 @@ +#ifndef GUARD_WEATHER_H +#define GUARD_WEATHER_H + +#include "dungeon_entity.h" + +// 0x7E580 +u8 GetWeather(struct DungeonEntity* pokemon); + +#endif |