feat(trol): True Form wears Valheim's own troll
True Form now hides the Trol's body and puts the vanilla forest troll's model in its place, on the owner's client and on every other player's. The costume stands as tall as the old True Form did: it follows the Visual scale Trol_PlayerUpdate_Patch already grows and publishes, so the grow-in, the shrink back and the size others see come for free. It takes the Trol skin colour from Trol - Appearance. Weapons are out while it is up. Left click is the troll's punch, right click its ground slam, and with a log in hand they become its two log swings, which wear the log down per hit as a club swing did. Throw Rock plays the troll's throw. The attacks, their triggers and reach are read off the troll's own weapons at runtime, and each hit lands on the troll's OnAttackTrigger event rather than a fixed delay. Damage is a share of the troll's own (Troll Attack Damage, 0.5), scaled by the Clubs skill like a club and hit as Clubs, so the True Form and tier melee bonuses still add on top. Other players see the troll from the existing True Form ZDO flag, with attacks replayed from a new trigger key. New options in Trol - True Form: Troll Model (on/off), Troll Model Size, Troll Attack Damage.
This commit is contained in:
parent
927bda1bbc
commit
c64cb393c7
4 changed files with 835 additions and 2 deletions
|
|
@ -153,6 +153,10 @@ namespace RacesOfValheim
|
|||
|
||||
private void Update()
|
||||
{
|
||||
// Before the race check, on purpose: a race change or a death has to take the troll
|
||||
// costume off, and nothing below the check runs for them any more.
|
||||
TrolTrueFormModel.Tick(Player.m_localPlayer);
|
||||
|
||||
if (!IsTrol()) return;
|
||||
|
||||
if (RaceInput.Allowed)
|
||||
|
|
@ -247,6 +251,8 @@ namespace RacesOfValheim
|
|||
if (nview != null && nview.IsValid()) nview.GetZDO().Set(Trol_PlayerUpdate_Patch.TrueFormKey, false);
|
||||
}
|
||||
|
||||
if (TrolTrueFormModel.RemoveLocal(player)) hadForm = true;
|
||||
|
||||
isTransforming = false;
|
||||
wasTrueFormActive = false;
|
||||
return hadForm;
|
||||
|
|
@ -402,8 +408,20 @@ namespace RacesOfValheim
|
|||
Player.m_localPlayer.GetInventory().RemoveItem(rightItem);
|
||||
}
|
||||
|
||||
// Wait a moment for the animation to reach the throw point
|
||||
yield return new WaitForSeconds(0.4f);
|
||||
// Wait a moment for the animation to reach the throw point. Wearing the troll, that is
|
||||
// the troll's own throw, and the rock leaves the hand on its OnAttackTrigger.
|
||||
TrolTrueFormBehavior troll = isTrueForm ? FindObjectOfType<TrolTrueFormBehavior>() : null;
|
||||
int baseline = troll != null ? troll.PlayThrow() : -1;
|
||||
if (baseline >= 0)
|
||||
{
|
||||
float started = Time.time;
|
||||
while (TrolTrueFormModel.AttackEvents == baseline && Time.time - started < 1.5f) yield return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
yield return new WaitForSeconds(0.4f);
|
||||
}
|
||||
if (Player.m_localPlayer == null) yield break;
|
||||
|
||||
Vector3 spawnPos = Player.m_localPlayer.GetEyePoint() + Player.m_localPlayer.GetLookDir() * 1.5f;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue