pokemon attributes, moveement, ai targeting into dungeon_logic.c

This commit is contained in:
DizzyEggg
2025-03-30 22:59:59 +02:00
parent 66d4d67e67
commit b829b761f6
60 changed files with 758 additions and 811 deletions

View File

@@ -1,28 +0,0 @@
#ifndef GUARD_DUNGEON_AI_TARGETING_H
#define GUARD_DUNGEON_AI_TARGETING_H
#include "structs/dungeon_entity.h"
void SetMessageArgument_2(u8 *buffer, EntityInfo *param_2, s32 colorNum);
bool8 HasNegativeStatus(Entity *pokemon);
bool8 IsSleeping(Entity *pokemon);
bool8 HasLowHealth(Entity *pokemon);
s32 sub_8070828(Entity *pokemon, bool8 displayMessage);
void sub_80709C8(u8 *buffer, EntityInfo *entityInfo);
bool8 CheckVariousStatuses2(Entity *pokemon, bool8 checkBlinker);
bool8 sub_8070BC0(Entity* entity);
bool8 CheckVariousConditions(Entity *pokemon);
bool8 CheckVariousStatuses(Entity *pokemon);
bool8 CannotAttack(Entity *pokemon, bool8 skipSleep);
bool8 CanMoveInDirection(Entity *pokemon, u32 direction);
bool8 CanAttackInDirection(Entity *pokemon, s32 direction);
bool8 CanAIMonsterMoveInDirection(Entity *pokemon, s32 direction, bool8 *pokemonInFront);
bool8 IsAtJunction(Entity *pokemon);
bool8 ShouldAvoidFirstHit(Entity *pokemon, bool8 forceAvoid);
bool8 ShouldMonsterRunAway(Entity *pokemon);
bool8 ShouldMonsterRunAwayAndShowEffect(Entity *pokemon, bool8 showRunAwayEffect);
void CheckRunAwayVisualFlag(Entity *pokemon, bool8 showRunAwayEffect);
u8 GetTreatmentBetweenMonsters(Entity *pokemon, Entity *targetPokemon, bool8 ignoreInvisible, bool8 checkPetrified);
u8 sub_807167C(Entity * pokemon, Entity * target);
#endif

59
include/dungeon_logic.h Normal file
View File

@@ -0,0 +1,59 @@
#ifndef GUARD_DUNGEON_LOGIC_H
#define GUARD_DUNGEON_LOGIC_H
#include "structs/map.h"
#include "structs/dungeon_entity.h"
extern u8 gWalkableTileToCrossableTerrain[8];
u8 GetCrossableTerrain(s16 species);
u8 sub_807034C(s32 id, const Tile *tile);
u8 sub_80703A0(Entity *pokemon, DungeonPos *pos);
bool8 CanCrossWalls(Entity *pokemon);
bool8 sub_807049C(Entity *pokemon, DungeonPos *pos);
bool8 sub_8070564(Entity *pokemon, DungeonPos *pos);
bool8 sub_80705F0(Entity *pokemon, DungeonPos *pos);
bool8 sub_80706A4(Entity *pokemon, DungeonPos *pos);
s32 CalcSpeedStage(Entity *pokemon);
s32 sub_8070828(Entity *pokemon, bool8 displayMessage);
void SetMessageArgument_2(u8 *buffer, EntityInfo *param_2, s32 colorNum);
void sub_8070968(u8 *buffer, EntityInfo *entityInfo, s32 colorNum);
void sub_80709C8(u8 *buffer, EntityInfo *entityInfo);
bool8 HasNegativeStatus(Entity *pokemon);
bool8 IsSleeping(Entity *pokemon);
bool8 HasLowHealth(Entity *pokemon);
bool8 CheckVariousStatuses2(Entity *pokemon, bool8 checkBlinker);
bool8 sub_8070BC0(Entity* entity);
bool8 CheckVariousConditions(Entity *pokemon);
bool8 CheckVariousStatuses(Entity *pokemon);
bool8 CannotAttack(Entity *pokemon, bool8 skipSleep);
bool8 CanMoveInDirection(Entity *pokemon, u32 direction);
bool8 sub_8070F3C(Entity * pokemon, DungeonPos *pos, s32 direction);
bool8 sub_8070F14(Entity * pokemon, s32 direction);
bool8 sub_8070F80(Entity * pokemon, s32 direction);
bool8 CanAttackInDirection(Entity *pokemon, s32 direction);
bool8 CanAIMonsterMoveInDirection(Entity *pokemon, s32 direction, bool8 *pokemonInFront);
bool8 IsAtJunction(Entity *pokemon);
bool8 ShouldAvoidFirstHit(Entity *pokemon, bool8 forceAvoid);
bool8 ShouldMonsterRunAway(Entity *pokemon);
bool8 ShouldMonsterRunAwayAndShowEffect(Entity *pokemon, bool8 showRunAwayEffect);
void CheckRunAwayVisualFlag(Entity *pokemon, bool8 showRunAwayEffect);
u8 GetTreatmentBetweenMonsters(Entity *pokemon, Entity *targetPokemon, bool8 ignoreInvisible, bool8 checkPetrified);
u8 sub_807167C(Entity * pokemon, Entity * target);
bool8 HasSafeguardStatus(Entity * pokemon, Entity * target, bool8 displayMessage);
bool8 sub_8071728(Entity * pokemon, Entity * target, bool8 displayMessage);
bool8 sub_80717A4(Entity *pokemon, u16 moveID);
bool8 AbilityIsActive(Entity *pokemon, u8 ability);
bool8 MonsterIsType(Entity *pokemon, u8 type);
bool8 CanSeeInvisibleMonsters(Entity *pokemon);
bool8 IsTacticSet(Entity *pokemon, u8 tactic);
bool8 IQSkillIsEnabled(Entity *pokemon, u8 IQSkill);
void LoadIQSkills(Entity *pokemon);
bool8 CanSeeTeammate(Entity * pokemon);
u8 GetMoveTypeForMonster(Entity *pokemon, Move *pokeMove);
s32 GetMovePower(Entity *pokemon, Move *pokeMove);
bool8 MonsterCanThrowItems(EntityInfo *pokemon);
bool8 sub_8071A8C(Entity *pokemon);
bool8 SetVisualFlags(EntityInfo *entityInfo, u16 newFlag, bool8 param_3);
#endif

View File

@@ -1,19 +0,0 @@
#ifndef GUARD_DUNGEON_MOVEMENT
#define GUARD_DUNGEON_MOVEMENT
#include "structs/dungeon_entity.h"
#include "structs/map.h"
extern u8 gWalkableTileToCrossableTerrain[8];
u8 GetCrossableTerrain(s16 species);
u8 sub_807034C(s32 id, const Tile *tile);
u8 sub_80703A0(Entity *pokemon, DungeonPos *pos);
bool8 CanCrossWalls(Entity *pokemon);
bool8 sub_807049C(Entity *pokemon, DungeonPos *pos);
bool8 sub_8070564(Entity *pokemon, DungeonPos *pos);
bool8 sub_80705F0(Entity *pokemon, DungeonPos *pos);
bool8 sub_80706A4(Entity *pokemon, DungeonPos *pos);
s32 CalcSpeedStage(Entity *pokemon);
#endif

View File

@@ -1,21 +0,0 @@
#ifndef GUARD_DUNGEON_POKEMON_ATTRIBUTES_H
#define GUARD_DUNGEON_POKEMON_ATTRIBUTES_H
#include "structs/dungeon_entity.h"
bool8 HasSafeguardStatus(Entity * param_1, Entity * param_2, bool8 displayMessage);
bool8 sub_8071728(Entity * pokemon, Entity * target, bool8 displayMessage);
bool8 sub_80717A4(Entity *pokemon, u16 moveID);
bool8 AbilityIsActive(Entity *pokemon, u8 ability);
bool8 MonsterIsType(Entity *pokemon, u8 type);
bool8 CanSeeInvisibleMonsters(Entity *pokemon);
bool8 IsTacticSet(Entity *pokemon, u8 tactic);
bool8 IQSkillIsEnabled(Entity *pokemon, u8 IQSkill);
void LoadIQSkills(Entity *pokemon);
bool8 CanSeeTeammate(Entity * pokemon);
u8 GetMoveTypeForMonster(Entity *pokemon, Move *pokeMove);
s32 GetMovePower(Entity *pokemon, Move *pokeMove);
bool8 MonsterCanThrowItems(EntityInfo *pokemon);
bool8 SetVisualFlags(EntityInfo *entityInfo, u16 newFlag, bool8 param_3);
#endif

View File

@@ -243,9 +243,7 @@ SECTIONS {
src/code_806E8B0.o(.text);
src/code_806FDF4.o(.text);
src/status_checks.o(.text);
src/dungeon_movement.o(.text);
src/dungeon_ai_targeting.o(.text);
src/dungeon_pokemon_attributes.o(.text);
src/dungeon_logic.o(.text);
src/code_80718D8.o(.text);
asm/code_80718D8.o(.text);
src/code_8072B78.o(.text);
@@ -580,7 +578,7 @@ SECTIONS {
src/code_806CD90.o(.rodata);
src/type_effectiveness.o(.data);
data/data_8106F7C.o(.rodata);
src/dungeon_ai_targeting.o(.rodata);
src/dungeon_logic.o(.rodata);
data/data_8107010.o(.rodata);
src/dungeon_serializer.o(.rodata);
data/data_8107224.o(.rodata);

View File

@@ -18,7 +18,7 @@
#include "dungeon_map_access.h"
#include "dungeon_message.h"
#include "dungeon_music.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_range.h"
#include "dungeon_util.h"
#include "game_options.h"

View File

@@ -16,7 +16,7 @@
#include "code_804267C.h"
#include "code_806CD90.h"
#include "dungeon_config.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_util.h"
#include "items.h"
#include "math.h"

View File

@@ -12,7 +12,7 @@
#include "code_8077274_1.h"
#include "code_807CD9C.h"
#include "code_8084778.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "run_dungeon.h"
#include "dungeon_items.h"
#include "dungeon_leader.h"
@@ -21,7 +21,7 @@
#include "dungeon_misc.h"
#include "dungeon_move.h"
#include "dungeon_move_util.h"
#include "dungeon_movement.h"
#include "dungeon_logic.h"
#include "dungeon_music.h"
#include "dungeon_random.h"
#include "dungeon_strings.h"

View File

@@ -22,8 +22,8 @@
#include "dungeon_leader.h"
#include "dungeon_map_access.h"
#include "dungeon_misc.h"
#include "dungeon_movement.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_message.h"
#include "dungeon_util.h"

View File

@@ -13,12 +13,12 @@
#include "code_805D8C8.h"
#include "code_806CD90.h"
#include "code_8077274_1.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "dungeon_config.h"
#include "dungeon_items.h"
#include "dungeon_map_access.h"
#include "dungeon_message.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_misc.h"
#include "dungeon_util.h"

View File

@@ -1,7 +1,7 @@
#include "global.h"
#include "constants/ability.h"
#include "structs/str_dungeon.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "text_util.h"
#include "dungeon_message.h"
#include "string_format.h"
@@ -19,7 +19,7 @@
#include "structs/str_damage.h"
#include "dungeon_util.h"
#include "dungeon_config.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
void sub_8042940(Entity *r0);
void sub_80428B0(Entity *r0);

View File

@@ -11,7 +11,7 @@
#include "code_8097670.h"
#include "dungeon.h"
#include "dungeon_items.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "friend_area.h"

View File

@@ -1,7 +1,7 @@
#include "global.h"
#include "constants/tactic.h"
#include "dungeon_config.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_leader.h"
#include "dungeon_message.h"
#include "code_8041AD0.h"
@@ -14,7 +14,7 @@
#include "pokemon_3.h"
#include "code_805D8C8.h"
#include "structs/str_806B7F8.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
EWRAM_DATA s32 gUnknown_202F31C[2] = {0, 0};
EWRAM_DATA s32 gUnknown_202F324[2] = {0, 0};

View File

@@ -3,7 +3,7 @@
#include "code_806CD90.h"
#include "dungeon_map_access.h"
#include "dungeon_message.h"
#include "dungeon_movement.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "moves.h"
@@ -12,7 +12,7 @@
#include "structs/map.h"
#include "structs/str_pokemon.h"
#include "structs/str_806B7F8.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
extern u8 *gUnknown_80FE2EC[];

View File

@@ -3,7 +3,7 @@
#include "items.h"
#include "status.h"
#include "weather.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "structs/dungeon_entity.h"
#include "structs/map.h"
#include "structs/str_moves.h"
@@ -12,7 +12,7 @@
#include "dungeon_map_access.h"
#include "code_803E46C.h"
#include "code_806CD90.h"
#include "dungeon_movement.h"
#include "dungeon_logic.h"
#include "game_options.h"
#include "dungeon_items.h"
#include "moves.h"
@@ -28,7 +28,7 @@
#include "number_util.h"
#include "dungeon_message.h"
#include "code_8077274_1.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "math.h"
#include "dungeon_config.h"

View File

@@ -7,12 +7,12 @@
#include "code_806CD90.h"
#include "dungeon_items.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_util.h"
#include "structs/str_dungeon.h"
#include "position_util.h"
#include "trap.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
extern void sub_8073D14(Entity *);

View File

@@ -11,8 +11,8 @@
#include "constants/status.h"
#include "constants/type.h"
#include "dungeon_items.h"
#include "dungeon_movement.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "move_effects_target.h"
@@ -26,7 +26,7 @@
#include "dungeon_map_access.h"
#include "structs/str_806B7F8.h"
#include "dungeon_config.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
extern u8 *gUnknown_80FA8BC[];
extern u8 *gUnknown_80FA824[];

View File

@@ -10,8 +10,8 @@
#include "dungeon_ai.h"
#include "run_dungeon.h"
#include "dungeon_generation.h"
#include "dungeon_movement.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_logic.h"
#include "dungeon_map.h"
#include "dungeon_map_access.h"
#include "dungeon_util.h"

View File

@@ -7,7 +7,7 @@
#include "dungeon_ai.h"
#include "dungeon_leader.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_util.h"
#include "dungeon_config.h"
#include "move_util.h"

View File

@@ -10,12 +10,12 @@
#include "pokemon.h"
#include "structs/map.h"
#include "dungeon_message.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "string_format.h"
#include "dungeon_movement.h"
#include "dungeon_logic.h"
#include "dungeon_map_access.h"
#include "dungeon_movement.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "dungeon_logic.h"
#include "position_util.h"
#include "dungeon_ai.h"
#include "code_806CD90.h"

View File

@@ -2,7 +2,7 @@
#include "constants/ability.h"
#include "constants/iq_skill.h"
#include "structs/dungeon_entity.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util.h"

View File

@@ -4,7 +4,7 @@
#include "structs/str_dungeon.h"
#include "dungeon_cutscenes.h"
#include "dungeon_music.h"
#include "dungeon_movement.h"
#include "dungeon_logic.h"
#include "dungeon_util_1.h"
#include "exclusive_pokemon.h"
#include "weather.h"

View File

@@ -12,7 +12,7 @@
#include "code_8077274_1.h"
#include "code_807CD9C.h"
#include "code_8084778.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "run_dungeon.h"
#include "dungeon_items.h"
#include "dungeon_leader.h"
@@ -21,7 +21,7 @@
#include "dungeon_misc.h"
#include "dungeon_move.h"
#include "dungeon_move_util.h"
#include "dungeon_movement.h"
#include "dungeon_logic.h"
#include "dungeon_music.h"
#include "dungeon_random.h"
#include "dungeon_strings.h"

View File

@@ -7,7 +7,7 @@
#include "structs/dungeon_entity.h"
#include "structs/str_dungeon.h"
#include "dungeon_leader.h"
#include "dungeon_movement.h"
#include "dungeon_logic.h"
#include "dungeon_generation.h"
#include "dungeon_util.h"
#include "dungeon_strings.h"

View File

@@ -17,11 +17,11 @@
#include "dungeon_ai_attack.h"
#include "dungeon_ai_items.h"
#include "dungeon_ai_movement.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "dungeon_items.h"
#include "dungeon_leader.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util_1.h"
#include "dungeon_util.h"

View File

@@ -12,12 +12,12 @@
#include "constants/targeting.h"
#include "constants/type.h"
#include "dungeon_action.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "dungeon_ai.h"
#include "dungeon_config.h"
#include "run_dungeon.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "items.h"

View File

@@ -3,9 +3,9 @@
#include "dungeon_ai_item_weight.h"
#include "constants/status.h"
#include "constants/targeting.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_util.h"
#include "moves.h"
#include "number_util.h"

View File

@@ -9,11 +9,11 @@
#include "dungeon_ai_attack.h"
#include "dungeon_ai_item_weight.h"
#include "dungeon_ai_items.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "structs/dungeon_entity.h"
#include "structs/str_dungeon.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "items.h"

View File

@@ -15,11 +15,11 @@
#include "constants/move_id.h"
#include "constants/status.h"
#include "constants/targeting.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "dungeon_items.h"
#include "dungeon_leader.h"
#include "dungeon_movement.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "move_util.h"

View File

@@ -8,11 +8,11 @@
#include "constants/tactic.h"
#include "dungeon_action.h"
#include "dungeon_ai_leader.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "structs/str_dungeon.h"
#include "dungeon_map_access.h"
#include "dungeon_movement.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_range.h"
#include "dungeon_util.h"

View File

@@ -18,7 +18,7 @@
#include "dungeon_message.h"
#include "dungeon_music.h"
#include "dungeon_misc.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util_1.h"
#include "dungeon_util.h"

View File

@@ -6,12 +6,12 @@
#include "dungeon_ai_leader.h"
#include "dungeon_ai.h"
#include "dungeon_leader.h"
#include "dungeon_movement.h"
#include "dungeon_logic.h"
#include "dungeon_util.h"
#include "structs/dungeon_entity.h"
#include "structs/str_dungeon.h"
#include "constants/ability.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
extern bool8 sub_8044B28(void);
extern void TrySpawnMonsterAndActivatePlusMinus(void);

View File

@@ -14,7 +14,7 @@
#include "dungeon_action.h"
#include "dungeon_items.h"
#include "dungeon_music.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "move_effects_target.h"
@@ -31,7 +31,7 @@
#include "dungeon_misc.h"
#include "code_803E724.h"
#include "dungeon_data.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
extern u8 *gUnknown_80F89F4[];
extern u8 *gUnknown_80FB580[];

View File

@@ -16,7 +16,7 @@
#include "dungeon_music.h"
#include "dungeon_map.h"
#include "dungeon_strings.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "string_format.h"
#include "items.h"
#include "structs/map.h"

View File

@@ -1,36 +1,44 @@
#include "global.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "structs/map.h"
#include "constants/item.h"
#include "constants/iq_skill.h"
#include "constants/status.h"
#include "constants/type.h"
#include "constants/weather.h"
#include "run_dungeon.h"
#include "dungeon_items.h"
#include "structs/str_dungeon.h"
#include "dungeon_map_access.h"
#include "dungeon_logic.h"
#include "dungeon_util.h"
#include "pokemon.h"
#include "weather.h"
#include "constants/ability.h"
#include "constants/dungeon.h"
#include "constants/iq_skill.h"
#include "constants/item.h"
#include "constants/status.h"
#include "constants/tactic.h"
#include "constants/targeting.h"
#include "run_dungeon.h"
#include "structs/str_dungeon.h"
#include "dungeon_items.h"
#include "dungeon_map_access.h"
#include "dungeon_movement.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "structs/map.h"
#include "dungeon_move_util.h"
#include "code_800D090.h"
#include "dungeon_message.h"
#include "constants/weather.h"
#include "pokemon_mid.h"
#include "pokemon.h"
#include "structs/str_dungeon.h"
#include "weather.h"
#include "dungeon_strings.h"
#include "constants/move_id.h"
#include "moves.h"
#include "pokemon_3.h"
#include "pokemon.h"
#include "dungeon_config.h"
// This file deals with things like controlling movement, walkable tiles, ai targeting, status checks and pokemon attributes.
extern const u8 gUnknown_8106FA4[];
extern void sub_80429B4(Entity *r0);
extern void ShowVisualFlags(Entity *r0);
EWRAM_DATA u8 gWalkableTileToCrossableTerrain[8] = {0};
const u8 gDirectionBitMasks_1[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
const u8 gDirectionBitMasks_2[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
const u8 gDirectionBitMasks_3[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
@@ -72,6 +80,335 @@ const u8 gTreatmentData[3][2][2][2] = {
}
};
u8 GetCrossableTerrain(s16 species)
{
u8 walkableTiles = GetMovementType(species);
if (walkableTiles >= NUM_CROSSABLE_TERRAIN)
{
// Pokémon that can cross water or lava have a walkable tile value of 4 (MOVEMENT_TYPE_LAVA) or 5 (MOVEMENT_TYPE_WATER), respectively.
// Indices 4 and 5 in this array are assigned either CROSSABLE_TERRAIN_REGULAR or CROSSABLE_TERRAIN_LIQUID
// depending on whether the dungeon's liquid is water or lava.
// For example, a lava dungeon like Mt. Blaze would have these values:
// gWalkableTileToCrossableTerrain[MOVEMENT_TYPE_LAVA]: CROSSABLE_TERRAIN_LIQUID
// gWalkableTileToCrossableTerrain[MOVEMENT_TYPE_WATER]: CROSSABLE_TERRAIN_REGULAR
// This means a Fire-type can cross the dungeon's liquid, while a Water-type cannot.
return gWalkableTileToCrossableTerrain[walkableTiles];
}
else
{
return walkableTiles;
}
}
u8 sub_807034C(s32 id, const Tile *tile)
{
s32 crossableTerrain;
u16 tileFlags;
s32 id_s32;
id_s32 = SpeciesId(id);
if ((tile->monster == NULL) && ((tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL) == 0)) {
crossableTerrain = GetCrossableTerrain(id_s32);
tileFlags = tile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
switch(crossableTerrain)
{
case CROSSABLE_TERRAIN_LIQUID:
if(tileFlags == TERRAIN_TYPE_SECONDARY) return FALSE;
case CROSSABLE_TERRAIN_REGULAR:
if(tileFlags == TERRAIN_TYPE_NORMAL) return FALSE;
break;
case CROSSABLE_TERRAIN_WALL:
default:
return FALSE;
case CROSSABLE_TERRAIN_CREVICE:
if(tileFlags != 0) return FALSE;
}
}
return TRUE;
}
u8 sub_80703A0(Entity *pokemon, DungeonPos *pos)
{
const Tile *tile;
u8 crossableTerrain;
u16 tileFlags;
EntityInfo *entityInfo;
entityInfo = GetEntInfo(pokemon);
tile = GetTile(pos->x,pos->y);
if (pos->x < 0 || pos->y < 0)
return TRUE;
if (pos->x >= DUNGEON_MAX_SIZE_X || pos->y >= DUNGEON_MAX_SIZE_Y)
return TRUE;
if (tile->monster != NULL)
return TRUE;
if (tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL)
return TRUE;
if ((IsCurrentFixedRoomBossFight()) || ((entityInfo->invisibleClassStatus.status != STATUS_MOBILE && (!HasHeldItem(pokemon, ITEM_MOBILE_SCARF))))) {
crossableTerrain = GetCrossableTerrain(entityInfo->id);
tileFlags = tile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
if (IQSkillIsEnabled(pokemon, IQ_ALL_TERRAIN_HIKER)) {
crossableTerrain = CROSSABLE_TERRAIN_CREVICE;
}
if (IQSkillIsEnabled(pokemon, IQ_SUPER_MOBILE)) {
crossableTerrain = CROSSABLE_TERRAIN_WALL;
}
switch(crossableTerrain)
{
case CROSSABLE_TERRAIN_LIQUID:
if(tileFlags == TERRAIN_TYPE_SECONDARY) return FALSE;
case CROSSABLE_TERRAIN_REGULAR:
if(tileFlags == TERRAIN_TYPE_NORMAL) return FALSE;
break;
case CROSSABLE_TERRAIN_WALL:
default:
return FALSE;
case CROSSABLE_TERRAIN_CREVICE:
if(tileFlags != 0) return FALSE;
}
}
else {
return FALSE;
}
return TRUE;
}
bool8 CanCrossWalls(Entity *pokemon)
{
EntityInfo *pokemonInfo = GetEntInfo(pokemon);
if (pokemonInfo->invisibleClassStatus.status == STATUS_MOBILE)
{
return TRUE;
}
if (HasHeldItem(pokemon, ITEM_MOBILE_SCARF))
{
return TRUE;
}
if (GetCrossableTerrain(pokemonInfo->id) == CROSSABLE_TERRAIN_WALL)
{
return TRUE;
}
return FALSE;
}
bool8 sub_807049C(Entity *pokemon, DungeonPos *pos)
{
s32 crossableTerrain;
const Tile *tile;
u16 tileFlags;
EntityInfo *entityInfo;
entityInfo = GetEntInfo(pokemon);
tile = GetTile(pos->x,pos->y);
if (pos->x < 0 || pos->y < 0)
return TRUE;
if (pos->x >= DUNGEON_MAX_SIZE_X || pos->y >= DUNGEON_MAX_SIZE_Y)
return TRUE;
if (tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL)
return TRUE;
if (tile->monster != NULL && GetEntityType(tile->monster) != ENTITY_MONSTER)
return TRUE;
if (IsCurrentFixedRoomBossFight() || (entityInfo->invisibleClassStatus.status != STATUS_MOBILE && !HasHeldItem(pokemon, ITEM_MOBILE_SCARF))) {
crossableTerrain = GetCrossableTerrain(entityInfo->id);
tileFlags = tile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
if (IQSkillIsEnabled(pokemon, IQ_ALL_TERRAIN_HIKER)) {
crossableTerrain = CROSSABLE_TERRAIN_CREVICE;
}
if (IQSkillIsEnabled(pokemon, IQ_SUPER_MOBILE)) {
crossableTerrain = CROSSABLE_TERRAIN_WALL;
}
switch(crossableTerrain)
{
case CROSSABLE_TERRAIN_LIQUID:
if(tileFlags == TERRAIN_TYPE_SECONDARY) return FALSE;
case CROSSABLE_TERRAIN_REGULAR:
if(tileFlags == TERRAIN_TYPE_NORMAL) return FALSE;
break;
case CROSSABLE_TERRAIN_WALL:
default:
return FALSE;
case CROSSABLE_TERRAIN_CREVICE:
if(tileFlags != 0) return FALSE;
}
}
else {
return FALSE;
}
return TRUE;
}
bool8 sub_8070564(Entity *pokemon, DungeonPos *pos)
{
u16 crossableTerrain;
u32 tileFlags;
EntityInfo *entityInfo = GetEntInfo(pokemon);
const Tile *tile = GetTile(pos->x,pos->y);
if (pos->x < 0 || pos->y < 0)
return TRUE;
if (pos->x >= DUNGEON_MAX_SIZE_X || pos->y >= DUNGEON_MAX_SIZE_Y)
return TRUE;
if (tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL)
return TRUE;
if (tile->monster != NULL && GetEntityType(tile->monster) != ENTITY_MONSTER)
return TRUE;
crossableTerrain = GetCrossableTerrain(entityInfo->id);
tileFlags = GetTerrainType(tile);
switch (crossableTerrain)
{
default:
return FALSE;
case CROSSABLE_TERRAIN_WALL:
case CROSSABLE_TERRAIN_CREVICE:
if (tileFlags != TERRAIN_TYPE_WALL) return FALSE;
break;
case CROSSABLE_TERRAIN_REGULAR:
if (tileFlags == TERRAIN_TYPE_NORMAL) return FALSE;
break;
case CROSSABLE_TERRAIN_LIQUID:
if (tileFlags == TERRAIN_TYPE_SECONDARY) return FALSE;
if (tileFlags == TERRAIN_TYPE_NORMAL) return FALSE;
break;
}
return TRUE;
}
bool8 sub_80705F0(Entity *pokemon, DungeonPos *pos)
{
s32 crossableTerrain;
const Tile *tile;
u16 tileFlags;
EntityInfo *entityInfo;
entityInfo = GetEntInfo(pokemon);
tile = GetTile(pos->x,pos->y);
if (pos->x < 0 || pos->y < 0)
return TRUE;
if (pos->x >= DUNGEON_MAX_SIZE_X || pos->y >= DUNGEON_MAX_SIZE_Y)
return TRUE;
if (((tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL) == 0) && (tile->monster == NULL || (GetEntityType(tile->monster) == ENTITY_MONSTER))) {
if (IsCurrentFixedRoomBossFight() || (entityInfo->invisibleClassStatus.status != STATUS_MOBILE && !HasHeldItem(pokemon, ITEM_MOBILE_SCARF))) {
crossableTerrain = GetCrossableTerrain(entityInfo->id);
tileFlags = tile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
if (IQSkillIsEnabled(pokemon, IQ_ALL_TERRAIN_HIKER)) {
crossableTerrain = CROSSABLE_TERRAIN_CREVICE;
}
if (IQSkillIsEnabled(pokemon, IQ_SUPER_MOBILE)) {
crossableTerrain = CROSSABLE_TERRAIN_WALL;
}
switch(crossableTerrain)
{
case CROSSABLE_TERRAIN_WALL:
default:
return FALSE;
case CROSSABLE_TERRAIN_REGULAR:
case CROSSABLE_TERRAIN_LIQUID:
case CROSSABLE_TERRAIN_CREVICE:
if(tileFlags != 0) return FALSE;
}
}
else return FALSE;
}
return TRUE;
}
bool8 sub_80706A4(Entity *pokemon, DungeonPos *pos)
{
s32 crossableTerrain;
const Tile *tile;
u16 tileFlags;
EntityInfo *entityInfo;
entityInfo = GetEntInfo(pokemon);
tile = GetTile(pos->x,pos->y);
if (pos->x < 0 || pos->y < 0)
return TRUE;
if (pos->x >= DUNGEON_MAX_SIZE_X || pos->y >= DUNGEON_MAX_SIZE_Y)
return TRUE;
if ((((tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL) == 0))
&& (tile->monster == NULL || ((GetEntityType(tile->monster) == ENTITY_MONSTER) && (GetEntInfo(tile->monster) == entityInfo)))) {
if (IsCurrentFixedRoomBossFight() || (entityInfo->invisibleClassStatus.status != STATUS_MOBILE && !HasHeldItem(pokemon, ITEM_MOBILE_SCARF))) {
crossableTerrain = GetCrossableTerrain(entityInfo->id);
tileFlags = tile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
if (IQSkillIsEnabled(pokemon, IQ_ALL_TERRAIN_HIKER)) {
crossableTerrain = CROSSABLE_TERRAIN_CREVICE;
}
if (IQSkillIsEnabled(pokemon, IQ_SUPER_MOBILE)) {
crossableTerrain = CROSSABLE_TERRAIN_WALL;
}
switch(crossableTerrain)
{
case CROSSABLE_TERRAIN_LIQUID:
if(tileFlags == TERRAIN_TYPE_SECONDARY) return FALSE;
case CROSSABLE_TERRAIN_REGULAR:
if(tileFlags == TERRAIN_TYPE_NORMAL) return FALSE;
break;
case CROSSABLE_TERRAIN_WALL:
default:
return FALSE;
case CROSSABLE_TERRAIN_CREVICE:
if(tileFlags != 0) return FALSE;
}
}
else return FALSE;
}
return TRUE;
}
s32 CalcSpeedStage(Entity *pokemon)
{
s32 index;
s32 speed;
EntityInfo * entityInfo;
entityInfo = GetEntInfo(pokemon);
speed = 0;
for(index = 0; index < NUM_SPEED_COUNTERS; index++)
{
if (entityInfo->speedUpCounters[index + NUM_SPEED_COUNTERS] != 0) {
speed--;
}
if (entityInfo->speedUpCounters[index] != 0) {
speed++;
}
}
if (entityInfo->burnClassStatus.status == STATUS_PARALYSIS) {
speed--;
}
speed += GetMovementSpeed(entityInfo->id);
if ((MonsterIsType(pokemon, TYPE_ICE)) && (GetApparentWeather(pokemon) == WEATHER_SNOW)) {
speed++;
}
if (entityInfo->apparentID == MONSTER_DEOXYS_SPEED) {
speed++;
}
if ((entityInfo->id == MONSTER_KECLEON) && entityInfo->isNotTeamMember &&
gDungeon->unk644.unk2A) {
speed++;
}
if (speed < 0) {
speed = 0;
}
if (MAX_SPEED_STAGE < speed) {
speed = MAX_SPEED_STAGE;
}
entityInfo->speedStage = speed;
return speed;
}
s32 sub_8070828(Entity *pokemon, bool8 displayMessage)
{
bool8 flag;
@@ -867,3 +1204,247 @@ error:
}
goto error;
}
bool8 HasSafeguardStatus(Entity * pokemon, Entity * target, bool8 displayMessage)
{
if (GetEntInfo(target)->reflectClassStatus.status == STATUS_SAFEGUARD) {
if (displayMessage) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC2FC);
}
return TRUE;
}
return FALSE;
}
bool8 sub_8071728(Entity * pokemon, Entity * target, bool8 displayMessage)
{
if (GetEntInfo(target)->reflectClassStatus.status == STATUS_MIST) {
if (displayMessage) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], target, 0);
TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80FC31C);
}
return TRUE;
}
else {
if (AbilityIsActive(target, ABILITY_CLEAR_BODY) || AbilityIsActive(target, ABILITY_WHITE_SMOKE)) {
if (displayMessage) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], target, 0);
TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80FCEFC);
}
return TRUE;
}
}
return FALSE;
}
bool8 sub_80717A4(Entity *pokemon, u16 moveID)
{
EntityInfo * entityInfo;
s32 i;
entityInfo = GetEntInfo(pokemon);
if ((entityInfo->sleepClassStatus.status != STATUS_SLEEP) && (entityInfo->sleepClassStatus.status != STATUS_NAPPING) && (entityInfo->sleepClassStatus.status != STATUS_NIGHTMARE)) {
return FALSE;
}
else {
for (i = 0; i < MAX_MON_MOVES; i++) {
Move *move = &entityInfo->moves.moves[i];
if (MoveFlagExists(move)
&& (entityInfo->isTeamLeader || (move->moveFlags & MOVE_FLAG_ENABLED_FOR_AI))
&& sub_805744C(pokemon, move, TRUE)
&& move->PP != 0
&& move->id == moveID)
{
return TRUE;
}
}
}
return FALSE;
}
bool8 AbilityIsActive(Entity *pokemon, u8 ability)
{
if (!EntityIsValid(pokemon))
{
return FALSE;
}
else
{
EntityInfo *pokemonInfo = GetEntInfo(pokemon);
if (pokemonInfo->abilities[0] == ability || pokemonInfo->abilities[1] == ability)
{
return TRUE;
}
return FALSE;
}
}
bool8 MonsterIsType(Entity *pokemon, u8 type)
{
EntityInfo *pokemonInfo = pokemonInfo = GetEntInfo(pokemon);
if (type == TYPE_NONE)
{
return FALSE;
}
if (pokemonInfo->types[0] == type)
{
return TRUE;
}
if (pokemonInfo->types[1] == type)
{
return TRUE;
}
return FALSE;
}
bool8 CanSeeInvisibleMonsters(Entity *pokemon)
{
EntityInfo *pokemonInfo = GetEntInfo(pokemon);
if (pokemonInfo->blinkerClassStatus.status != STATUS_EYEDROPS)
{
if (!HasHeldItem(pokemon, ITEM_GOGGLE_SPECS))
return FALSE;
else
return TRUE;
}
else
return TRUE;
}
bool8 IsTacticSet(Entity *pokemon, u8 tactic)
{
EntityInfo *pokemonInfo = GetEntInfo(pokemon);
if (pokemonInfo->isTeamLeader)
{
bool8 isGoTheOtherWay = tactic == TACTIC_GO_THE_OTHER_WAY;
return isGoTheOtherWay;
}
return pokemonInfo->tactic == tactic;
}
bool8 IQSkillIsEnabled(Entity *pokemon, u8 IQSkill)
{
return IsIQSkillSet(&GetEntInfo(pokemon)->IQSkillFlags, 1 << IQSkill);
}
UNUSED static bool8 IQSkillPairIsEnabled(Entity *pokemon, u8 IQSkill1, u8 IQSkill2)
{
return IsIQSkillSet(&GetEntInfo(pokemon)->IQSkillFlags, 1 << IQSkill1 | 1 << IQSkill2);
}
void LoadIQSkills(Entity *pokemon)
{
s32 IQSkill;
EntityInfo *pokemonInfo;
pokemonInfo = GetEntInfo(pokemon);
if (pokemonInfo->isNotTeamMember) {
IqSkillFlags *iqSkills = &pokemonInfo->IQSkillFlags;
SetIQSkill(iqSkills, IQ_STATUS_CHECKER);
SetIQSkill(iqSkills, IQ_PP_CHECKER);
SetIQSkill(iqSkills, IQ_ITEM_CATCHER);
if (pokemonInfo->bossFlag)
SetIQSkill(iqSkills, IQ_SELF_CURER);
if (pokemonInfo->level >= gIqItemMasterMinWildLevel)
SetIQSkill(iqSkills, IQ_ITEM_MASTER);
pokemonInfo->tactic = TACTIC_GO_AFTER_FOES;
}
else {
pokemonInfo->IQSkillFlags.flags[0] = 0;
pokemonInfo->IQSkillFlags.flags[1] = 0;
pokemonInfo->IQSkillFlags.flags[2] = 0;
for(IQSkill = IQ_TYPE_ADVANTAGE_MASTER; IQSkill < NUM_IQ_SKILLS; IQSkill++)
{
if (HasIQForSkill(pokemonInfo->IQ,IQSkill) &&
IsIQSkillSet(&pokemonInfo->IQSkillMenuFlags, 1 << IQSkill))
{
SetIQSkill(&pokemonInfo->IQSkillFlags,IQSkill);
}
}
}
}
bool8 CanSeeTeammate(Entity * pokemon)
{
Entity *teamMember;
s32 memberIdx;
if (GetEntInfo(pokemon)->isNotTeamMember) {
return FALSE;
}
else
{
for(memberIdx = 0; memberIdx < MAX_TEAM_MEMBERS; memberIdx++)
{
teamMember = gDungeon->teamPokemon[memberIdx];
if (EntityIsValid(pokemon) && (pokemon != teamMember) && (CanSeeTarget(pokemon,teamMember)))
{
return TRUE;
}
}
return FALSE;
}
}
u8 GetMoveTypeForMonster(Entity *pokemon, Move *pokeMove)
{
if (pokeMove->id == MOVE_HIDDEN_POWER)
return GetEntInfo(pokemon)->hiddenPower.hiddenPowerType;
else
return GetMoveType(pokeMove);
}
s32 GetMovePower(Entity *pokemon, Move *pokeMove)
{
if(pokeMove->id == MOVE_HIDDEN_POWER)
return (GetEntInfo(pokemon)->hiddenPower.hiddenPowerBasePower + pokeMove->ginseng);
else
return (GetMoveBasePower(pokeMove) + pokeMove->ginseng);
}
bool8 MonsterCanThrowItems(EntityInfo *pokemon)
{
if(!MonsterIDCanThrowItems(pokemon->id))
return FALSE;
return TRUE;
}
bool8 sub_8071A8C(Entity *pokemon)
{
EntityInfo *pokemonInfo;
if(EntityIsValid(pokemon))
{
pokemonInfo = GetEntInfo(pokemon);
if(pokemonInfo->monsterBehavior != BEHAVIOR_RESCUE_TARGET)
{
if(!IsExperienceLocked(pokemonInfo->joinedAt.id))
return TRUE;
}
}
return FALSE;
}
bool8 SetVisualFlags(EntityInfo *entityInfo, u16 newFlag, bool8 param_3)
{
if ((entityInfo->visualFlags & newFlag)) {
entityInfo->previousVisualFlags = newFlag | entityInfo->previousVisualFlags;
}
else {
entityInfo->previousVisualFlags = entityInfo->previousVisualFlags & ~newFlag;
}
if (param_3) {
entityInfo->visualFlags = newFlag | entityInfo->visualFlags;
}
else {
entityInfo->visualFlags = entityInfo->visualFlags & ~newFlag;
}
if ( ((entityInfo->previousVisualFlags & newFlag) == 0) && ((entityInfo->visualFlags & newFlag)) ) {
return TRUE;
}
else {
return FALSE;
}
}

View File

@@ -21,7 +21,7 @@
#include "code_806CD90.h"
#include "dungeon_action.h"
#include "dungeon_ai_movement.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "dungeon_items.h"
#include "dungeon_leader.h"
#include "dungeon_main.h"
@@ -36,9 +36,9 @@
#include "dungeon_message.h"
#include "dungeon_message_log.h"
#include "dungeon_misc.h"
#include "dungeon_movement.h"
#include "dungeon_logic.h"
#include "dungeon_music.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "game_options.h"

View File

@@ -11,7 +11,7 @@
#include "run_dungeon.h"
#include "dungeon_leader.h"
#include "dungeon_map.h"
#include "dungeon_movement.h"
#include "dungeon_logic.h"
#include "dungeon_util.h"
#include "game_options.h"
#include "random.h"

View File

@@ -9,7 +9,7 @@
#include "dungeon_main.h"
#include "dungeon_message.h"
#include "dungeon_action.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_util.h"
#include "pokemon.h"
#include "items.h"
@@ -26,7 +26,7 @@
#include "text_1.h"
#include "code_8044CC8.h"
#include "code_801B3C0.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
extern void PlayDungeonCancelSE(void);
extern void PlayDungeonConfirmationSE(void);

View File

@@ -11,7 +11,7 @@
#include "dungeon_menu_moves.h"
#include "dungeon_menu_team.h"
#include "dungeon_message.h"
#include "dungeon_movement.h"
#include "dungeon_logic.h"
#include "dungeon_music.h"
#include "dungeon_random.h"
#include "dungeon_submenu.h"
@@ -27,7 +27,7 @@
#include "text_1.h"
#include "text_2.h"
#include "text_3.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
extern void PlayDungeonCancelSE(void);
extern void PlayDungeonConfirmationSE(void);

View File

@@ -23,9 +23,9 @@
#include "dungeon_menu_team.h"
#include "dungeon_message.h"
#include "dungeon_misc.h"
#include "dungeon_movement.h"
#include "dungeon_logic.h"
#include "dungeon_music.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_submenu.h"
#include "dungeon_util.h"
@@ -42,7 +42,7 @@
#include "string_format.h"
#include "text_2.h"
#include "weather.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
extern bool8 sub_8048A68(Entity *param_1,Item *item);
extern bool8 sub_8048950(Entity *param_1,Item *item);

View File

@@ -19,7 +19,7 @@
#include "dungeon_leader.h"
#include "dungeon_message.h"
#include "dungeon_message_log.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "constants/dungeon.h"
#include "constants/friend_area.h"
#include "constants/status.h"
@@ -29,8 +29,8 @@
#include "constants/weather.h"
#include "code_806CD90.h"
#include "code_8077274_1.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_movement.h"
#include "dungeon_logic.h"
#include "dungeon_logic.h"
#include "dungeon_util.h"
#include "exclusive_pokemon.h"
#include "dungeon_config.h"

View File

@@ -19,14 +19,14 @@
#include "code_8077274_1.h"
#include "code_807CD9C.h"
#include "code_808417C.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "dungeon_config.h"
#include "run_dungeon.h"
#include "dungeon_items.h"
#include "dungeon_map_access.h"
#include "dungeon_message.h"
#include "dungeon_misc.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_strings.h"
#include "dungeon_util.h"

View File

@@ -18,7 +18,7 @@
#include "code_8077274_1.h"
#include "code_807CD9C.h"
#include "code_808417C.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "dungeon_config.h"
#include "run_dungeon.h"
#include "dungeon_items.h"
@@ -26,7 +26,7 @@
#include "dungeon_message.h"
#include "dungeon_misc.h"
#include "dungeon_move.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_strings.h"
#include "dungeon_util.h"

View File

@@ -1,348 +0,0 @@
#include "global.h"
#include "structs/map.h"
#include "dungeon_movement.h"
#include "constants/item.h"
#include "constants/iq_skill.h"
#include "constants/status.h"
#include "constants/type.h"
#include "constants/weather.h"
#include "run_dungeon.h"
#include "dungeon_items.h"
#include "structs/str_dungeon.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_util.h"
#include "pokemon.h"
#include "weather.h"
EWRAM_DATA u8 gWalkableTileToCrossableTerrain[8] = {0};
u8 GetCrossableTerrain(s16 species)
{
u8 walkableTiles = GetMovementType(species);
if (walkableTiles >= NUM_CROSSABLE_TERRAIN)
{
// Pokémon that can cross water or lava have a walkable tile value of 4 (MOVEMENT_TYPE_LAVA) or 5 (MOVEMENT_TYPE_WATER), respectively.
// Indices 4 and 5 in this array are assigned either CROSSABLE_TERRAIN_REGULAR or CROSSABLE_TERRAIN_LIQUID
// depending on whether the dungeon's liquid is water or lava.
// For example, a lava dungeon like Mt. Blaze would have these values:
// gWalkableTileToCrossableTerrain[MOVEMENT_TYPE_LAVA]: CROSSABLE_TERRAIN_LIQUID
// gWalkableTileToCrossableTerrain[MOVEMENT_TYPE_WATER]: CROSSABLE_TERRAIN_REGULAR
// This means a Fire-type can cross the dungeon's liquid, while a Water-type cannot.
return gWalkableTileToCrossableTerrain[walkableTiles];
}
else
{
return walkableTiles;
}
}
u8 sub_807034C(s32 id, const Tile *tile)
{
s32 crossableTerrain;
u16 tileFlags;
s32 id_s32;
id_s32 = SpeciesId(id);
if ((tile->monster == NULL) && ((tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL) == 0)) {
crossableTerrain = GetCrossableTerrain(id_s32);
tileFlags = tile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
switch(crossableTerrain)
{
case CROSSABLE_TERRAIN_LIQUID:
if(tileFlags == TERRAIN_TYPE_SECONDARY) return FALSE;
case CROSSABLE_TERRAIN_REGULAR:
if(tileFlags == TERRAIN_TYPE_NORMAL) return FALSE;
break;
case CROSSABLE_TERRAIN_WALL:
default:
return FALSE;
case CROSSABLE_TERRAIN_CREVICE:
if(tileFlags != 0) return FALSE;
}
}
return TRUE;
}
u8 sub_80703A0(Entity *pokemon, DungeonPos *pos)
{
const Tile *tile;
u8 crossableTerrain;
u16 tileFlags;
EntityInfo *entityInfo;
entityInfo = GetEntInfo(pokemon);
tile = GetTile(pos->x,pos->y);
if (pos->x < 0 || pos->y < 0)
return TRUE;
if (pos->x >= DUNGEON_MAX_SIZE_X || pos->y >= DUNGEON_MAX_SIZE_Y)
return TRUE;
if (tile->monster != NULL)
return TRUE;
if (tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL)
return TRUE;
if ((IsCurrentFixedRoomBossFight()) || ((entityInfo->invisibleClassStatus.status != STATUS_MOBILE && (!HasHeldItem(pokemon, ITEM_MOBILE_SCARF))))) {
crossableTerrain = GetCrossableTerrain(entityInfo->id);
tileFlags = tile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
if (IQSkillIsEnabled(pokemon, IQ_ALL_TERRAIN_HIKER)) {
crossableTerrain = CROSSABLE_TERRAIN_CREVICE;
}
if (IQSkillIsEnabled(pokemon, IQ_SUPER_MOBILE)) {
crossableTerrain = CROSSABLE_TERRAIN_WALL;
}
switch(crossableTerrain)
{
case CROSSABLE_TERRAIN_LIQUID:
if(tileFlags == TERRAIN_TYPE_SECONDARY) return FALSE;
case CROSSABLE_TERRAIN_REGULAR:
if(tileFlags == TERRAIN_TYPE_NORMAL) return FALSE;
break;
case CROSSABLE_TERRAIN_WALL:
default:
return FALSE;
case CROSSABLE_TERRAIN_CREVICE:
if(tileFlags != 0) return FALSE;
}
}
else {
return FALSE;
}
return TRUE;
}
bool8 CanCrossWalls(Entity *pokemon)
{
EntityInfo *pokemonInfo = GetEntInfo(pokemon);
if (pokemonInfo->invisibleClassStatus.status == STATUS_MOBILE)
{
return TRUE;
}
if (HasHeldItem(pokemon, ITEM_MOBILE_SCARF))
{
return TRUE;
}
if (GetCrossableTerrain(pokemonInfo->id) == CROSSABLE_TERRAIN_WALL)
{
return TRUE;
}
return FALSE;
}
bool8 sub_807049C(Entity *pokemon, DungeonPos *pos)
{
s32 crossableTerrain;
const Tile *tile;
u16 tileFlags;
EntityInfo *entityInfo;
entityInfo = GetEntInfo(pokemon);
tile = GetTile(pos->x,pos->y);
if (pos->x < 0 || pos->y < 0)
return TRUE;
if (pos->x >= DUNGEON_MAX_SIZE_X || pos->y >= DUNGEON_MAX_SIZE_Y)
return TRUE;
if (tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL)
return TRUE;
if (tile->monster != NULL && GetEntityType(tile->monster) != ENTITY_MONSTER)
return TRUE;
if (IsCurrentFixedRoomBossFight() || (entityInfo->invisibleClassStatus.status != STATUS_MOBILE && !HasHeldItem(pokemon, ITEM_MOBILE_SCARF))) {
crossableTerrain = GetCrossableTerrain(entityInfo->id);
tileFlags = tile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
if (IQSkillIsEnabled(pokemon, IQ_ALL_TERRAIN_HIKER)) {
crossableTerrain = CROSSABLE_TERRAIN_CREVICE;
}
if (IQSkillIsEnabled(pokemon, IQ_SUPER_MOBILE)) {
crossableTerrain = CROSSABLE_TERRAIN_WALL;
}
switch(crossableTerrain)
{
case CROSSABLE_TERRAIN_LIQUID:
if(tileFlags == TERRAIN_TYPE_SECONDARY) return FALSE;
case CROSSABLE_TERRAIN_REGULAR:
if(tileFlags == TERRAIN_TYPE_NORMAL) return FALSE;
break;
case CROSSABLE_TERRAIN_WALL:
default:
return FALSE;
case CROSSABLE_TERRAIN_CREVICE:
if(tileFlags != 0) return FALSE;
}
}
else {
return FALSE;
}
return TRUE;
}
bool8 sub_8070564(Entity *pokemon, DungeonPos *pos)
{
u16 crossableTerrain;
u32 tileFlags;
EntityInfo *entityInfo = GetEntInfo(pokemon);
const Tile *tile = GetTile(pos->x,pos->y);
if (pos->x < 0 || pos->y < 0)
return TRUE;
if (pos->x >= DUNGEON_MAX_SIZE_X || pos->y >= DUNGEON_MAX_SIZE_Y)
return TRUE;
if (tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL)
return TRUE;
if (tile->monster != NULL && GetEntityType(tile->monster) != ENTITY_MONSTER)
return TRUE;
crossableTerrain = GetCrossableTerrain(entityInfo->id);
tileFlags = GetTerrainType(tile);
switch (crossableTerrain)
{
default:
return FALSE;
case CROSSABLE_TERRAIN_WALL:
case CROSSABLE_TERRAIN_CREVICE:
if (tileFlags != TERRAIN_TYPE_WALL) return FALSE;
break;
case CROSSABLE_TERRAIN_REGULAR:
if (tileFlags == TERRAIN_TYPE_NORMAL) return FALSE;
break;
case CROSSABLE_TERRAIN_LIQUID:
if (tileFlags == TERRAIN_TYPE_SECONDARY) return FALSE;
if (tileFlags == TERRAIN_TYPE_NORMAL) return FALSE;
break;
}
return TRUE;
}
bool8 sub_80705F0(Entity *pokemon, DungeonPos *pos)
{
s32 crossableTerrain;
const Tile *tile;
u16 tileFlags;
EntityInfo *entityInfo;
entityInfo = GetEntInfo(pokemon);
tile = GetTile(pos->x,pos->y);
if (pos->x < 0 || pos->y < 0)
return TRUE;
if (pos->x >= DUNGEON_MAX_SIZE_X || pos->y >= DUNGEON_MAX_SIZE_Y)
return TRUE;
if (((tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL) == 0) && (tile->monster == NULL || (GetEntityType(tile->monster) == ENTITY_MONSTER))) {
if (IsCurrentFixedRoomBossFight() || (entityInfo->invisibleClassStatus.status != STATUS_MOBILE && !HasHeldItem(pokemon, ITEM_MOBILE_SCARF))) {
crossableTerrain = GetCrossableTerrain(entityInfo->id);
tileFlags = tile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
if (IQSkillIsEnabled(pokemon, IQ_ALL_TERRAIN_HIKER)) {
crossableTerrain = CROSSABLE_TERRAIN_CREVICE;
}
if (IQSkillIsEnabled(pokemon, IQ_SUPER_MOBILE)) {
crossableTerrain = CROSSABLE_TERRAIN_WALL;
}
switch(crossableTerrain)
{
case CROSSABLE_TERRAIN_WALL:
default:
return FALSE;
case CROSSABLE_TERRAIN_REGULAR:
case CROSSABLE_TERRAIN_LIQUID:
case CROSSABLE_TERRAIN_CREVICE:
if(tileFlags != 0) return FALSE;
}
}
else return FALSE;
}
return TRUE;
}
bool8 sub_80706A4(Entity *pokemon, DungeonPos *pos)
{
s32 crossableTerrain;
const Tile *tile;
u16 tileFlags;
EntityInfo *entityInfo;
entityInfo = GetEntInfo(pokemon);
tile = GetTile(pos->x,pos->y);
if (pos->x < 0 || pos->y < 0)
return TRUE;
if (pos->x >= DUNGEON_MAX_SIZE_X || pos->y >= DUNGEON_MAX_SIZE_Y)
return TRUE;
if ((((tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL) == 0))
&& (tile->monster == NULL || ((GetEntityType(tile->monster) == ENTITY_MONSTER) && (GetEntInfo(tile->monster) == entityInfo)))) {
if (IsCurrentFixedRoomBossFight() || (entityInfo->invisibleClassStatus.status != STATUS_MOBILE && !HasHeldItem(pokemon, ITEM_MOBILE_SCARF))) {
crossableTerrain = GetCrossableTerrain(entityInfo->id);
tileFlags = tile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
if (IQSkillIsEnabled(pokemon, IQ_ALL_TERRAIN_HIKER)) {
crossableTerrain = CROSSABLE_TERRAIN_CREVICE;
}
if (IQSkillIsEnabled(pokemon, IQ_SUPER_MOBILE)) {
crossableTerrain = CROSSABLE_TERRAIN_WALL;
}
switch(crossableTerrain)
{
case CROSSABLE_TERRAIN_LIQUID:
if(tileFlags == TERRAIN_TYPE_SECONDARY) return FALSE;
case CROSSABLE_TERRAIN_REGULAR:
if(tileFlags == TERRAIN_TYPE_NORMAL) return FALSE;
break;
case CROSSABLE_TERRAIN_WALL:
default:
return FALSE;
case CROSSABLE_TERRAIN_CREVICE:
if(tileFlags != 0) return FALSE;
}
}
else return FALSE;
}
return TRUE;
}
s32 CalcSpeedStage(Entity *pokemon)
{
s32 index;
s32 speed;
EntityInfo * entityInfo;
entityInfo = GetEntInfo(pokemon);
speed = 0;
for(index = 0; index < NUM_SPEED_COUNTERS; index++)
{
if (entityInfo->speedUpCounters[index + NUM_SPEED_COUNTERS] != 0) {
speed--;
}
if (entityInfo->speedUpCounters[index] != 0) {
speed++;
}
}
if (entityInfo->burnClassStatus.status == STATUS_PARALYSIS) {
speed--;
}
speed += GetMovementSpeed(entityInfo->id);
if ((MonsterIsType(pokemon, TYPE_ICE)) && (GetApparentWeather(pokemon) == WEATHER_SNOW)) {
speed++;
}
if (entityInfo->apparentID == MONSTER_DEOXYS_SPEED) {
speed++;
}
if ((entityInfo->id == MONSTER_KECLEON) && entityInfo->isNotTeamMember &&
gDungeon->unk644.unk2A) {
speed++;
}
if (speed < 0) {
speed = 0;
}
if (MAX_SPEED_STAGE < speed) {
speed = MAX_SPEED_STAGE;
}
entityInfo->speedStage = speed;
return speed;
}

View File

@@ -8,7 +8,7 @@
#include "dungeon_util.h"
#include "music.h"
#include "text_util.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
extern MenuInputStruct gDungeonMenu;

View File

@@ -1,275 +0,0 @@
#include "global.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_message.h"
#include "constants/ability.h"
#include "constants/dungeon.h"
#include "constants/iq_skill.h"
#include "constants/move_id.h"
#include "constants/status.h"
#include "constants/tactic.h"
#include "constants/type.h"
#include "dungeon_items.h"
#include "dungeon_util.h"
#include "moves.h"
#include "pokemon_3.h"
#include "pokemon.h"
#include "dungeon_config.h"
#include "structs/str_dungeon.h"
extern const u8 *gUnknown_80FC31C;
extern const u8 * gUnknown_80FCEFC;
extern const u8 * gUnknown_80FC2FC;
extern bool8 sub_805744C(Entity *, Move *, u32);
bool8 HasSafeguardStatus(Entity * pokemon, Entity * target, bool8 displayMessage)
{
if (GetEntInfo(target)->reflectClassStatus.status == STATUS_SAFEGUARD) {
if (displayMessage) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC2FC);
}
return TRUE;
}
return FALSE;
}
bool8 sub_8071728(Entity * pokemon, Entity * target, bool8 displayMessage)
{
if (GetEntInfo(target)->reflectClassStatus.status == STATUS_MIST) {
if (displayMessage) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], target, 0);
TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80FC31C);
}
return TRUE;
}
else {
if (AbilityIsActive(target, ABILITY_CLEAR_BODY) || AbilityIsActive(target, ABILITY_WHITE_SMOKE)) {
if (displayMessage) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], target, 0);
TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80FCEFC);
}
return TRUE;
}
}
return FALSE;
}
bool8 sub_80717A4(Entity *pokemon, u16 moveID)
{
EntityInfo * entityInfo;
s32 i;
entityInfo = GetEntInfo(pokemon);
if ((entityInfo->sleepClassStatus.status != STATUS_SLEEP) && (entityInfo->sleepClassStatus.status != STATUS_NAPPING) && (entityInfo->sleepClassStatus.status != STATUS_NIGHTMARE)) {
return FALSE;
}
else {
for (i = 0; i < MAX_MON_MOVES; i++) {
Move *move = &entityInfo->moves.moves[i];
if (MoveFlagExists(move)
&& (entityInfo->isTeamLeader || (move->moveFlags & MOVE_FLAG_ENABLED_FOR_AI))
&& sub_805744C(pokemon, move, TRUE)
&& move->PP != 0
&& move->id == moveID)
{
return TRUE;
}
}
}
return FALSE;
}
bool8 AbilityIsActive(Entity *pokemon, u8 ability)
{
if (!EntityIsValid(pokemon))
{
return FALSE;
}
else
{
EntityInfo *pokemonInfo = GetEntInfo(pokemon);
if (pokemonInfo->abilities[0] == ability || pokemonInfo->abilities[1] == ability)
{
return TRUE;
}
return FALSE;
}
}
bool8 MonsterIsType(Entity *pokemon, u8 type)
{
EntityInfo *pokemonInfo = pokemonInfo = GetEntInfo(pokemon);
if (type == TYPE_NONE)
{
return FALSE;
}
if (pokemonInfo->types[0] == type)
{
return TRUE;
}
if (pokemonInfo->types[1] == type)
{
return TRUE;
}
return FALSE;
}
bool8 CanSeeInvisibleMonsters(Entity *pokemon)
{
EntityInfo *pokemonInfo = GetEntInfo(pokemon);
if (pokemonInfo->blinkerClassStatus.status != STATUS_EYEDROPS)
{
if (!HasHeldItem(pokemon, ITEM_GOGGLE_SPECS))
return FALSE;
else
return TRUE;
}
else
return TRUE;
}
bool8 IsTacticSet(Entity *pokemon, u8 tactic)
{
EntityInfo *pokemonInfo = GetEntInfo(pokemon);
if (pokemonInfo->isTeamLeader)
{
bool8 isGoTheOtherWay = tactic == TACTIC_GO_THE_OTHER_WAY;
return isGoTheOtherWay;
}
return pokemonInfo->tactic == tactic;
}
bool8 IQSkillIsEnabled(Entity *pokemon, u8 IQSkill)
{
return IsIQSkillSet(&GetEntInfo(pokemon)->IQSkillFlags, 1 << IQSkill);
}
bool8 IQSkillPairIsEnabled(Entity *pokemon, u8 IQSkill1, u8 IQSkill2)
{
return IsIQSkillSet(&GetEntInfo(pokemon)->IQSkillFlags, 1 << IQSkill1 | 1 << IQSkill2);
}
void LoadIQSkills(Entity *pokemon)
{
s32 IQSkill;
EntityInfo *pokemonInfo;
pokemonInfo = GetEntInfo(pokemon);
if (pokemonInfo->isNotTeamMember) {
IqSkillFlags *iqSkills = &pokemonInfo->IQSkillFlags;
SetIQSkill(iqSkills, IQ_STATUS_CHECKER);
SetIQSkill(iqSkills, IQ_PP_CHECKER);
SetIQSkill(iqSkills, IQ_ITEM_CATCHER);
if (pokemonInfo->bossFlag)
SetIQSkill(iqSkills, IQ_SELF_CURER);
if (pokemonInfo->level >= gIqItemMasterMinWildLevel)
SetIQSkill(iqSkills, IQ_ITEM_MASTER);
pokemonInfo->tactic = TACTIC_GO_AFTER_FOES;
}
else {
pokemonInfo->IQSkillFlags.flags[0] = 0;
pokemonInfo->IQSkillFlags.flags[1] = 0;
pokemonInfo->IQSkillFlags.flags[2] = 0;
for(IQSkill = IQ_TYPE_ADVANTAGE_MASTER; IQSkill < NUM_IQ_SKILLS; IQSkill++)
{
if (HasIQForSkill(pokemonInfo->IQ,IQSkill) &&
IsIQSkillSet(&pokemonInfo->IQSkillMenuFlags, 1 << IQSkill))
{
SetIQSkill(&pokemonInfo->IQSkillFlags,IQSkill);
}
}
}
}
bool8 CanSeeTeammate(Entity * pokemon)
{
Entity *teamMember;
s32 memberIdx;
if (GetEntInfo(pokemon)->isNotTeamMember) {
return FALSE;
}
else
{
for(memberIdx = 0; memberIdx < MAX_TEAM_MEMBERS; memberIdx++)
{
teamMember = gDungeon->teamPokemon[memberIdx];
if (EntityIsValid(pokemon) && (pokemon != teamMember) && (CanSeeTarget(pokemon,teamMember)))
{
return TRUE;
}
}
return FALSE;
}
}
u8 GetMoveTypeForMonster(Entity *pokemon, Move *pokeMove)
{
if (pokeMove->id == MOVE_HIDDEN_POWER)
return GetEntInfo(pokemon)->hiddenPower.hiddenPowerType;
else
return GetMoveType(pokeMove);
}
s32 GetMovePower(Entity *pokemon, Move *pokeMove)
{
if(pokeMove->id == MOVE_HIDDEN_POWER)
return (GetEntInfo(pokemon)->hiddenPower.hiddenPowerBasePower + pokeMove->ginseng);
else
return (GetMoveBasePower(pokeMove) + pokeMove->ginseng);
}
bool8 MonsterCanThrowItems(EntityInfo *pokemon)
{
if(!MonsterIDCanThrowItems(pokemon->id))
return FALSE;
return TRUE;
}
static inline bool8 sub_8071A8C_sub(EntityInfo *pokemonInfo)
{
if(pokemonInfo->joinedAt.id == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON ||
pokemonInfo->joinedAt.id == DUNGEON_RESCUE_TEAM_BASE)
return TRUE;
else
return FALSE;
}
bool8 sub_8071A8C(Entity *pokemon)
{
EntityInfo *pokemonInfo;
if(EntityIsValid(pokemon))
{
pokemonInfo = GetEntInfo(pokemon);
if(pokemonInfo->monsterBehavior != BEHAVIOR_RESCUE_TARGET)
{
if(!sub_8071A8C_sub(pokemonInfo))
return TRUE;
}
}
return FALSE;
}
bool8 SetVisualFlags(EntityInfo *entityInfo, u16 newFlag, bool8 param_3)
{
if ((entityInfo->visualFlags & newFlag)) {
entityInfo->previousVisualFlags = newFlag | entityInfo->previousVisualFlags;
}
else {
entityInfo->previousVisualFlags = entityInfo->previousVisualFlags & ~newFlag;
}
if (param_3) {
entityInfo->visualFlags = newFlag | entityInfo->visualFlags;
}
else {
entityInfo->visualFlags = entityInfo->visualFlags & ~newFlag;
}
if ( ((entityInfo->previousVisualFlags & newFlag) == 0) && ((entityInfo->visualFlags & newFlag)) ) {
return TRUE;
}
else {
return FALSE;
}
}

View File

@@ -6,7 +6,7 @@
#include "code_806CD90.h"
#include "dungeon_items.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_serializer.h"
#include "dungeon_util.h"
#include "pokemon.h"

View File

@@ -16,14 +16,14 @@
#include "code_805D8C8.h"
#include "constants/status.h"
#include "constants/item.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "dungeon_leader.h"
#include "dungeon_message.h"
#include "dungeon_music.h"
#include "dungeon_map.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "string_format.h"
#include "items.h"
#include "trap.h"

View File

@@ -8,7 +8,7 @@
#include "structs/str_dungeon.h"
#include "dungeon_items.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_util.h"
#include "move_checks.h"
#include "moves.h"
@@ -19,7 +19,7 @@
#include "trap.h"
#include "weather.h"
#include "dungeon_config.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
bool8 CanUseOnSelfWithStatusChecker(Entity *pokemon, Move *move)
{

View File

@@ -16,11 +16,11 @@
#include "dungeon_ai_attack.h"
#include "dungeon_ai_items.h"
#include "dungeon_ai_movement.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "dungeon_items.h"
#include "dungeon_leader.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util_1.h"
#include "dungeon_util.h"

View File

@@ -12,12 +12,12 @@
#include "constants/targeting.h"
#include "constants/type.h"
#include "constants/weather.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "dungeon_items.h"
#include "dungeon_map_access.h"
#include "dungeon_message.h"
#include "dungeon_movement.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "dungeon_move.h"

View File

@@ -12,12 +12,12 @@
#include "constants/targeting.h"
#include "constants/type.h"
#include "constants/weather.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "dungeon_items.h"
#include "dungeon_map_access.h"
#include "dungeon_message.h"
#include "dungeon_movement.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "dungeon_move.h"

View File

@@ -12,7 +12,7 @@
#include "constants/targeting.h"
#include "constants/type.h"
#include "constants/weather.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "dungeon_config.h"
#include "run_dungeon.h"
#include "dungeon_items.h"
@@ -20,9 +20,9 @@
#include "dungeon_message.h"
#include "dungeon_misc.h"
#include "dungeon_move.h"
#include "dungeon_movement.h"
#include "dungeon_logic.h"
#include "dungeon_move_util.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_strings.h"
#include "dungeon_util.h"

View File

@@ -14,12 +14,12 @@
#include "constants/targeting.h"
#include "constants/type.h"
#include "constants/weather.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "run_dungeon.h"
#include "dungeon_items.h"
#include "dungeon_map_access.h"
#include "dungeon_misc.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_util.h"
#include "move_util.h"
#include "moves.h"

View File

@@ -8,12 +8,12 @@
#include "constants/status.h"
#include "constants/type.h"
#include "dungeon_ai_movement.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
#include "dungeon_items.h"
#include "dungeon_map_access.h"
#include "dungeon_message.h"
#include "dungeon_movement.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_logic.h"
#include "dungeon_util.h"
#include "math.h"
#include "move_effects_target.h"

View File

@@ -10,7 +10,7 @@
#include "dungeon_action.h"
#include "dungeon_ai_attack.h"
#include "dungeon_random.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic.h"
extern const char *gPtrFrozenMessage[];
extern const char *gPtrWrappedAroundMessage[];

View File

@@ -3,7 +3,7 @@
#include "constants/move_id.h"
#include "constants/type.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "moves.h"
s16 GetMoveTargetAndRangeForPokemon(Entity *pokemon, Move *move, bool32 isAI)

View File

@@ -14,7 +14,7 @@
#include "dungeon_items.h"
#include "dungeon_map.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "items.h"

View File

@@ -5,7 +5,7 @@
#include "constants/weather.h"
#include "structs/str_dungeon.h"
#include "dungeon_message.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_util.h"
#include "math.h"
#include "status.h"

View File

@@ -152,7 +152,7 @@ gUnknown_202EE76: /* 202EE76 (sub_804513C - sub_8082A08) */
.include "src/dungeon_menu_recruitment.o"
.include "src/code_8066D04.o"
.include "src/dungeon_8067A80.o"
.include "src/dungeon_movement.o"
.include "src/dungeon_logic.o"
.include "src/code_80718D8.o"
gUnknown_202F32C: /* 202F32C (xxx_dungeon_8042F6C - sub_8072CF4) */