chore(release): v1.4.16 - Trol True Form toggle past Fader, Gammeltroll thrown log

Past Fader the Trol's True Form never expires (SE ttl 0) and the key
toggles it off with no cooldown. The True Form log throw now fires one
projectile read off the Gammeltroll's own weapons at runtime, hitting
with the rock's damage formula, and falls back to the old physical log
if none is found; 'dumpgammel' logs what was resolved.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Ferdinando 2026-09-13 11:33:47 +02:00
commit 8aa917cfcb
9 changed files with 191 additions and 28 deletions

View file

@ -1,7 +1,7 @@
{
"name": "RacesOfValheim",
"description": "A Valheim mod that adds ten custom playable races (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.4.15",
"version_number": "1.4.16",
"website_url": "",
"dependencies": [
"denikson-BepInExPack_Valheim-5.4.2333",

View file

@ -376,7 +376,7 @@ namespace RacesOfValheim
sb.AppendLine("The Queen Defeated: Unlocked Log Weapon (in True Form, interact with trees to wield them as weapons). True Form size is massively increased.\n");
if (state >= 8)
sb.AppendLine("Fader Defeated: Your wielded trees can now instantly smash through the toughest materials in the Ashlands.\n");
sb.AppendLine("Fader Defeated: Your wielded trees can now instantly smash through the toughest materials in the Ashlands. True Form no longer runs out and has no cooldown - press the key again to return to your normal size.\n");
knownTexts["Trol Secrets"] = sb.ToString();
}

View file

@ -15,7 +15,7 @@ namespace RacesOfValheim
{
public const string PluginGUID = "com.nandor.racesofvalheim";
public const string PluginName = "Races Of Valheim";
public const string PluginVersion = "1.4.15";
public const string PluginVersion = "1.4.16";
private readonly Harmony harmony = new Harmony(PluginGUID);
@ -73,6 +73,7 @@ namespace RacesOfValheim
CommandManager.Instance.AddConsoleCommand(new ResetProgressionCommand());
CommandManager.Instance.AddConsoleCommand(new DumpDvergerCommand());
CommandManager.Instance.AddConsoleCommand(new DumpElderCommand());
CommandManager.Instance.AddConsoleCommand(new DumpGammelCommand());
CommandManager.Instance.AddConsoleCommand(new FenrirPackSpawnCommand());
CommandManager.Instance.AddConsoleCommand(new DumpPotionsCommand());
CommandManager.Instance.AddConsoleCommand(new ListPrefabsCommand());

View file

@ -111,7 +111,7 @@ namespace RacesOfValheim
const string trueForm = "Trol - True Form";
TrueFormDuration = config.Bind(trueForm, "Duration", 60f,
new ConfigDescription("Seconds True Form lasts before automatically reverting.", new AcceptableValueRange<float>(5f, 600f)));
new ConfigDescription("Seconds True Form lasts before automatically reverting. Ignored once Fader is defeated: the form then lasts until you press the key again.", new AcceptableValueRange<float>(5f, 600f)));
TrueFormCooldown = config.Bind(trueForm, "Cooldown", 600f,
new ConfigDescription("Seconds between True Form activations.", new AcceptableValueRange<float>(0f, 3600f)));
TrueFormScaleNormal = config.Bind(trueForm, "Scale", 2.0f,

View file

@ -0,0 +1,126 @@
using System.Collections.Generic;
using Jotunn.Entities;
using UnityEngine;
namespace RacesOfValheim
{
/// <summary>
/// The thrown log in True Form borrows ONE projectile from the Gammeltroll (Valheim 1.0), the
/// one it fires a whole rose of. The prefab names live in compressed asset bundles, so nothing
/// here is hard-coded past the monster itself: the projectile is read off the Gammeltroll's own
/// weapons at runtime, the same way Attack.Start would find it. Two shapes are handled:
/// - the rose is m_projectiles > 1 on the attack: the attack's projectile already IS one log;
/// - the rose is a single projectile that splits on hit (m_spawnOnHit with m_spawnCount > 1):
/// then the log is the child, and the parent would bring the whole rose along with it.
/// If none of that resolves, GetProjectile returns null and TrolRace falls back to the old
/// physical log. "dumpgammel" in the console logs what was actually found.
/// </summary>
public static class TrolGammelLog
{
private const string GammeltrollPrefab = "Gammeltroll";
private static GameObject cachedProjectile;
private static float cachedVelocity;
private static bool warned;
public static GameObject GetProjectile(out float velocity)
{
if (cachedProjectile == null && ZNetScene.instance != null)
{
Resolve(out cachedProjectile, out cachedVelocity, null);
if (cachedProjectile == null && !warned)
{
warned = true;
Jotunn.Logger.LogWarning("[Trol] Gammeltroll log projectile not found - falling back to the physical log throw. Run 'dumpgammel' to see why.");
}
}
velocity = cachedVelocity > 0f ? cachedVelocity : TrolConfig.ThrowLogVelocity.Value;
return cachedProjectile;
}
/// <summary>log is null for the silent path; the dump command passes a sink.</summary>
internal static void Resolve(out GameObject projectile, out float velocity, System.Action<string> log)
{
projectile = null;
velocity = 0f;
GameObject troll = FindGammeltroll();
if (troll == null) { log?.Invoke("Gammeltroll prefab not found in ZNetScene."); return; }
log?.Invoke($"Monster prefab: '{troll.name}'");
Humanoid humanoid = troll.GetComponent<Humanoid>();
if (humanoid == null) { log?.Invoke(" no Humanoid on it."); return; }
// Prefer the attack that fires several projectiles at once (the rose); any other
// projectile attack is only a fallback.
Attack best = null;
foreach (GameObject item in ItemsOf(humanoid))
{
ItemDrop drop = item != null ? item.GetComponent<ItemDrop>() : null;
if (drop == null) continue;
var shared = drop.m_itemData.m_shared;
foreach (Attack attack in new[] { shared.m_attack, shared.m_secondaryAttack })
{
if (attack == null) continue;
log?.Invoke($" item '{item.name}' anim='{attack.m_attackAnimation}' projectile='{(attack.m_attackProjectile != null ? attack.m_attackProjectile.name : "-")}' count={attack.m_projectiles} bursts={attack.m_projectileBursts} vel={attack.m_projectileVel} acc={attack.m_projectileAccuracy}");
if (attack.m_attackProjectile == null) continue;
if (best == null || (attack.m_projectiles > 1 && best.m_projectiles <= 1)) best = attack;
}
}
if (best == null) { log?.Invoke(" no attack with a projectile."); return; }
projectile = best.m_attackProjectile;
velocity = best.m_projectileVel;
Projectile p = projectile.GetComponent<Projectile>();
if (p != null)
{
log?.Invoke($" chosen '{projectile.name}': spawnOnHit='{(p.m_spawnOnHit != null ? p.m_spawnOnHit.name : "-")}' spawnCount={p.m_spawnCount} randomSpawns={(p.m_randomSpawnOnHit != null ? p.m_randomSpawnOnHit.Count : 0)} damage={p.m_damage.GetTotalDamage()}");
if (p.m_spawnOnHit != null && p.m_spawnCount > 1 && p.m_spawnOnHit.GetComponent<Projectile>() != null)
{
projectile = p.m_spawnOnHit;
log?.Invoke($" it splits on hit - using the child '{projectile.name}' instead.");
}
}
log?.Invoke($"=> thrown log: '{projectile.name}', velocity {velocity}");
}
private static GameObject FindGammeltroll()
{
GameObject exact = ZNetScene.instance.GetPrefab(GammeltrollPrefab);
if (exact != null) return exact;
foreach (GameObject prefab in ZNetScene.instance.m_prefabs)
{
if (prefab != null && prefab.name.ToLowerInvariant().Contains("gammel") && prefab.GetComponent<Humanoid>() != null)
return prefab;
}
return null;
}
private static IEnumerable<GameObject> ItemsOf(Humanoid h)
{
if (h.m_defaultItems != null) foreach (var go in h.m_defaultItems) yield return go;
if (h.m_randomWeapon != null) foreach (var go in h.m_randomWeapon) yield return go;
if (h.m_randomSets != null)
foreach (var set in h.m_randomSets)
if (set.m_items != null) foreach (var go in set.m_items) yield return go;
if (h.m_randomItems != null) foreach (var ri in h.m_randomItems) yield return ri.m_prefab;
}
}
public class DumpGammelCommand : ConsoleCommand
{
public override string Name => "dumpgammel";
public override string Help => "[DEBUG] Logs the Gammeltroll's projectile attacks and which one the Trol throws as a log";
public override void Run(string[] args)
{
if (ZNetScene.instance == null) { Console.instance.Print("Load a world first."); return; }
TrolGammelLog.Resolve(out _, out _, line =>
{
Jotunn.Logger.LogInfo("[dumpgammel] " + line);
Console.instance.Print(line);
});
}
}
}

View file

@ -202,6 +202,12 @@ namespace RacesOfValheim
// Grabbing a log now has its own key (TrolConfig.GrabLogKey, see TryGrabLog) -
// pressing True Form again while already transformed no longer tries to grab
// whatever you happen to be looking at.
// Past Fader the form never runs out, so the key is a toggle instead: dropping
// the SE lets Update's auto-revert check shrink the Trol back.
if (BossProgressionManager.GetCurrentProgressionState() >= 8 && !isTransforming)
{
Player.m_localPlayer.GetSEMan().RemoveStatusEffect("SE_TrolTrueForm".GetStableHashCode(), true);
}
return;
}
@ -288,7 +294,9 @@ namespace RacesOfValheim
visual.transform.localScale = targetScale;
}
Player.m_localPlayer.GetSEMan().AddStatusEffect("SE_TrolTrueFormCooldown".GetStableHashCode(), true);
// No cooldown past Fader - reverting is a choice there, not the form running out.
if (BossProgressionManager.GetCurrentProgressionState() < 8)
Player.m_localPlayer.GetSEMan().AddStatusEffect("SE_TrolTrueFormCooldown".GetStableHashCode(), true);
isTransforming = false;
}
@ -342,9 +350,24 @@ namespace RacesOfValheim
if (isHoldingLog && !string.IsNullOrEmpty(logName))
{
// Spawn original log asset further away so it doesn't instantly collide with the player
// Spawn further away so it doesn't instantly collide with the player
Vector3 logSpawnPos = Player.m_localPlayer.GetEyePoint() + Player.m_localPlayer.GetLookDir() * 3.5f;
GameObject originalLogPrefab = ZNetScene.instance.GetPrefab(logName);
// One log out of the Gammeltroll's rose (see TrolGammelLog); the physical log
// below is only the fallback if that projectile can't be found.
GameObject gammelPrefab = TrolGammelLog.GetProjectile(out float gammelVelocity);
Projectile gammelProj = null;
if (gammelPrefab != null)
{
GameObject gammelInstance = UnityEngine.Object.Instantiate(gammelPrefab, logSpawnPos, Quaternion.LookRotation(Player.m_localPlayer.GetLookDir()));
gammelProj = gammelInstance.GetComponent<Projectile>();
if (gammelProj != null)
gammelProj.Setup(Player.m_localPlayer, Player.m_localPlayer.GetLookDir() * gammelVelocity, -1f, BuildThrowHitData(isTrueForm), null, null);
else
ZNetScene.instance.Destroy(gammelInstance);
}
GameObject originalLogPrefab = gammelProj == null ? ZNetScene.instance.GetPrefab(logName) : null;
if (originalLogPrefab != null)
{
GameObject logInstance = UnityEngine.Object.Instantiate(originalLogPrefab, logSpawnPos, Quaternion.LookRotation(Player.m_localPlayer.GetLookDir()));
@ -373,29 +396,36 @@ namespace RacesOfValheim
Projectile proj = projInstance.GetComponent<Projectile>();
if (proj != null)
{
HitData hitData = new HitData();
hitData.m_damage.m_blunt = TrolConfig.ThrowRockBaseDamage.Value;
if (BossProgressionManager.GetCurrentProgressionState() >= 4)
{
hitData.m_damage.m_blunt += TrolConfig.ThrowRockBonemassBonus.Value;
}
if (BossProgressionManager.GetCurrentProgressionState() >= 6)
{
hitData.m_damage.m_blunt += TrolConfig.ThrowRockYagluthBonus.Value;
}
if (isTrueForm)
{
hitData.m_damage.m_blunt += TrolConfig.ThrowRockTrueFormBonus.Value;
}
hitData.SetAttacker(Player.m_localPlayer);
proj.Setup(Player.m_localPlayer, Player.m_localPlayer.GetLookDir() * TrolConfig.ThrowRockProjectileVelocity.Value, -1f, hitData, null, null);
proj.Setup(Player.m_localPlayer, Player.m_localPlayer.GetLookDir() * TrolConfig.ThrowRockProjectileVelocity.Value, -1f, BuildThrowHitData(isTrueForm), null, null);
}
}
}
}
// Shared by the rock and the Gammeltroll log, so a thrown log hits as hard as a
// True Form rock rather than with whatever the monster's own weapon carries.
private static HitData BuildThrowHitData(bool isTrueForm)
{
HitData hitData = new HitData();
hitData.m_damage.m_blunt = TrolConfig.ThrowRockBaseDamage.Value;
if (BossProgressionManager.GetCurrentProgressionState() >= 4)
{
hitData.m_damage.m_blunt += TrolConfig.ThrowRockBonemassBonus.Value;
}
if (BossProgressionManager.GetCurrentProgressionState() >= 6)
{
hitData.m_damage.m_blunt += TrolConfig.ThrowRockYagluthBonus.Value;
}
if (isTrueForm)
{
hitData.m_damage.m_blunt += TrolConfig.ThrowRockTrueFormBonus.Value;
}
hitData.SetAttacker(Player.m_localPlayer);
return hitData;
}
}
public class LogImpactBreaker : MonoBehaviour

View file

@ -35,7 +35,9 @@ namespace RacesOfValheim
name = "SE_TrolTrueForm";
m_name = "True Form";
m_tooltip = "You have unleashed your inner troll!";
m_ttl = TrolConfig.TrueFormDuration.Value;
// Past Fader the form no longer runs out: m_ttl 0 is vanilla's "never expires", and
// the True Form key becomes the only way back (see TrolRace.TryTrueForm).
m_ttl = BossProgressionManager.GetCurrentProgressionState() >= 8 ? 0f : TrolConfig.TrueFormDuration.Value;
GameObject itemPrefab = PrefabManager.Cache.GetPrefab<GameObject>("Stone");
if (itemPrefab != null)

View file

@ -268,7 +268,7 @@ Build a **Brood Mound** with the hammer — no more than two within its density
- **Moder:** Unlock True Form.
- **Yagluth:** +5% size, +50 carry, +5 club/unarmed/axes, +5 rock throw, unlocks 5th food slot.
- **Queen:** Log Weapon (True Form): interact with trees to wield/throw. True Form is massive (2.5x size).
- **Fader:** Trees you wield instantly destroy any material in Ashlands.
- **Fader:** Trees you wield instantly destroy any material in Ashlands. True Form lasts forever and the key becomes a toggle (no cooldown).
</details>
@ -410,6 +410,10 @@ Both halves have an off switch under `Factions` in Configuration Manager: **Fact
## Changelog
### v1.4.16
- **CHANGED - The Trol's True Form no longer runs out after Fader:** once Fader is defeated the form lasts until you press the True Form key again, and there is no cooldown — reverting is a choice there, not the form running out. Before Fader nothing changes: it lasts `Duration` seconds and then the cooldown applies. The radial menu entry presses the same key, so it is a toggle from the gamepad too. A form already running when Fader falls keeps its old duration; the next one is permanent.
- **CHANGED - The Trol's thrown log is a Gammeltroll log:** in True Form the log you throw is now one of the projectiles the Gammeltroll (Valheim 1.0) fires in a rose, just one instead of the whole spread. It is read off the monster's own weapons at runtime rather than by a hard-coded name. It hits exactly as hard as a True Form rock, with the same `Throw Rock` bonuses from Bonemass and Yagluth, and it no longer breaks into wood. If the projectile can't be found, the old physical log is thrown instead and a warning goes to the log. `dumpgammel` in the console shows what was found.
### v1.4.15
- **Fix - Bone Servants stopped working at every furnace, hearth and mead barrel after the 1.0 update:** Valheim 1.0 added an extra value to the calls that put an item into a station, and the servant was still sending the old ones. At a smelter, kiln, windmill or spinning wheel that threw an `EndOfStreamException` into the log on every tick and the Bone Smith stood in front of it holding its ore; the Bone Cook hit the same wall at hearths and ovens, and reading the cooking slots failed too. The mead barrel failed silently — 1.0 now identifies its contents by a number instead of a name, so the servant's "do you take this?" was answered no for every ingredient and barrels were never filled. All four are fixed; nothing a servant was carrying was lost, it simply could not put it down.
- **Fix - The Aswid blood brews lost their four-times fermentation speed:** the same 1.0 change to how a barrel records its contents meant the check for "is one of our blood bases in there?" read nothing for every barrel, so blood brews fermented at vanilla speed. They are back to four times as fast.

View file

@ -1,7 +1,7 @@
{
"name": "RacesOfValheim",
"description": "A Valheim mod that adds ten custom playable races (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.4.15",
"version_number": "1.4.16",
"website_url": "",
"dependencies": [
"denikson-BepInExPack_Valheim-5.4.2333",