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:
parent
6e87be3c77
commit
8aa917cfcb
9 changed files with 191 additions and 28 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
126
JotunnModStub/Trol/TrolGammelLog.cs
Normal file
126
JotunnModStub/Trol/TrolGammelLog.cs
Normal 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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue