diff --git a/src/code_806FDF4.c b/src/code_806FDF4.c index a3b789a6f..9c418659c 100644 --- a/src/code_806FDF4.c +++ b/src/code_806FDF4.c @@ -34,12 +34,12 @@ u8 sub_8097900(s16); void sub_806F910(void); u8 sub_806F9BC(s16); -bool8 sub_806F660(Entity *pokemon, Entity *target) +bool8 TryRecruitMonster(Entity *attacker, Entity *target) { s32 i; s32 rand; s32 recruitRate; - EntityInfo *pokemonInfo = GetEntInfo(pokemon); + EntityInfo *attackerInfo = GetEntInfo(attacker); EntityInfo *targetInfo = GetEntInfo(target); s32 foundIndex = -1; s32 size = GetBodySize(targetInfo->apparentID); @@ -85,13 +85,13 @@ bool8 sub_806F660(Entity *pokemon, Entity *target) if (!sub_806F9BC(targetInfo->id)) return FALSE; - if (abs((pokemon->pos).x - (target->pos).x) >= 2 || abs((pokemon->pos).y - (target->pos).y) >= 2) + if (abs((attacker->pos).x - (target->pos).x) >= 2 || abs((attacker->pos).y - (target->pos).y) >= 2) return FALSE; if (targetInfo->joinedAt.id == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON) return FALSE; if (targetInfo->monsterBehavior == 1) return FALSE; - if (!CanSeeTarget(target,pokemon)) + if (!CanSeeTarget(target,attacker)) return FALSE; sub_806F910(); @@ -100,10 +100,10 @@ bool8 sub_806F660(Entity *pokemon, Entity *target) if (recruitRate == -999) return FALSE; - if (HasHeldItem(pokemon, ITEM_FRIEND_BOW)) { + if (HasHeldItem(attacker, ITEM_FRIEND_BOW)) { recruitRate += gFriendBowRecruitRateUpValue; } - recruitRate += gRecruitRateByLevel[pokemonInfo->level]; + recruitRate += gRecruitRateByLevel[attackerInfo->level]; if (rand >= recruitRate) return FALSE; @@ -120,7 +120,7 @@ bool8 sub_806F660(Entity *pokemon, Entity *target) } } if (foundIndex == -1) { - nullsub_96(pokemon, target); + nullsub_96(attacker, target); return FALSE; } @@ -129,7 +129,7 @@ bool8 sub_806F660(Entity *pokemon, Entity *target) break; } if (i == 4) { - nullsub_96(pokemon, target); + nullsub_96(attacker, target); return FALSE; } @@ -138,7 +138,7 @@ bool8 sub_806F660(Entity *pokemon, Entity *target) break; } if (i == 4) { - nullsub_96(pokemon, target); + nullsub_96(attacker, target); return FALSE; } diff --git a/src/dungeon_damage.c b/src/dungeon_damage.c index e83f4e875..8d0996f4d 100644 --- a/src/dungeon_damage.c +++ b/src/dungeon_damage.c @@ -54,7 +54,7 @@ extern void sub_8041D00(Entity *pokemon, Entity *target); extern void sub_8042238(Entity *pokemon, Entity *target); extern void sub_803ED30(s32, Entity *r0, u8, s32); extern bool8 sub_806A458(Entity *); -extern bool8 sub_806F660(Entity *, Entity *); +extern bool8 TryRecruitMonster(Entity *attacker, Entity *target); extern bool8 sub_806A58C(s16 a0); extern void sub_8042148(Entity *pokemon); extern void sub_8042A24(Entity *r0); @@ -737,7 +737,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc struct unkStruct_8069D4C sp; sub_8069D4C(&sp, target); - if (sub_806F660(attacker, target)) { + if (TryRecruitMonster(attacker, target)) { if (!sub_806FA5C(attacker, target, &sp)) { HandleFaint(target, DUNGEON_EXIT_LEFT_WITHOUT_BEING_BEFRIENDED, attacker); }