Skip to content

Commit

Permalink
Some new functions related to dungeon AI behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
assidion2 authored and assidion2 committed Aug 22, 2024
1 parent 0c552de commit 6c6cf2b
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions CREDITS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ other parts of the project, feel free to add yourself to this file!
- Rhokin
- ShadyGamerX
- ElectricGeorge
- Assidion
- The rest of the contributors to Project Pokémon's technical documentation
for the NDS Mystery Dungeon games, which can be found here:
https://projectpokemon.org/home/docs/mystery-dungeon-nds/
Expand Down
3 changes: 3 additions & 0 deletions headers/functions/overlay29.h
Original file line number Diff line number Diff line change
Expand Up @@ -867,5 +867,8 @@ void DisplayMessageInternal(int message_id, bool wait_for_input, struct portrait
void OpenMenu(undefined param_1, undefined param_2, bool open_bag);
int OthersMenuLoop(void);
undefined OthersMenu(void);
int GetAiUseItemProbability(struct entity* item_consumer, struct item* used_item, int unknown);
bool IsAdjacentToEnemy(struct entity* entity);
enum relation GetRelationBetweenMonsters(struct entity* entity_1, struct entity* entity_2, bool unknown_1, bool unknown_2);

#endif
7 changes: 7 additions & 0 deletions headers/types/dungeon_mode/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -1442,4 +1442,11 @@ enum fade_status_dungeon {
DUNGEON_FADE_0x5 = 5,
};

// Used to indicate whether two monsters are allies, enemies, or neither (one is a shopkeeper, decoy, etc.)
enum relation {
RELATION_ALLIES = 0,
RELATION_ENEMIES = 1,
RELATION_OTHER = 2,
};

#endif
38 changes: 38 additions & 0 deletions symbols/overlay29.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8500,6 +8500,44 @@ overlay29:
Called when the in-dungeon "others" menu is open. Does not return until the menu is closed.
return: Always 0
- name: GetAiUseItemProbability
address:
EU: 0x231EAC4
NA: 0x231DEB8
JP: 0x231F138
description: |-
Called to get the probability of an item being used or thrown by an AI on the current turn.
r0: Pointer to either the user if it is an item used by the AI or the target if it is an item thrown by the AI
r1: Pointer to item
r2: Unknown 2-bit bitvector. Bit 1 influences only the Warp Seed case, while Bit 0 influences various items.
return: Integer in range [0, 100]
- name: IsAdjacentToEnemy
address:
EU: 0x231F358
NA: 0x231E74C
JP: 0x231F9CC
description: |-
Called to check if a hostile entity is present in any of the tiles adjacent to an entity.
r0: Pointer to entity
return: True if yes, false if no
- name: GetRelationBetweenMonsters
address:
EU: 0x2302188
NA: 0x230157C
JP: 0x23027FC
description: |-
Called to check if two monsters are allies, enemies, or neither (one is a shopkeeper, decoy, etc.)
r0: Pointer to entity 1
r1: Pointer to entity 2
r2: ? (If == 0, will make function return 2 if r1 is invisible and r0 can see invisible monsters)
r3: ? (If != 0, will make function return 2 if r0 is a team member and r1 has some sort of status)
return: 0 if allies, 1 if enemies, 2 if other
data:
- name: DUNGEON_STRUCT_SIZE
address:
Expand Down

0 comments on commit 6c6cf2b

Please sign in to comment.