diff --git a/JotunnModStub/Alfar/AlfarArchon.cs b/JotunnModStub/Alfar/AlfarArchon.cs index 079d7a6..0be4415 100644 --- a/JotunnModStub/Alfar/AlfarArchon.cs +++ b/JotunnModStub/Alfar/AlfarArchon.cs @@ -119,10 +119,7 @@ namespace RacesOfValheim if (Time.time >= nextPulse) { nextPulse = Time.time + AlfarPowerConfig.ArchonPulseInterval.Value; - // The pulse fires on its own while the form lasts, so it earns what an aura does: - // a tenth of a hit per second, once per pulse that struck something. - if (AlfarPowers.Pulse(player, AlfarPowerConfig.ArchonPulseRadius.Value, AlfarPowerConfig.ArchonPulseDamage.Value)) - FormMelee.RaiseSkill(Skills.SkillType.ElementalMagic, 0.1f * AlfarPowerConfig.ArchonPulseInterval.Value); + AlfarPowers.Pulse(player, AlfarPowerConfig.ArchonPulseRadius.Value, AlfarPowerConfig.ArchonPulseDamage.Value); } } diff --git a/JotunnModStub/Alfar/AlfarPatches.cs b/JotunnModStub/Alfar/AlfarPatches.cs index 73864de..5d5e5ea 100644 --- a/JotunnModStub/Alfar/AlfarPatches.cs +++ b/JotunnModStub/Alfar/AlfarPatches.cs @@ -38,37 +38,6 @@ namespace RacesOfValheim } } - /// - /// Hair and beard never attach to an Alfr. Every equipment change makes the game write the - /// profile's hair back (Humanoid.SetupVisEquipment), and ApplyHairless only clears it on its - /// 0.5s pass, so players saw the hair flash in for a moment. Zeroing the hash here, where - /// VisEquipment spawns the model, means it never appears. Covers remote players too, since - /// their visuals go through the same call. - /// - [HarmonyPatch(typeof(VisEquipment), "SetHairEquipped")] - public static class Alfar_SetHairEquipped_Patch - { - public static void Prefix(VisEquipment __instance, ref int hash) - { - if (hash != 0 && IsAlfarVis(__instance)) hash = 0; - } - } - - [HarmonyPatch(typeof(VisEquipment), "SetBeardEquipped")] - public static class Alfar_SetBeardEquipped_Patch - { - public static void Prefix(VisEquipment __instance, ref int hash) - { - if (hash != 0 && IsAlfarVis(__instance)) hash = 0; - } - } - - private static bool IsAlfarVis(VisEquipment vis) - { - Player player = vis.GetComponent(); - return player != null && AlfarVisuals.IsAlfarPlayer(player); - } - /// /// The character preview on the main menu is a Player too, with the saved race in its custom data /// and no ZNetView. Its Update may never run, so a small driver on it keeps the look: skin, hair, diff --git a/JotunnModStub/Alfar/AlfarPowers.cs b/JotunnModStub/Alfar/AlfarPowers.cs index 8a02b61..82aca06 100644 --- a/JotunnModStub/Alfar/AlfarPowers.cs +++ b/JotunnModStub/Alfar/AlfarPowers.cs @@ -148,17 +148,12 @@ namespace RacesOfValheim } /// A pulse of lightning on every hostile creature within a radius of the Alfr. - /// True if it struck at least one creature. - public static bool Pulse(Player player, float radius, float damage) + public static void Pulse(Player player, float radius, float damage) { - bool struck = false; foreach (Character character in CharactersIn(player.transform.position, radius)) { - if (!IsHostile(player, character)) continue; - Strike(player, character, damage, character.GetCenterPoint()); - struck = true; + if (IsHostile(player, character)) Strike(player, character, damage, character.GetCenterPoint()); } - return struck; } private static IEnumerable CharactersIn(Vector3 center, float radius) @@ -182,64 +177,35 @@ namespace RacesOfValheim Vector3 direction = aim.forward; float distance = AlfarPowerConfig.SkridDistance.Value; + if (!Pay(player, AlfarPowerConfig.SkridCost.Value)) return; + // Stop short of whatever is in the way, so the blink never ends inside a wall. Vector3 destination = origin + direction * distance; - if (NearestHit(player, origin, direction, distance, out RaycastHit wall)) + RaycastHit[] hits = Physics.RaycastAll(origin, direction, distance, ~0, QueryTriggerInteraction.Ignore); + float nearest = float.MaxValue; + foreach (RaycastHit hit in hits) { - destination = wall.point - direction * 0.6f; - } - - // Back down to the player's own height: the origin was at the chest. The floor is found - // with a short ray down from the landing point, never with GetSolidHeight: that one casts - // from 1000 m up, so under any roof (a crypt, a cave, a house) it returned the roof and - // put the Alfr on top of it. A flat 1 m drop also sank the feet under the floor when the - // blink was aimed at it. - const float FloorSearch = 3f; - if (NearestHit(player, destination, Vector3.down, FloorSearch, out RaycastHit floor)) - { - destination.y = floor.point.y + 0.05f; - } - else if (player.InInterior()) - { - // No floor under the landing point inside a dungeon: it would end in the void the - // dungeon floats in. Cancel before paying. - return; - } - else - { - destination.y -= 1.0f; - if (ZoneSystem.instance != null) + if (hit.collider.GetComponentInParent() == player) continue; + if (hit.distance < nearest) { - // Terrain only, so a roof overhead is never mistaken for the ground. - float ground = ZoneSystem.instance.GetGroundHeight(destination); - if (destination.y < ground) destination.y = ground + 0.1f; + nearest = hit.distance; + destination = hit.point - direction * 0.6f; } } - if (!Pay(player, AlfarPowerConfig.SkridCost.Value)) return; + // Back down to the player's own height: the origin was at the chest. + destination.y -= 1.0f; + if (ZoneSystem.instance != null) + { + float ground = ZoneSystem.instance.GetSolidHeight(destination); + if (destination.y < ground) destination.y = ground + 0.1f; + } Teleport(player, destination); StartCooldown("skrid", AlfarPowerConfig.SkridCooldown.Value); AlfarFx.Spawn("fx_JotunWitch_LightningBolt_Explosion", origin); } - /// The nearest solid hit along a ray, skipping the caster's own colliders. - private static bool NearestHit(Player player, Vector3 origin, Vector3 direction, float distance, out RaycastHit nearest) - { - nearest = default; - bool found = false; - foreach (RaycastHit hit in Physics.RaycastAll(origin, direction, distance, ~0, QueryTriggerInteraction.Ignore)) - { - if (hit.collider.GetComponentInParent() == player) continue; - if (!found || hit.distance < nearest.distance) - { - nearest = hit; - found = true; - } - } - return found; - } - /// /// Moves the body without the teleport fade: the rigidbody is repositioned and its velocity /// zeroed, and the fall tracker is reset so a blink up a cliff does not count as a fall. @@ -430,11 +396,7 @@ namespace RacesOfValheim AlfarEitr.Spend(player, cost); } - if (IsHostile(player, target)) - { - Strike(player, target, AlfarPowerConfig.BeamDps.Value * tick, end); - FormMelee.RaiseSkill(Skills.SkillType.ElementalMagic, tick); // a full hit per second on target - } + if (IsHostile(player, target)) Strike(player, target, AlfarPowerConfig.BeamDps.Value * tick, end); } private static void RaiseHand(Player player) @@ -586,19 +548,14 @@ namespace RacesOfValheim const float tick = 0.5f; nextTick = Time.time + tick; - bool struck = false; foreach (Collider collider in Physics.OverlapSphere(transform.position, Radius, ~0, QueryTriggerInteraction.Ignore)) { Character character = collider.GetComponentInParent(); if (character == null || character == Owner || character.IsDead() || character.IsTamed()) continue; if (!BaseAI.IsEnemy(Owner, character)) continue; AlfarPowers.Strike(Owner, character, DamagePerSecond * tick, character.GetCenterPoint()); - struck = true; } - // Once per tick, not per creature: a full hit per second the storm strikes something. - if (struck && Owner == Player.m_localPlayer) FormMelee.RaiseSkill(Skills.SkillType.ElementalMagic, tick); - Vector2 offset = Random.insideUnitCircle * Radius; AlfarFx.Spawn("fx_JotunWitch_LightningBolt_Explosion", transform.position + new Vector3(offset.x, 0f, offset.y)); } diff --git a/JotunnModStub/Aswid/AswidBatForm.cs b/JotunnModStub/Aswid/AswidBatForm.cs index 2ac80c7..1ce1fc3 100644 --- a/JotunnModStub/Aswid/AswidBatForm.cs +++ b/JotunnModStub/Aswid/AswidBatForm.cs @@ -118,27 +118,6 @@ namespace RacesOfValheim } } - /// - /// Notes when the local player last lost health, for the bat's combat lock. ApplyDamage is the - /// one final stage for direct hits, burning, poison and bleeding, so comparing health around it - /// catches them all, and a hit fully blocked or absorbed (Alfar shield, Heimkall) is no hurt. - /// - [HarmonyPatch(typeof(Character), "ApplyDamage", - new[] { typeof(HitData), typeof(bool), typeof(bool), typeof(HitData.DamageModifier) })] - public static class Aswid_BatCombatLock_Patch - { - public static void Prefix(Character __instance, ref float __state) - { - __state = __instance == Player.m_localPlayer ? __instance.GetHealth() : -1f; - } - - public static void Postfix(Character __instance, float __state) - { - if (__state < 0f) return; - if (__instance.GetHealth() < __state) AswidRace.LastHurtTime = Time.time; - } - } - /// /// Sleepers. UpdateSleep picks the closest player itself, possibly a remote bat, so the counter /// goes up for the whole call and the bat test happens in the IsDebugFlying postfix, which only diff --git a/JotunnModStub/Aswid/AswidConfig.cs b/JotunnModStub/Aswid/AswidConfig.cs index 57bc11a..fa58ee2 100644 --- a/JotunnModStub/Aswid/AswidConfig.cs +++ b/JotunnModStub/Aswid/AswidConfig.cs @@ -107,7 +107,6 @@ namespace RacesOfValheim public static ConfigEntry BatMaxDuration; public static ConfigEntry BatDurationPerState; public static ConfigEntry BatCooldown; - public static ConfigEntry BatCombatLock; // ─── Vampiric Aura (passive, always active) ────────────────────────────── public static ConfigEntry AuraTickInterval; @@ -293,8 +292,6 @@ namespace RacesOfValheim new ConfigDescription("Seconds added to the max duration per progression state. Does nothing while the max duration is 0.", new AcceptableValueRange(0f, 600f))); BatCooldown = config.Bind(batform, "Cooldown", 0f, new ConfigDescription("Seconds after leaving bat form before you can take it again. 0 means none.", new AcceptableValueRange(0f, 3600f))); - BatCombatLock = config.Bind(batform, "Combat Lock", 2.5f, - new ConfigDescription("Seconds after you last lost health (a hit, or a tick of fire, poison or bleeding) before you can take bat form. Turning back from bat form is never blocked. 0 means none.", new AcceptableValueRange(0f, 30f))); const string aura = "Aswid - Vampiric Aura"; AuraTickInterval = config.Bind(aura, "Tick Interval", 0.25f, diff --git a/JotunnModStub/Aswid/AswidPatches.cs b/JotunnModStub/Aswid/AswidPatches.cs index b607ad9..b799936 100644 --- a/JotunnModStub/Aswid/AswidPatches.cs +++ b/JotunnModStub/Aswid/AswidPatches.cs @@ -931,30 +931,6 @@ 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 { diff --git a/JotunnModStub/Aswid/AswidRace.cs b/JotunnModStub/Aswid/AswidRace.cs index 8367a64..556d8d5 100644 --- a/JotunnModStub/Aswid/AswidRace.cs +++ b/JotunnModStub/Aswid/AswidRace.cs @@ -615,14 +615,6 @@ namespace RacesOfValheim return; } - // No escaping a fight by taking wing mid-blow: the form waits until the hits stop. - float hurtLeft = AswidConfig.BatCombatLock.Value - (Time.time - LastHurtTime); - if (hurtLeft > 0f) - { - Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_aswid_bat_combat_lock", Mathf.CeilToInt(hurtLeft))); - return; - } - float cooldownLeft = AswidConfig.BatCooldown.Value - (Time.time - lastBatEndTime); if (cooldownLeft > 0f) { @@ -637,10 +629,6 @@ namespace RacesOfValheim // fresh session never begins on cooldown. private float lastBatEndTime = -100000f; - // When the local player last lost health, for the bat's combat lock. Written by - // Aswid_BatCombatLock_Patch for every race; only the Aswid reads it. - public static float LastHurtTime = -100000f; - // The one bat or mist routine in flight, if any. Kept so ResetRace can stop it: a // TransformIntoBatRoutine left running through a reset finishes its 1.1s gesture and // turns a freshly reset Human into a bat. @@ -1191,7 +1179,6 @@ namespace RacesOfValheim int layerMask = LayerMask.GetMask("character", "character_net", "character_ghost"); var colliders = Physics.OverlapSphere(center, radius, layerMask); - bool hitCreature = false; foreach (var col in colliders) { @@ -1242,16 +1229,10 @@ namespace RacesOfValheim // kill). ApplyDamage() skipped all of that: it edited the local copy of a // character we usually do not own, and the owner overwrote it on the next sync. c.Damage(hd); - hitCreature = true; SpawnBloodVFX(c); } } - - // The aura scales with Blood Magic but called Damage directly, so it never paid - // the skill back. Passive and always on, so it earns what the Skadi's Frost Aura - // does: a tenth of a hit per second of draining, once per tick, not per victim. - if (hitCreature) FormMelee.RaiseSkill(Skills.SkillType.BloodMagic, 0.1f * AswidConfig.AuraTickInterval.Value); } catch (Exception ex) { diff --git a/JotunnModStub/ConfigSync.cs b/JotunnModStub/ConfigSync.cs index fbf16b6..fd0fa67 100644 --- a/JotunnModStub/ConfigSync.cs +++ b/JotunnModStub/ConfigSync.cs @@ -31,8 +31,6 @@ namespace RacesOfValheim "Aswid - Eyes", "Fenrir - Appearance", "Skeleton - Visuals", - // Food and stamina for a Skeleton who wants them: each only gives up an advantage. - "Skeleton - Mortal Habits", "Sverm - Dorsal Spines", "Sverm - Emberform", "Trol - Appearance", diff --git a/JotunnModStub/DebugConfig.cs b/JotunnModStub/DebugConfig.cs deleted file mode 100644 index ae763e0..0000000 --- a/JotunnModStub/DebugConfig.cs +++ /dev/null @@ -1,32 +0,0 @@ -using UnityEngine; -using BepInEx.Configuration; - -namespace RacesOfValheim -{ - /// - /// The mod-wide debug switches, in one "Debug" section rather than one per race. Bound last - /// from RacesOfValheim.Awake(), so Configuration Manager lists the section at the bottom. - /// - /// Every entry stays local (never synced from the server): ConfigSync leaves KeyboardShortcut - /// entries and any key containing "debug" alone, so keep "Debug" in the key names. - /// - public static class DebugConfig - { - public static ConfigEntry EnableDebugKey; - public static ConfigEntry DebugKey; - public static ConfigEntry LogFormHits; - - public static void Bind(ConfigFile config) - { - const string section = "Debug"; - EnableDebugKey = config.Bind(section, "Debug: Enable Debug Key", false, - new ConfigDescription("Turns on the debug key below. Leave it off unless you are sending a bug report.")); - DebugKey = config.Bind(section, "Debug Key", new KeyboardShortcut(KeyCode.F8), - new ConfigDescription("Toggles the melee reach readout (top left and log) and writes what the Alfar drones and the camera's target are doing to the log.")); - // Was "Fenrir - Debug" / "Debug: Log Form Hits" until v1.6.10. It covers the Skadi, - // Sverm and Trol forms too (FormMelee.LogHit), so it moved here. - LogFormHits = config.Bind(section, "Debug: Log Form Hits", false, - new ConfigDescription("Writes one log line per form claw, bite or swing: what was in reach, what it hit, and why anything was skipped. For bug reports about attacks that do no damage.")); - } - } -} diff --git a/JotunnModStub/Factions/FactionHostilityPatch.cs b/JotunnModStub/Factions/FactionHostilityPatch.cs index 2bc10ce..7fee617 100644 --- a/JotunnModStub/Factions/FactionHostilityPatch.cs +++ b/JotunnModStub/Factions/FactionHostilityPatch.cs @@ -54,17 +54,9 @@ namespace RacesOfValheim // // Skeleton_Hildir stays out deliberately, on the same rule that keeps GoblinKing and the // Hildir brothers out of the Black Forest set: a quest boss is not somebody's kin. - // - // Valheim 1.0 added a skeleton per region (the green swamp ones and the blue mountain ones - // players noticed first), each with a melee-only twin, and spawners place those instead - // of the plain Skeleton. Left out, they fought a Skeleton player the plain ones ignored. private static readonly HashSet PaludeMobs = new HashSet { "Ghost", "Skeleton", "Skeleton_NoArcher", "Skeleton_Poison", // Skeleton, Rancid remains - "Skeleton_Meadows", "Skeleton_Meadows_noarcher", - "Skeleton_Swamps", "Skeleton_Swamps_noarcher", - "Skeleton_Mountains", "Skeleton_Mountains_noarcher", - "Skeleton_DeepNorth", "Draugr", "Draugr_Elite", "Draugr_Ranged", "Wraith", "Leech", "Abomination", "Blob", "BlobElite", "BlobTar", // Blob, Oozer, Growth @@ -165,10 +157,6 @@ namespace RacesOfValheim if (!__result) return; // already not enemies, nothing to add if (a == null || b == null) return; - // The player's own blow. Peace is the creature's choice, not a shield. See - // RaceGrudge.StrikeScope. - if (RaceGrudge.PlayerStrikes(a)) return; - if (IsThrallTruce(a, b) || IsThrallTruce(b, a)) { __result = false; diff --git a/JotunnModStub/Factions/FactionMerchantCatalog.cs b/JotunnModStub/Factions/FactionMerchantCatalog.cs index 93a0b71..e4db2cb 100644 --- a/JotunnModStub/Factions/FactionMerchantCatalog.cs +++ b/JotunnModStub/Factions/FactionMerchantCatalog.cs @@ -337,16 +337,7 @@ namespace RacesOfValheim { "Draugr_Elite", DraugrShop }, { "Skeleton", SkeletonShop }, - { "Skeleton_NoArcher", SkeletonShop }, { "Skeleton_Poison", SkeletonShop }, - // Valheim 1.0's regional skeletons, the ones its spawners actually place. - { "Skeleton_Meadows", SkeletonShop }, - { "Skeleton_Meadows_noarcher", SkeletonShop }, - { "Skeleton_Swamps", SkeletonShop }, - { "Skeleton_Swamps_noarcher", SkeletonShop }, - { "Skeleton_Mountains", SkeletonShop }, - { "Skeleton_Mountains_noarcher", SkeletonShop }, - { "Skeleton_DeepNorth", SkeletonShop }, { "Ghost", GhostShop }, { "Wraith", WraithShop }, diff --git a/JotunnModStub/Factions/FactionsConfig.cs b/JotunnModStub/Factions/FactionsConfig.cs index 6535e12..2448192 100644 --- a/JotunnModStub/Factions/FactionsConfig.cs +++ b/JotunnModStub/Factions/FactionsConfig.cs @@ -21,8 +21,6 @@ namespace RacesOfValheim public static ConfigEntry HostilityEnabled; public static ConfigEntry MerchantsEnabled; public static ConfigEntry GrudgeDuration; - public static ConfigEntry GrudgeSpreadEnabled; - public static ConfigEntry GrudgeSpreadRadius; // Null-safe, defaulting to ON, for the same reason WarVultureConfig guards its own reads: // a patch that somehow runs before Bind() should behave like the shipped default rather @@ -30,8 +28,6 @@ namespace RacesOfValheim public static bool Hostility => HostilityEnabled?.Value ?? true; public static bool Merchants => MerchantsEnabled?.Value ?? true; public static float GrudgeSeconds => GrudgeDuration?.Value ?? 60f; - public static bool GrudgeSpreads => GrudgeSpreadEnabled?.Value ?? false; - public static float GrudgeSpreadMeters => GrudgeSpreadRadius?.Value ?? 20f; public static void Bind(ConfigFile config) { @@ -59,24 +55,11 @@ namespace RacesOfValheim "Without this the truce is absolute in both directions: MonsterAI.UpdateTarget " + "throws away any target BaseAI.IsEnemy calls a non-enemy, so a truced mob could " + "not fight back even after being struck - it stood still, or fled because it " + - "was hurt and had no enemy it was allowed to have. Each creature holds one " + - "grudge, against the last player who hit it, and keeps it when another player's " + - "game takes over running that creature. 0 restores the " + + "was hurt and had no enemy it was allowed to have. The grudge is per attacker " + + "and per creature, on whichever machine runs that creature's AI. 0 restores the " + "old absolute truce.", new AcceptableValueRange(0f, 600f))); - // Joacwoo's request: the truce made the swamp and the crypts a walk for a Skeleton, - // since only the one creature you hit ever fought back. - GrudgeSpreadEnabled = config.Bind(factions, "Grudge spreads to kin", false, - new ConfigDescription("Off: only the creature you hit fights back. On: hit a creature of your " + - "own faction and every creature of that faction near it turns on you too, " + - "for the same Faction grudge time, the way vanilla's Dvergr treat a human. " + - "Peace still holds until you strike first.")); - GrudgeSpreadRadius = config.Bind(factions, "Grudge spread radius", 20f, - new ConfigDescription("Meters around the creature you hit within which its kin join the fight, " + - "with Grudge spreads to kin on.", - new AcceptableValueRange(5f, 60f))); - MerchantsEnabled = config.Bind(factions, "Faction merchants", true, new ConfigDescription("Certain mobs of your own faction can be traded with - 'E - Talk' opens a shop " + "where you sell them what their kind wants. Turn this off and they are ordinary " + diff --git a/JotunnModStub/Fenrir/FenrirBehaviors.cs b/JotunnModStub/Fenrir/FenrirBehaviors.cs index d0dd0cd..b702a20 100644 --- a/JotunnModStub/Fenrir/FenrirBehaviors.cs +++ b/JotunnModStub/Fenrir/FenrirBehaviors.cs @@ -774,7 +774,6 @@ namespace RacesOfValheim Collider[] hits = Physics.OverlapSphere(attackPoint, attackRadius, layerMask); FormMelee.LogSwing(FormLabel, hits.Length); System.Collections.Generic.HashSet hitObjects = new System.Collections.Generic.HashSet(); - bool hitCreature = false; foreach (Collider hit in hits) { @@ -824,13 +823,10 @@ namespace RacesOfValheim FormMelee.LogHit(FormLabel, target, totalDamage); target.Damage(hitData); FormMelee.GrantAdrenaline(target); - if (target is Character) hitCreature = true; } } } } - - if (hitCreature) FormMelee.RaiseSkill(Skills.SkillType.Unarmed); } } @@ -1071,7 +1067,6 @@ namespace RacesOfValheim Collider[] hits = Physics.OverlapSphere(attackPoint, attackRadius, layerMask); FormMelee.LogSwing(FormLabel, hits.Length); System.Collections.Generic.HashSet hitObjects = new System.Collections.Generic.HashSet(); - bool hitCreature = false; foreach (Collider hit in hits) { @@ -1111,7 +1106,6 @@ namespace RacesOfValheim FormMelee.LogHit(FormLabel, target, totalDamage); target.Damage(hitData); FormMelee.GrantAdrenaline(target, 0.2f); // one 0.2s tick: a full hit per second of breath - if (target is Character) hitCreature = true; if (ZNetScene.instance != null) { @@ -1121,8 +1115,6 @@ namespace RacesOfValheim } } } - - if (hitCreature) FormMelee.RaiseSkill(Skills.SkillType.ElementalMagic, 0.2f); // one 0.2s tick: a full swing's worth per second of breath } private IEnumerator ClawRoutine() @@ -1239,7 +1231,6 @@ namespace RacesOfValheim Collider[] hits = Physics.OverlapSphere(attackPoint, attackRadius, layerMask); FormMelee.LogSwing(FormLabel, hits.Length); System.Collections.Generic.HashSet hitObjects = new System.Collections.Generic.HashSet(); - bool hitCreature = false; foreach (Collider hit in hits) { @@ -1289,13 +1280,10 @@ namespace RacesOfValheim FormMelee.LogHit(FormLabel, target, totalDamage); target.Damage(hitData); FormMelee.GrantAdrenaline(target); - if (target is Character) hitCreature = true; } } } } - - if (hitCreature) FormMelee.RaiseSkill(Skills.SkillType.Unarmed); } } @@ -1458,7 +1446,6 @@ namespace RacesOfValheim Collider[] hits = Physics.OverlapSphere(attackPoint, attackRadius, layerMask); FormMelee.LogSwing(FormLabel, hits.Length); System.Collections.Generic.HashSet hitObjects = new System.Collections.Generic.HashSet(); - bool hitCreature = false; foreach (Collider hit in hits) { @@ -1508,13 +1495,10 @@ namespace RacesOfValheim FormMelee.LogHit(FormLabel, target, totalDamage); target.Damage(hitData); FormMelee.GrantAdrenaline(target); - if (target is Character) hitCreature = true; } } } } - - if (hitCreature) FormMelee.RaiseSkill(Skills.SkillType.Unarmed); } } @@ -1670,7 +1654,6 @@ namespace RacesOfValheim Collider[] hits = Physics.OverlapSphere(attackPoint, attackRadius, layerMask); FormMelee.LogSwing(FormLabel, hits.Length); System.Collections.Generic.HashSet hitObjects = new System.Collections.Generic.HashSet(); - bool hitCreature = false; foreach (Collider hit in hits) { @@ -1720,13 +1703,10 @@ namespace RacesOfValheim FormMelee.LogHit(FormLabel, target, totalDamage); target.Damage(hitData); FormMelee.GrantAdrenaline(target); - if (target is Character) hitCreature = true; } } } } - - if (hitCreature) FormMelee.RaiseSkill(Skills.SkillType.Unarmed); } private IEnumerator UlvJumpAttackRoutine() diff --git a/JotunnModStub/Fenrir/FenrirConfig.cs b/JotunnModStub/Fenrir/FenrirConfig.cs index 2190a36..78a2c48 100644 --- a/JotunnModStub/Fenrir/FenrirConfig.cs +++ b/JotunnModStub/Fenrir/FenrirConfig.cs @@ -100,6 +100,9 @@ namespace RacesOfValheim public static ConfigEntry UlvAttackRadius; public static ConfigEntry UlvPushForce; + // ─── Debug ───────────────────────────────────────────────────────────── + public static ConfigEntry DebugFormHits; + // ─── Appearance (per player, never synced) ────────────────────────────── public static ConfigEntry ReadyMessage; public static ConfigEntry EyeGlow; @@ -265,6 +268,10 @@ namespace RacesOfValheim // Tried at 1.2 in game: the orange was too strong. 0.9 checked and kept. EyeReadyStrength = config.Bind(appearance, "Eye Ready Strength", 0.9f, new ConfigDescription("Glow at night while a form is ready.", new AcceptableValueRange(0f, 3f))); + + // "debug" in the key keeps it local - see ConfigSync. + DebugFormHits = config.Bind("Fenrir - Debug", "Debug: Log Form Hits", false, + new ConfigDescription("Writes one log line per claw or bite: what was in reach, what it hit, and why anything was skipped. For bug reports about attacks that do no damage.")); } /// diff --git a/JotunnModStub/Fenrir/FenrirFormShared.cs b/JotunnModStub/Fenrir/FenrirFormShared.cs index bcd9c27..a26c6ed 100644 --- a/JotunnModStub/Fenrir/FenrirFormShared.cs +++ b/JotunnModStub/Fenrir/FenrirFormShared.cs @@ -342,7 +342,7 @@ namespace RacesOfValheim /// public static void LogMiss(string form, Collider hit, string reason) { - if (!DebugConfig.LogFormHits.Value) return; + if (!FenrirConfig.DebugFormHits.Value) return; Jotunn.Logger.LogInfo($"[FenrirForm] {form} swing skipped '{hit.name}' (layer {LayerMask.LayerToName(hit.gameObject.layer)}): {reason}."); } @@ -368,21 +368,6 @@ namespace RacesOfValheim player.AddAdrenaline(perHit * character.m_enemyAdrenalineMultiplier * scale); } - /// - /// The skill experience vanilla gives for a weapon hit, which a hand-built hit never got. - /// Vanilla raises the skill inside Attack (once per swing that landed on a creature) and - /// inside Projectile.OnHit; Character.Damage never does, so a form that calls Damage - /// directly left its skill at whatever level the player brought in. Call it once per - /// swing or tick, after the loop, never once per target. amount lets a damage-over-time - /// tick pay a fraction of a swing. - /// - public static void RaiseSkill(Skills.SkillType skill, float amount = 1f) - { - Player player = Player.m_localPlayer; - if (player == null || amount <= 0f) return; - player.RaiseSkill(skill, amount); - } - /// /// Charges a form attack's stamina the way vanilla charges a weapon's (Attack.GetAttackStamina): /// the equipment modifier, status effects (meads, race passives), then up to a third off with @@ -413,37 +398,16 @@ namespace RacesOfValheim return true; } - private static readonly System.Collections.Generic.Dictionary weapons = - new System.Collections.Generic.Dictionary(); - - /// - /// A creature's own attack item (dragon_bite, SeekerBrute_ram...), read once and cached, - /// null if the game has none by that name. A hand-built swing skips Attack, and Attack is - /// where vanilla plays the item's m_triggerEffect and m_hitEffect, so a form that wants the - /// creature's real swing and impact sounds plays them from here. - /// - public static ItemDrop.ItemData.SharedData CreatureWeapon(string prefabName) - { - if (string.IsNullOrEmpty(prefabName)) return null; - if (weapons.TryGetValue(prefabName, out ItemDrop.ItemData.SharedData cached)) return cached; - - GameObject prefab = Jotunn.Managers.PrefabManager.Cache.GetPrefab(prefabName); - ItemDrop.ItemData.SharedData shared = prefab != null ? prefab.GetComponent()?.m_itemData?.m_shared : null; - if (shared == null) Jotunn.Logger.LogWarning($"[FormMelee] No attack item '{prefabName}'; that swing stays silent."); - weapons[prefabName] = shared; - return shared; - } - public static void LogHit(string form, IDestructible target, float damage) { - if (!DebugConfig.LogFormHits.Value) return; + if (!FenrirConfig.DebugFormHits.Value) return; string name = target is MonoBehaviour behaviour && behaviour != null ? behaviour.name : target.ToString(); Jotunn.Logger.LogInfo($"[FenrirForm] {form} swing hit '{name}' for {damage:0}."); } public static void LogSwing(string form, int candidates) { - if (!DebugConfig.LogFormHits.Value) return; + if (!FenrirConfig.DebugFormHits.Value) return; Jotunn.Logger.LogInfo($"[FenrirForm] {form} swing: {candidates} collider(s) in reach."); } } diff --git a/JotunnModStub/Package/manifest.json b/JotunnModStub/Package/manifest.json index a240b90..7bfb6ec 100644 --- a/JotunnModStub/Package/manifest.json +++ b/JotunnModStub/Package/manifest.json @@ -1,7 +1,7 @@ { "name": "RacesOfValheim", "description": "A Valheim mod that adds eleven custom playable races (Alfar, Aswid, Draugh, Dvergar, Fenrir, Furling, Skadi, Skeleton, Sverm, Trenta, Trol) each with unique abilities, traits, race stations and a deep boss-driven progression system.", - "version_number": "1.6.11", + "version_number": "1.6.7", "website_url": "", "dependencies": [ "denikson-BepInExPack_Valheim-5.4.2333", diff --git a/JotunnModStub/RaceCompendium.cs b/JotunnModStub/RaceCompendium.cs index 1505ac1..946311a 100644 --- a/JotunnModStub/RaceCompendium.cs +++ b/JotunnModStub/RaceCompendium.cs @@ -725,18 +725,7 @@ namespace RacesOfValheim sb.AppendLine((state <= BossProgressionManager.MinState ? ModText.Get("rov_compendium_skeleton_stand_at_first_eight_standings") : ModText.Get("rov_compendium_skeleton_stand_at_eight_standings_earned", state, BossProgressionManager.GetBossTokenForState(state)))); sb.AppendLine(ModText.Get("rov_compendium_skeleton_undead_diet")); - bool eats = SkeletonConfig.EatsMortalFood.Value, tires = SkeletonConfig.FeelsFatigue.Value; - if (!eats && !tires) - { - sb.AppendLine(ModText.Get("rov_compendium_skeleton_no_hunger_moves_no_meal", (health).ToString("0"))); - } - else - { - // A player who picked one of the "Mortal Habits" reads what they actually have. - string diet = eats ? ModText.Get("rov_compendium_skeleton_diet_mortal") : ModText.Get("rov_compendium_skeleton_diet_bones", (health).ToString("0")); - string effort = tires ? ModText.Get("rov_compendium_skeleton_effort_mortal") : ModText.Get("rov_compendium_skeleton_effort_none"); - sb.AppendLine(diet + " " + effort + "\n"); - } + sb.AppendLine(ModText.Get("rov_compendium_skeleton_no_hunger_moves_no_meal", (health).ToString("0"))); sb.AppendLine(ModText.Get("rov_compendium_skeleton_bones_blades")); sb.AppendLine(ModText.Get("rov_compendium_skeleton_blades_points_find_little_cut")); @@ -874,8 +863,8 @@ namespace RacesOfValheim int foodDuration = Mathf.RoundToInt(TrentaConfig.FoodDurationMultiplier); int purpleRainRadius = Mathf.RoundToInt(TrentaConfig.PurpleRainRadius); - int purpleRainHeal = Mathf.RoundToInt(TrentaConfig.PurpleRainHealFor(Player.m_localPlayer)); - int purpleRainPoison = Mathf.RoundToInt(TrentaConfig.PurpleRainPoisonFor(Player.m_localPlayer)); + int purpleRainHeal = Mathf.RoundToInt(TrentaConfig.PurpleRainHealAmount); + int purpleRainPoison = Mathf.RoundToInt(TrentaConfig.PurpleRainPoisonDamage); int purpleRainCooldown = Mathf.RoundToInt(TrentaConfigManagement.PurpleRainCooldown.Value); int purpleRainMuspellCooldown = Mathf.RoundToInt(TrentaConfigManagement.MuspellPurpleRainCooldown.Value); diff --git a/JotunnModStub/RaceGrudge.cs b/JotunnModStub/RaceGrudge.cs index 09bb834..927f4b5 100644 --- a/JotunnModStub/RaceGrudge.cs +++ b/JotunnModStub/RaceGrudge.cs @@ -25,13 +25,11 @@ namespace RacesOfValheim /// which means everything downstream - acquiring, chasing, retaliating, giving up - is vanilla /// behaviour rather than anything reimplemented here. /// - /// WHERE IT LIVES. On the creature's own ZDO: who it is angry at and until when, in network time. - /// The AI that reads it runs on whichever machine owns the creature, and that can change in the - /// middle of a fight (the owner walks off or logs out). A grudge kept in one machine's memory - /// went with it, and the new owner's copy of the creature made peace on its next UpdateTarget. - /// On the ZDO the new owner reads the same grudge. Only the owner writes it: a hit reaches the - /// owner through Character.Damage's RPC anyway, and kin owned elsewhere are told by an RPC of - /// our own (RpcName), so no client writes a ZDO it does not own. + /// WHERE IT RUNS. On the client that owns the mob's AI, which is the only one whose UpdateTarget + /// matters and the only one that runs Character.ApplyDamage for it. BaseAI.OnDamaged is reached + /// through the character's damage callback on exactly that machine, so the record is made where + /// it will be read. Nothing is replicated and nothing needs to be: another client's copy of the + /// same mob is not the one deciding who it chases. /// /// Vanilla has its own version of this idea in BaseAI.SetAggravated, and it is not usable here: /// it does nothing unless the prefab sets m_aggravatable, which only the dvergr and the seekers @@ -39,96 +37,67 @@ namespace RacesOfValheim /// public static class RaceGrudge { - private const string RpcName = "RacesOfValheim_Grudge"; + private struct Grudge + { + public ZDOID Attacker; + public float Until; + } - // One grudge per creature, against the last player that hit it. A creature can only chase - // one target anyway, and if two players of the same race are both poking it, the one it - // wants is whoever hit it last. - private static readonly KeyValuePair AttackerKey = ZDO.GetHashZDOID("RacesOfValheim_GrudgeAttacker"); - private static readonly int UntilKey = "RacesOfValheim_GrudgeUntil".GetStableHashCode(); + // One grudge per mob, against the last thing that hit it. A creature can only chase one + // target anyway, and if two players of the same race are both poking it, the one it wants + // is whoever hit it last. + private static readonly Dictionary grudges = new Dictionary(); + private static float lastSweep = 0f; private static float Duration => FactionsConfig.GrudgeSeconds; - // Network time, the same on every machine, so an end time written by one owner means the - // same thing to the next. Milliseconds in a long: ZDO has no double. - private static long NowMs => ZNet.instance != null ? (long)(ZNet.instance.GetTimeSeconds() * 1000.0) : 0L; - - private static ZDO ZdoOf(Character character) - { - if (character == null || ZDOMan.instance == null) return null; - ZDOID id = character.GetZDOID(); - return id.IsNone() ? null : ZDOMan.instance.GetZDO(id); - } - /// /// True while is owed a hit by . Both - /// truce postfixes ask this first and leave IsEnemy alone when it answers yes. Read on any - /// machine; it only matters on the owner's. + /// truce postfixes ask this first and leave IsEnemy alone when it answers yes. /// public static bool Holds(Character monster, Character player) { if (monster == null || player == null) return false; if (Duration <= 0f) return false; - ZDO zdo = ZdoOf(monster); - if (zdo == null) return false; + if (!grudges.TryGetValue(monster.GetZDOID(), out Grudge grudge)) return false; + if (Time.time >= grudge.Until) return false; - long until = zdo.GetLong(UntilKey, 0L); - if (until == 0L || NowMs >= until) return false; + return grudge.Attacker == player.GetZDOID(); + } - return zdo.GetZDOID(AttackerKey) == player.GetZDOID(); + public static void Remember(Character monster, Character attacker) + { + if (monster == null || attacker == null) return; + if (Duration <= 0f) return; + + grudges[monster.GetZDOID()] = new Grudge + { + Attacker = attacker.GetZDOID(), + Until = Time.time + Duration + }; + + Sweep(); } /// - /// Writes the grudge on the creature's ZDO if this machine owns it, and otherwise asks the - /// owner to. Returns true when it was written here. + /// Drops grudges nobody is owed any more. At most once per duration: a fight is a burst of + /// damage events and the list should not be walked on each one. /// - public static bool Remember(Character monster, Character attacker) + private static void Sweep() { - if (monster == null || attacker == null) return false; - if (Duration <= 0f) return false; + if (Time.time - lastSweep < Duration) return; + lastSweep = Time.time; - ZNetView nview = monster.GetComponent(); - if (nview == null || !nview.IsValid()) return false; - - if (!nview.IsOwner()) + List expired = null; + foreach (var entry in grudges) { - nview.InvokeRPC(RpcName, attacker.GetZDOID()); - return false; - } - - Write(nview.GetZDO(), attacker.GetZDOID()); - return true; - } - - private static void Write(ZDO zdo, ZDOID attacker) - { - zdo.Set(AttackerKey, attacker); - zdo.Set(UntilKey, NowMs + (long)(Duration * 1000f)); - } - - /// - /// Every creature can be told about a grudge by a machine that does not own it. ZNetView's - /// InvokeRPC routes to the owner, so the handler always runs where the ZDO may be written, - /// and the owner checks it is still the owner: ownership can move while the RPC travels. - /// - [HarmonyPatch(typeof(Character), "Awake")] - public static class Character_Awake_GrudgeRpc_Patch - { - public static void Postfix(Character __instance) - { - if (__instance.IsPlayer()) return; - ZNetView nview = __instance.GetComponent(); - if (nview == null || !nview.IsValid()) return; - - nview.Register(RpcName, (sender, attacker) => - { - if (__instance == null || !nview.IsValid() || !nview.IsOwner()) return; - if (attacker.IsNone() || Duration <= 0f) return; - Write(nview.GetZDO(), attacker); - __instance.GetBaseAI()?.Alert(); - }); + if (Time.time < entry.Value.Until) continue; + if (expired == null) expired = new List(); + expired.Add(entry.Key); } + if (expired == null) return; + foreach (ZDOID id in expired) grudges.Remove(id); } /// @@ -152,81 +121,6 @@ namespace RacesOfValheim if (monster == null || monster.IsPlayer()) return; Remember(monster, attacker); - if (FactionsConfig.GrudgeSpreads && attacker is Player player) SpreadToKin(monster, player); - } - } - - // How deep we are inside one of vanilla's hit filters (see StrikeScope). A counter rather - // than a bool because Projectile.OnHit calls DoAOE, and the inner exit must not end the - // outer scope. - private static int strikeDepth = 0; - - /// - /// True while vanilla is deciding whether 's own weapon, arrow or - /// area hit lands. Both truce postfixes stand down for that question: the truce is about - /// who a creature attacks, never about whether the player is allowed to strike it. - /// - public static bool PlayerStrikes(Character attacker) - { - return strikeDepth > 0 && attacker != null && attacker.IsPlayer(); - } - - /// - /// THE PLAYER COULD NOT HIT THEIR OWN FACTION AT ALL. Valheim 1.0's hit filters (Attack's - /// melee and area swings, Projectile's direct hit, its AoE and its IsValidTarget, Aoe's - /// ShouldHit) ask BaseAI.IsEnemy(attacker, target) and skip the target when it answers false - /// and the attacker is a player without PvP on - vanilla's guard for tames. Our truce - /// answers false for every allied creature, so the blow passed through it, it took no - /// damage, BaseAI.OnDamaged never ran and no grudge was ever born. That is both reports at - /// once: "it will not allow me" to attack, and kin that never fight back, group grudge on or - /// off, because nobody was ever hit. With PvP on the filter let the hit through, which is - /// why it looked fine in some tests. - /// - /// The scope is open only around those six methods, so everything else that asks IsEnemy - /// with the player first keeps the truce: the green health bar on allied creatures, sneaking - /// past them, the Aswid's aura leaving kin alone. - /// - [HarmonyPatch] - public static class StrikeScope - { - public static IEnumerable TargetMethods() - { - yield return AccessTools.Method(typeof(Attack), "DoMeleeAttack"); - yield return AccessTools.Method(typeof(Attack), "DoAreaAttack"); - yield return AccessTools.Method(typeof(Projectile), "DoAOE"); - yield return AccessTools.Method(typeof(Projectile), "IsValidTarget"); - yield return AccessTools.Method(typeof(Projectile), "OnHit"); - yield return AccessTools.Method(typeof(Aoe), "ShouldHit"); - } - - public static void Prefix() => strikeDepth++; - - // Finalizer rather than Postfix: the count has to come down even when the method - // throws, or every IsEnemy afterwards would ignore the truce. - public static void Finalizer() => strikeDepth--; - } - - /// - /// Vanilla's Dvergr camp, for every faction ("Grudge spreads to kin", off by default): hit - /// a creature that is at peace with you and its kin around it take up the same grudge. - /// - /// Kin this machine owns are written here; kin owned by another player's machine are told - /// through RpcName, and their owner writes the grudge and alerts them. - /// - private static void SpreadToKin(Character monster, Player player) - { - string race = FactionHostilityPatch.GetPlayerRace(player); - if (!FactionHostilityPatch.IsAlliedMob(race, monster.gameObject.name)) return; - - Vector3 center = monster.transform.position; - float radius = FactionsConfig.GrudgeSpreadMeters; - foreach (Character other in Character.GetAllCharacters()) - { - if (other == null || other == monster || other.IsPlayer() || other.IsDead() || other.IsTamed()) continue; - if (Vector3.Distance(other.transform.position, center) > radius) continue; - if (!FactionHostilityPatch.IsAlliedMob(race, other.gameObject.name)) continue; - - if (Remember(other, player)) other.GetBaseAI()?.Alert(); } } } diff --git a/JotunnModStub/RaceHostilityManager.cs b/JotunnModStub/RaceHostilityManager.cs index 13ed8ed..03f9fa4 100644 --- a/JotunnModStub/RaceHostilityManager.cs +++ b/JotunnModStub/RaceHostilityManager.cs @@ -22,9 +22,6 @@ namespace RacesOfValheim if (a == null || b == null) return; - // The player's own blow lands on kin too. See RaceGrudge.StrikeScope. - if (RaceGrudge.PlayerStrikes(a)) return; - Character playerCharacter = a.IsPlayer() ? a : (b.IsPlayer() ? b : null); Character monster = a.IsPlayer() ? b : (b.IsPlayer() ? a : null); diff --git a/JotunnModStub/RaceMeleeReach.cs b/JotunnModStub/RaceMeleeReach.cs index 4bb0331..052a2ff 100644 --- a/JotunnModStub/RaceMeleeReach.cs +++ b/JotunnModStub/RaceMeleeReach.cs @@ -115,14 +115,13 @@ namespace RacesOfValheim } } - /// The debug key (DebugConfig, F8 by default) turns the reach readout on and off. + /// F8 turns the reach readout on and off. [HarmonyPatch(typeof(Player), "Update")] internal static class RaceMeleeReachDebugKey { private static void Postfix(Player __instance) { - if (__instance != Player.m_localPlayer || !DebugConfig.EnableDebugKey.Value) return; - if (!DebugConfig.DebugKey.Value.IsDownIgnoringHeldKeys()) return; + if (__instance != Player.m_localPlayer || !Input.GetKeyDown(KeyCode.F8)) return; RaceMeleeReach.DebugOn = !RaceMeleeReach.DebugOn; __instance.Message(MessageHud.MessageType.TopLeft, $"[RoV reach] debug {(RaceMeleeReach.DebugOn ? "on" : "off")}"); AlfarMiner.DebugReport(__instance); diff --git a/JotunnModStub/RacesOfValheim.cs b/JotunnModStub/RacesOfValheim.cs index 6172ff6..7d181c8 100644 --- a/JotunnModStub/RacesOfValheim.cs +++ b/JotunnModStub/RacesOfValheim.cs @@ -16,7 +16,7 @@ namespace RacesOfValheim { public const string PluginGUID = "com.nandor.racesofvalheim"; public const string PluginName = "Races Of Valheim"; - public const string PluginVersion = "1.6.11"; + public const string PluginVersion = "1.6.7"; private readonly Harmony harmony = new Harmony(PluginGUID); @@ -57,8 +57,6 @@ namespace RacesOfValheim // Not a race either: the faction truce and the faction merchants, which cut across // every race at once, so they bind last rather than inside the alphabetical run above. FactionsConfig.Bind(Config); - // The mod-wide debug switches, at the bottom of the list on purpose. - DebugConfig.Bind(Config); // After every Bind above: tags the gameplay entries for Jotunn's server-to-client sync. ConfigSync.Apply(Config); harmony.PatchAll(); diff --git a/JotunnModStub/Skadi/DrakeFormBehavior.cs b/JotunnModStub/Skadi/DrakeFormBehavior.cs index b76674f..eeed348 100644 --- a/JotunnModStub/Skadi/DrakeFormBehavior.cs +++ b/JotunnModStub/Skadi/DrakeFormBehavior.cs @@ -311,29 +311,6 @@ namespace RacesOfValheim return true; } - /// - /// How many hit events the form's clips have sent: the dragon's own "Hit" event, which - /// CharacterAnimEvent hands to the player's OnAttackTrigger and SkadiBlockAttackTriggerPatch - /// counts here instead of letting it through. FenrirForms.AttackEvents, the same idea. - /// - public static int AttackEvents { get; private set; } - - public static void NotifyAttackTrigger() => AttackEvents++; - - // Longest a melee waits for its Hit event before landing anyway, from the trigger. The - // slowest blow is the Moder's claw at 2.0 s of 3.75 s; a clip that never sends one must - // not leave the swing hitting nothing. - private const float HitEventTimeout = 3f; - - /// - /// Waits for the clip's own blow. A fixed 0.5 s used to land every melee early, read off the - /// game's clips: Moder bite 0.60 s and claws 2.0 s, Fader bite 1.27 s, claws 1.24 s, spin 1.30 s. - /// - private IEnumerator WaitForHit(int baseline, float started) - { - while (AttackEvents == baseline && Time.time - started < HitEventTimeout) yield return null; - } - private IEnumerator PerformAttackCoroutine(int button) { lastAttackTime = Time.time; @@ -432,18 +409,13 @@ namespace RacesOfValheim breathingUntil = Time.time + projDelay + projCount * 0.05f + 0.5f; } - int hitBaseline = AttackEvents; - float triggeredAt = Time.time; SetAttackTrigger(attackTrigger); + yield return new WaitForSeconds(projDelay); + if (isMelee) { - yield return WaitForHit(hitBaseline, triggeredAt); - ExecuteMeleeDamage(MODER_MELEE_DAMAGE, MELEE_RADIUS, MeleeWeapon(attackTrigger)); - } - else - { - yield return new WaitForSeconds(projDelay); + ExecuteMeleeDamage(MODER_MELEE_DAMAGE, MELEE_RADIUS); } if (!isMelee && projName != null) @@ -543,18 +515,13 @@ namespace RacesOfValheim breathingUntil = Time.time + projDelay + projCount * 0.05f + 0.5f; } - int hitBaseline = AttackEvents; - float triggeredAt = Time.time; SetAttackTrigger(attackTrigger); + yield return new WaitForSeconds(projDelay); + if (isMelee) { - yield return WaitForHit(hitBaseline, triggeredAt); - ExecuteMeleeDamage(meleeDamage, meleeRadius, MeleeWeapon(attackTrigger)); - } - else - { - yield return new WaitForSeconds(projDelay); + ExecuteMeleeDamage(meleeDamage, meleeRadius); } if (!isMelee && projName != null) @@ -616,28 +583,7 @@ namespace RacesOfValheim // The dragon forms never go through Humanoid.StartAttack - SkadiAttackPatch blocks it, and // they carry no weapon - so the bite, claw and spin animations landed no damage at all and // simply burned eitr. Sweep for targets the way FenrirBehaviors does for its claws. - private string FormLabel => formRules != null ? formRules.Form.ToString() : "Skadi form"; - - /// - /// The real creature's attack item behind each melee trigger, for its impact sound. The - /// Fader's spin has no item of its own in the game's manifest, so it borrows the claw's. - /// - private string MeleeWeapon(string trigger) - { - bool fader = formRules != null && formRules.Form == SkadiProgression.FormType.SkeletonDragon; - switch (trigger) - { - case "attack_bite": return fader ? "Fader_Bite" : "dragon_bite"; - case "attack_claw_left": return "dragon_claw_left"; - case "attack_claw_right": return "dragon_claw_right"; - case "attack_ClawL": return "Fader_Claw_Left"; - case "attack_ClawR": return "Fader_Claw_Right"; - case "attack_Spin": return "Fader_Claw_Left"; - default: return null; - } - } - - private void ExecuteMeleeDamage(float baseDamage, float radius, string weapon) + private void ExecuteMeleeDamage(float baseDamage, float radius) { if (Player.m_localPlayer == null) return; @@ -652,10 +598,7 @@ namespace RacesOfValheim int layerMask = LayerMask.GetMask("Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "character", "character_net", "character_ghost", "hitbox", "character_noenv", "vehicle"); Collider[] hits = Physics.OverlapSphere(attackPoint, radius, layerMask); - FormMelee.LogSwing(FormLabel, hits.Length); - ItemDrop.ItemData.SharedData shared = FormMelee.CreatureWeapon(weapon); System.Collections.Generic.HashSet hitObjects = new System.Collections.Generic.HashSet(); - bool hitCreature = false; foreach (Collider hit in hits) { @@ -669,29 +612,18 @@ namespace RacesOfValheim if (characterTarget != null && characterTarget == Player.m_localPlayer) continue; GameObject targetObj = (target as MonoBehaviour)?.gameObject; - // Marked only once it is hit, further down: marking it here let the first collider - // found (a limb outside the arc) rule out a body squarely in the swing. - if (targetObj != null && hitObjects.Contains(targetObj)) continue; + if (targetObj != null) + { + if (hitObjects.Contains(targetObj)) continue; + hitObjects.Add(targetObj); + } Vector3 targetCenter = hit.bounds.center; Vector3 dirToTarget = (targetCenter - playerPos).normalized; - float angle = Vector3.Angle(forward, dirToTarget); - if (!fullCircle && angle >= 70f) - { - FormMelee.LogMiss(FormLabel, hit, $"outside the swing arc ({angle:0} deg)"); - continue; - } + if (!fullCircle && Vector3.Angle(forward, dirToTarget) >= 70f) continue; - // FormMelee.CanReach, not a bare Linecast. The Linecast tested the piece layer and - // counted the target's own collider as cover, so anything living on that layer - // could never be hit: the T.W.I.G. training dummy is a Humanoid whose only collider - // is on "piece". Wildlife sits on "character" and was never affected. Vector3 eyePos = playerPos + Vector3.up * 1.5f; - if (!FormMelee.CanReach(eyePos, attackPoint, hit, target, out string cover)) - { - FormMelee.LogMiss(FormLabel, hit, "no clear line, blocked by '" + cover + "'"); - continue; - } + if (Physics.Linecast(eyePos, targetCenter, out RaycastHit rayHit, LayerMask.GetMask("Default", "static_solid", "terrain", "piece"))) continue; HitData hitData = new HitData(); // Frost-flavoured maul; SkadiDamagePatch tops this up with the per-tier frost bonus. @@ -707,15 +639,9 @@ namespace RacesOfValheim hitData.m_toolTier = 0; hitData.SetAttacker(Player.m_localPlayer); - if (targetObj != null) hitObjects.Add(targetObj); - FormMelee.LogHit(FormLabel, target, totalDamage); target.Damage(hitData); FormMelee.GrantAdrenaline(target); - shared?.m_hitEffect.Create(targetCenter, Quaternion.identity); - if (characterTarget != null) hitCreature = true; } - - if (hitCreature) FormMelee.RaiseSkill(Skills.SkillType.Unarmed); } private void OnDestroy() diff --git a/JotunnModStub/Skadi/SkadiPatches.cs b/JotunnModStub/Skadi/SkadiPatches.cs index b7560c2..94b1c56 100644 --- a/JotunnModStub/Skadi/SkadiPatches.cs +++ b/JotunnModStub/Skadi/SkadiPatches.cs @@ -408,11 +408,7 @@ namespace RacesOfValheim public static bool Prefix(Humanoid __instance) { if (__instance != Player.m_localPlayer) return true; - if (__instance.GetComponentInChildren() == null) return true; - - // The dragon's own clip calling its blow: the hit cue for the form's melee. - DrakeFormBehavior.NotifyAttackTrigger(); - return false; + return __instance.GetComponentInChildren() == null; } } } diff --git a/JotunnModStub/Skeleton/SkeletonConfig.cs b/JotunnModStub/Skeleton/SkeletonConfig.cs index ba66608..dd3935d 100644 --- a/JotunnModStub/Skeleton/SkeletonConfig.cs +++ b/JotunnModStub/Skeleton/SkeletonConfig.cs @@ -49,10 +49,6 @@ namespace RacesOfValheim public static ConfigEntry RaiseDeadIcon; public static ConfigEntry ShowHelmet; - // ─── Mortal Habits (per player) ──────────────────────────────────────── - public static ConfigEntry EatsMortalFood; - public static ConfigEntry FeelsFatigue; - public static void Bind(ConfigFile config) { const string combat = "Skeleton - Passive Combat"; @@ -92,16 +88,6 @@ namespace RacesOfValheim RaiseDeadIcon = config.Bind(visuals, "Raise the Dead Icon", true, new ConfigDescription("Shows the Raise the Dead status icon while your Summon on Kill is on.")); ShowHelmet = config.Bind(visuals, "Show Helmet", false, - new ConfigDescription("Off: your helmet stays hidden over the skull. On: the helmet you wear shows. Helmets and hoods are moved and enlarged to fit the skull. Your own choice: other players see you the way you picked. A viking body (Body Model Enabled off) always shows its helmet.")); - - // For groups who want the Skeleton but miss Valheim's food or stamina. Both only take - // away an advantage (permanent best-tier food, infinite stamina), so each player picks - // for themselves and the server does not sync them. - const string habits = "Skeleton - Mortal Habits"; - EatsMortalFood = config.Bind(habits, "Eats Mortal Food", false, - new ConfigDescription("Off: you never eat, and your Maximum Health comes from your standing (the bosses you have defeated). On: you eat like the living, your health and stamina come from your meals, and the standing's health bonus is gone. Your other Skeleton powers stay. Your own choice, not synced by the server.")); - FeelsFatigue = config.Bind(habits, "Feels Fatigue", false, - new ConfigDescription("Off: you have no stamina and never tire. On: you spend stamina like the living. Without Eats Mortal Food your stamina grows with your standing, from the same meals your health is measured by. Your own choice, not synced by the server.")); - } + new ConfigDescription("Off: your helmet stays hidden over the skull. On: the helmet you wear shows. Helmets and hoods are moved and enlarged to fit the skull. Your own choice: other players see you the way you picked. A viking body (Body Model Enabled off) always shows its helmet.")); } } } diff --git a/JotunnModStub/Skeleton/SkeletonPatches.cs b/JotunnModStub/Skeleton/SkeletonPatches.cs index e5c95f7..9121e17 100644 --- a/JotunnModStub/Skeleton/SkeletonPatches.cs +++ b/JotunnModStub/Skeleton/SkeletonPatches.cs @@ -44,26 +44,16 @@ namespace RacesOfValheim /// GetTotalFoodValue has exactly one caller, Player.UpdateFood, which passes the result /// straight to SetMaxHealth - so this is the single point where the number is decided, and /// it now comes from the progression table rather than from three scaled sausages. - /// - /// A Skeleton with "Eats Mortal Food" is left to vanilla: its real meals decide both - /// numbers, and the tier's health, which stands in for those meals, does not stack on top. - /// One with "Feels Fatigue" who does not eat gets the stand-in meals' stamina, which the - /// fake foods themselves never deliver. /// [HarmonyPatch(typeof(Player), "GetTotalFoodValue")] public static class Player_GetTotalFoodValue_SkeletonHealth_Patch { - public static void Postfix(Player __instance, ref float hp, ref float stamina) + public static void Postfix(Player __instance, ref float hp) { if (__instance != Player.m_localPlayer || !SkeletonRace.IsSkeleton()) return; - if (SkeletonConfig.EatsMortalFood.Value) return; int state = BossProgressionManager.GetCurrentProgressionState(); hp = __instance.m_baseHP + SkeletonProgression.GetMaxHealthBonus(state); - if (SkeletonConfig.FeelsFatigue.Value) - { - stamina = __instance.m_baseStamina + SkeletonRace.GetStandInStamina(state); - } } } @@ -73,7 +63,7 @@ namespace RacesOfValheim public static bool Prefix(Player __instance) { // The Aswid used to be on this list. It spends stamina now, see Aswid_UseStamina_Patch. - if (((SkeletonRace.IsSkeleton() && !SkeletonConfig.FeelsFatigue.Value) || DraughRace.IsDraugh()) && __instance == Player.m_localPlayer) + if ((SkeletonRace.IsSkeleton() || DraughRace.IsDraugh()) && __instance == Player.m_localPlayer) { // Infinite stamina: skip the original UseStamina method return false; @@ -89,7 +79,7 @@ namespace RacesOfValheim { if (__instance == Player.m_localPlayer) { - if (SkeletonRace.IsSkeleton() && !SkeletonConfig.EatsMortalFood.Value && item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Consumable && (item.m_shared.m_food > 0 || item.m_shared.m_foodStamina > 0 || item.m_shared.m_foodEitr > 0)) + if (SkeletonRace.IsSkeleton() && item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Consumable && (item.m_shared.m_food > 0 || item.m_shared.m_foodStamina > 0 || item.m_shared.m_foodEitr > 0)) { __instance.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_skeleton_skeletons_do_not_need_eat")); __result = false; @@ -204,7 +194,7 @@ namespace RacesOfValheim { try { - if (player == Player.m_localPlayer && SkeletonRace.IsSkeleton() && !SkeletonConfig.EatsMortalFood.Value) + if (player == Player.m_localPlayer && SkeletonRace.IsSkeleton()) { if (__instance.m_foodBarRoot != null && __instance.m_foodBarRoot.gameObject.activeSelf) { @@ -243,7 +233,7 @@ namespace RacesOfValheim } catch (System.Exception e) { - if (player == Player.m_localPlayer && SkeletonRace.IsSkeleton() && !SkeletonConfig.EatsMortalFood.Value) return false; + if (player == Player.m_localPlayer && SkeletonRace.IsSkeleton()) return false; return true; } } @@ -872,10 +862,6 @@ namespace RacesOfValheim if (name == "skeleton" || name == "skeleton_noarcher" || name == "skeleton_poison" || - name == "skeleton_meadows" || name == "skeleton_meadows_noarcher" || - name == "skeleton_swamps" || name == "skeleton_swamps_noarcher" || - name == "skeleton_mountains" || name == "skeleton_mountains_noarcher" || - name == "skeleton_deepnorth" || name == "skeleton_friendly" || name.StartsWith("draugr") || name == "ghost" || diff --git a/JotunnModStub/Skeleton/SkeletonRace.cs b/JotunnModStub/Skeleton/SkeletonRace.cs index 47b359e..479af4e 100644 --- a/JotunnModStub/Skeleton/SkeletonRace.cs +++ b/JotunnModStub/Skeleton/SkeletonRace.cs @@ -125,22 +125,6 @@ namespace RacesOfValheim Player.m_localPlayer.m_customData["Race"] == "Skeleton"; } - /// - /// Stamina from the tier's stand-in meals, for a Skeleton who feels fatigue but does not - /// eat. The fake foods cannot supply it: they are kept at m_time 0, so UpdateFood scales - /// their stamina to nothing on every tick. - /// - public static float GetStandInStamina(int state) - { - var foods = GetBestRealFoods(state); - float stamina = 0f; - if (foods != null) - { - foreach (var f in foods) stamina += f.m_shared.m_foodStamina; - } - return stamina; - } - private static readonly int StatsEffectHash = "SE_SkeletonStats".GetStableHashCode(); private float lastAuraTime = 0f; @@ -153,7 +137,7 @@ namespace RacesOfValheim private static List[] cachedRealFoods = new List[9]; - private static List GetBestRealFoods(int state) + private List GetBestRealFoods(int state) { if (state < 1) state = 1; if (state > 8) state = 8; @@ -252,6 +236,97 @@ namespace RacesOfValheim return bestCombo; } + private void DumpTransformHierarchy(Transform t, string indent) + { + if (t == null) return; + Jotunn.Logger.LogInfo(indent + t.name + " (Active: " + t.gameObject.activeSelf + ")"); + for(int i = 0; i < t.childCount; i++) + { + DumpTransformHierarchy(t.GetChild(i), indent + " "); + } + } + + /// + /// F8 debug: fires a ray from the camera and logs whatever it hits. Cosmetic pieces + /// (hair, beard, helmet) carry no collider, so this mostly confirms terrain/creature hits + /// - LogHeadCosmeticsState below is what actually answers "what is that floating chunk." + /// Kept anyway because it is the general-purpose "what am I looking at" tool for any other + /// bone or prefab placement question that comes up later. + /// + private void LogRaycastHit() + { + Camera cam = Camera.main; + if (cam == null) + { + Jotunn.Logger.LogInfo("[F8] No camera found for raycast."); + return; + } + + Ray ray = new Ray(cam.transform.position, cam.transform.forward); + if (Physics.Raycast(ray, out RaycastHit hit, 50f)) + { + Jotunn.Logger.LogInfo("--- F8 RAYCAST HIT ---"); + Jotunn.Logger.LogInfo($"Collider: '{hit.collider.gameObject.name}' at {hit.point:F2}, distance={hit.distance:F2}"); + Jotunn.Logger.LogInfo($"Full path: {GetFullPath(hit.collider.transform)}"); + Renderer renderer = hit.collider.GetComponentInParent(); + if (renderer != null) + { + Jotunn.Logger.LogInfo($"Nearest renderer: '{renderer.gameObject.name}' ({renderer.GetType().Name}), enabled={renderer.enabled}, scale={renderer.transform.lossyScale:F3}"); + } + Jotunn.Logger.LogInfo("----------------------"); + } + else + { + Jotunn.Logger.LogInfo("[F8] Raycast hit nothing within 50m (cosmetic pieces usually have no collider anyway)."); + } + } + + private static string GetFullPath(Transform t) + { + string path = t.name; + for (Transform parent = t.parent; parent != null; parent = parent.parent) + { + path = parent.name + "/" + path; + } + return path; + } + + /// + /// F8 debug: dumps the exact state of the three item slots this race hides (hair, beard, + /// helmet) - active flag, renderer enabled flag and scale for every renderer underneath. + /// This is the direct answer to "what is still visible and why": a chunk that survives + /// hiding will show up here as active=true, or as a renderer with enabled=true even while + /// its wrapper is scaled to zero (the skinned-mesh case scale alone cannot hide). + /// + private void LogHeadCosmeticsState() + { + if (Player.m_localPlayer == null) return; + VisEquipment vis = Player.m_localPlayer.GetComponent(); + if (vis == null) return; + + Jotunn.Logger.LogInfo("--- F8 SKELETON HEAD COSMETICS ---"); + DumpItemInstanceField(vis, "m_hairItemInstance"); + DumpItemInstanceField(vis, "m_beardItemInstance"); + DumpItemInstanceField(vis, "m_helmetItemInstance"); + Jotunn.Logger.LogInfo("----------------------------------"); + } + + private static void DumpItemInstanceField(VisEquipment vis, string fieldName) + { + GameObject go = HarmonyLib.Traverse.Create(vis).Field(fieldName).Value; + if (go == null) + { + Jotunn.Logger.LogInfo($"[F8] {fieldName}: null (nothing equipped/instantiated)."); + return; + } + + Jotunn.Logger.LogInfo($"[F8] {fieldName}: '{go.name}' active={go.activeSelf} scale={go.transform.localScale:F3}"); + foreach (Renderer r in go.GetComponentsInChildren(true)) + { + Jotunn.Logger.LogInfo($"[F8] renderer '{r.gameObject.name}' ({r.GetType().Name}) enabled={r.enabled}"); + } + } + private void Update() { if (Player.m_localPlayer == null) return; @@ -378,15 +453,8 @@ namespace RacesOfValheim // Manage Fake Foods var foods = Player.m_localPlayer.GetFoods(); bool needsFood = false; - - if (SkeletonConfig.EatsMortalFood.Value) - { - // Real meals instead. The stand-in foods are the ones held at m_time 0 or below; - // dropped here at once rather than left for UpdateFood, which would announce each - // one as "food done". - foods.RemoveAll(f => f.m_time <= 0f); - } - else if (foods.Count != 3) + + if (foods.Count != 3) { needsFood = true; } diff --git a/JotunnModStub/Sverm/SvermConfigManagement.cs b/JotunnModStub/Sverm/SvermConfigManagement.cs index 62bda1a..a25aec9 100644 --- a/JotunnModStub/Sverm/SvermConfigManagement.cs +++ b/JotunnModStub/Sverm/SvermConfigManagement.cs @@ -46,7 +46,6 @@ namespace RacesOfValheim public static ConfigEntry RavagerYawDegrees; public static ConfigEntry RavagerAttackOffsetValue; public static ConfigEntry RavagerSlamCraterValue; - public static ConfigEntry RavagerDamageShareValue; // ─── Colony caps ───────────────────────────────────────────────────── // Every ceiling on how many things the colony can have alive at once, in one section, so @@ -232,11 +231,6 @@ namespace RacesOfValheim "The middle-click slam digs into the ground where it lands, like a pickaxe blow. " + "Never inside a ward you have no access to."); - RavagerDamageShareValue = config.Bind(ravager, "Ravager Attack Damage", 1f, - new ConfigDescription("Share of a real Seeker Brute's damage each Ravager attack deals. " + - "Your Unarmed skill then scales it the way it scales a weapon: about 40% at level 0, " + - "about 92% at level 100.", new AcceptableValueRange(0.1f, 2f))); - EmberGlowStrength = config.Bind(ember, "Glow Strength", SvermConfig.EmberGlowStrength, "How hot the chitin burns at Fader. This multiplies an HDR colour and it is applied " + "to the chest, the legs and the helmet at once, so it goes a very long way. Settled " + @@ -370,7 +364,6 @@ namespace RacesOfValheim public static float RavagerYaw => RavagerYawDegrees?.Value ?? 0f; public static float RavagerAttackOffset => RavagerAttackOffsetValue?.Value ?? 1.5f; public static bool RavagerSlamCrater => RavagerSlamCraterValue?.Value ?? true; - public static float RavagerDamageShare => RavagerDamageShareValue?.Value ?? 1f; public static bool Spines => SpinesEnabled?.Value ?? false; public static float SizeSmall => SpineSizeSmall?.Value ?? SvermConfig.SpineSizeSmall; diff --git a/JotunnModStub/Sverm/SvermRavagerAttacks.cs b/JotunnModStub/Sverm/SvermRavagerAttacks.cs index e084678..2bf3567 100644 --- a/JotunnModStub/Sverm/SvermRavagerAttacks.cs +++ b/JotunnModStub/Sverm/SvermRavagerAttacks.cs @@ -24,29 +24,6 @@ namespace RacesOfValheim { public string Trigger; public HitData.DamageTypes Damage; - - /// The Brute weapon itself, for its swing (m_triggerEffect) and impact - /// (m_hitEffect) sounds. Vanilla plays both inside Attack, which this form never runs, - /// so without them every hit landed silent. Null if the weapon was missing. - public ItemDrop.ItemData.SharedData Shared; - - /// The weapon's own push (m_attackForce), tool tier and swing arc, the way - /// TrolTrueFormModel.Profile carries the troll's. - public float PushForce; - public int ToolTier; - public float Angle; - } - - /// - /// One blow's damage: the Brute's, times Ravager Attack Damage, times the Unarmed skill - /// factor the way a weapon's skill scales it (0.25-0.55 at level 0, 0.85-1 at 100). - /// TrolTrueFormModel.DamageFor does the same with Clubs for the troll. - /// - public static HitData.DamageTypes DamageFor(Player player, Profile profile) - { - HitData.DamageTypes damage = profile.Damage.Clone(); - damage.Modify(SvermConfigManagement.RavagerDamageShare * player.GetRandomSkillFactor(Skills.SkillType.Unarmed)); - return damage; } private static Profile bite; @@ -95,10 +72,6 @@ namespace RacesOfValheim { Trigger = shared.m_attack != null ? (shared.m_attack.m_attackAnimation ?? "") : "", Damage = shared.m_damages, - Shared = shared, - PushForce = shared.m_attackForce, - ToolTier = shared.m_toolTier, - Angle = shared.m_attack != null ? shared.m_attack.m_attackAngle : 90f, }; Jotunn.Logger.LogInfo($"[Sverm] Ravager Strain reads '{profile.Trigger}' off '{sourcePrefabName}' - " + diff --git a/JotunnModStub/Sverm/SvermRavagerForm.cs b/JotunnModStub/Sverm/SvermRavagerForm.cs index 44e6599..52262b1 100644 --- a/JotunnModStub/Sverm/SvermRavagerForm.cs +++ b/JotunnModStub/Sverm/SvermRavagerForm.cs @@ -794,7 +794,7 @@ namespace RacesOfValheim { if (FormStagger.AttackInterrupted) return; if (slam) Slam(profile, radius, leftY, rightY, dropSamples); - else ExecuteDamage(profile, radius, false); + else ExecuteDamage(profile, radius); }, () => { if (leftClaw == null || rightClaw == null) return; @@ -828,11 +828,7 @@ namespace RacesOfValheim { Player player = Player.m_localPlayer; if (player != null) - { - // No Strike: the roar above is the taunt's sound, the weapon's would double it. - if (ApplyDamageInSphere(player.transform.position + Vector3.up, SvermConfig.RavagerTauntRadius, profile, true)) - FormMelee.RaiseSkill(Skills.SkillType.Unarmed); - } + ApplyDamageInSphere(player.transform.position + Vector3.up, SvermConfig.RavagerTauntRadius, profile.Damage); }, null); isAttacking = false; @@ -848,11 +844,6 @@ namespace RacesOfValheim { if (hasForwardSpeed) anim.SetFloat("forward_speed", 0f); - // The Brute weapon's swing sound, which vanilla plays in Attack.Start (the bite's - // snap, the ram's charge, the slam's wind-up). The taunt's weapon has none. - Player player = Player.m_localPlayer; - if (player != null) profile.Shared?.m_startEffect.Create(player.transform.position, player.transform.rotation, player.transform); - if (string.IsNullOrEmpty(profile.Trigger) || !knownTriggers.Contains(profile.Trigger)) return false; anim.SetTrigger(profile.Trigger); @@ -953,14 +944,14 @@ namespace RacesOfValheim Transform claw = StrikingClaw(leftY, rightY, samples); if (claw == null) { - ExecuteDamage(profile, radius, true); + ExecuteDamage(profile, radius); Player player = Player.m_localPlayer; if (player != null) DigCrater(player.transform.position + player.transform.forward * SvermConfigManagement.RavagerAttackOffset); return; } - Strike(claw.position + Vector3.up * 0.5f, radius, profile, true); + ApplyDamageInSphere(claw.position + Vector3.up * 0.5f, radius, profile.Damage); DigCrater(claw.position); } @@ -994,14 +985,14 @@ namespace RacesOfValheim /// FenrirBehaviors.ExecuteClawDamage, unchanged in shape: a sphere swept against the same /// broad layer mask every melee form in this mod already uses. /// - private void ExecuteDamage(SvermRavagerAttacks.Profile profile, float radius, bool slam) + private void ExecuteDamage(SvermRavagerAttacks.Profile profile, float radius) { Player player = Player.m_localPlayer; if (player == null) return; float reach = SvermConfigManagement.RavagerAttackOffset; Vector3 attackPoint = player.transform.position + player.transform.forward * reach + Vector3.up; - Strike(attackPoint, radius, profile, slam); + ApplyDamageInSphere(attackPoint, radius, profile.Damage); } private const string CraterPrefab = "digg_v3"; @@ -1024,40 +1015,26 @@ namespace RacesOfValheim if (crater != null) Object.Instantiate(crater, ground.point, Quaternion.identity); } - private const string FormLabel = "Ravager"; - - private static readonly int HitMask = LayerMask.GetMask("Default", "static_solid", "Default_small", "piece", - "piece_nonsolid", "terrain", "character", "character_net", "character_ghost", - "hitbox", "character_noenv", "vehicle"); - /// - /// The actual sweep, shared by every attack this form has. TrolTrueFormHit.SphereHit in - /// shape: a forward swing stays inside its arc (the Brute's own, widened to 75 degrees each - /// side the way the troll's is), the slam's claws and the taunt reach all around, and - /// FormMelee.CanReach keeps a blow from landing through a wall. Each target that takes the - /// blow plays the Brute weapon's own impact effect, which vanilla plays inside Attack. + /// The actual sweep, shared by every attack this form has (the three forward swings and + /// the taunt's own AoE) - only the sphere's centre and radius differ between them. /// /// m_skill is Swords, deliberately NOT Unarmed: Sverm_Damage_Patch rewrites any Unarmed /// hit from a Sverm into the Chitin Claws' own tier damage, and that patch fires for THIS /// call too, since it hooks Character.Damage itself rather than caring who dealt the hit. - /// Swords keeps that rewrite from overwriting the Brute's numbers with the claws'. It is - /// the Brute weapons' own skill too. The damage still scales with Unarmed (DamageFor). + /// Swords keeps that rewrite from overwriting the Brute's real numbers with the claws'. /// - /// True if the blow landed on a creature, so the caller raises the skill. - private static bool ApplyDamageInSphere(Vector3 center, float radius, SvermRavagerAttacks.Profile profile, bool allAround) + private static void ApplyDamageInSphere(Vector3 center, float radius, HitData.DamageTypes damage) { Player player = Player.m_localPlayer; - if (player == null) return false; + if (player == null) return; - Vector3 pos = player.transform.position; - Vector3 forward = player.transform.forward; - float halfAngle = allAround ? 180f : Mathf.Max(75f, profile.Angle * 0.5f); - HitData.DamageTypes damage = SvermRavagerAttacks.DamageFor(player, profile); + int layerMask = LayerMask.GetMask("Default", "static_solid", "Default_small", "piece", + "piece_nonsolid", "terrain", "character", "character_net", "character_ghost", + "hitbox", "character_noenv", "vehicle"); - Collider[] hits = Physics.OverlapSphere(center, radius, HitMask); - FormMelee.LogSwing(FormLabel, hits.Length); + Collider[] hits = Physics.OverlapSphere(center, radius, layerMask); var hitObjects = new System.Collections.Generic.HashSet(); - bool hitCreature = false; foreach (Collider hit in hits) { @@ -1065,65 +1042,35 @@ namespace RacesOfValheim if (hit.attachedRigidbody != null && hit.attachedRigidbody.gameObject == player.gameObject) continue; IDestructible target = hit.GetComponentInParent(); - if (target == null || (target is Character self && self == player)) continue; + if (target == null) continue; + + if (target is Character characterTarget && characterTarget == player) continue; - // Marked only once it is hit, further down, so a limb outside the arc does not rule - // out a body squarely in the swing. GameObject targetObj = (target as MonoBehaviour)?.gameObject; - if (targetObj != null && hitObjects.Contains(targetObj)) continue; + if (targetObj != null) + { + if (hitObjects.Contains(targetObj)) continue; + hitObjects.Add(targetObj); + } Vector3 targetCenter = hit.bounds.center; - Vector3 flat = targetCenter - pos; - flat.y = 0f; - float angle = flat.sqrMagnitude > 0.0001f ? Vector3.Angle(forward, flat) : 0f; - if (angle > halfAngle) - { - FormMelee.LogMiss(FormLabel, hit, $"outside the swing arc ({angle:0} deg)"); - continue; - } - - if (!FormMelee.CanReach(player.GetEyePoint(), center, hit, target, out string cover)) - { - FormMelee.LogMiss(FormLabel, hit, "no clear line, blocked by '" + cover + "'"); - continue; - } + Vector3 dirToTarget = (targetCenter - player.transform.position).normalized; HitData hitData = new HitData(); hitData.m_damage = damage; hitData.m_point = targetCenter; - hitData.m_dir = (targetCenter - pos).normalized; - hitData.m_pushForce = profile.PushForce; + hitData.m_dir = dirToTarget; + hitData.m_pushForce = 40f; hitData.m_skill = Skills.SkillType.Swords; hitData.m_dodgeable = true; hitData.m_blockable = true; hitData.m_hitType = HitData.HitType.PlayerHit; - hitData.m_toolTier = (short)profile.ToolTier; + hitData.m_toolTier = 100; hitData.SetAttacker(player); - if (targetObj != null) hitObjects.Add(targetObj); - FormMelee.LogHit(FormLabel, target, damage.GetTotalDamage()); target.Damage(hitData); FormMelee.GrantAdrenaline(target); - profile.Shared?.m_hitEffect.Create(targetCenter, Quaternion.identity); - if (target is Character) hitCreature = true; } - - return hitCreature; - } - - /// - /// One blow of a Ravager attack: the Brute weapon's trigger effect (the slam's landing - /// thud; the bite and the ram have none), the sweep, and the Unarmed experience vanilla - /// pays inside Attack for a swing that reached a creature. The Ravager fights unarmed like - /// the rest of the Sverm, so that is the skill it trains. - /// - private static void Strike(Vector3 center, float radius, SvermRavagerAttacks.Profile profile, bool allAround) - { - Player player = Player.m_localPlayer; - if (player == null) return; - - profile.Shared?.m_triggerEffect.Create(center, player.transform.rotation); - if (ApplyDamageInSphere(center, radius, profile, allAround)) FormMelee.RaiseSkill(Skills.SkillType.Unarmed); } } } diff --git a/JotunnModStub/Translations/English/compendium.json b/JotunnModStub/Translations/English/compendium.json index e4dbf47..1d72d04 100644 --- a/JotunnModStub/Translations/English/compendium.json +++ b/JotunnModStub/Translations/English/compendium.json @@ -240,9 +240,5 @@ "rov_compendium_warvulture_goes_where_look_goes_as": "It goes where you look, and it goes as long as you care to stay up: $1 meters a second costs it nothing at all. Hold your run key and it gives you $2 for $3 seconds and not a moment longer - there is only so much haste in a bird. Let go and the wind comes back into it in $4 seconds, in the air. You never have to land for it.\n", "rov_compendium_warvulture_vulture_s_head_kept_stick": "A vulture's head kept on a stick, and the bird answers to it. Raise it and the vulture comes back under you. Raise it again and it carries you down, deaf to you until the ground arrives - and a third time lets go of it where you are.\n", "rov_compendium_warvulture_war_vulture": "\n-- THE WAR VULTURE --\n", - "rov_compendium_warvulture_what_bird_has_left_bar": "What the bird has left is the bar under your own.\n", - "rov_compendium_skeleton_diet_bones": "No hunger moves you and no meal can help you - mortal food is nothing to dry bones. In its place the dead grow strong as their betters fall: you carry +$1 Maximum Health at your present standing.", - "rov_compendium_skeleton_diet_mortal": "You kept the habits of the flesh: you eat as the living do, and your health comes from your meals, not from your standing.", - "rov_compendium_skeleton_effort_none": "Nor does effort tire you; you have no stamina to spend at all.", - "rov_compendium_skeleton_effort_mortal": "Effort tires you as it tires the living, and you spend stamina like anyone else." + "rov_compendium_warvulture_what_bird_has_left_bar": "What the bird has left is the bar under your own.\n" } diff --git a/JotunnModStub/Translations/English/messages.json b/JotunnModStub/Translations/English/messages.json index b800d90..ac5b9d4 100644 --- a/JotunnModStub/Translations/English/messages.json +++ b/JotunnModStub/Translations/English/messages.json @@ -18,7 +18,6 @@ "rov_msg_aswid_vae_victis": "Vae Victis", "rov_msg_aswid_what_horrible_night_have_curse": "what a horrible night to have a curse", "rov_msg_aswid_bat_cooldown": "Your blood is not ready to take wing again ($1s)", - "rov_msg_aswid_bat_combat_lock": "Your blood runs too hot from the fight to take wing ($1s)", "rov_msg_aswid_bat_form_fades": "The bat form fades", "rov_msg_aswid_bat_too_heavy_to_beat": "Too heavy to beat your wings. You can only glide", "rov_msg_aswid_too_heavy_for_bat": "You carry too much to take bat form", diff --git a/JotunnModStub/Translations/Italian/compendium.json b/JotunnModStub/Translations/Italian/compendium.json index cc77ae0..abbce59 100644 --- a/JotunnModStub/Translations/Italian/compendium.json +++ b/JotunnModStub/Translations/Italian/compendium.json @@ -240,9 +240,5 @@ "rov_compendium_warvulture_goes_where_look_goes_as": "Va dove guardi, e va finché vuoi restare in aria: $1 metri al secondo non gli costano niente. Tieni premuto il tasto di corsa e ti dà $2 per $3 secondi, non un momento di più: in un uccello c'è solo tanta fretta. Lascia andare e il vento gli torna dentro in $4 secondi, in aria. Non devi mai atterrare per questo.\n", "rov_compendium_warvulture_vulture_s_head_kept_stick": "La testa di un avvoltoio infilata su un bastone, e l'uccello le risponde. Sollevala e l'avvoltoio torna sotto di te. Sollevala di nuovo e ti porta giù, sordo a te finché non arriva il terreno; una terza volta ti lascia andare dove sei.\n", "rov_compendium_warvulture_war_vulture": "\n-- L'AVVOLTOIO DA GUERRA --\n", - "rov_compendium_warvulture_what_bird_has_left_bar": "Ciò che resta all'uccello è la barra sotto la tua.\n", - "rov_compendium_skeleton_diet_bones": "Nessuna fame ti muove e nessun pasto può aiutarti: il cibo dei mortali non è niente per ossa secche. Al suo posto i morti si rafforzano man mano che i loro superiori cadono: al tuo grado attuale hai +$1 di salute massima.", - "rov_compendium_skeleton_diet_mortal": "Hai conservato le abitudini della carne: mangi come i vivi, e la tua salute viene dai pasti, non dal tuo grado.", - "rov_compendium_skeleton_effort_none": "Nemmeno la fatica ti stanca: non hai stamina da spendere.", - "rov_compendium_skeleton_effort_mortal": "La fatica ti stanca come stanca i vivi, e spendi stamina come chiunque altro." + "rov_compendium_warvulture_what_bird_has_left_bar": "Ciò che resta all'uccello è la barra sotto la tua.\n" } diff --git a/JotunnModStub/Translations/Italian/messages.json b/JotunnModStub/Translations/Italian/messages.json index 1fb5a4d..4eb8257 100644 --- a/JotunnModStub/Translations/Italian/messages.json +++ b/JotunnModStub/Translations/Italian/messages.json @@ -18,7 +18,6 @@ "rov_msg_aswid_vae_victis": "Vae Victis", "rov_msg_aswid_what_horrible_night_have_curse": "what a horrible night to have a curse", "rov_msg_aswid_bat_cooldown": "Il tuo sangue non è pronto a spiccare il volo di nuovo ($1s)", - "rov_msg_aswid_bat_combat_lock": "Il sangue ti ribolle per lo scontro, non puoi spiccare il volo ($1s)", "rov_msg_aswid_bat_form_fades": "La forma di pipistrello svanisce", "rov_msg_aswid_bat_too_heavy_to_beat": "Troppo pesante per battere le ali. Puoi solo planare", "rov_msg_aswid_too_heavy_for_bat": "Porti troppo peso per prendere la forma di pipistrello", diff --git a/JotunnModStub/Translations/Russian/compendium.json b/JotunnModStub/Translations/Russian/compendium.json index 0ba3e79..c0af6d7 100644 --- a/JotunnModStub/Translations/Russian/compendium.json +++ b/JotunnModStub/Translations/Russian/compendium.json @@ -240,9 +240,5 @@ "rov_compendium_warvulture_goes_where_look_goes_as": "Она летит туда, куда обращен ваш взор, и летит так долго, как вы того пожелаете: полет со скоростью $1 м/с не стоит птице никаких сил. Зажмите клавишу бега — и она выдаст рывок со скоростью $2 м/с на $3 с, не дольше: птичьи силы не безграничны. Отпустите бег, и дыхание вернется к ней через $4 с прямо в воздухе. Садиться на землю не придется.\n", "rov_compendium_warvulture_vulture_s_head_kept_stick": "Голова стервятника на шесте, и хищная птица повинуется ей. Поднимите ее — и птица опустится вам под ноги. Поднимите снова — и она понесет вас к земле, не слушая команд до самого приземления, а поднятая в третий раз — отпустит вас на лету.\n", "rov_compendium_warvulture_war_vulture": "\n-- БОЕВОЙ СТЕРВЯТНИК --\n", - "rov_compendium_warvulture_what_bird_has_left_bar": "Остаток выносливости птицы отображается шкалой под вашей собственной.\n", - "rov_compendium_skeleton_diet_bones": "Голод не движет вами, и никакая еда вам не поможет: смертная пища ничто для сухих костей. Взамен мёртвые крепнут по мере падения своих владык: на вашей нынешней ступени у вас +$1 к максимальному здоровью.", - "rov_compendium_skeleton_diet_mortal": "Вы сохранили привычки плоти: вы едите, как живые, и ваше здоровье даёт пища, а не ступень.", - "rov_compendium_skeleton_effort_none": "И усилия вас не утомляют: выносливости у вас нет вовсе.", - "rov_compendium_skeleton_effort_mortal": "Усилия утомляют вас, как живых, и вы тратите выносливость, как все." + "rov_compendium_warvulture_what_bird_has_left_bar": "Остаток выносливости птицы отображается шкалой под вашей собственной.\n" } diff --git a/JotunnModStub/Translations/Russian/messages.json b/JotunnModStub/Translations/Russian/messages.json index a60d470..a067cfb 100644 --- a/JotunnModStub/Translations/Russian/messages.json +++ b/JotunnModStub/Translations/Russian/messages.json @@ -18,7 +18,6 @@ "rov_msg_aswid_vae_victis": "Vae Victis", "rov_msg_aswid_what_horrible_night_have_curse": "Какая ужасная ночь для носителя проклятия...", "rov_msg_aswid_bat_cooldown": "Ваша кровь еще не готова снова подняться в небо ($1 с)", - "rov_msg_aswid_bat_combat_lock": "Кровь слишком горяча после схватки, чтобы подняться в небо ($1 с)", "rov_msg_aswid_bat_form_fades": "Облик летучей мыши рассеивается", "rov_msg_aswid_bat_too_heavy_to_beat": "Слишком тяжело, чтобы махать крыльями. Вы можете только планировать", "rov_msg_aswid_too_heavy_for_bat": "Вы несете слишком много, чтобы принять облик летучей мыши", diff --git a/JotunnModStub/Trenta/TrentaAbilities.cs b/JotunnModStub/Trenta/TrentaAbilities.cs index 088ec3a..3809865 100644 --- a/JotunnModStub/Trenta/TrentaAbilities.cs +++ b/JotunnModStub/Trenta/TrentaAbilities.cs @@ -196,14 +196,7 @@ namespace RacesOfValheim // The Trenta stands in its own rain and is healed by it too. It used to be left out, so // a lone Trenta cast a heal that never touched anyone. - float heal = TrentaConfig.PurpleRainHealFor(player); - float poison = TrentaConfig.PurpleRainPoisonFor(player); - player.Heal(heal, true); - - // Blood Magic experience once per cast that reached someone besides the caster, the - // way a vanilla staff pays per cast: healing only yourself earns nothing, or the - // skill would level by casting into an empty field on cooldown. - bool reachedSomeone = false; + player.Heal(TrentaConfig.PurpleRainHealAmount, true); HashSet hit = new HashSet(); foreach (Collider collider in Physics.OverlapSphere(player.transform.position, TrentaConfig.PurpleRainRadius)) @@ -216,20 +209,16 @@ namespace RacesOfValheim if (BaseAI.IsEnemy(player, character)) { HitData hitData = new HitData(); - hitData.m_damage.m_poison = poison; - hitData.m_skill = Skills.SkillType.BloodMagic; + hitData.m_damage.m_poison = TrentaConfig.PurpleRainPoisonDamage; hitData.SetAttacker(player); hitData.m_dir = Vector3.zero; character.Damage(hitData); } else { - character.Heal(heal, true); + character.Heal(TrentaConfig.PurpleRainHealAmount, true); } - reachedSomeone = true; } - - if (reachedSomeone) FormMelee.RaiseSkill(Skills.SkillType.BloodMagic); } /// diff --git a/JotunnModStub/Trenta/TrentaConfig.cs b/JotunnModStub/Trenta/TrentaConfig.cs index f3a1972..35fc25d 100644 --- a/JotunnModStub/Trenta/TrentaConfig.cs +++ b/JotunnModStub/Trenta/TrentaConfig.cs @@ -120,16 +120,6 @@ namespace RacesOfValheim public static float PurpleRainRadius => TrentaConfigManagement.PurpleRainRadius.Value; public static float PurpleRainHealAmount => TrentaConfigManagement.PurpleRainHealAmount.Value; public static float PurpleRainPoisonDamage => TrentaConfigManagement.PurpleRainPoisonDamage.Value; - - // The base figures plus the Blood Magic bonus, scaled linearly up to the full bonus at - // level 100 - the same shape as the Aswid's Vampiric Aura. The compendium reads these - // too, so its numbers follow the player's skill. - public static float PurpleRainHealFor(Player player) => - PurpleRainHealAmount + BloodMagicFactor(player) * TrentaConfigManagement.PurpleRainBloodMagicHeal.Value; - public static float PurpleRainPoisonFor(Player player) => - PurpleRainPoisonDamage + BloodMagicFactor(player) * TrentaConfigManagement.PurpleRainBloodMagicPoison.Value; - private static float BloodMagicFactor(Player player) => - player != null ? player.GetSkillFactor(Skills.SkillType.BloodMagic) : 0f; // A Poison-type hit; vanilla's own // poison-on-hit handling takes over from // there, same as SkeletonRace's fire aura diff --git a/JotunnModStub/Trenta/TrentaConfigManagement.cs b/JotunnModStub/Trenta/TrentaConfigManagement.cs index 09b5752..556edf9 100644 --- a/JotunnModStub/Trenta/TrentaConfigManagement.cs +++ b/JotunnModStub/Trenta/TrentaConfigManagement.cs @@ -45,8 +45,6 @@ namespace RacesOfValheim public static ConfigEntry PurpleRainRadius; public static ConfigEntry PurpleRainHealAmount; public static ConfigEntry PurpleRainPoisonDamage; - public static ConfigEntry PurpleRainBloodMagicHeal; - public static ConfigEntry PurpleRainBloodMagicPoison; // ─── Bonemass (tier 4+, passive) ────────────────────────────────────── public static ConfigEntry SwimStaminaRegen; @@ -118,10 +116,6 @@ namespace RacesOfValheim new ConfigDescription("Flat heal applied to you and to every ally hit.", new AcceptableValueRange(0f, 200f))); PurpleRainPoisonDamage = config.Bind(purpleRain, "Enemy Poison Damage", 40f, new ConfigDescription("Flat poison damage applied to every enemy hit.", new AcceptableValueRange(0f, 200f))); - PurpleRainBloodMagicHeal = config.Bind(purpleRain, "Blood Magic Heal Bonus", 40f, - new ConfigDescription("Extra heal at 100 Blood Magic skill, added to Ally Heal Amount (scales linearly from 0).", new AcceptableValueRange(0f, 200f))); - PurpleRainBloodMagicPoison = config.Bind(purpleRain, "Blood Magic Poison Bonus", 40f, - new ConfigDescription("Extra poison damage at 100 Blood Magic skill, added to Enemy Poison Damage (scales linearly from 0).", new AcceptableValueRange(0f, 200f))); const string bonemass = "Trenta - Bonemass"; SwimStaminaRegen = config.Bind(bonemass, "Swim Stamina Regen", 0.1f, diff --git a/JotunnModStub/Trenta/TrentaMuspell.cs b/JotunnModStub/Trenta/TrentaMuspell.cs index a75f761..3dadb33 100644 --- a/JotunnModStub/Trenta/TrentaMuspell.cs +++ b/JotunnModStub/Trenta/TrentaMuspell.cs @@ -435,7 +435,6 @@ namespace RacesOfValheim float totalDamage = baseDamage + unarmedSkillLevel; HashSet hit = new HashSet(); - bool hitCreature = false; foreach (Collider collider in Physics.OverlapSphere(center, radius)) { Character target = collider.GetComponentInParent(); @@ -443,12 +442,7 @@ namespace RacesOfValheim if (!BaseAI.IsEnemy(player, target)) continue; DealDamage(player, target, totalDamage, HitData.DamageType.Blunt, Vector3.zero); - hitCreature = true; } - - // The spike projectile levels Unarmed through vanilla's Projectile.OnHit; the stomp - // calls Damage directly and has to raise the skill itself. - if (hitCreature) FormMelee.RaiseSkill(Skills.SkillType.Unarmed); } /// diff --git a/README.md b/README.md index dad3cdb..e01006a 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,11 @@ Support the mod: [Patreon — NandorTheModder](https://www.patreon.com/c/NandorT --- -## New in v1.6.11 +## New in v1.6.7 -**F8 no longer fires by accident.** The debug key now lives in a new `Debug` section of the config. It's off until you turn it on, and you can rebind it. Heads-up: `Debug: Log Form Hits` moved there from `Fenrir - Debug`, so if you had turned it on, turn it on again. Full details in the [changelog](#v1611). +**Heads-up: a few settings reset.** Some Skadi and Fenrir config keys have new names, so any value you changed in them is back to its default; the [changelog](#v167) lists which. + +**Every dragon and every wolf has a job.** The Skadi's Drake is the quick scout and the Moder the slow freighter, and each form has its own duration and cooldown settings. The Fenrir's Ulv is the travel form, the Fenring holds the line, the Cultist burns and breaks easily. Alfar drones carry wood to the kiln again. Full details in the [changelog](#v167). --- @@ -29,7 +31,6 @@ Support the mod: [Patreon — NandorTheModder](https://www.patreon.com/c/NandorT ![Skeleton](https://wiki.aledanidev.ovh/assets/images/corna_scheletro.gif) - **Stamina-less Combat:** Skeletons use no stamina and do not have a stamina bar. - **Undead Diet:** Cannot eat normal food. Max health increases automatically as you defeat bosses to make up for lack of food buffs. -- **Mortal Habits (optional):** each player can turn on *Eats Mortal Food* (eat like the living; health comes from meals, and the boss health bonus is dropped) and *Feels Fatigue* (spend stamina like the living) in the config section `Skeleton - Mortal Habits`. Both are off by default and not synced by the server. - **Lit Sockets:** Your skull carries the eye lights of the creature your tier is built from, in that creature's own colour — so they change as the body does. - **Body Model switch:** with a player model mod (EnhancedValheimVRM and the like), set `Skeleton - Visuals` → `Body Model Enabled` to off and Skeletons keep the vanilla body. Abilities stay the same. - **Show Helmet:** turn on `Skeleton - Visuals` → `Show Helmet` and your helmet sits on the skull. Off by default; other players see it the way you picked. @@ -58,7 +59,7 @@ Support the mod: [Patreon — NandorTheModder](https://www.patreon.com/c/NandorT ### 4. Aswid ![Aswid](https://wiki.aledanidev.ovh/assets/images/aswidchallenge.gif) - **The Vampire:** Life-draining abilities. -- **Bat Form:** Press G to become a bat. It flies where you look, with the Skadi drake's controls: W beats forward, Shift sprints, S beats backwards, and letting go hovers a moment before you glide down. Flying and sprinting cost stamina; out of stamina you can only glide. Carrying too much makes it cost 15% more, or, if you set `While Encumbered` to Blocked, keeps you on the ground. Monsters see, chase and hurt the bat like anyone else. You can't take bat form until 2.5 seconds after you last lost health (`Combat Lock`). +- **Bat Form:** Press G to become a bat. It flies where you look, with the Skadi drake's controls: W beats forward, Shift sprints, S beats backwards, and letting go hovers a moment before you glide down. Flying and sprinting cost stamina; out of stamina you can only glide. Carrying too much makes it cost 15% more, or, if you set `While Encumbered` to Blocked, keeps you on the ground. Monsters see, chase and hurt the bat like anyone else. - **Free Bat Flight:** Prefer the old bat? Turn on `Aswid - Bat Form` → `Free Bat Flight`: up to 50 m/s, no stamina and no weight limit, Jump rises and Left Ctrl sinks. Monsters still see and hurt you. The server's `Bat Flight Rule` can force one flight on everyone. - **Vampiric Aura:** A passive life-draining aura around you, no key to hold: half damage as human, double as mist. As a bat it stays silent until The Queen falls (configurable under `Aswid - Vampiric Aura`). Press **[I]** to toggle it (and Devour) off, e.g. before trading with Haldor or Hildir, since it does not recognize traders from monsters. - **Blood Magic Mastery:** Cast Blood Magic items with infinite Eitr (health cost only). @@ -94,7 +95,6 @@ Support the mod: [Patreon — NandorTheModder](https://www.patreon.com/c/NandorT - **Kin of the Traders:** Haldor/Hildir give you better prices. - **Coin Instead of Blood:** The Contract Bank hires professional dvergr crews and the Rune Barrel gives them drink — see [Race Stations](#race-stations--companions). - **Runes:** Late game, spend Eitr for powerful effects. -- **Deep-Folk Builders:** Black marble building pieces cost 3 stone per marble, and Yggdrasil wood pieces 2 fine wood per Yggdrasil wood. Stations and furniture keep their cost. The pieces carry the Dvergar icon in the build menu, and taking one down gives back what you paid. Ratios and an off switch under `Dvergar - Cheap Building`. ### 9. Trenta ![Trenta](https://wiki.aledanidev.ovh/assets/images/trentecheers.gif) @@ -110,7 +110,7 @@ Support the mod: [Patreon — NandorTheModder](https://www.patreon.com/c/NandorT - **Hive Pheromones:** No invertebrate attacks you — leeches, ticks, deathsquitos, seekers and bees all ignore you, from tier zero. - **Toxin Immunity:** Poison cannot touch you. Blunt and fire hit you 40% harder — until Fader, when the fire weakness burns out and comes back as a resistance. - **The Colony:** After the Elder, a Brood Mound, a Hive Market and a roster of insect troops bought with digested biomass. -- **Ravager Strain:** After Yagluth, become a Seeker Brute, with its own bite, lunging ram and two-claw ground slam that digs the earth. Its damage grows with Unarmed. The carapace is worth double. +- **Ravager Strain:** After Yagluth, become a Seeker Brute, with its own bite, lunging ram and two-claw ground slam that digs the earth. The carapace is worth double. ### 11. Alfar - **Eitr Shield:** Eitr is your armour: blows land on the eitr pool first, and lightning and spirit cost double. Only drowning and the edge of the world ignore it. Every food you eat also feeds the pool. @@ -296,7 +296,7 @@ Build a **Brood Mound** with the hammer — no more than two within its density - **Base:** Tree-Born. Green skin/branches, plant diet, food lasts 2x. Photosynthesis: stand still in daylight for 10s = heal 10% max HP/sec for 8s, Rested buff (5 min +1min per boss). Greylings, greydwarves, fulings, trolls, leeches and deathsquitos ignore you. - **Eikthyr:** Awakened Seeds – eat seeds/cones/acorns/mushrooms for strong food buffs. -- **Elder:** Purple Rain (G): 8m toxic pollen heals you and your allies, poisons enemies, 20s CD. Heal and poison grow with Blood Magic (+40 each at level 100), and a cast that reaches someone else trains it. +- **Elder:** Purple Rain (G): 8m toxic pollen heals you and your allies, poisons enemies, 20s CD. - **Bonemass:** Swim uses no stamina and stamina comes back slowly in the water, immune to Poison/Wet. - **Moder:** Last Stand – armor rises as health falls (up to +50%), Thorns (reflects 20% damage). - **Yagluth:** Homecoming Portal (H): portal to respawn point, anyone can use, 5min CD. @@ -484,7 +484,7 @@ Aswid, Draugh, Skeleton / at peace with Ghost, Skeleton, Draugr, Wraith, Leech, The **Sverm** belongs to no faction. Its Hive Pheromones make every invertebrate in the game ignore it instead — leeches, ticks, deathsquitos, seekers and bees — with no boss gate and no trading. -A truce is not a shield: hit one of your own and it hits back, for **Faction grudge** seconds (60 by default), then forgets about it. Want it harder? Turn on **Grudge spreads to kin** and every creature of that faction within 20 m (`Grudge spread radius`) joins the fight too, the way vanilla's Dvergr treat a human. Your always-on auras — the Aswid's drain, the Skadi's frost — leave your own kin alone, so they never start that fight for you. +A truce is not a shield: hit one of your own and it hits back, for **Faction grudge** seconds (60 by default), then forgets about it. Your always-on auras — the Aswid's drain, the Skadi's frost — leave your own kin alone, so they never start that fight for you. Both halves have an off switch under `Factions` in Configuration Manager: **Faction truce** for whether your faction's mobs leave you alone, **Faction merchants** for whether they will trade. Both are on by default and both take effect without a restart. Be aware that turning the truce off also gives up every race's own peace — Fenrir's wolves, the Aswid's list, the Draugh's undead, the Trenta's Black Forest, the Sverm's invertebrates, the Furling's Plains roster and the Skeleton's undead — because they are all the same question asked of the same vanilla method. @@ -492,35 +492,6 @@ Both halves have an off switch under `Factions` in Configuration Manager: **Fact ## Changelog -### v1.6.11 -- **Heads-up - config key moved:** `Fenrir - Debug` → `Debug: Log Form Hits` is now `Debug` → `Debug: Log Form Hits`. If you had turned it on, turn it on again in Configuration Manager. The old entry stays in your .cfg but does nothing; delete it by hand if you like. -- **Change - the debug key is off by default and can be rebound:** F8 used to toggle the melee reach readout and write Alfar drone reports to the log for everyone, with no way to turn it off. It now sits in a new `Debug` section: `Debug: Enable Debug Key` (off by default) turns it on, and `Debug Key` (F8 by default) rebinds it. `Debug: Log Form Hits` moved into the same section, since it logs the Skadi, Sverm and Trol forms as well as the Fenrir ones. Thanks to Dagaz for the request. Not tested in game yet. - -### v1.6.10 -- **Fix - Skadi's Moder and Fader forms couldn't hit the training dummy:** their bites, claws and spin checked for cover with a line that counted the target's own body as a wall. Anything standing on the build layer, like the T.W.I.G. training dummy, could never be hit; wildlife worked. They now use the same reach check as the Fenrir forms, and each hit plays the real dragon's impact sound. The blow also lands on the clip's own hit frame instead of a fixed half second, which was early for every melee: the Moder's claws landed a second and a half before the claw came down. Thanks to lexsonn for the report. Not tested in game yet. -- **Change - Ravager Strain fights like the troll True Form:** the Brute's swing and impact sounds play on the bite, ram and slam, which were silent. Every attack that lands on a creature trains Unarmed, and the damage now grows with it the way a weapon grows with its skill: about 40% of a real Seeker Brute's at level 0, about 92% at level 100. The new key `Sverm - Ravager Strain` → `Ravager Attack Damage` (default 1) multiplies it. The bite and the ram now stay in front of you and no longer hit through walls, and each attack uses the Brute's own push and tool tier. Thanks to lexsonn for the report. Not tested in game yet. -- **Fix - Alfar Skrid blinked you onto the roof:** a blink aimed at the floor ended with your feet under it, and the check meant to lift you out of the ground measured from the sky, so under any roof (a crypt, a cave, a house) it put you on top of the roof instead. Skrid now lands you on the floor under the spot it reaches. Inside a dungeon or cave it is cancelled, at no cost, when there is no floor under that spot. Thanks to Joacwoo for the report and the videos. Not tested in game yet. -- **Fix - Alfar hair and beard flashed in for a moment:** changing anything in your hands made the game put the character's hair and beard back, and the Alfar only took them off again half a second later. They are now blocked where the game attaches them, so they never show. Thanks to Joacwoo for the report and the video. Not tested in game yet. - -### v1.6.9 -- **Fix - you couldn't hit your own faction:** since Valheim 1.0, a player's hit passes through any creature the game calls friendly unless PvP is on, and the faction truce called every creature of your faction friendly. Your blows did nothing, no grudge started, and `Grudge spreads to kin` had nothing to spread. Hitting one of your own works again, and it and its kin fight back as intended. The truce still keeps them off you; it no longer shields them from you. Thanks to Joacwoo and CrimsonAiro for the reports. Not tested in game yet. -- **Fix - grudges in multiplayer:** a creature now keeps its grudge when another player's game takes over running it mid-fight, for example when the first player walks away or logs out. `Grudge spreads to kin` now also reaches kin that another player's game is running; before, they stayed calm until hit themselves. Every player needs this version: a creature run by an older client behaves the old way. Not tested in multiplayer yet. -- **New - race attacks train their skills:** many attacks grew with a skill but gave no XP for it, so the skill never moved. Now an attack that lands on a creature gives the XP a weapon hit gives, and damage over time gives a share per second. Hitting trees or rocks gives nothing. Not tested in game yet. - - Fenrir: the Fenring, Cultist, Wolf and Ulv claws and bites train Unarmed. The Cultist's fire breath trains Elemental Magic. - - Skadi: the Drake forms' bites and claws train Unarmed. - - Trenta: the Muspell stomp trains Unarmed. - - Aswid: the Vampiric Aura slowly trains Blood Magic. - - Alfar: Geisli and Ljosstorm train Elemental Magic. The Sameining pulse trains it slowly. -- **Change - Purple Rain grows with Blood Magic:** at level 100 it heals and poisons for 40 more than its base 40. The bonus has two new keys under `Trenta - Purple Rain`: `Blood Magic Heal Bonus` and `Blood Magic Poison Bonus`. A cast that reaches anyone besides you trains Blood Magic, and the Compendium shows your current numbers. Not tested in game yet. -- **Fix - pukeberries and the Aswid's fourth stomach:** pukeberries emptied only the three vanilla food slots, so the Aswid's fourth meal stayed. It now goes like the others. Thanks to Joacwoo for the report. - -### v1.6.8 -- **New - Skeleton Mortal Habits:** two options under `Skeleton - Mortal Habits`, both off by default, each player picking their own. *Eats Mortal Food*: the Skeleton eats like the living, and its health and stamina come from its meals. The boss-tier health bonus goes away, since it stood in for food. *Feels Fatigue*: the Skeleton spends stamina; if it doesn't eat, its stamina grows with its standing. Every other Skeleton power stays. Thanks to Celepito for the request. Not tested in game yet. -- **New - Aswid bat form waits out a fight:** you can't take bat form until 2.5 seconds after you last lost health, from a hit or a tick of fire, poison or bleeding. Turning back is never blocked, and a hit still doesn't knock you out of bat form. `Aswid - Bat Form` → `Combat Lock` sets the time; 0 turns it off. Not tested in game yet. -- **New - Dvergar build cheap marble and Yggdrasil pieces:** a Dvergar pays 3 stone for each black marble and 2 fine wood for each Yggdrasil wood on walls, floors, beams, roofs, arches, stairs, doors and stakes. Stations, furniture, containers and fires keep their cost. The marble pieces still need a Stonecutter and the Yggdrasil ones a Black Forge, and they show in the build menu with the Dvergar icon once you know stone or fine wood. Taking a piece down gives back what was paid for it, whoever does it, so a cheap wall never turns into black marble. `Dvergar - Cheap Building` holds the off switch and both ratios. Thanks to Wargles for the suggestion. Refunds not tested in game yet. -- **New - a faction can fight as a group:** turn on `Factions` → `Grudge spreads to kin` and hitting a creature of your own faction makes every creature of that faction within 20 m turn on you too, for the usual grudge time, the way vanilla's Dvergr treat a human. Peace still holds until you strike first, and the radius is `Grudge spread radius`. Off by default. In multiplayer a creature run by another player's game stays calm until it is hit itself. Thanks to Joacwoo for the idea. Not tested in game yet. -- **Fix - Valheim 1.0's new skeletons ignored the faction:** the regional skeletons Valheim 1.0 added (the green ones in the swamp, the blue ones in the mountains, and those of the Meadows and the Deep North, each with its melee-only twin) were missing from the swamp faction, so they attacked Skeleton, Aswid and Draugh players the old skeletons left alone. They keep the truce now and run the Skeleton's faction shop. Thanks to Joacwoo for the report. Not tested in game yet. - ### v1.6.7 - **Heads-up - config reset:** some settings were renamed, so any value you changed in them is back to its default. Skadi: everything in `Skadi - Directed Flight` now lives in `Skadi - Dragon Forms`, split into Drake and Moder keys. Fenrir: `Full Form Speed Bonus` is now `Fenring And Cultist Speed Bonus`, and `Wolf Form Speed Bonus` is split into `Wolf Speed Bonus` and `Ulv Speed Bonus`. If you had tuned any of these, set them again in Configuration Manager. The old entries stay in your .cfg but do nothing. Delete them by hand, or, if you never changed any setting, delete the whole .cfg and the game writes a fresh one on the next start. Don't delete the whole file if you customised anything else: everything goes back to default, keybinds included. - **Change - Skadi's Drake and Moder fly differently:** the Drake is the scout: it turns faster, sprints at 26 m/s and flies for free, but it will not take off while you are encumbered. The Moder is the freighter: it turns slowly and pays 3 stamina a second to beat its wings, but it carries a heavy pack at 25% extra cost and glides for 8 seconds. `Skadi - Dragon Forms` holds every flight number per form plus, as on the Aswid's bat, Flight Stamina, While Encumbered, Encumbered Extra Stamina Cost, Max Duration, Duration Per State and Cooldown for the Drake, the Moder and the Fader. Duration and cooldown default to -1, which keeps the boss-tier timings. Each form also has its own cooldown now, with its own icon, so a cooldown on one form never blocks another. Thanks to Dissolution for the suggestion. Not tested in game yet. diff --git a/manifest.json b/manifest.json index a240b90..7bfb6ec 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "RacesOfValheim", "description": "A Valheim mod that adds eleven custom playable races (Alfar, Aswid, Draugh, Dvergar, Fenrir, Furling, Skadi, Skeleton, Sverm, Trenta, Trol) each with unique abilities, traits, race stations and a deep boss-driven progression system.", - "version_number": "1.6.11", + "version_number": "1.6.7", "website_url": "", "dependencies": [ "denikson-BepInExPack_Valheim-5.4.2333",