Merge pull request #439 from FexCollects/master
Some checks failed
GithubCI / build (push) Has been cancelled

Name function checking for recruit
This commit is contained in:
Seth Barberee 2025-09-10 15:23:15 -07:00 committed by GitHub
commit 500caa1c3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 11 deletions

View File

@ -34,12 +34,12 @@ u8 sub_8097900(s16);
void sub_806F910(void); void sub_806F910(void);
u8 sub_806F9BC(s16); u8 sub_806F9BC(s16);
bool8 sub_806F660(Entity *pokemon, Entity *target) bool8 TryRecruitMonster(Entity *attacker, Entity *target)
{ {
s32 i; s32 i;
s32 rand; s32 rand;
s32 recruitRate; s32 recruitRate;
EntityInfo *pokemonInfo = GetEntInfo(pokemon); EntityInfo *attackerInfo = GetEntInfo(attacker);
EntityInfo *targetInfo = GetEntInfo(target); EntityInfo *targetInfo = GetEntInfo(target);
s32 foundIndex = -1; s32 foundIndex = -1;
s32 size = GetBodySize(targetInfo->apparentID); s32 size = GetBodySize(targetInfo->apparentID);
@ -85,13 +85,13 @@ bool8 sub_806F660(Entity *pokemon, Entity *target)
if (!sub_806F9BC(targetInfo->id)) if (!sub_806F9BC(targetInfo->id))
return FALSE; 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; return FALSE;
if (targetInfo->joinedAt.id == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON) if (targetInfo->joinedAt.id == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON)
return FALSE; return FALSE;
if (targetInfo->monsterBehavior == 1) if (targetInfo->monsterBehavior == 1)
return FALSE; return FALSE;
if (!CanSeeTarget(target,pokemon)) if (!CanSeeTarget(target,attacker))
return FALSE; return FALSE;
sub_806F910(); sub_806F910();
@ -100,10 +100,10 @@ bool8 sub_806F660(Entity *pokemon, Entity *target)
if (recruitRate == -999) if (recruitRate == -999)
return FALSE; return FALSE;
if (HasHeldItem(pokemon, ITEM_FRIEND_BOW)) { if (HasHeldItem(attacker, ITEM_FRIEND_BOW)) {
recruitRate += gFriendBowRecruitRateUpValue; recruitRate += gFriendBowRecruitRateUpValue;
} }
recruitRate += gRecruitRateByLevel[pokemonInfo->level]; recruitRate += gRecruitRateByLevel[attackerInfo->level];
if (rand >= recruitRate) if (rand >= recruitRate)
return FALSE; return FALSE;
@ -120,7 +120,7 @@ bool8 sub_806F660(Entity *pokemon, Entity *target)
} }
} }
if (foundIndex == -1) { if (foundIndex == -1) {
nullsub_96(pokemon, target); nullsub_96(attacker, target);
return FALSE; return FALSE;
} }
@ -129,7 +129,7 @@ bool8 sub_806F660(Entity *pokemon, Entity *target)
break; break;
} }
if (i == 4) { if (i == 4) {
nullsub_96(pokemon, target); nullsub_96(attacker, target);
return FALSE; return FALSE;
} }
@ -138,7 +138,7 @@ bool8 sub_806F660(Entity *pokemon, Entity *target)
break; break;
} }
if (i == 4) { if (i == 4) {
nullsub_96(pokemon, target); nullsub_96(attacker, target);
return FALSE; return FALSE;
} }

View File

@ -54,7 +54,7 @@ extern void sub_8041D00(Entity *pokemon, Entity *target);
extern void sub_8042238(Entity *pokemon, Entity *target); extern void sub_8042238(Entity *pokemon, Entity *target);
extern void sub_803ED30(s32, Entity *r0, u8, s32); extern void sub_803ED30(s32, Entity *r0, u8, s32);
extern bool8 sub_806A458(Entity *); 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 bool8 sub_806A58C(s16 a0);
extern void sub_8042148(Entity *pokemon); extern void sub_8042148(Entity *pokemon);
extern void sub_8042A24(Entity *r0); extern void sub_8042A24(Entity *r0);
@ -737,7 +737,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc
struct unkStruct_8069D4C sp; struct unkStruct_8069D4C sp;
sub_8069D4C(&sp, target); sub_8069D4C(&sp, target);
if (sub_806F660(attacker, target)) { if (TryRecruitMonster(attacker, target)) {
if (!sub_806FA5C(attacker, target, &sp)) { if (!sub_806FA5C(attacker, target, &sp)) {
HandleFaint(target, DUNGEON_EXIT_LEFT_WITHOUT_BEING_BEFRIENDED, attacker); HandleFaint(target, DUNGEON_EXIT_LEFT_WITHOUT_BEING_BEFRIENDED, attacker);
} }