From c1c1c763606e7dcb8a92a7d76f31b83c6b01b004 Mon Sep 17 00:00:00 2001 From: kanym Date: Fri, 6 Nov 2026 21:21:20 +0100 Subject: [PATCH] fix(aswid): pukeberries empty the fourth stomach too SE_Puke calls RemoveOneFood, which only picks from vanilla's three slots, so the Aswid's fourth meal survived the berries. It now joins the same random draw, the way the Trol's extra slots do. --- JotunnModStub/Aswid/AswidPatches.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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 {