From 758f82c81e5139b9e41c60a545347c6ce0f35177 Mon Sep 17 00:00:00 2001 From: assidion2 Date: Sat, 31 Aug 2024 19:50:20 +0400 Subject: [PATCH 1/6] Couple of functions used for Magic Coat --- headers/functions/arm9.h | 4 ++-- headers/functions/overlay29.h | 3 +++ symbols/overlay29.yml | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/headers/functions/arm9.h b/headers/functions/arm9.h index 88455503..e7f31680 100644 --- a/headers/functions/arm9.h +++ b/headers/functions/arm9.h @@ -273,9 +273,9 @@ bool IsExclusiveItemIdForMonster(enum item_id item_id, enum monster_id monster_i enum type_id type1, enum type_id type2); bool IsExclusiveItemForMonster(struct item* item, enum monster_id monster_id, enum type_id type1, enum type_id type2); -enum item_id BagHasExclusiveItemTypeForMonster(int excl_type, enum monster_id monster_id, +enum item_id BagHasExclusiveItemTypeForMonster(enum exclusive_item_effect_id effect_id, enum monster_id monster_id, enum type_id type1, enum type_id type2); -bool GetExclusiveItemForMonsterFromBag(struct item* item, int excl_type, enum monster_id monster_id, +bool GetExclusiveItemForMonsterFromBag(struct item* item, enum exclusive_item_effect_id effect_id, enum monster_id monster_id, enum type_id type1, enum type_id type2); int GetHpBoostFromExclusiveItems(undefined* param_1); void ApplyGummiBoostsToGroundMonster(struct ground_monster* ground_monster, enum item_id item_id, diff --git a/headers/functions/overlay29.h b/headers/functions/overlay29.h index 771ecb72..7c852530 100644 --- a/headers/functions/overlay29.h +++ b/headers/functions/overlay29.h @@ -883,5 +883,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); +bool GetExclusiveItemWithEffectFromBag(struct entity* entity, enum exclusive_item_effect_id effect_id, + struct item* item); +bool CanHitWithRegularAttack(struct entity* attacker, struct entity* defender); #endif diff --git a/symbols/overlay29.yml b/symbols/overlay29.yml index 2542f520..41301df4 100644 --- a/symbols/overlay29.yml +++ b/symbols/overlay29.yml @@ -8641,6 +8641,26 @@ overlay29: Called when the in-dungeon "others" menu is open. Does not return until the menu is closed. return: Always 0 + - name: GetExclusiveItemWithEffectFromBag + address: + EU: 0x23100C8 + description: |- + If an exclusive item with a certain effect is present in the bag and works for the entity, returns true and copies the item struct to the address at item. Otherwise, returns false. + + r0: Entity pointer + r1: exclusive_item_effect_id enum + r2: Item pointer [output] + return: bool + - name: CanHitWithRegularAttack + address: + EU: 0x2333A08 + description: |- + Returns true if the attacker is adjacent to the defender and can hit them with a regular attack. + Notably, this check is what prevents ranged moves, moves that cut corners, etc. from being reflected by Magic Coat and Mirror Move. + + r0: Entity pointer (attacker) + r1: Entity pointer (defender) + return: bool data: - name: DUNGEON_STRUCT_SIZE address: From 4ec49626cdb3128f0a6b7bcb2744ba56600c0575 Mon Sep 17 00:00:00 2001 From: assidion2 Date: Sun, 1 Sep 2024 10:07:09 +0400 Subject: [PATCH 2/6] fix --- headers/functions/overlay29.h | 6 +++--- symbols/overlay29.yml | 40 +++++++++++++++++------------------ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/headers/functions/overlay29.h b/headers/functions/overlay29.h index 7c852530..608bfdb2 100644 --- a/headers/functions/overlay29.h +++ b/headers/functions/overlay29.h @@ -396,6 +396,8 @@ void GetPossibleAiThrownItemDirections(struct entity* entity, int ally_or_enemy, void GetPossibleAiArcItemTargets(struct entity* user, struct item* item, struct position* positions, bool always_add_position); void TryNonLeaderItemPickUp(struct entity* entity); +bool GetExclusiveItemWithEffectFromBag(struct entity* entity, enum exclusive_item_effect_id effect_id, + struct item* item); bool AuraBowIsActive(struct entity* entity); int ExclusiveItemOffenseBoost(struct entity* entity, int move_category_idx); int ExclusiveItemDefenseBoost(struct entity* entity, int move_category_idx); @@ -643,6 +645,7 @@ int DealDamageWithType(struct entity* attacker, struct entity* defender, enum ty struct move* move, fx32_8 damage_mult_fp, enum item_id item_id); int PerformDamageSequence(struct entity* attacker, struct entity* defender, struct move* move, struct damage_data* damage_out, union damage_source damage_source); +bool CanHitWithRegularAttack(struct entity* attacker, struct entity* defender); bool StatusCheckerCheck(struct entity* attacker, struct move* move); enum weather_id GetApparentWeather(struct entity* entity); void TryWeatherFormChange(struct entity* entity); @@ -883,8 +886,5 @@ 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); -bool GetExclusiveItemWithEffectFromBag(struct entity* entity, enum exclusive_item_effect_id effect_id, - struct item* item); -bool CanHitWithRegularAttack(struct entity* attacker, struct entity* defender); #endif diff --git a/symbols/overlay29.yml b/symbols/overlay29.yml index 41301df4..012f7e51 100644 --- a/symbols/overlay29.yml +++ b/symbols/overlay29.yml @@ -4045,6 +4045,16 @@ overlay29: Used both for enemies and team members. r0: entity pointer + - name: GetExclusiveItemWithEffectFromBag + address: + EU: 0x23100C8 + description: |- + If an exclusive item with a certain effect is present in the bag and works for the entity, returns true and copies the item struct to the address at item. Otherwise, returns false. + + r0: Entity pointer + r1: exclusive_item_effect_id enum + r2: [output] Item pointer + return: bool - name: AuraBowIsActive address: EU: 0x231013C @@ -6290,6 +6300,16 @@ overlay29: r3: [output] struct containing info about the damage calculation stack[0]: Damage source return: Calculated damage + - name: CanHitWithRegularAttack + address: + EU: 0x2333A08 + description: |- + Returns true if the defender is adjacent to the attacker and can hit them with a regular attack. + Notably, this check is what prevents ranged moves, moves that cut corners, etc. from being reflected by Magic Coat and Mirror Move. + + r0: Entity pointer (attacker) + r1: Entity pointer (defender) + return: bool - name: StatusCheckerCheck address: EU: 0x2333AB4 @@ -8641,26 +8661,6 @@ overlay29: Called when the in-dungeon "others" menu is open. Does not return until the menu is closed. return: Always 0 - - name: GetExclusiveItemWithEffectFromBag - address: - EU: 0x23100C8 - description: |- - If an exclusive item with a certain effect is present in the bag and works for the entity, returns true and copies the item struct to the address at item. Otherwise, returns false. - - r0: Entity pointer - r1: exclusive_item_effect_id enum - r2: Item pointer [output] - return: bool - - name: CanHitWithRegularAttack - address: - EU: 0x2333A08 - description: |- - Returns true if the attacker is adjacent to the defender and can hit them with a regular attack. - Notably, this check is what prevents ranged moves, moves that cut corners, etc. from being reflected by Magic Coat and Mirror Move. - - r0: Entity pointer (attacker) - r1: Entity pointer (defender) - return: bool data: - name: DUNGEON_STRUCT_SIZE address: From 42850f4b18f5cab6e7f69c644d7e8d6a5909c98f Mon Sep 17 00:00:00 2001 From: assidion2 Date: Sun, 1 Sep 2024 10:47:47 +0400 Subject: [PATCH 3/6] format --- headers/functions/arm9.h | 4 ++-- headers/functions/overlay29.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/headers/functions/arm9.h b/headers/functions/arm9.h index e7f31680..b0447394 100644 --- a/headers/functions/arm9.h +++ b/headers/functions/arm9.h @@ -275,8 +275,8 @@ bool IsExclusiveItemForMonster(struct item* item, enum monster_id monster_id, en enum type_id type2); enum item_id BagHasExclusiveItemTypeForMonster(enum exclusive_item_effect_id effect_id, enum monster_id monster_id, enum type_id type1, enum type_id type2); -bool GetExclusiveItemForMonsterFromBag(struct item* item, enum exclusive_item_effect_id effect_id, enum monster_id monster_id, - enum type_id type1, enum type_id type2); +bool GetExclusiveItemForMonsterFromBag(struct item* item, enum exclusive_item_effect_id effect_id, + enum monster_id monster_id, enum type_id type1, enum type_id type2); int GetHpBoostFromExclusiveItems(undefined* param_1); void ApplyGummiBoostsToGroundMonster(struct ground_monster* ground_monster, enum item_id item_id, bool not_boost_stats, struct gummi_result* gummi_result); diff --git a/headers/functions/overlay29.h b/headers/functions/overlay29.h index 608bfdb2..fed50894 100644 --- a/headers/functions/overlay29.h +++ b/headers/functions/overlay29.h @@ -396,7 +396,8 @@ void GetPossibleAiThrownItemDirections(struct entity* entity, int ally_or_enemy, void GetPossibleAiArcItemTargets(struct entity* user, struct item* item, struct position* positions, bool always_add_position); void TryNonLeaderItemPickUp(struct entity* entity); -bool GetExclusiveItemWithEffectFromBag(struct entity* entity, enum exclusive_item_effect_id effect_id, +bool GetExclusiveItemWithEffectFromBag(struct entity* entity, + enum exclusive_item_effect_id effect_id, struct item* item); bool AuraBowIsActive(struct entity* entity); int ExclusiveItemOffenseBoost(struct entity* entity, int move_category_idx); From 2d2a498e916f1deac96a47422d1fd138fb6ef0a0 Mon Sep 17 00:00:00 2001 From: assidion2 Date: Sun, 1 Sep 2024 10:50:00 +0400 Subject: [PATCH 4/6] format --- headers/functions/arm9.h | 2 +- headers/functions/overlay29.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/headers/functions/arm9.h b/headers/functions/arm9.h index b0447394..eee5721b 100644 --- a/headers/functions/arm9.h +++ b/headers/functions/arm9.h @@ -275,7 +275,7 @@ bool IsExclusiveItemForMonster(struct item* item, enum monster_id monster_id, en enum type_id type2); enum item_id BagHasExclusiveItemTypeForMonster(enum exclusive_item_effect_id effect_id, enum monster_id monster_id, enum type_id type1, enum type_id type2); -bool GetExclusiveItemForMonsterFromBag(struct item* item, enum exclusive_item_effect_id effect_id, +bool GetExclusiveItemForMonsterFromBag(struct item* item, enum exclusive_item_effect_id effect_id, enum monster_id monster_id, enum type_id type1, enum type_id type2); int GetHpBoostFromExclusiveItems(undefined* param_1); void ApplyGummiBoostsToGroundMonster(struct ground_monster* ground_monster, enum item_id item_id, diff --git a/headers/functions/overlay29.h b/headers/functions/overlay29.h index fed50894..a96a433d 100644 --- a/headers/functions/overlay29.h +++ b/headers/functions/overlay29.h @@ -396,7 +396,7 @@ void GetPossibleAiThrownItemDirections(struct entity* entity, int ally_or_enemy, void GetPossibleAiArcItemTargets(struct entity* user, struct item* item, struct position* positions, bool always_add_position); void TryNonLeaderItemPickUp(struct entity* entity); -bool GetExclusiveItemWithEffectFromBag(struct entity* entity, +bool GetExclusiveItemWithEffectFromBag(struct entity* entity, enum exclusive_item_effect_id effect_id, struct item* item); bool AuraBowIsActive(struct entity* entity); From a43f9a8d66a1f478fd014fa2749dc9bfd2bc28d5 Mon Sep 17 00:00:00 2001 From: assidion2 Date: Sun, 1 Sep 2024 10:53:19 +0400 Subject: [PATCH 5/6] test --- headers/functions/arm9.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/headers/functions/arm9.h b/headers/functions/arm9.h index eee5721b..854bd34c 100644 --- a/headers/functions/arm9.h +++ b/headers/functions/arm9.h @@ -273,7 +273,8 @@ bool IsExclusiveItemIdForMonster(enum item_id item_id, enum monster_id monster_i enum type_id type1, enum type_id type2); bool IsExclusiveItemForMonster(struct item* item, enum monster_id monster_id, enum type_id type1, enum type_id type2); -enum item_id BagHasExclusiveItemTypeForMonster(enum exclusive_item_effect_id effect_id, enum monster_id monster_id, +enum item_id BagHasExclusiveItemTypeForMonster(enum exclusive_item_effect_id effect_id, + enum monster_id monster_id, enum type_id type1, enum type_id type2); bool GetExclusiveItemForMonsterFromBag(struct item* item, enum exclusive_item_effect_id effect_id, enum monster_id monster_id, enum type_id type1, enum type_id type2); From 95e7bcc2ca6feb21455fcdcd6a62a37f3ab52a55 Mon Sep 17 00:00:00 2001 From: assidion2 Date: Sun, 1 Sep 2024 22:39:27 +0400 Subject: [PATCH 6/6] format --- headers/functions/arm9.h | 9 +++++---- headers/functions/overlay29.h | 3 +-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/headers/functions/arm9.h b/headers/functions/arm9.h index 854bd34c..e2fce384 100644 --- a/headers/functions/arm9.h +++ b/headers/functions/arm9.h @@ -273,11 +273,12 @@ bool IsExclusiveItemIdForMonster(enum item_id item_id, enum monster_id monster_i enum type_id type1, enum type_id type2); bool IsExclusiveItemForMonster(struct item* item, enum monster_id monster_id, enum type_id type1, enum type_id type2); -enum item_id BagHasExclusiveItemTypeForMonster(enum exclusive_item_effect_id effect_id, - enum monster_id monster_id, - enum type_id type1, enum type_id type2); +enum item_id BagHasExclusiveItemTypeForMonster(enum exclusive_item_effect_id effect_id, + enum monster_id monster_id, enum type_id type1, + enum type_id type2); bool GetExclusiveItemForMonsterFromBag(struct item* item, enum exclusive_item_effect_id effect_id, - enum monster_id monster_id, enum type_id type1, enum type_id type2); + enum monster_id monster_id, enum type_id type1, + enum type_id type2); int GetHpBoostFromExclusiveItems(undefined* param_1); void ApplyGummiBoostsToGroundMonster(struct ground_monster* ground_monster, enum item_id item_id, bool not_boost_stats, struct gummi_result* gummi_result); diff --git a/headers/functions/overlay29.h b/headers/functions/overlay29.h index a96a433d..dc98ceb0 100644 --- a/headers/functions/overlay29.h +++ b/headers/functions/overlay29.h @@ -397,8 +397,7 @@ void GetPossibleAiArcItemTargets(struct entity* user, struct item* item, struct bool always_add_position); void TryNonLeaderItemPickUp(struct entity* entity); bool GetExclusiveItemWithEffectFromBag(struct entity* entity, - enum exclusive_item_effect_id effect_id, - struct item* item); + enum exclusive_item_effect_id effect_id, struct item* item); bool AuraBowIsActive(struct entity* entity); int ExclusiveItemOffenseBoost(struct entity* entity, int move_category_idx); int ExclusiveItemDefenseBoost(struct entity* entity, int move_category_idx);