From ffed6fd33efa4f229e668f5d02e8d5b9672dfda5 Mon Sep 17 00:00:00 2001 From: kanym Date: Wed, 11 Nov 2026 18:43:42 +0100 Subject: [PATCH 1/2] fix(alfar): Skrid lands on the floor under its end, never on a roof; cancelled in a dungeon with no floor --- JotunnModStub/Alfar/AlfarPowers.cs | 61 ++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 16 deletions(-) diff --git a/JotunnModStub/Alfar/AlfarPowers.cs b/JotunnModStub/Alfar/AlfarPowers.cs index 6b0ea70..8a02b61 100644 --- a/JotunnModStub/Alfar/AlfarPowers.cs +++ b/JotunnModStub/Alfar/AlfarPowers.cs @@ -182,35 +182,64 @@ 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; - RaycastHit[] hits = Physics.RaycastAll(origin, direction, distance, ~0, QueryTriggerInteraction.Ignore); - float nearest = float.MaxValue; - foreach (RaycastHit hit in hits) + if (NearestHit(player, origin, direction, distance, out RaycastHit wall)) { - if (hit.collider.GetComponentInParent() == player) continue; - if (hit.distance < nearest) + 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) { - nearest = hit.distance; - destination = hit.point - direction * 0.6f; + // 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; } } - // 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; - } + if (!Pay(player, AlfarPowerConfig.SkridCost.Value)) return; 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. From b431bb9d1fdaa783ebfa59199b7619a8d188f1d9 Mon Sep 17 00:00:00 2001 From: kanym Date: Wed, 11 Nov 2026 18:43:43 +0100 Subject: [PATCH 2/2] docs: v1.6.10 adds the Skrid roof fix; Joacwoo credit --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1ca46cd..b7b5ff2 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Support the mod: [Patreon — NandorTheModder](https://www.patreon.com/c/NandorT ## New in v1.6.10 -**Drake forms hit the training dummy, the Ravager hits like a Brute, and an Alfr's hair stays gone.** Skadi's Moder and Fader melee could never hit the training dummy and landed before the animation did. The Ravager's attacks play the Brute's sounds and grow with Unarmed. Swapping items no longer flashes an Alfr's hair and beard. Full details in the [changelog](#v1610). +**Drake forms hit the training dummy, the Ravager hits like a Brute, and the Alfar stay off the roof.** Skadi's Moder and Fader melee could never hit the training dummy and landed before the animation did. The Ravager's attacks play the Brute's sounds and grow with Unarmed. Skrid no longer blinks an Alfr onto the roof of a crypt or cave, and swapping items no longer flashes their hair and beard. Full details in the [changelog](#v1610). --- @@ -495,7 +495,8 @@ Both halves have an off switch under `Factions` in Configuration Manager: **Fact ### 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 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 and Flandremonio for the report and the video. 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.