Skip to content

Commit

Permalink
Added constants for GetLeadMonFriendshipScore
Browse files Browse the repository at this point in the history
  • Loading branch information
LOuroboros committed Aug 25, 2022
1 parent 32ea55d commit 1f4ef2a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
4 changes: 2 additions & 2 deletions data/maps/PacifidlogTown_House2/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ PacifidlogTown_House2_EventScript_FanClubYoungerBrother::
call_if_unset FLAG_MET_FANCLUB_YOUNGER_BROTHER, PacifidlogTown_House2_EventScript_FirstMonAssessment
setflag FLAG_MET_FANCLUB_YOUNGER_BROTHER
specialvar VAR_RESULT, GetLeadMonFriendshipScore
goto_if_ge VAR_RESULT, 4, PacifidlogTown_House2_EventScript_GiveReturn
goto_if_ge VAR_RESULT, FRIENDSHIP_GE_150, PacifidlogTown_House2_EventScript_GiveReturn
specialvar VAR_RESULT, GetLeadMonFriendshipScore
goto_if_ge VAR_RESULT, 2, PacifidlogTown_House2_EventScript_PutInEffort
goto_if_ge VAR_RESULT, FRIENDSHIP_GE_50, PacifidlogTown_House2_EventScript_PutInEffort
goto PacifidlogTown_House2_EventScript_GiveFrustration
end

Expand Down
2 changes: 1 addition & 1 deletion data/maps/SlateportCity_PokemonFanClub/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ SlateportCity_PokemonFanClub_EventScript_SootheBellWoman::
goto_if_set FLAG_RECEIVED_SOOTHE_BELL, SlateportCity_PokemonFanClub_EventScript_ReceivedSootheBell
msgbox SlateportCity_PokemonFanClub_Text_ShowMePokemonThatLoveYou, MSGBOX_DEFAULT
specialvar VAR_RESULT, GetLeadMonFriendshipScore
goto_if_ge VAR_RESULT, 4, SlateportCity_PokemonFanClub_EventScript_GiveSootheBell
goto_if_ge VAR_RESULT, FRIENDSHIP_GE_150, SlateportCity_PokemonFanClub_EventScript_GiveSootheBell
release
end

Expand Down
14 changes: 7 additions & 7 deletions data/maps/VerdanturfTown_FriendshipRatersHouse/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ VerdanturfTown_FriendshipRatersHouse_EventScript_FriendshipRater::
msgbox VerdanturfTown_FriendshipRatersHouse_Text_SeeHowMuchPokemonLikesYou, MSGBOX_DEFAULT
specialvar VAR_RESULT, GetLeadMonFriendshipScore
switch VAR_RESULT
case 0, VerdanturfTown_FriendshipRatersHouse_EventScript_DetestsYou
case 1, VerdanturfTown_FriendshipRatersHouse_EventScript_VeryWary
case 2, VerdanturfTown_FriendshipRatersHouse_EventScript_NotUsedToYou
case 3, VerdanturfTown_FriendshipRatersHouse_EventScript_GettingUsedToYou
case 4, VerdanturfTown_FriendshipRatersHouse_EventScript_LikesYouQuiteALot
case 5, VerdanturfTown_FriendshipRatersHouse_EventScript_VeryHappy
case 6, VerdanturfTown_FriendshipRatersHouse_EventScript_AdoresYou
case FRIENDSHIP_NONE, VerdanturfTown_FriendshipRatersHouse_EventScript_DetestsYou
case FRIENDSHIP_GE_1, VerdanturfTown_FriendshipRatersHouse_EventScript_VeryWary
case FRIENDSHIP_GE_50, VerdanturfTown_FriendshipRatersHouse_EventScript_NotUsedToYou
case FRIENDSHIP_GE_100, VerdanturfTown_FriendshipRatersHouse_EventScript_GettingUsedToYou
case FRIENDSHIP_GE_150, VerdanturfTown_FriendshipRatersHouse_EventScript_LikesYouQuiteALot
case FRIENDSHIP_GE_200, VerdanturfTown_FriendshipRatersHouse_EventScript_VeryHappy
case FRIENDSHIP_MAX, VerdanturfTown_FriendshipRatersHouse_EventScript_AdoresYou
release
end

Expand Down
9 changes: 9 additions & 0 deletions include/constants/pokemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@
#define FRIENDSHIP_EVENT_FAINT_FIELD_PSN 7
#define FRIENDSHIP_EVENT_FAINT_LARGE 8 // If opponent was >= 30 levels higher. See AdjustFriendshipOnBattleFaint

// Constants for GetLeadMonFriendshipScore
#define FRIENDSHIP_NONE 0
#define FRIENDSHIP_GE_1 1
#define FRIENDSHIP_GE_50 2
#define FRIENDSHIP_GE_100 3
#define FRIENDSHIP_GE_150 4
#define FRIENDSHIP_GE_200 5
#define FRIENDSHIP_MAX 6

#define MAX_FRIENDSHIP 255
#define MAX_SHEEN 255
#define MAX_CONDITION 255
Expand Down
15 changes: 8 additions & 7 deletions src/field_specials.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#include "constants/weather.h"
#include "constants/metatile_labels.h"
#include "palette.h"
#include "constants/pokemon.h"

EWRAM_DATA bool8 gBikeCyclingChallenge = FALSE;
EWRAM_DATA u8 gBikeCollisions = 0;
Expand Down Expand Up @@ -941,19 +942,19 @@ u8 GetLeadMonFriendshipScore(void)
{
struct Pokemon *pokemon = &gPlayerParty[GetLeadMonIndex()];
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) == MAX_FRIENDSHIP)
return 6;
return FRIENDSHIP_MAX;
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 200)
return 5;
return FRIENDSHIP_GE_200;
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 150)
return 4;
return FRIENDSHIP_GE_150;
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 100)
return 3;
return FRIENDSHIP_GE_100;
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 50)
return 2;
return FRIENDSHIP_GE_50;
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 1)
return 1;
return FRIENDSHIP_GE_1;

return 0;
return FRIENDSHIP_NONE;
}

static void CB2_FieldShowRegionMap(void)
Expand Down

0 comments on commit 1f4ef2a

Please sign in to comment.