Add execute mechanic to Vampiric Aura and bump version to 1.3.5

This commit is contained in:
Ferdinando 2026-07-31 08:49:55 +02:00
commit c580871a2d
6 changed files with 140 additions and 1 deletions

View file

@ -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();

View file

@ -48,6 +48,65 @@ namespace RacesOfValheim
}
}
[HarmonyPatch(typeof(MessageHud), "ShowMessage")]
public static class MessageHud_ShowMessage_Patch
{
private static System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<float>> messageTimestamps = new System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<float>>();
private static System.Collections.Generic.Dictionary<string, float> messageBans = new System.Collections.Generic.Dictionary<string, float>();
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<float>();
}
// 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
{

View file

@ -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.

29
check_localization.cs Normal file
View file

@ -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);
}
}
}

42
check_messagehud.cs Normal file
View file

@ -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);
}
}
}

View file

@ -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",