Merge remote-tracking branch 'origin/main' into creating-race-totem

This commit is contained in:
kanym 2026-08-02 08:49:19 +02:00
commit c4d426a1ba
8 changed files with 555 additions and 163 deletions

View file

@ -12,9 +12,10 @@ namespace RacesOfValheim
private static Dictionary<string, string> mobToTrophyMap = new Dictionary<string, string>
{
{ "Boar", "TrophyBoar" },
{ "Greyling", "TrophyGreyling" },
{ "Neck", "TrophyNeck" },
{ "Greydwarf", "TrophyGreydwarf" },
{ "Greydwarf_Elite", "TrophyGreydwarfElite" },
{ "Greydwarf_Elite", "TrophyGreydwarfBrute" },
{ "Greydwarf_Shaman", "TrophyGreydwarfShaman" },
{ "Troll", "TrophyFrostTroll" },
{ "Deer", "TrophyDeer" },
@ -119,7 +120,7 @@ namespace RacesOfValheim
}
else
{
customItem = new Jotunn.Entities.CustomItem(foodName, "RawMeat", config);
customItem = new Jotunn.Entities.CustomItem(foodName, "CookedMeat", config);
}
if (customItem != null && customItem.ItemDrop != null)
@ -244,50 +245,18 @@ namespace RacesOfValheim
// Locally generate the visual
if (!activeSensesLight.ContainsKey(c))
{
GameObject prefab = ZNetScene.instance?.GetPrefab("piece_groundtorch_green");
if (prefab != null)
{
ZNetView.m_forceDisableInit = true;
GameObject tempObj = Instantiate(prefab);
ZNetView.m_forceDisableInit = false;
GameObject lightObj = new GameObject("AswidSensesLight");
lightObj.transform.SetParent(c.transform);
lightObj.transform.position = c.GetCenterPoint();
GameObject lightObj = new GameObject("AswidSensesLight");
lightObj.transform.SetParent(c.transform);
lightObj.transform.localPosition = Vector3.zero;
Light pLight = lightObj.AddComponent<Light>();
pLight.type = LightType.Point;
pLight.color = Color.green;
pLight.range = 10f;
pLight.intensity = 2f;
pLight.shadows = LightShadows.None;
Transform enabledNode = tempObj.transform.Find("_enabled");
if (enabledNode != null)
{
enabledNode.SetParent(lightObj.transform);
enabledNode.localPosition = Vector3.zero;
enabledNode.localScale = new Vector3(2.2f, 2.2f, 2.2f);
// FORCE ACTIVE because Fireplace script might have disabled it due to no fuel!
enabledNode.gameObject.SetActive(true);
foreach (var col in enabledNode.GetComponentsInChildren<Collider>(true)) Destroy(col);
foreach (var audio in enabledNode.GetComponentsInChildren<AudioSource>(true)) Destroy(audio);
foreach (var l in enabledNode.GetComponentsInChildren<Light>(true))
{
if (l != null) l.range *= 2.2f;
}
foreach (var mb in enabledNode.GetComponentsInChildren<MonoBehaviour>(true))
{
if (mb == null) continue;
string typeName = mb.GetType().Name;
if (typeName != "ParticleSystem" && typeName != "LightFlicker")
{
Destroy(mb);
}
}
}
Destroy(tempObj);
activeSensesLight[c] = lightObj;
}
activeSensesLight[c] = lightObj;
}
}
catch (Exception ex)
@ -354,111 +323,7 @@ namespace RacesOfValheim
UpdateSuperhumanSenses();
if (Input.GetKeyDown(KeyCode.F8))
{
Jotunn.Logger.LogInfo("[AswidDebug] F8 Pressed. Dumping Player Visuals:");
VisEquipment vis = Player.m_localPlayer.GetComponentInChildren<VisEquipment>();
if (vis != null)
{
Jotunn.Logger.LogInfo($"[AswidDebug] m_bodyModel.enabled: {(vis.m_bodyModel != null ? vis.m_bodyModel.enabled.ToString() : "null")}");
var legItems = Traverse.Create(vis).Field("m_legItemInstances").GetValue<List<GameObject>>();
if (legItems != null)
{
foreach (var go in legItems) Jotunn.Logger.LogInfo($"[AswidDebug] LegItem: {go.name}, Active: {go.activeSelf}");
}
var chestItems = Traverse.Create(vis).Field("m_chestItemInstances").GetValue<List<GameObject>>();
if (chestItems != null)
{
foreach (var go in chestItems) Jotunn.Logger.LogInfo($"[AswidDebug] ChestItem: {go.name}, Active: {go.activeSelf}");
}
}
Transform visual = Player.m_localPlayer.transform.Find("Visual");
if (visual != null)
{
foreach (var smr in visual.GetComponentsInChildren<SkinnedMeshRenderer>(true))
{
Jotunn.Logger.LogInfo($"[AswidDebug] Player SMR: {smr.name} | Active: {smr.gameObject.activeSelf} | Enabled: {smr.enabled}");
}
}
GameObject geirrhafaPrefab = Jotunn.Managers.PrefabManager.Cache.GetPrefab<GameObject>("Fenring_Cultist_Hildir");
if (geirrhafaPrefab != null)
{
Jotunn.Logger.LogInfo("[AswidDebug] GEIRRHAFA PREFAB DUMP:");
foreach (var smr in geirrhafaPrefab.GetComponentsInChildren<SkinnedMeshRenderer>(true))
{
Jotunn.Logger.LogInfo($"[AswidDebug] Geirrhafa SMR: {smr.name} | Bones: {smr.bones.Length}");
}
}
List<Character> allChars = Character.GetAllCharacters();
Vector3 myPos = Player.m_localPlayer.transform.position;
int charsInRange = 0;
foreach (var c in allChars)
{
if (c == null || c == Player.m_localPlayer || c.IsDead() || c.IsTamed()) continue;
float dist = Vector3.Distance(c.transform.position, myPos);
if (dist <= 100f)
{
charsInRange++;
bool hasLight = activeSensesLight.ContainsKey(c);
bool hasMalus = c.GetSEMan() != null && c.GetSEMan().HaveStatusEffect("SE_AswidSensesMark".GetStableHashCode());
Jotunn.Logger.LogInfo($"[AswidDebug] In range: {c.name} (Dist: {dist}), HasLight: {hasLight}, HasMalus: {hasMalus}");
if (hasLight)
{
GameObject lightObj = activeSensesLight[c];
if (lightObj != null)
{
Jotunn.Logger.LogInfo($"[AswidDebug] LightObj: {lightObj.name}, ActiveSelf: {lightObj.activeSelf}, ActiveInHierarchy: {lightObj.activeInHierarchy}");
Jotunn.Logger.LogInfo(DumpGameObject(lightObj, " "));
}
else
{
Jotunn.Logger.LogInfo($"[AswidDebug] LightObj is NULL!");
}
}
}
}
Jotunn.Logger.LogInfo($"[AswidDebug] Total valid chars in range: {charsInRange}");
Jotunn.Logger.LogInfo($"[AswidDebug] activeSensesLight count: {activeSensesLight.Count}");
Jotunn.Logger.LogInfo("[AswidDebug] F8 pressed! Finding nearest mob to consume...");
Character nearest = null;
float minDist = 10f;
foreach (Character c in Character.GetAllCharacters())
{
if (c != Player.m_localPlayer && c.GetHealth() > 0)
{
float dist = UnityEngine.Vector3.Distance(Player.m_localPlayer.transform.position, c.transform.position);
if (dist < minDist)
{
minDist = dist;
nearest = c;
}
}
}
if (nearest != null)
{
Jotunn.Logger.LogInfo($"[AswidDebug] Consuming {nearest.name} via F8!");
TryConsumeMob(nearest, nearest.GetMaxHealth());
HitData hit = new HitData();
hit.m_damage.m_damage = 99999f;
hit.m_hitType = HitData.HitType.Undefined;
hit.m_attacker = Player.m_localPlayer.GetZDOID();
nearest.ApplyDamage(hit, true, false);
}
else
{
Jotunn.Logger.LogInfo("[AswidDebug] No mob found near player to consume.");
}
}
try
{
@ -518,7 +383,7 @@ namespace RacesOfValheim
TryCastEclipse(state);
return;
}
if (Input.GetKeyDown(KeyCode.K))
if (Input.GetKeyDown(KeyCode.U))
{
TryTameHoverObject(state);
return;
@ -1222,3 +1087,8 @@ namespace RacesOfValheim
public class NightAuraTintFlag : MonoBehaviour { }
}

View file

@ -35,7 +35,22 @@ namespace RacesOfValheim
public static bool UseItem_Prefix(Humanoid __instance, Inventory inventory, ItemDrop.ItemData item, bool fromInventoryGui)
{
Player player = __instance as Player;
if (player == null || player != Player.m_localPlayer || !DraughRace.IsDraugh() || item == null || item.m_shared == null) return true;
if (player == null || player != Player.m_localPlayer || item == null || item.m_shared == null) return true;
// Prevent non-Draughs from eating Human Meat
if (item.m_dropPrefab != null && item.m_dropPrefab.name == "HumanMeat")
{
if (!DraughRace.IsDraugh())
{
player.Message(MessageHud.MessageType.Center, "This rotting flesh is fatal to the living.");
return false; // Block consumption
}
// If it IS a Draugh, let them consume it via native mechanics
return true;
}
// Normal Draugh Food restrictions
if (!DraughRace.IsDraugh()) return true;
// Intercept right click on raw items.
// In UseItem, if it's a Consumable, Valheim will process it. If it's our EdibleUncooked_, it's a Consumable!
@ -64,6 +79,12 @@ namespace RacesOfValheim
if (ate)
{
inventory.RemoveItem(item, 1);
var consumeEffects = Traverse.Create(player).Field("m_consumeItemEffects").GetValue<EffectList>();
if (consumeEffects != null) consumeEffects.Create(player.transform.position, Quaternion.identity, player.transform, 1f, -1);
var zanim = Traverse.Create(player).Field("m_zanim").GetValue<ZSyncAnimation>();
if (zanim != null) zanim.SetTrigger("eat");
}
return false; // Skip native UseItem
}

View file

@ -23,8 +23,22 @@ namespace RacesOfValheim
if (__instance.m_bodyModel != null && __instance.m_bodyModel.material != null)
{
// Sickly grayish-green undead skin color (corpse green)
Color draughColor = new Color(0.25f, 0.4f, 0.28f, 1f);
Color draughColor = new Color(0.25f, 0.4f, 0.28f, 1f); // Sickly grayish-green undead skin color
// Stage 6: Undying Will ghost visuals
if (DraughRace.isUndying && player == Player.m_localPlayer)
{
draughColor = new Color(0.2f, 1f, 0.2f, 0.5f); // Bright transparent green
__instance.m_bodyModel.material.SetOverrideTag("RenderType", "Transparent");
__instance.m_bodyModel.material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
__instance.m_bodyModel.material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
__instance.m_bodyModel.material.SetInt("_ZWrite", 0);
__instance.m_bodyModel.material.DisableKeyword("_ALPHATEST_ON");
__instance.m_bodyModel.material.EnableKeyword("_ALPHABLEND_ON");
__instance.m_bodyModel.material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
__instance.m_bodyModel.material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;
}
__instance.m_bodyModel.material.SetColor("_SkinColor", draughColor);
}
@ -114,6 +128,18 @@ namespace RacesOfValheim
// +50% damage received from fire, spirit
hit.m_damage.m_fire *= 1.5f;
hit.m_damage.m_spirit *= 1.5f;
// Stage 4: Undead Fortitude (Poison Immunity)
if (BossProgressionManager.GetCurrentProgressionState() >= 4)
{
hit.m_damage.m_poison = 0f;
}
// Stage 5: Grave Chill (Frost Immunity)
if (BossProgressionManager.GetCurrentProgressionState() >= 5)
{
hit.m_damage.m_frost = 0f;
}
}
}
}

View file

@ -0,0 +1,355 @@
using HarmonyLib;
using UnityEngine;
using System.Collections.Generic;
namespace RacesOfValheim
{
public static class DraughProgressionPatches
{
// ========================================
// STAGE 2: SUNKEN MENACE (State >= 2)
// ========================================
[HarmonyPatch(typeof(SE_Wet), "Setup")]
public static class SE_Wet_Setup_Patch
{
public static void Postfix(SE_Wet __instance, Character character)
{
if (character == Player.m_localPlayer && DraughRace.IsDraugh())
{
if (BossProgressionManager.GetCurrentProgressionState() >= 2)
{
// Invert the Wet debuff to actually heal the Draugh
__instance.m_healthRegenMultiplier = 1.25f; // +25% health regen
__instance.m_staminaRegenMultiplier = 1f; // No stamina penalty
__instance.m_tooltip = "The water restores your rotten flesh. Health regeneration increased.";
}
}
}
}
// ========================================
// STAGE 3: ROTTING EDGE (State >= 3)
// ========================================
[HarmonyPatch(typeof(Character), "Damage")]
public static class Draugh_DealDamage_Patch
{
public static void Prefix(Character __instance, HitData hit)
{
if (hit == null || __instance == null || hit.GetAttacker() == null) return;
if (hit.GetAttacker() == Player.m_localPlayer && DraughRace.IsDraugh())
{
if (BossProgressionManager.GetCurrentProgressionState() >= 3)
{
// If it's a physical attack (slash, pierce, blunt, or chop)
float physDamage = hit.m_damage.m_blunt + hit.m_damage.m_slash + hit.m_damage.m_pierce + hit.m_damage.m_chop;
if (physDamage > 0f && hit.m_skill != Skills.SkillType.BloodMagic && hit.m_skill != Skills.SkillType.ElementalMagic)
{
// Add poison damage based on the physical damage (e.g., 20% of physical damage as poison DoT)
hit.m_damage.m_poison += physDamage * 0.20f;
}
}
if (BossProgressionManager.GetCurrentProgressionState() >= 4)
{
// Stage 4: Undead Fortitude (+30% crit damage on staggered enemies)
if (__instance.IsStaggering())
{
hit.m_damage.m_blunt *= 1.30f;
hit.m_damage.m_slash *= 1.30f;
hit.m_damage.m_pierce *= 1.30f;
hit.m_damage.m_chop *= 1.30f;
}
}
}
}
}
[HarmonyPatch(typeof(Humanoid), "BlockAttack")]
public static class Draugh_Parry_Patch
{
private static float lastNorthWindTime = -100f; // Track cooldown
public static void Postfix(Humanoid __instance, HitData hit, Character attacker, ref bool __result)
{
if (!__result || __instance != Player.m_localPlayer || attacker == null) return;
if (DraughRace.IsDraugh())
{
int state = BossProgressionManager.GetCurrentProgressionState();
if (state >= 3)
{
// Check if it was a parry.
float blockTimer = Traverse.Create(__instance).Field("m_blockTimer").GetValue<float>();
float parryTime = 0.25f; // Default Valheim parry window
if (blockTimer != -1f && blockTimer <= parryTime)
{
// Stage 3: Poison Splash
HitData poisonSplash = new HitData();
poisonSplash.m_damage.m_poison = 40f; // Flat base poison splash
poisonSplash.m_point = attacker.GetCenterPoint();
poisonSplash.SetAttacker(__instance);
poisonSplash.m_dir = (attacker.GetCenterPoint() - __instance.GetCenterPoint()).normalized;
attacker.ApplyDamage(poisonSplash, true, false);
// Visual effect for splash
UnityEngine.Object.Instantiate(ZNetScene.instance.GetPrefab("vfx_OozeHit"), attacker.GetCenterPoint(), Quaternion.identity);
// Stage 5: North Wind (AoE Frost)
if (state >= 5)
{
if (Time.time - lastNorthWindTime >= 20f)
{
lastNorthWindTime = Time.time;
// Visual effect for Nova (sledge frost effect)
GameObject iceHit = ZNetScene.instance.GetPrefab("vfx_sledge_iron_hit"); // Actually, vfx_ice_hit is better, or vfx_sledge_iron_hit which is used by Frostner
if (iceHit == null) iceHit = ZNetScene.instance.GetPrefab("vfx_ice_hit");
if (iceHit != null)
{
UnityEngine.Object.Instantiate(iceHit, __instance.transform.position, Quaternion.identity);
}
// Find all characters within 8 meters
List<Character> allCharacters = Character.GetAllCharacters();
foreach (Character ch in allCharacters)
{
if (ch == null || ch == __instance || ch.IsPlayer() || ch.IsDead()) continue;
if (Vector3.Distance(__instance.transform.position, ch.transform.position) <= 8f)
{
HitData northWind = new HitData();
northWind.m_damage.m_frost = 50f;
northWind.m_point = ch.GetCenterPoint();
northWind.SetAttacker(__instance);
northWind.m_dir = (ch.GetCenterPoint() - __instance.GetCenterPoint()).normalized;
northWind.m_pushForce = 20f;
ch.ApplyDamage(northWind, true, false);
}
}
Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "The northern wind blows");
}
}
}
}
}
}
}
// ========================================
// STAGE 4: UNDEAD FORTITUDE & DEATH AURA (State >= 4)
// ========================================
[HarmonyPatch(typeof(Skills), "LowerAllSkills")]
public static class Draugh_NoSkillDrain_Patch
{
public static bool Prefix(Skills __instance)
{
// Check if this Skills instance belongs to the local player
Player player = Traverse.Create(__instance).Field("m_player").GetValue<Player>();
if (player != null && player == Player.m_localPlayer)
{
if (DraughRace.IsDraugh() && BossProgressionManager.GetCurrentProgressionState() >= 4)
{
return false; // Prevent skill drain
}
}
return true;
}
}
[HarmonyPatch(typeof(Player), "OnDeath")]
public static class Draugh_DeathAura_Patch
{
public static void Prefix(Player __instance)
{
if (BossProgressionManager.GetCurrentProgressionState() >= 4)
{
bool draughNearby = false;
foreach (Player p in Player.GetAllPlayers())
{
if (p.m_customData != null && p.m_customData.TryGetValue("Race", out string race) && race == "Draugh")
{
if (Vector3.Distance(__instance.transform.position, p.transform.position) <= 100f)
{
draughNearby = true;
break;
}
}
}
if (draughNearby)
{
GameObject meatPrefab = ObjectDB.instance.GetItemPrefab("HumanMeat");
if (meatPrefab != null)
{
Vector3 dropPos = __instance.transform.position + Vector3.up * 1.0f;
GameObject dropped = UnityEngine.Object.Instantiate(meatPrefab, dropPos, Quaternion.identity);
ItemDrop itemDrop = dropped.GetComponent<ItemDrop>();
if (itemDrop != null)
{
itemDrop.m_itemData.m_stack = 1;
Rigidbody rb = dropped.GetComponent<Rigidbody>();
if (rb != null)
{
rb.linearVelocity = Vector3.up * 5f + UnityEngine.Random.insideUnitSphere * 2f;
}
}
}
}
}
}
}
// ========================================
// STAGE 6: UNDYING WILL (State >= 6)
// ========================================
[HarmonyPatch(typeof(Player), "OnDeath")]
public static class Player_OnDeath_Undying_Patch
{
public static bool Prefix(Player __instance)
{
if (__instance == Player.m_localPlayer && DraughRace.IsDraugh() && BossProgressionManager.GetCurrentProgressionState() >= 6)
{
if (DraughRace.isUndying)
{
// If they are already undying and they reach OnDeath again, it means their Eitr ran out.
// We must let them die for real this time.
return true;
}
float currentEitr = __instance.GetEitr();
if (currentEitr > 0f && Time.time - DraughRace.lastUndyingWillTime >= 600f) // 10 minutes
{
// Trigger Undying Will!
DraughRace.lastUndyingWillTime = Time.time;
DraughRace.isUndying = true;
// Prevent the real death this frame, stay alive at 1 HP
__instance.SetHealth(1f);
DraughRace.Instance.StartCoroutine(DraughRace.Instance.UndyingWillRoutine(__instance));
// Return false to skip the original OnDeath method
return false;
}
}
return true;
}
}
[HarmonyPatch(typeof(Character), "ApplyDamage")]
public static class Character_ApplyDamage_Undying_Patch
{
public static bool Prefix(Character __instance, HitData hit)
{
if (__instance == Player.m_localPlayer && DraughRace.IsDraugh())
{
if (DraughRace.isUndying)
{
// Become immune to all damage
return false;
}
}
return true;
}
}
// ========================================
// STAGE 7: SWARM OF TERROR (State >= 7)
// ========================================
[HarmonyPatch(typeof(Character), "Damage")]
public static class Character_Damage_SwarmOfTerror_Patch
{
public static void Prefix(Character __instance, HitData hit)
{
if (__instance == Player.m_localPlayer && DraughRace.IsDraugh() && BossProgressionManager.GetCurrentProgressionState() >= 7)
{
if (hit == null || hit.GetAttacker() == null || hit.m_damage.GetTotalDamage() <= 0f) return;
// Melee check via distance
if (Vector3.Distance(hit.GetAttacker().transform.position, __instance.transform.position) <= 5f)
{
if (Time.time - DraughRace.lastSeekerSpawnTime >= 10f)
{
DraughRace.lastSeekerSpawnTime = Time.time;
GameObject prefab = ObjectDB.instance.GetItemPrefab("SeekerBrood");
if (prefab == null)
{
prefab = ZNetScene.instance.GetPrefab("SeekerBrood");
}
if (prefab != null)
{
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "Swarm of Terror!");
for (int i = 0; i < 2; i++)
{
Vector3 spawnPos = __instance.transform.position + __instance.transform.forward * 1f + UnityEngine.Random.insideUnitSphere * 1.5f;
spawnPos.y = __instance.transform.position.y;
GameObject brood = UnityEngine.Object.Instantiate(prefab, spawnPos, Quaternion.identity);
Character c = brood.GetComponent<Character>();
if (c != null)
{
c.m_faction = Character.Faction.Players; // Make it friendly
// Remove drops
CharacterDrop drop = brood.GetComponent<CharacterDrop>();
if (drop != null)
{
UnityEngine.Object.Destroy(drop);
}
// Kill after 9.5 seconds
DraughRace.Instance.StartCoroutine(DraughRace.Instance.KillBroodAfterTime(c, 9.5f));
}
}
}
}
}
}
}
public static void Postfix(Character __instance, HitData hit)
{
// STAGE 8: STEAL THEIR BREATH (State >= 8)
if (DraughRace.isUndying && __instance != Player.m_localPlayer && __instance.GetHealth() <= 0f)
{
if (BossProgressionManager.GetCurrentProgressionState() >= 8)
{
if (hit != null && hit.GetAttacker() == Player.m_localPlayer)
{
// Steal Their Breath triggered!
DraughRace.isUndying = false; // Break the routine loop
float healAmount = Player.m_localPlayer.GetMaxHealth() * 0.25f;
Player.m_localPlayer.Heal(healAmount);
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "Steal Their Breath! Death is denied.");
// Restore visuals immediately
if (Player.m_localPlayer.GetComponent<VisEquipment>() != null)
{
HarmonyLib.Traverse.Create(Player.m_localPlayer.GetComponent<VisEquipment>()).Method("UpdateVisuals").GetValue();
HarmonyLib.Traverse.Create(Player.m_localPlayer.GetComponent<VisEquipment>()).Method("UpdateColors").GetValue();
}
}
}
}
}
}
}
}

View file

@ -6,6 +6,11 @@ namespace RacesOfValheim
{
public static DraughRace Instance;
public static bool isUndying = false;
public static float lastUndyingWillTime = -1000f;
public static float lastSeekerSpawnTime = -1000f;
private void Awake()
{
Instance = this;
@ -118,6 +123,7 @@ namespace RacesOfValheim
{
draughVFX = new GameObject("DraughAuraVFX");
draughVFX.transform.SetParent(Player.m_localPlayer.transform, false);
// Centro del giocatore invece che il pivot (piedi)
draughVFX.transform.localPosition = new Vector3(0, 1f, 0);
// Find all ParticleSystems in Draugr prefab
@ -131,14 +137,28 @@ namespace RacesOfValheim
psCopy.name = ps.gameObject.name;
psCopy.SetActive(true);
// Ensure it's positioned correctly
psCopy.transform.localPosition = ps.transform.localPosition;
// Entrambi (fumo e mosche) partono esattamente dal centro
psCopy.transform.localPosition = Vector3.zero;
psCopy.transform.localRotation = ps.transform.localRotation;
// Make the green smoke 50% larger. We exclude "flies" in case they are separate.
if (!psCopy.name.ToLower().Contains("flies"))
string psName = psCopy.name.ToLower();
if (psName.Contains("flies"))
{
psCopy.transform.localScale = ps.transform.localScale * 1.5f;
// Flies effect: leave as is
}
else if (psName.Contains("drip") || psName.Contains("drop") || psName.Contains("rain") || psName.Contains("splash"))
{
// Effetto 3 (pioggia): disattivato
psCopy.SetActive(false);
}
else
{
// Smoke effect: scale reduced to 1.5f (-40% of 2.5f)
psCopy.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
var main = psCopy.GetComponent<ParticleSystem>().main;
main.scalingMode = ParticleSystemScalingMode.Hierarchy;
}
}
}
@ -158,5 +178,58 @@ namespace RacesOfValheim
}
}
}
public System.Collections.IEnumerator UndyingWillRoutine(Player p)
{
p.Message(MessageHud.MessageType.Center, "Zombie Ritual Activated! Your borrowed time is fading...");
// Trigger a re-evaluation of visuals to apply the ghost effect
if (p.GetComponent<VisEquipment>() != null)
{
HarmonyLib.Traverse.Create(p.GetComponent<VisEquipment>()).Method("UpdateVisuals").GetValue();
HarmonyLib.Traverse.Create(p.GetComponent<VisEquipment>()).Method("UpdateColors").GetValue();
}
while (isUndying)
{
float currentEitr = p.GetEitr();
if (currentEitr <= 0f)
{
isUndying = false;
// Force death properly through the damage system
HitData killHit = new HitData();
killHit.m_damage.m_damage = 99999f;
killHit.m_point = p.transform.position;
p.Damage(killHit);
break;
}
// Drain 2 Eitr per tick (5 ticks per second = 10 eitr/sec)
p.UseEitr(2f);
yield return new WaitForSeconds(0.2f);
}
// Restore visuals
if (p != null && p.GetComponent<VisEquipment>() != null)
{
HarmonyLib.Traverse.Create(p.GetComponent<VisEquipment>()).Method("UpdateVisuals").GetValue();
HarmonyLib.Traverse.Create(p.GetComponent<VisEquipment>()).Method("UpdateColors").GetValue();
}
}
public System.Collections.IEnumerator KillBroodAfterTime(Character brood, float time)
{
yield return new WaitForSeconds(time);
if (brood != null && !brood.IsDead())
{
// Force death naturally
HitData killHit = new HitData();
killHit.m_damage.m_damage = 9999f;
killHit.m_point = brood.transform.position;
brood.Damage(killHit);
}
}
}
}

View file

@ -14,7 +14,8 @@ namespace RacesOfValheim
"Skadi Secrets",
"Skeleton Secrets",
"Furling Secrets",
"Trol Secrets"
"Trol Secrets",
"Draugh Secrets"
};
public static void UpdateCompendiumText(Player player)
@ -62,6 +63,41 @@ namespace RacesOfValheim
{
GenerateTrolText(knownTexts, state, player);
}
else if (currentRace == "Draugh")
{
GenerateDraughText(knownTexts, state, player);
}
}
private static void GenerateDraughText(Dictionary<string, string> knownTexts, int state, Player player)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("The Draugh's Awakening\n");
sb.AppendLine("[Base Passive] Born Dead, Buried Alive: You are a decaying undead warrior. You have innate resistance to Poison, but are weak to Fire and Spirit damage. Your digestive system adapts to death, allowing you to consume raw and rotten meat (Neck tail, raw meat, entrails, ooze, etc.).\n");
if (state >= 2)
sb.AppendLine("Slowly We Rot (Passive): You are no longer hindered by water. You gain immunity to the Wet effect, your movement speed in water is greatly increased, and you passively regenerate health while wet or swimming.\n");
if (state >= 3)
sb.AppendLine("Toxic Trace (Passive): Your physical attacks are laced with the swamp's decay. Enemies struck by your physical weapons suffer additional poison damage over time.\n");
if (state >= 4)
sb.AppendLine("Flesh and the Power It Holds (Passive): Slaying humanoid enemies drops Human Meat. Consuming it grants incredible buffs. You also gain the Corpse Run buff permanently.\n");
if (state >= 5)
sb.AppendLine("At the Heart of Winter (Parry Effect): When you successfully parry an attack, you unleash a freezing nova of frost magic around you, pushing back and damaging enemies (20 second cooldown).\n");
if (state >= 6)
sb.AppendLine("Zombie Ritual (Passive Survival): When you take fatal damage, you do not die. Instead, you enter a ghostly state, becoming immune to all damage. While in this state, your Eitr drains rapidly. If your Eitr hits zero, you truly die.\n");
if (state >= 7)
sb.AppendLine("Swarm of Terror (Retaliation): Whenever you are struck in melee combat, you automatically spawn 2 Seeker Broods to fight for you. They live for 9.5 seconds and have a 10 second cooldown.\n");
if (state >= 8)
sb.AppendLine("Steal Their Breath (Execution): While surviving in the 'Zombie Ritual' ghost state, scoring a killing blow on any enemy will instantly restore 25% of your maximum health, stop the Eitr drain, and save your life, bringing you fully back to the world of the living.\n");
knownTexts["Draugh Secrets"] = sb.ToString();
}
private static void GenerateTrolText(Dictionary<string, string> knownTexts, int state, Player player)

View file

@ -49,6 +49,17 @@ namespace RacesOfValheim
if (state >= 7 && (prefabName.Contains("hare") || prefabName.Contains("gjall"))) __result = false;
if (state >= 8 && (prefabName.Contains("asksvin") || prefabName.Contains("volture") || prefabName.Contains("vulture") || prefabName.Contains("valkyrie"))) __result = false;
}
// Draugh Race Logic
if (p.m_customData.ContainsKey("Race") && p.m_customData["Race"] == "Draugh")
{
string prefabName = monster.gameObject.name.ToLower();
if (prefabName.Contains("skeleton") || prefabName.Contains("draugr") ||
prefabName.Contains("ghost") || prefabName.Contains("wraith"))
{
__result = false;
}
}
}
}
}

View file

@ -231,7 +231,7 @@ namespace RacesOfValheim
CreateRaceButtonWithConfirm("Aswid", new Vector2(-450, -20), GetAswidIcon(), "Fierce night stalker. Strong and resilient, transforms into a bat.", SelectAswid);
CreateRaceButtonWithConfirm("Furling", new Vector2(-150, -20), GetFurlingIcon(), "Cunning goblin-like creatures. Agile and resourceful.", SelectFurling);
CreateRaceButtonWithConfirm("Trol", new Vector2(150, -20), GetTrolIcon(), "Massive brute strength. Towering over others but slow to react.", SelectTrol);
CreateRaceButtonWithConfirm("Draugh", new Vector2(450, -20), GetDraughIcon(), "Undead warriors of the swamps. Accustomed to damp and decay.", SelectDraugh);
CreateRaceButtonWithConfirm("Draugh", new Vector2(450, -20), GetDraughIcon(), "A decaying undead warrior fueled by dark magic and extreme metal.", SelectDraugh);
GUIManager.BlockInput(true);
}