Add execute mechanic to Vampiric Aura and bump version to 1.3.5
This commit is contained in:
parent
1b37d924a2
commit
c580871a2d
6 changed files with 140 additions and 1 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue