From f728e7e90ebd50521dbc32f7f2b2be5858d91477 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Fri, 4 Feb 2022 23:13:01 -0500 Subject: Decomped DecideAttack() --- include/constants/move.h | 2 +- include/dungeon_ai.h | 2 ++ include/dungeon_ai_attack.h | 4 ++-- include/dungeon_ai_attack_1.h | 9 +++++++++ include/dungeon_capabilities_1.h | 2 ++ include/dungeon_pokemon_attributes_1.h | 2 +- include/moves.h | 5 +++++ include/status_checks.h | 2 ++ 8 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 include/dungeon_ai_attack_1.h (limited to 'include') diff --git a/include/constants/move.h b/include/constants/move.h index 4e3396b..8148ab5 100644 --- a/include/constants/move.h +++ b/include/constants/move.h @@ -44,7 +44,7 @@ struct PokemonMove u8 moveFlags; bool8 sealed; u16 moveID; - u8 pp; + u8 PP; u8 powerBoost; // How much the move is boosted by Ginsengs. }; diff --git a/include/dungeon_ai.h b/include/dungeon_ai.h index e02da08..e3f7a37 100644 --- a/include/dungeon_ai.h +++ b/include/dungeon_ai.h @@ -5,5 +5,7 @@ // 0x71494 bool8 ShouldAvoidEnemies(struct DungeonEntity *pokemon); +// 0x71518 +bool8 ShouldAvoidEnemiesAndShowEffect(struct DungeonEntity *pokemon, bool8 showRunAwayEffect); #endif diff --git a/include/dungeon_ai_attack.h b/include/dungeon_ai_attack.h index 75abcab..77b53fc 100644 --- a/include/dungeon_ai_attack.h +++ b/include/dungeon_ai_attack.h @@ -3,7 +3,7 @@ #include "dungeon_entity.h" -// 0x7C9F8 -bool8 IsTargetStraightAhead(struct DungeonEntity *pokemon, struct DungeonEntity *targetPokemon, s32 facingDir, s32 maxRange); +// 0x7BB94 +void DecideAttack(struct DungeonEntity *pokemon); #endif diff --git a/include/dungeon_ai_attack_1.h b/include/dungeon_ai_attack_1.h new file mode 100644 index 0000000..89a1f0d --- /dev/null +++ b/include/dungeon_ai_attack_1.h @@ -0,0 +1,9 @@ +#ifndef GUARD_DUNGEON_AI_ATTACK_1_H +#define GUARD_DUNGEON_AI_ATTACK_1_H + +#include "dungeon_entity.h" + +// 0x7C9F8 +bool8 IsTargetStraightAhead(struct DungeonEntity *pokemon, struct DungeonEntity *targetPokemon, s32 facingDir, s32 maxRange); + +#endif diff --git a/include/dungeon_capabilities_1.h b/include/dungeon_capabilities_1.h index c19391b..1319230 100644 --- a/include/dungeon_capabilities_1.h +++ b/include/dungeon_capabilities_1.h @@ -7,6 +7,8 @@ bool8 CannotUseItems(struct DungeonEntity *pokemon); // 0x70CD0 bool8 CannotAct(struct DungeonEntity *pokemon); +// 0x70d04 +bool8 CannotAttack(struct DungeonEntity *pokemon, bool8 skipSleep); // 0x70D6C bool8 CanMoveInDirection(struct DungeonEntity *pokemon, u32 facingDir); diff --git a/include/dungeon_pokemon_attributes_1.h b/include/dungeon_pokemon_attributes_1.h index cdfa989..c81c4b9 100644 --- a/include/dungeon_pokemon_attributes_1.h +++ b/include/dungeon_pokemon_attributes_1.h @@ -12,7 +12,7 @@ bool8 HasIQSkill(struct DungeonEntity *pokemon, u8 IQSkill); void LoadIQSkills(struct DungeonEntity *pokemon); bool8 CanSeeTeammate(struct DungeonEntity * pokemon); -u8 GetMoveType_2(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove); +u8 GetMoveTypeForPokemon(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove); // 0x71A44 s32 CalculateMovePower(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove); diff --git a/include/moves.h b/include/moves.h index bba50b3..847f167 100644 --- a/include/moves.h +++ b/include/moves.h @@ -3,6 +3,11 @@ #include "constants/move.h" +// 0x92A88 +void InitPokemonMove(struct PokemonMove *move, u16 moveID); +// 0x92B90 +u8 GetMoveWeight(struct PokemonMove *move); +// 0x92BF4 u32 GetMoveMaxPP(struct PokemonMove *move); #endif diff --git a/include/status_checks.h b/include/status_checks.h index 086711d..5bc80eb 100644 --- a/include/status_checks.h +++ b/include/status_checks.h @@ -3,6 +3,8 @@ #include "dungeon_entity.h" +extern const s16 gConfusedAttackChance; + // 0x7001C bool8 HasStatusAffectingActions(struct DungeonEntity *pokemon); -- cgit v1.2.3 From a9b5977d4ca6c0aeedea966a0165b625a4c2dbab Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Sat, 5 Feb 2022 20:23:01 -0500 Subject: Decomped MoveMatchesChargingStatus --- include/charge_move.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/charge_move.h b/include/charge_move.h index 9d10ac2..fd88a62 100644 --- a/include/charge_move.h +++ b/include/charge_move.h @@ -3,7 +3,10 @@ #include "dungeon_entity.h" +// 0x570AC +bool8 MoveMatchesChargingStatus(struct DungeonEntity *pokemon, struct PokemonMove *move); // 0x570F4 +// checkCharge = Check for the move named Charge. bool8 IsCharging(struct DungeonEntity *pokemon, bool8 checkCharge); #endif -- cgit v1.2.3 From 9939c543ce7a8cbf7abb85d3125b5e6d95204433 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Sat, 5 Feb 2022 22:02:03 -0500 Subject: Decomped TargetTileInFront() --- include/targeting.h | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 include/targeting.h (limited to 'include') diff --git a/include/targeting.h b/include/targeting.h new file mode 100644 index 0000000..7330398 --- /dev/null +++ b/include/targeting.h @@ -0,0 +1,9 @@ +#ifndef GUARD_TARGETING_H +#define GUARD_TARGETING_H + +#include "dungeon_entity.h" + +// 0x69DCC +void TargetTileInFront(struct DungeonEntity *pokemon); + +#endif -- cgit v1.2.3 From a02346be01efa13b6d969a89be642e3450f7ca35 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Sun, 13 Feb 2022 22:02:17 -0500 Subject: Decomped FindMoveTarget() --- include/dungeon_ai_attack.h | 9 +++++++++ include/map.h | 2 +- include/moves.h | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/dungeon_ai_attack.h b/include/dungeon_ai_attack.h index 77b53fc..1878889 100644 --- a/include/dungeon_ai_attack.h +++ b/include/dungeon_ai_attack.h @@ -3,7 +3,16 @@ #include "dungeon_entity.h" +struct MoveTargetResults +{ + bool8 moveUsable; + u8 targetDir; + s32 moveWeight; +}; + // 0x7BB94 void DecideAttack(struct DungeonEntity *pokemon); +// 0x7C04C +s32 FindMoveTarget(struct MoveTargetResults *moveTargetResults, struct DungeonEntity *pokemon, struct PokemonMove *move); #endif diff --git a/include/map.h b/include/map.h index 9122f00..3601a14 100644 --- a/include/map.h +++ b/include/map.h @@ -38,7 +38,7 @@ struct MapTile u8 unk8; /* 0x9 */ u8 roomIndex; // Bitwise flags for whether Pokémon can move to an adjacent tile. Bits correspond to directions in direction.h. - // Different sets of flags are used for Pokémon that can cross special terrain, corresponding to Cthe rossableTerrain enum. + // Different sets of flags are used for Pokémon that can cross special terrain, corresponding to the CrossableTerrain enum. /* 0xA */ u8 canMoveAdjacent[NUM_CROSSABLE_TERRAIN]; u8 fillE[0x10 - 0xE]; /* 0x10 */ struct DungeonEntity *pokemon; // Pokémon on the tile. diff --git a/include/moves.h b/include/moves.h index 847f167..c86f986 100644 --- a/include/moves.h +++ b/include/moves.h @@ -9,5 +9,7 @@ void InitPokemonMove(struct PokemonMove *move, u16 moveID); u8 GetMoveWeight(struct PokemonMove *move); // 0x92BF4 u32 GetMoveMaxPP(struct PokemonMove *move); +// 0x92C54 +bool8 GetMoveDealsDirectDamage(struct PokemonMove *move); #endif -- cgit v1.2.3 From 3bbb6035e746cdb83b128b1d6153436756cb3be0 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Sun, 13 Feb 2022 22:30:25 -0500 Subject: Decomped GetMoveTargetingFlagsForPokemon() --- include/constants/move.h | 8 +++++--- include/moves.h | 2 ++ include/targeting_flags.h | 10 ++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 include/targeting_flags.h (limited to 'include') diff --git a/include/constants/move.h b/include/constants/move.h index 8148ab5..15ae1b9 100644 --- a/include/constants/move.h +++ b/include/constants/move.h @@ -52,17 +52,19 @@ enum TargetingFlag { TARGETING_FLAG_TARGET_OTHER = 0x0, TARGETING_FLAG_HEAL_TEAM = 0x1, - TARGETING_FLAG_SWAP_POSITIONS = 0x2, + TARGETING_FLAG_LONG_RANGE = 0x2, + TARGETING_FLAG_BOOST_SELF = 0x3, + TARGETING_FLAG_MULTI_TURN = 0x4, TARGETING_FLAG_ATTACK_ALL = 0x5, TARGETING_FLAG_BOOST_TEAM = 0x6, - TARGETING_FLAG_DONT_USE = 0xF, + TARGETING_FLAG_ITEM = 0xF, TARGETING_FLAG_TARGET_FRONTAL_CONE = 0x10, TARGETING_FLAG_TARGET_AROUND = 0x20, TARGETING_FLAG_TARGET_ROOM = 0x30, TARGETING_FLAG_TARGET_2_TILES_AHEAD = 0x40, TARGETING_FLAG_TARGET_LINE = 0x50, TARGETING_FLAG_TARGET_FLOOR = 0x60, - TARGETING_FLAG_SELF_HEAL = 0x70, + TARGETING_FLAG_TARGET_SELF = 0x70, TARGETING_FLAG_CUT_CORNERS = 0x80, TARGETING_FLAG_SET_TRAP = 0x100, TARGETING_FLAG_HEAL_HP = 0x200, diff --git a/include/moves.h b/include/moves.h index c86f986..dca2ac4 100644 --- a/include/moves.h +++ b/include/moves.h @@ -5,6 +5,8 @@ // 0x92A88 void InitPokemonMove(struct PokemonMove *move, u16 moveID); +// 0x92AE0 +s16 GetMoveTargetingFlags(struct PokemonMove *move, u32 isAI); // 0x92B90 u8 GetMoveWeight(struct PokemonMove *move); // 0x92BF4 diff --git a/include/targeting_flags.h b/include/targeting_flags.h new file mode 100644 index 0000000..54e7063 --- /dev/null +++ b/include/targeting_flags.h @@ -0,0 +1,10 @@ +#ifndef GUARD_TARGETING_FLAGS_H +#define GUARD_TARGETING_FLAGS_H + +#include "constants/move.h" +#include "dungeon_entity.h" + +// 0x7CD64 +s16 GetMoveTargetingFlagsForPokemon(struct DungeonEntity *pokemon, struct PokemonMove *move, u32 isAI); + +#endif -- cgit v1.2.3 From 2a2a0805b481b8425b4d1047d868fb1159993e6c Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Sun, 13 Feb 2022 23:13:47 -0500 Subject: Decomped HasType() --- include/dungeon_pokemon_attributes.h | 16 ++++++++++++++++ include/dungeon_pokemon_attributes_1.h | 21 --------------------- include/moves.h | 2 ++ include/pokemon_3.h | 2 ++ 4 files changed, 20 insertions(+), 21 deletions(-) delete mode 100644 include/dungeon_pokemon_attributes_1.h (limited to 'include') diff --git a/include/dungeon_pokemon_attributes.h b/include/dungeon_pokemon_attributes.h index 941c966..40b13ee 100644 --- a/include/dungeon_pokemon_attributes.h +++ b/include/dungeon_pokemon_attributes.h @@ -5,5 +5,21 @@ // 0x71824 bool8 HasAbility(struct DungeonEntity *pokemon, u8 ability); +// 0x71858 +bool8 HasType(struct DungeonEntity *pokemon, u8 type); +// 0x71884 +bool8 CanSeeInvisible(struct DungeonEntity *pokemon); +// 0x718AC +bool8 HasTactic(struct DungeonEntity *pokemon, u8 tactic); +// 0x718D8 +bool8 HasIQSkill(struct DungeonEntity *pokemon, u8 IQSkill); + +void LoadIQSkills(struct DungeonEntity *pokemon); +bool8 CanSeeTeammate(struct DungeonEntity * pokemon); +u8 GetMoveTypeForPokemon(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove); + +// 0x71A44 +s32 CalculateMovePower(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove); +bool8 ToolboxEnabled(struct DungeonEntityData *pokemon); #endif diff --git a/include/dungeon_pokemon_attributes_1.h b/include/dungeon_pokemon_attributes_1.h deleted file mode 100644 index c81c4b9..0000000 --- a/include/dungeon_pokemon_attributes_1.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef GUARD_DUNGEON_POKEMON_ATTRIBUTES_1_H -#define GUARD_DUNGEON_POKEMON_ATTRIBUTES_1_H - -#include "dungeon_entity.h" - -// 0x71884 -bool8 CanSeeInvisible(struct DungeonEntity *pokemon); -// 0x718AC -bool8 HasTactic(struct DungeonEntity *pokemon, u8 tactic); -// 0x718D8 -bool8 HasIQSkill(struct DungeonEntity *pokemon, u8 IQSkill); - -void LoadIQSkills(struct DungeonEntity *pokemon); -bool8 CanSeeTeammate(struct DungeonEntity * pokemon); -u8 GetMoveTypeForPokemon(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove); - -// 0x71A44 -s32 CalculateMovePower(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove); -bool8 ToolboxEnabled(struct DungeonEntityData *pokemon); - -#endif diff --git a/include/moves.h b/include/moves.h index dca2ac4..d301b0a 100644 --- a/include/moves.h +++ b/include/moves.h @@ -7,8 +7,10 @@ void InitPokemonMove(struct PokemonMove *move, u16 moveID); // 0x92AE0 s16 GetMoveTargetingFlags(struct PokemonMove *move, u32 isAI); +u8 GetMoveType(struct PokemonMove *move); // 0x92B90 u8 GetMoveWeight(struct PokemonMove *move); +s32 GetMovePower(struct PokemonMove *move); // 0x92BF4 u32 GetMoveMaxPP(struct PokemonMove *move); // 0x92C54 diff --git a/include/pokemon_3.h b/include/pokemon_3.h index 968e2ef..c68da39 100644 --- a/include/pokemon_3.h +++ b/include/pokemon_3.h @@ -1,6 +1,8 @@ #ifndef GUARD_POKEMON_3_H #define GUARD_POKEMON_3_H +bool8 HasIQForSkill(s32 pokeIQ, u8 IQSkillIndex); +void SetIQSkill(u8 *param_1, u32 skillIndex); bool8 IsIQSkillSet(u8 *IQSkillsEnabled, u32 IQSkill); #endif -- cgit v1.2.3 From ece475a4804a64790cfa86dfa0ba577a732adee8 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Sun, 13 Feb 2022 23:17:46 -0500 Subject: Renamed some boolean move functions --- include/moves.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/moves.h b/include/moves.h index d301b0a..22f7ba6 100644 --- a/include/moves.h +++ b/include/moves.h @@ -14,6 +14,6 @@ s32 GetMovePower(struct PokemonMove *move); // 0x92BF4 u32 GetMoveMaxPP(struct PokemonMove *move); // 0x92C54 -bool8 GetMoveDealsDirectDamage(struct PokemonMove *move); +bool8 MoveDealsDirectDamage(struct PokemonMove *move); #endif -- cgit v1.2.3