diff --git a/JotunnModStub/Aswid/AswidPatches.cs b/JotunnModStub/Aswid/AswidPatches.cs index b799936..b607ad9 100644 --- a/JotunnModStub/Aswid/AswidPatches.cs +++ b/JotunnModStub/Aswid/AswidPatches.cs @@ -931,6 +931,30 @@ namespace RacesOfValheim } } + /// + /// Pukeberries empty the fourth stomach too. + /// + /// SE_Puke calls RemoveOneFood once a second, and vanilla only ever picks from its own three + /// slots, so the Aswid's fourth meal survived the berries. It now goes into the same random + /// draw as the other three, the way the Trol's extra slots do. + /// + [HarmonyPatch(typeof(Player), "RemoveOneFood")] + public static class Aswid_PlayerRemoveOneFood_Patch + { + public static bool Prefix(Player __instance, System.Collections.Generic.List ___m_foods, ref bool __result) + { + if (__instance != Player.m_localPlayer || !AswidRace.IsAswid()) return true; + if (!AswidFoodManager.ExtraFoods.TryGetValue(__instance, out Player.Food extraFood) || extraFood == null) return true; + + int vanillaCount = ___m_foods != null ? ___m_foods.Count : 0; + if (Random.Range(0, vanillaCount + 1) < vanillaCount) return true; // one of vanilla's three + + AswidFoodManager.ClearFood(__instance); + __result = true; + return false; + } + } + [HarmonyPatch(typeof(Player), "ClearFood")] public static class Aswid_Player_ClearFood_Patch {