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

@ -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