From cb735f90b40e5582dc49ae48292c69186ed59fa9 Mon Sep 17 00:00:00 2001 From: rglezg Date: Fri, 23 Jul 2021 22:07:14 -0400 Subject: [PATCH 1/2] Add missing check for HM item. --- src/field_player_avatar.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 26e6c46f6292..65d1313e4dc2 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -8,6 +8,7 @@ #include "field_effect_helpers.h" #include "field_player_avatar.h" #include "fieldmap.h" +#include "item.h" #include "menu.h" #include "metatile_behavior.h" #include "overworld.h" @@ -1284,7 +1285,7 @@ bool8 PartyHasMonWithSurf(void) { u8 i; - if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING)) + if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING) && CheckBagHasItem(ITEM_HM03_SURF - ITEM_TM01_FOCUS_PUNCH, 1)) { for (i = 0; i < PARTY_SIZE; i++) { @@ -1302,6 +1303,8 @@ void CheckPlayerHasMonWithHM(u16 hm) u8 i; gSpecialVar_Result = PARTY_SIZE; + if (!CheckBagHasItem(hm, 1)) + return; for (i = 0; i < PARTY_SIZE; i++) { u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL); From 93b9336298faf7597e4c63edb93eb4a88489f11d Mon Sep 17 00:00:00 2001 From: rglezg Date: Sat, 24 Jul 2021 17:26:46 -0400 Subject: [PATCH 2/2] Fixed bug that disabled surf. --- src/field_player_avatar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 65d1313e4dc2..a1ad0f556350 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -1285,7 +1285,7 @@ bool8 PartyHasMonWithSurf(void) { u8 i; - if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING) && CheckBagHasItem(ITEM_HM03_SURF - ITEM_TM01_FOCUS_PUNCH, 1)) + if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING) && CheckBagHasItem(ITEM_HM03_SURF, 1)) { for (i = 0; i < PARTY_SIZE; i++) {