diff --git a/JotunnModStub/Aswid/AswidRace.cs b/JotunnModStub/Aswid/AswidRace.cs index a1b78bd..c05235d 100644 --- a/JotunnModStub/Aswid/AswidRace.cs +++ b/JotunnModStub/Aswid/AswidRace.cs @@ -992,6 +992,7 @@ namespace RacesOfValheim hitAnything = true; float maxHp = c.GetMaxHealth(); + float currentHp = c.GetHealth(); float baseDamage = 1.0f; // Reduced by 50% float bloodMagicFactor = Player.m_localPlayer.GetSkillFactor(Skills.SkillType.BloodMagic); @@ -1002,6 +1003,11 @@ namespace RacesOfValheim totalDamage *= 0.5f; } + if (currentHp > 0 && currentHp <= maxHp * 0.20f && !c.IsBoss()) + { + totalDamage = currentHp * 2f; // Lethal damage for execute + } + HitData hd = new HitData(); hd.m_damage.m_damage = totalDamage; hd.m_point = c.GetCenterPoint(); diff --git a/JotunnModStub/Skeleton/SkeletonPatches.cs b/JotunnModStub/Skeleton/SkeletonPatches.cs index 25450e6..71b298b 100644 --- a/JotunnModStub/Skeleton/SkeletonPatches.cs +++ b/JotunnModStub/Skeleton/SkeletonPatches.cs @@ -48,6 +48,65 @@ namespace RacesOfValheim } } + [HarmonyPatch(typeof(MessageHud), "ShowMessage")] + public static class MessageHud_ShowMessage_Patch + { + private static System.Collections.Generic.Dictionary> messageTimestamps = new System.Collections.Generic.Dictionary>(); + private static System.Collections.Generic.Dictionary messageBans = new System.Collections.Generic.Dictionary(); + + public static bool Prefix(MessageHud __instance, MessageHud.MessageType type, string text) + { + if (Player.m_localPlayer != null && SkeletonRace.IsSkeleton()) + { + if (string.IsNullOrEmpty(text)) return true; + + // Exception for resting messages to never be filtered + string lowerText = text.ToLower(); + if (text == "$se_resting_name" || text == "$se_resting" || lowerText.Contains("resting") || lowerText.Contains("riposo")) + { + return true; + } + + float currentTime = Time.time; + + // Check if message is currently banned (4 hours = 14400 seconds) + if (messageBans.TryGetValue(text, out float banTime)) + { + if (currentTime - banTime < 14400f) + { + return false; // Still banned + } + else + { + messageBans.Remove(text); // Ban expired + if (messageTimestamps.ContainsKey(text)) + { + messageTimestamps[text].Clear(); // Reset spam count + } + } + } + + if (!messageTimestamps.ContainsKey(text)) + { + messageTimestamps[text] = new System.Collections.Generic.List(); + } + + // Remove timestamps older than 5 seconds + messageTimestamps[text].RemoveAll(t => currentTime - t > 5f); + + if (messageTimestamps[text].Count >= 2) + { + // Trigger a 4-hour ban + messageBans[text] = currentTime; + return false; + } + + messageTimestamps[text].Add(currentTime); + } + return true; + } + } + [HarmonyPatch(typeof(Player), "Message")] public static class Player_Message_Patch { diff --git a/README.md b/README.md index 25c34f0..a11dbdd 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,9 @@ Please write to us on my Discord server: **https://discord.gg/gbBEK2VTE** ## Changelog +**v1.3.5** +- **Aswid**: Added an Execution mechanic to Blood Magic (Vampiric Aura): Non-boss enemies that fall below 20% health while inside the aura are instantly killed! + **v1.3.4** - **Aswid**: Refined the Aswid's diet. Restored Ashlands creatures (except undead like Charred and Morgen) and enabled a 4th stomach slot exclusively for Aswid prey. - **Aswid**: Added a keybind (I) to toggle the automatic devour on/off. diff --git a/check_localization.cs b/check_localization.cs new file mode 100644 index 0000000..8fd1bb4 --- /dev/null +++ b/check_localization.cs @@ -0,0 +1,29 @@ +using System; +using System.Reflection; + +public class Program +{ + public static void Main() + { + try + { + Assembly valheimAsm = Assembly.LoadFrom(@"c:\Users\FERDINANDO\Desktop\JotunnModStub-master\RacesOfValheim\libraries\assembly_valheim_publicized.dll"); + if (valheimAsm == null) + { + valheimAsm = Assembly.LoadFrom(@"c:\Users\FERDINANDO\Desktop\JotunnModStub-master\RacesOfValheim\JotunnModStub\bin\Debug\net48\assembly_valheim_publicized.dll"); + } + + foreach (var type in valheimAsm.GetTypes()) + { + if (type.Name.Contains("Localize") || type.Name.Contains("Localization")) + { + Console.WriteLine(type.FullName); + } + } + } + catch (Exception ex) + { + Console.WriteLine(ex); + } + } +} diff --git a/check_messagehud.cs b/check_messagehud.cs new file mode 100644 index 0000000..bfcbac4 --- /dev/null +++ b/check_messagehud.cs @@ -0,0 +1,42 @@ +using System; +using System.Reflection; + +public class Program +{ + public static void Main() + { + try + { + Assembly valheimAsm = Assembly.LoadFrom(@"c:\Users\FERDINANDO\Desktop\JotunnModStub-master\RacesOfValheim\libraries\assembly_valheim_publicized.dll"); + if (valheimAsm == null) + { + // try different path if not in libraries + valheimAsm = Assembly.LoadFrom(@"c:\Users\FERDINANDO\Desktop\JotunnModStub-master\RacesOfValheim\JotunnModStub\bin\Debug\net48\assembly_valheim_publicized.dll"); + } + + Type messageHudType = valheimAsm.GetType("MessageHud"); + if (messageHudType == null) { + Console.WriteLine("Could not find MessageHud type."); + return; + } + + foreach (var m in messageHudType.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static)) + { + if (m.Name.Contains("Message")) + { + Console.Write(m.Name + "("); + var p = m.GetParameters(); + for (int i = 0; i < p.Length; i++) { + Console.Write(p[i].ParameterType.Name); + if (i < p.Length - 1) Console.Write(", "); + } + Console.WriteLine(")"); + } + } + } + catch (Exception ex) + { + Console.WriteLine(ex); + } + } +} diff --git a/manifest.json b/manifest.json index 171e78a..e364df6 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "RacesOfValheim", "description": "A Valheim mod that adds custom playable races (Skeleton, Skadi, Fenrir, Aswid, Furling) each with unique abilities, traits, and a deep boss-driven progression system.", - "version_number": "1.3.4", + "version_number": "1.3.5", "website_url": "", "dependencies": [ "denikson-BepInExPack_Valheim-5.4.2333",