Merge branch 'balance-aswid': the Aswid rebalance - stamina, devour, bat flight, weaknesses

This commit is contained in:
kanym 2026-10-26 16:06:05 +01:00
commit 04e540a89d
25 changed files with 1179 additions and 553 deletions

View file

@ -1,182 +0,0 @@
using HarmonyLib;
using UnityEngine;
namespace RacesOfValheim
{
/// <summary>
/// Why nothing in Valheim ever attacked the bat, and the smallest honest fix for it.
///
/// The bat flies on Player.m_debugFly - the developer no-clip flag - because that is the only
/// flight vanilla actually has, and it is what BatFormBehavior sets and WarVultureMount reuses.
/// What nobody noticed is that vanilla reads that same flag as "this player is not really
/// here". Six places, all read out of assembly_valheim with Cecil rather than guessed:
///
/// BaseAI.CanHearTarget - first line: the target is a Player in debug fly -> return false.
/// BaseAI.CanSeeTarget - the same first line, the same false.
/// BaseAI.FindEnemy - its HuntPlayer fallback throws the player away for the same reason.
/// MonsterAI.UpdateSleep - a sleeping monster refuses to wake for one, twice over.
/// Character.ApplyDamage - first line: IsDebugFlying -> return, the hit does nothing.
/// Character.RPC_Damage - the same.
///
/// So the bat was never merely ignored: it was invulnerable as well, and both facts came out of
/// the one flag. There was nothing wrong with the Aswid's own code, which is why nothing in it
/// looked wrong.
///
/// The fix keeps the flag - it IS the flight - and lies about it in exactly the places that
/// decide aggro and damage, and nowhere else:
///
/// Player.InDebugFlyMode() is forced false for a bat unconditionally. That is safe, and it is
/// the reason this file is short: a scan of the whole assembly says that method has
/// exactly three callers, and all three are the sensing paths listed above. No part of
/// flight, camera, stamina or motion goes through it.
/// Player.IsDebugFlying() is NOT forced false, because Character.UpdateMotion reads it and
/// that read is what holds the bat in the air. It is only forced false while the call
/// stack is inside one of the three vanilla methods that must not honour it, which is
/// what the depth counter below is for.
///
/// Both halves sit behind their own config toggle, so a bat can be made visible-but-immortal,
/// or put back the way it was, without touching code.
/// </summary>
public static class AswidBatForm
{
/// <summary>
/// The ZDO flag AswidRace writes when the form goes up. Replicated, so it answers for
/// remote players too - which matters here, because the machine asking "is this player a
/// bat" is whichever one owns the monster, not the bat's own.
/// </summary>
public const string BatZdoKey = "Aswid_IsBatForm";
private static readonly int BatFormHash = "SE_BatForm".GetStableHashCode();
// How deep we currently are inside vanilla calls that must not see the debug-fly flag. A
// counter and not a bool: ApplyDamage runs inside RPC_Damage, so the frames nest.
private static int unmaskDepth;
public static bool Unmasked => unmaskDepth > 0;
public static void PushUnmask() { unmaskDepth++; }
public static void PopUnmask() { if (unmaskDepth > 0) unmaskDepth--; }
/// <summary>
/// The ZDO first and the status effect only as a fallback: the ZDO is the one that is true
/// on every client, and the status effect covers the local player during the frames of the
/// transform where the ZDO write has not landed yet.
/// </summary>
public static bool IsBat(Player player)
{
if (player == null) return false;
ZNetView nview = player.GetComponent<ZNetView>();
if (nview != null && nview.IsValid() && nview.GetZDO().GetBool(BatZdoKey, false)) return true;
return player == Player.m_localPlayer &&
player.GetSEMan() != null &&
player.GetSEMan().HaveStatusEffect(BatFormHash);
}
}
/// <summary>
/// The whole of the aggro fix. See AswidBatForm for why patching this one method flat is safe,
/// and why patching IsDebugFlying flat would drop the bat out of the sky instead.
/// </summary>
[HarmonyPatch(typeof(Player), "InDebugFlyMode")]
public static class Aswid_BatIsVisibleToAI_Patch
{
public static void Postfix(Player __instance, ref bool __result)
{
if (!__result) return;
if (AswidConfig.BatFormAggro != null && !AswidConfig.BatFormAggro.Value) return;
if (AswidBatForm.IsBat(__instance)) __result = false;
}
}
/// <summary>
/// The scoped half. Only ever fires inside the three vanilla methods that push the counter, and
/// only for a player who is a bat - so the flag still reads true everywhere flight, motion, the
/// camera and Player.UpdateStats look at it.
/// </summary>
[HarmonyPatch(typeof(Player), "IsDebugFlying")]
public static class Aswid_BatIsDebugFlying_Patch
{
public static void Postfix(Player __instance, ref bool __result)
{
if (!__result || !AswidBatForm.Unmasked) return;
if (AswidBatForm.IsBat(__instance)) __result = false;
}
}
/// <summary>
/// A hit landing on a bat. Finalizer rather than Postfix throughout this file: the counter has
/// to come back down even when the patched method throws, and a Postfix does not run then. A
/// void Finalizer leaves the original exception alone, so nothing is swallowed either.
/// </summary>
[HarmonyPatch(typeof(Character), "ApplyDamage")]
public static class Aswid_BatTakesDamage_Patch
{
public static void Prefix(Character __instance, ref bool __state)
{
__state = (AswidConfig.BatFormVulnerable == null || AswidConfig.BatFormVulnerable.Value)
&& __instance is Player player && AswidBatForm.IsBat(player);
if (__state) AswidBatForm.PushUnmask();
}
public static void Finalizer(bool __state)
{
if (__state) AswidBatForm.PopUnmask();
}
}
/// <summary>The networked half of the same thing: a hit sent by another machine.</summary>
[HarmonyPatch(typeof(Character), "RPC_Damage")]
public static class Aswid_BatTakesRemoteDamage_Patch
{
public static void Prefix(Character __instance, ref bool __state)
{
__state = (AswidConfig.BatFormVulnerable == null || AswidConfig.BatFormVulnerable.Value)
&& __instance is Player player && AswidBatForm.IsBat(player);
if (__state) AswidBatForm.PushUnmask();
}
public static void Finalizer(bool __state)
{
if (__state) AswidBatForm.PopUnmask();
}
}
/// <summary>
/// Sleepers. Unlike the two above this cannot pre-check who the player is - UpdateSleep picks
/// the closest one itself, and that may be a remote bat - so the counter goes up for the whole
/// call and the per-player test happens in the IsDebugFlying postfix, where it costs nothing:
/// that postfix only runs at all for a character who is already flying.
/// </summary>
[HarmonyPatch(typeof(MonsterAI), "UpdateSleep")]
public static class Aswid_BatWakesSleepers_Patch
{
public static void Prefix(ref bool __state)
{
__state = AswidConfig.BatFormAggro == null || AswidConfig.BatFormAggro.Value;
if (__state) AswidBatForm.PushUnmask();
}
public static void Finalizer(bool __state)
{
if (__state) AswidBatForm.PopUnmask();
}
}
/// <summary>
/// Dying as a bat only became possible with the patches above, and the revert path could not
/// handle it: AswidRace.Update() returns early on IsDead(), so the coroutine that takes the
/// form down never starts. The debug-fly flag would stay on and the ZDO would stay true, which
/// is a respawned player floating over the ground with a bat drawn on them.
/// </summary>
[HarmonyPatch(typeof(Player), "OnDeath")]
public static class Aswid_BatDiesAsBat_Patch
{
public static void Prefix(Player __instance)
{
if (__instance != Player.m_localPlayer) return;
if (AswidRace.Instance == null) return;
AswidRace.Instance.HardResetBatForm();
}
}
}

View file

@ -1,57 +0,0 @@
using HarmonyLib;
using UnityEngine;
namespace RacesOfValheim
{
/// <summary>
/// How fast the bat flies, as a factor on vanilla's own debug-fly speed.
///
/// The form flies on Player.m_debugFly (see AswidBatForm for why), so its speed is whatever
/// Character.UpdateDebugFly decides. Read out of assembly_valheim rather than assumed, that
/// method ends with:
///
/// m_currentVel = Vector3.Lerp(m_currentVel, b, 0.5f);
/// m_body.linearVelocity = m_currentVel;
///
/// where b is m_moveDir times m_debugFlySpeed - a public STATIC INT, 20 by default, times 2.5
/// while the run key is held.
///
/// Two ways to make that faster were rejected before this one:
///
/// Retuning m_debugFlySpeed around the call. It is shared by every character in the game and
/// it is an int, so a 1.35x multiplier would land on 27 and a 1.37x on the same 27 - the
/// slider would move in 5% steps and would be writing a global while it did it.
///
/// Scaling m_currentVel itself, which is what WarVultureMount does for the bird. That field
/// is the input to the NEXT frame's lerp, so scaling it feeds back: with a factor s the
/// velocity settles at 0.5s/(1-0.5s) times vanilla, not s times it, and at s >= 2 it does
/// not settle at all.
///
/// So only the rigidbody is scaled, and m_currentVel is left exactly as vanilla wrote it. The
/// lerp keeps smoothing the same trajectory it always did - the ramp up, the ease off, the
/// standstill at zero input - and the bat simply covers it faster. Linear in the slider, with
/// nothing to accumulate.
/// </summary>
[HarmonyPatch(typeof(Character), "UpdateDebugFly")]
public static class Aswid_BatFlightSpeed_Patch
{
public static void Postfix(Character __instance, Vector3 ___m_currentVel, Rigidbody ___m_body)
{
// Bound from RacesOfValheim.Awake(), before harmony.PatchAll() - the null check is for
// the config that failed to bind at all, not for a race between the two.
if (AswidConfig.BatFormFlightSpeed == null) return;
float multiplier = AswidConfig.BatFormFlightSpeed.Value;
if (Mathf.Approximately(multiplier, 1f)) return;
// Local player only. Every other machine's bat moves on its replicated position, and
// scaling velocity here would fight that sync rather than help it.
Player player = __instance as Player;
if (player == null || player != Player.m_localPlayer) return;
if (___m_body == null) return;
if (!AswidBatForm.IsBat(player)) return;
___m_body.linearVelocity = ___m_currentVel * multiplier;
}
}
}

View file

@ -0,0 +1,59 @@
using HarmonyLib;
using UnityEngine;
namespace RacesOfValheim
{
/// <summary>
/// Whether a player is a bat, on any client.
///
/// This file used to be AswidBatAggro: while the bat flew on vanilla's debug-fly flag, vanilla
/// read that flag as "this player is not really here" - no monster could see, hear or wake for
/// it, and every hit on it was dropped - and six patches here lied about the flag in exactly
/// those places. The bat now flies on m_flying (DirectedFlight.cs), which vanilla's AI and
/// damage never look at, so monsters notice and hurt it with no help, and the lie went.
/// </summary>
public static class AswidBatForm
{
/// <summary>
/// The ZDO flag AswidRace writes when the form goes up. Replicated, so it answers for
/// remote players too.
/// </summary>
public const string BatZdoKey = "Aswid_IsBatForm";
private static readonly int BatFormHash = "SE_BatForm".GetStableHashCode();
/// <summary>
/// The ZDO first and the status effect only as a fallback: the ZDO is the one that is true
/// on every client, and the status effect covers the local player during the frames of the
/// transform where the ZDO write has not landed yet.
/// </summary>
public static bool IsBat(Player player)
{
if (player == null) return false;
ZNetView nview = player.GetComponent<ZNetView>();
if (nview != null && nview.IsValid() && nview.GetZDO().GetBool(BatZdoKey, false)) return true;
return player == Player.m_localPlayer &&
player.GetSEMan() != null &&
player.GetSEMan().HaveStatusEffect(BatFormHash);
}
}
/// <summary>
/// The revert path cannot handle a bat that dies: AswidRace.Update() returns early on IsDead(),
/// so the coroutine that takes the form down never starts. The flight flag would stay on and
/// the ZDO would stay true, which is a respawned player floating over the ground with a bat
/// drawn on them.
/// </summary>
[HarmonyPatch(typeof(Player), "OnDeath")]
public static class Aswid_BatDiesAsBat_Patch
{
public static void Prefix(Player __instance)
{
if (__instance != Player.m_localPlayer) return;
if (AswidRace.Instance == null) return;
AswidRace.Instance.HardResetBatForm();
}
}
}

View file

@ -33,13 +33,64 @@ namespace RacesOfValheim
public static ConfigEntry<float> BloodMagicSkillGainMultiplier;
public static ConfigEntry<float> SurtlingFormDamageBonus;
// ─── Stamina ─────────────────────────────────────────────────────────────
// The race used to have infinite stamina. Now it has a large pool that grows with each
// boss, on top of what its devoured food gives - added, never assigned, so stamina mods
// still stack.
public static ConfigEntry<float> BaseStaminaBonus;
public static ConfigEntry<float> StaminaBonusPerState;
public static ConfigEntry<float> StaminaCostMultiplier;
// ─── Weaknesses ──────────────────────────────────────────────────────────
// The Discord reports said the race had no real downsides. Each weakness has its own
// switch, so a single player can drop one; on a server the host's values win.
public static ConfigEntry<bool> SunlightEnabled;
public static ConfigEntry<float> SunHealthRegenPenalty;
public static ConfigEntry<float> SunStaminaRegenPenalty;
public static ConfigEntry<float> SunSpeedPenalty;
public static ConfigEntry<float> SunHealthLossPerSecond;
public static ConfigEntry<float> SunHealthFloor;
public static ConfigEntry<bool> FireWeaknessEnabled;
public static ConfigEntry<float> FireWeakness;
public static ConfigEntry<bool> FaderRemovesFireWeakness;
public static ConfigEntry<bool> PierceWeaknessEnabled;
public static ConfigEntry<float> PierceWeakness;
// ─── Running Water ─────────────────────────────────────────────────────
// Lore says a vampire cannot cross running water unaided (Dagaz's report). Swimming costs
// more, and open water - sea, river or lake - burns, swimming or flying over it; a boat
// carries you, which the lore allows, though the camera still sways on board. The camera sway is a per-player comfort choice and stays local
// (ConfigSync's "camera sway" key part).
public static ConfigEntry<bool> RunningWaterEnabled;
public static ConfigEntry<bool> WaterOceanOnly;
public static ConfigEntry<float> SwimStaminaMultiplier;
public static ConfigEntry<float> SeaHealthLossPerSecond;
public static ConfigEntry<float> SeaStaminaDrainPerSecond;
public static ConfigEntry<float> SeaHealthFloor;
public static ConfigEntry<bool> SeaCameraSway;
public static ConfigEntry<float> SeaCameraSwayStrength;
// ─── Bat Form ────────────────────────────────────────────────────────────
// Both of these undo something vanilla does to any player on the debug-fly flag, which is
// what the bat flies on. See AswidBatAggro for the six vanilla methods involved.
public static ConfigEntry<bool> BatFormAggro;
public static ConfigEntry<bool> BatFormVulnerable;
// A factor on vanilla's debug-fly speed, not a speed in metres - see AswidBatFlight.
public static ConfigEntry<float> BatFormFlightSpeed;
// The bat flies on the same directed flight as the Skadi's drakes (DirectedFlight.cs),
// with its own numbers. It used to fly on vanilla's debug-fly flag: 50 m/s, free, blind
// to carry weight, and ignored by every monster until AswidBatAggro lied to six vanilla
// methods about it. None of that is left.
public enum EncumberedMode { Allowed, Blocked }
public static ConfigEntry<float> BatTurnSpeed;
public static ConfigEntry<float> BatGlideSpeed;
public static ConfigEntry<float> BatBoostSpeed;
public static ConfigEntry<float> BatSprintSpeed;
public static ConfigEntry<float> BatReverseSpeed;
public static ConfigEntry<float> BatLiftoffSpeed;
public static ConfigEntry<float> BatHoverSeconds;
public static ConfigEntry<float> BatPoweredStaminaPerSecond;
public static ConfigEntry<float> BatSprintStaminaPerSecond;
public static ConfigEntry<EncumberedMode> BatEncumbered;
public static ConfigEntry<float> BatEncumberedExtraCost;
public static ConfigEntry<float> BatMaxDuration;
public static ConfigEntry<float> BatDurationPerState;
public static ConfigEntry<float> BatCooldown;
// ─── Vampiric Aura (passive, always active) ──────────────────────────────
public static ConfigEntry<float> AuraTickInterval;
@ -48,6 +99,8 @@ namespace RacesOfValheim
public static ConfigEntry<float> AuraBaseDamage;
public static ConfigEntry<float> AuraBloodMagicScaling;
public static ConfigEntry<float> AuraExecuteThreshold;
public static ConfigEntry<bool> AuraInBatForm;
public static ConfigEntry<int> BatAuraUnlockState;
// ─── Superhuman Senses (tier 5+ passive) ─────────────────────────────────
public static ConfigEntry<float> SensesRadius;
@ -62,6 +115,12 @@ namespace RacesOfValheim
// ─── Devour ────────────────────────────────────────────────────────────
public static ConfigEntry<float> DevourCooldown;
// What a devoured creature feeds - see AswidRace.ApplyFoodBalance.
public static ConfigEntry<float> DevourHealthMultiplier;
public static ConfigEntry<float> DevourStaminaShare;
public static ConfigEntry<float> EarlyStaminaShare;
public static ConfigEntry<float> FoodCapBase;
public static ConfigEntry<float> FoodCapPerBiome;
// ─── Domination (tier 6+ ability, native Interact key) ───────────────────
public static ConfigEntry<float> EnslaveCooldown;
@ -130,13 +189,89 @@ namespace RacesOfValheim
SurtlingFormDamageBonus = config.Bind(combat, "Surtling Form Damage Bonus", 30f,
new ConfigDescription("Flat damage added to every attack once the tier 8 Surtling form is unlocked.", new AcceptableValueRange<float>(0f, 100f)));
const string stamina = "Aswid - Stamina";
BaseStaminaBonus = config.Bind(stamina, "Base Stamina Bonus", 25f,
new ConfigDescription("Max stamina added on top of the game's base 75 and your food, before any boss.", new AcceptableValueRange<float>(0f, 300f)));
StaminaBonusPerState = config.Bind(stamina, "Stamina Bonus Per State", 10f,
new ConfigDescription("Max stamina added per progression state (8 at Fader).", new AcceptableValueRange<float>(0f, 50f)));
StaminaCostMultiplier = config.Bind(stamina, "Stamina Cost Multiplier", 1f,
new ConfigDescription("Multiplies every stamina cost: sprinting, swimming, attacks, blocking. 1 is the normal cost, 0.5 half. There is no infinite setting on purpose; set the bonuses above high instead.", new AcceptableValueRange<float>(0.1f, 2f)));
const string weak = "Aswid - Weaknesses";
SunlightEnabled = config.Bind(weak, "Sunlight", true,
new ConfigDescription("Weakens you by day while you stand under open sky. A roof (the same test as the game's Sheltered status), a dungeon, the Swamp, the Mistlands, the night and your own Eclipse all shield you.", null));
SunHealthRegenPenalty = config.Bind(weak, "Sunlight Health Regen Penalty", 0.5f,
new ConfigDescription("Health regeneration lost in sunlight. 0.5 = half.", new AcceptableValueRange<float>(0f, 1f)));
SunStaminaRegenPenalty = config.Bind(weak, "Sunlight Stamina Regen Penalty", 0.25f,
new ConfigDescription("Stamina regeneration lost in sunlight. 0.25 = a quarter.", new AcceptableValueRange<float>(0f, 1f)));
SunSpeedPenalty = config.Bind(weak, "Sunlight Speed Penalty", 0.1f,
new ConfigDescription("Movement speed lost in sunlight. 0.1 = 10% slower.", new AcceptableValueRange<float>(0f, 0.9f)));
SunHealthLossPerSecond = config.Bind(weak, "Sunlight Health Loss Per Second", 0.5f,
new ConfigDescription("Health the sun burns away each second. 0 turns it off.", new AcceptableValueRange<float>(0f, 10f)));
SunHealthFloor = config.Bind(weak, "Sunlight Health Floor", 0.3f,
new ConfigDescription("The sun stops burning at this fraction of your max health, so it weakens you but never kills you. 0.3 = 30%.", new AcceptableValueRange<float>(0f, 1f)));
FireWeaknessEnabled = config.Bind(weak, "Fire Weakness", true,
new ConfigDescription("Fire, burning included, hurts more.", null));
FireWeakness = config.Bind(weak, "Fire Weakness Amount", 0.25f,
new ConfigDescription("Extra fire damage taken. 0.25 = 25% more. Resistance meads and armour still reduce it.", new AcceptableValueRange<float>(0f, 2f)));
FaderRemovesFireWeakness = config.Bind(weak, "Fader Removes Fire Weakness", true,
new ConfigDescription("Defeating Fader, the boss that grants the Surtling form, ends the fire weakness.", null));
PierceWeaknessEnabled = config.Bind(weak, "Pierce Weakness", true,
new ConfigDescription("Pierce damage (arrows, spears, stakes) hurts more. Mist Form's immunity still wins.", null));
PierceWeakness = config.Bind(weak, "Pierce Weakness Amount", 0.2f,
new ConfigDescription("Extra pierce damage taken. 0.2 = 20% more.", new AcceptableValueRange<float>(0f, 2f)));
const string water = "Aswid - Running Water";
RunningWaterEnabled = config.Bind(water, "Running Water", true,
new ConfigDescription("Swimming costs more stamina, and open water - the sea, rivers, lakes - hurts you while you swim in it or fly over it. Standing on, steering or sitting in a boat protects you. Wading, docks and bridges are safe.", null));
WaterOceanOnly = config.Bind(water, "Ocean Only", false,
new ConfigDescription("Limits the burn, the drain and the camera sway to the Ocean biome, leaving rivers and lakes alone. The swim stamina cost applies everywhere either way.", null));
SwimStaminaMultiplier = config.Bind(water, "Swim Stamina Multiplier", 2f,
new ConfigDescription("Multiplies the stamina swimming costs, anywhere. At 0 stamina the game's own drowning starts. Around 5 and up, swimming any distance is no longer possible.", new AcceptableValueRange<float>(1f, 10f)));
SeaHealthLossPerSecond = config.Bind(water, "Open Water Health Loss Per Second", 1f,
new ConfigDescription("Health open water burns away each second.", new AcceptableValueRange<float>(0f, 20f)));
SeaStaminaDrainPerSecond = config.Bind(water, "Open Water Stamina Drain Per Second", 2f,
new ConfigDescription("Stamina open water drains each second, on top of what swimming or flying costs.", new AcceptableValueRange<float>(0f, 30f)));
SeaHealthFloor = config.Bind(water, "Open Water Health Floor", 0.1f,
new ConfigDescription("The water's burn stops at this fraction of your max health. Drowning, once your stamina runs out, has no floor.", new AcceptableValueRange<float>(0f, 1f)));
SeaCameraSway = config.Bind(water, "Camera Sway", true,
new ConfigDescription("The camera rolls gently while you are out on the water, on a boat too, as if seasick. Local: each player chooses for themselves.", null));
SeaCameraSwayStrength = config.Bind(water, "Camera Sway Strength", 1f,
new ConfigDescription("How far the camera rolls. 1 is about 4 degrees. Local.", new AcceptableValueRange<float>(0f, 3f)));
const string batform = "Aswid - Bat Form";
BatFormAggro = config.Bind(batform, "Monsters Notice The Bat", true,
new ConfigDescription("Lets monsters see, hear and wake up for a player in Bat Form. Vanilla refuses to notice anyone flying on the debug-fly flag, which is the flag the form uses - turn this off to go back to a bat nothing ever looks at."));
BatFormVulnerable = config.Bind(batform, "The Bat Can Be Hurt", true,
new ConfigDescription("Lets damage land on a player in Bat Form. Same cause as the setting above: vanilla drops every hit on a debug-flying character. Turn this off for a bat that is noticed and chased but cannot be killed."));
BatFormFlightSpeed = config.Bind(batform, "Flight Speed", 1f,
new ConfigDescription("How fast the bat flies, as a multiplier on the game's own flight speed (20 m/s, and 2.5x that while the run key is held). 1 is untouched, 2 is twice as fast, 0.5 is half. Local only - it changes how your own bat moves, not anyone else's.", new AcceptableValueRange<float>(0.25f, 3f)));
// Same controls as the Skadi's drake: aim with the camera, W beats forward, Shift
// sprints, S beats backwards, and letting go hovers briefly before gliding down.
BatTurnSpeed = config.Bind(batform, "Turn Speed", 180f,
new ConfigDescription("Degrees per second the bat turns towards where you aim.", new AcceptableValueRange<float>(30f, 720f)));
BatGlideSpeed = config.Bind(batform, "Glide Speed", 6f,
new ConfigDescription("Speed while gliding down with no key held, in m/s.", new AcceptableValueRange<float>(0f, 30f)));
// Not "Flight Speed": that key held the old debug-fly multiplier, and an existing .cfg
// would load its 1 here as one metre per second.
BatBoostSpeed = config.Bind(batform, "Boost Speed", 13f,
new ConfigDescription("Speed while holding W, in m/s. Costs the powered stamina below.", new AcceptableValueRange<float>(0f, 60f)));
BatSprintSpeed = config.Bind(batform, "Sprint Speed", 24f,
new ConfigDescription("Speed while holding W and Shift, in m/s. Costs the sprint stamina on top. The old bat flew at 50.", new AcceptableValueRange<float>(0f, 80f)));
BatReverseSpeed = config.Bind(batform, "Reverse Speed", 8f,
new ConfigDescription("Speed while holding S, in m/s. Costs the powered stamina.", new AcceptableValueRange<float>(0f, 40f)));
BatLiftoffSpeed = config.Bind(batform, "Liftoff Speed", 9f,
new ConfigDescription("Climb speed out of water, in m/s. Always free, so a bat that touches the sea can still leave it.", new AcceptableValueRange<float>(0f, 30f)));
BatHoverSeconds = config.Bind(batform, "Hover Seconds", 3f,
new ConfigDescription("How long the bat holds its height after the last powered beat before it starts to glide down.", new AcceptableValueRange<float>(0f, 30f)));
BatPoweredStaminaPerSecond = config.Bind(batform, "Flight Stamina Per Second", 3f,
new ConfigDescription("Stamina per second while holding W or S. Out of stamina, the bat can only glide. 0 makes flight free, like the drake's.", new AcceptableValueRange<float>(0f, 60f)));
BatSprintStaminaPerSecond = config.Bind(batform, "Sprint Stamina Per Second", 12f,
new ConfigDescription("Extra stamina per second while sprinting, on top of the flight cost.", new AcceptableValueRange<float>(0f, 60f)));
BatEncumbered = config.Bind(batform, "While Encumbered", EncumberedMode.Allowed,
new ConfigDescription("Allowed: the bat flies while you carry too much, at the extra stamina cost below. Blocked: you cannot take bat form while encumbered, and a bat that becomes encumbered in the air can only glide down.", null));
BatEncumberedExtraCost = config.Bind(batform, "Encumbered Extra Stamina Cost", 0.15f,
new ConfigDescription("With 'Allowed' above: how much more flight and sprint cost while encumbered. 0.15 = 15% more.", new AcceptableValueRange<float>(0f, 1f)));
BatMaxDuration = config.Bind(batform, "Max Duration", 0f,
new ConfigDescription("Seconds the bat form lasts before you turn back on your own. 0 means no limit: stamina is the limit.", new AcceptableValueRange<float>(0f, 3600f)));
BatDurationPerState = config.Bind(batform, "Duration Per State", 0f,
new ConfigDescription("Seconds added to the max duration per progression state. Does nothing while the max duration is 0.", new AcceptableValueRange<float>(0f, 600f)));
BatCooldown = config.Bind(batform, "Cooldown", 0f,
new ConfigDescription("Seconds after leaving bat form before you can take it again. 0 means none.", new AcceptableValueRange<float>(0f, 3600f)));
const string aura = "Aswid - Vampiric Aura";
AuraTickInterval = config.Bind(aura, "Tick Interval", 0.25f,
@ -151,6 +286,10 @@ namespace RacesOfValheim
new ConfigDescription("Extra damage per tick at 100 Blood Magic skill (scales linearly from 0).", new AcceptableValueRange<float>(0f, 20f)));
AuraExecuteThreshold = config.Bind(aura, "Execute Threshold", 0.20f,
new ConfigDescription("Non-boss enemies at or below this fraction of max health are executed by the aura instead of merely damaged.", new AcceptableValueRange<float>(0f, 1f)));
AuraInBatForm = config.Bind(aura, "Active In Bat Form", false,
new ConfigDescription("Lets the aura drain while you are a bat from the start, as it did before. Off: the bat has no aura until the unlock state below.", null));
BatAuraUnlockState = config.Bind(aura, "Bat Form Unlock State", 7,
new ConfigDescription("The progression state at which the bat gets its aura back (7 = The Queen). 0 means never, so only the setting above can turn it on.", new AcceptableValueRange<int>(0, 8)));
const string senses = "Aswid - Superhuman Senses";
SensesRadius = config.Bind(senses, "Detection Radius", 100f,
@ -173,6 +312,23 @@ namespace RacesOfValheim
const string devour = "Aswid - Devour";
DevourCooldown = config.Bind(devour, "Consume Cooldown", 5f,
new ConfigDescription("How long one body stays drunk-dry, in seconds. A single death is reported to the devour more than once - by two damage patches, by the aura's execute, by a thrall's kill - and this is the window that keeps those from feeding you twice off the same corpse. It is per body, not per player: killing a whole pack at once devours every one of them. One second is used as the floor, so no corpse feeds you twice even at 0.", new AcceptableValueRange<float>(0f, 60f)));
DevourHealthMultiplier = config.Bind(devour, "Health Multiplier", 0.9f,
new ConfigDescription("Scales the health every devoured creature feeds you. 1 is the old amount.", new AcceptableValueRange<float>(0f, 2f)));
DevourStaminaShare = config.Bind(devour, "Stamina Share", 0.10f,
new ConfigDescription("Fraction of that health turned into stamina instead, for creatures past the Black Forest. 0.1 = 10%.", new AcceptableValueRange<float>(0f, 1f)));
EarlyStaminaShare = config.Bind(devour, "Early Creature Stamina Share", 0.60f,
new ConfigDescription("The same, for Meadows and Black Forest creatures. Above 0.5 they feed more stamina than health. Set it equal to the one above to treat every creature alike.", new AcceptableValueRange<float>(0f, 1f)));
FoodCapBase = config.Bind(devour, "Food Health Cap Base", 15f,
new ConfigDescription("Creatures with no hand-set meal feed half their health. That is capped at this plus the per-biome value times the biome's number (Meadows 1 ... Deep North 8). With the defaults: Black Forest 45, Mountains 75, Plains 90.", new AcceptableValueRange<float>(0f, 150f)));
FoodCapPerBiome = config.Bind(devour, "Food Health Cap Per Biome", 15f,
new ConfigDescription("See the base cap above.", new AcceptableValueRange<float>(0f, 50f)));
// Jotunn's server sync assigns Value, which fires SettingChanged, so the server's
// numbers reach the foods the same way a local drag does.
foreach (var entry in new[] { DevourHealthMultiplier, DevourStaminaShare, EarlyStaminaShare, FoodCapBase, FoodCapPerBiome })
{
entry.SettingChanged += (_, __) => AswidRace.ApplyAllFoodBalance();
}
const string domination = "Aswid - Domination";
EnslaveCooldown = config.Bind(domination, "Enslave Cooldown", 900f,

View file

@ -219,6 +219,32 @@ namespace RacesOfValheim
}
}
/// <summary>
/// Fire and pierce hurt the Aswid more: fire for the old way vampires end, pierce for the
/// stake. A plain multiplier, like the Trol's fire weakness, rather than DamageModifier.Weak,
/// which is a fixed +50% with nothing in between. ApplyDamage runs after resistances, so a
/// fire resistance mead still helps, and Mist Form's pierce immunity has already zeroed the
/// pierce by the time this sees it.
/// </summary>
[HarmonyPatch(typeof(Character), "ApplyDamage")]
public static class Aswid_Weakness_Patch
{
public static void Prefix(Character __instance, ref HitData hit)
{
if (__instance != Player.m_localPlayer || !AswidRace.IsAswid()) return;
if (AswidRace.HasFireWeakness(BossProgressionManager.GetCurrentProgressionState()) && hit.m_damage.m_fire > 0f)
{
hit.m_damage.m_fire *= 1f + AswidConfig.FireWeakness.Value;
}
if (AswidConfig.PierceWeaknessEnabled.Value && hit.m_damage.m_pierce > 0f)
{
hit.m_damage.m_pierce *= 1f + AswidConfig.PierceWeakness.Value;
}
}
}
[HarmonyPatch(typeof(Humanoid), "StartAttack")]
public static class Aswid_Attack_Patch
{
@ -497,7 +523,7 @@ namespace RacesOfValheim
{
public static bool Prefix(Hud __instance, Player player)
{
if (player == Player.m_localPlayer && (AswidRace.IsAswid() || DraughRace.IsDraugh()))
if (player == Player.m_localPlayer && DraughRace.IsDraugh())
{
if (__instance.m_staminaBar2Root != null && __instance.m_staminaBar2Root.gameObject.activeSelf)
{
@ -507,7 +533,8 @@ namespace RacesOfValheim
}
// Vanilla switches the bar on once, when the HUD is built, and never again. Without
// this a player who left the Aswid or the Draugh had no stamina bar until relog.
// this a player who left the Draugh had no stamina bar until relog - and an Aswid
// updating from a version that still hid it would have none either.
if (player == Player.m_localPlayer && __instance.m_staminaBar2Root != null
&& !__instance.m_staminaBar2Root.gameObject.activeSelf)
{
@ -597,6 +624,13 @@ namespace RacesOfValheim
{
bool isBat = nview.GetZDO().GetBool("Aswid_IsBatForm", false);
bool isMist = nview.GetZDO().GetBool("Aswid_IsMistForm", false);
// The bat flies on m_flying, which only the bat's own client sets. Mirror it here
// and switch gravity off for the duration, or this copy sinks to the terrain
// whatever altitude is replicated - the same fix ZdoVisualSync applies to drakes.
HarmonyLib.Traverse.Create(player).Field("m_flying").SetValue(isBat);
Rigidbody body = player.GetComponent<Rigidbody>();
if (body != null && body.useGravity == isBat) body.useGravity = !isBat;
Transform playerVisual = player.transform.Find("Visual");
@ -820,6 +854,80 @@ namespace RacesOfValheim
stamina += extraFood.m_stamina;
eitr += extraFood.m_eitr;
}
// Added on top of whatever vanilla and other mods put here, never assigned: a mod that
// raises max stamina has to keep raising it for an Aswid too.
stamina += AswidRace.GetStaminaBonus(BossProgressionManager.GetCurrentProgressionState());
}
}
/// <summary>
/// The Aswid's stamina. It used to be infinite: the Skeleton's UseStamina skip covered the
/// Aswid too, which made every stamina mod, food and skill meaningless for the race (the Discord
/// reports that started the rebalance). The cost is now scaled rather than skipped, so the
/// call still reaches vanilla - and any other mod patching it - with a smaller number.
/// </summary>
[HarmonyPatch(typeof(Player), "UseStamina")]
public static class Aswid_UseStamina_Patch
{
public static void Prefix(Player __instance, ref float v)
{
if (__instance != Player.m_localPlayer || !AswidRace.IsAswid()) return;
v *= AswidConfig.StaminaCostMultiplier.Value;
if (Aswid_SwimCost_Patch.Swimming && AswidConfig.RunningWaterEnabled.Value)
{
v *= AswidConfig.SwimStaminaMultiplier.Value;
}
}
}
/// <summary>
/// Marks the frames where vanilla charges for a swim stroke, so Aswid_UseStamina_Patch can
/// make that one cost dearer. Player.OnSwimming is the only place swimming spends stamina,
/// and it also runs the drowning check right after - which is what makes a high multiplier
/// play as "cannot swim" without any code of ours deciding who drowns.
/// </summary>
[HarmonyPatch(typeof(Player), "OnSwimming")]
public static class Aswid_SwimCost_Patch
{
public static bool Swimming { get; private set; }
public static void Prefix(Player __instance)
{
Swimming = __instance == Player.m_localPlayer;
}
public static void Finalizer()
{
Swimming = false;
}
}
/// <summary>
/// The seasick camera: a slow roll while the Aswid is out on the water, on a boat too. Applied after
/// vanilla has settled the camera's rotation for the frame, as a roll around the view axis,
/// so it never moves where the player aims - only how the horizon sits.
/// </summary>
[HarmonyPatch(typeof(GameCamera), "GetCameraPosition")]
public static class Aswid_SeaCameraSway_Patch
{
private const float DegreesAtStrengthOne = 4f;
private static float sway;
public static void Postfix(float dt, ref Quaternion rot)
{
bool on = AswidRace.OnWater && AswidConfig.SeaCameraSway.Value && AswidRace.IsAswid() &&
Player.m_localPlayer != null && !Player.m_localPlayer.IsDead();
// Eased in and out over about a second, so leaving the sea does not snap the horizon.
sway = Mathf.MoveTowards(sway, on ? 1f : 0f, dt);
if (sway <= 0f) return;
float t = Time.time;
float roll = (Mathf.Sin(t * 0.9f) + 0.4f * Mathf.Sin(t * 2.3f)) * DegreesAtStrengthOne *
AswidConfig.SeaCameraSwayStrength.Value * sway;
rot *= Quaternion.AngleAxis(roll, Vector3.forward);
}
}

View file

@ -191,6 +191,11 @@ namespace RacesOfValheim
if (c != null)
{
float foodHp = Mathf.Min(c.m_health / 2f, 150f);
// The formula alone only knows how big a creature is, not where it
// lives - a Black Forest troll came out at 150. Only these get the
// per-biome cap in ApplyFoodBalance; the hand-set values below are
// choices, not formula output, and keep theirs.
bool fromFormula = true;
// Capped at 50 minutes: a tough creature like the Barka would otherwise
// feed for over an hour.
float burnTime = Mathf.Min(c.m_health * 2f, 3000f);
@ -201,24 +206,38 @@ namespace RacesOfValheim
{
burnTime = 1200f; // 20 minutes
}
else if (mobName == "JotunWitch") { foodHp = 120f; burnTime = 3600f; } // 60 minutes
else if (mobName == "ElakingMole") { foodHp = 100f; burnTime = 1800f; } // 30 minutes
else if (mobName.StartsWith("Dverger") && mobName != "DvergerDeepNorth") { foodHp = 90f; burnTime = 1500f; } // 25 minutes
else if (mobName == "DvergerDeepNorth") { foodHp = 100f; burnTime = 1800f; } // 30 minutes
else if (mobName == "Greyling") { foodHp = 20f; burnTime = 1200f; }
else if (mobName == "Greydwarf") { foodHp = 25f; burnTime = 1200f; }
else if (mobName == "Greydwarf_Shaman") { foodHp = 30f; burnTime = 1200f; }
else if (mobName == "Greydwarf_Elite") { foodHp = 60f; burnTime = 1800f; }
else if (mobName == "JotunWitch") { foodHp = 120f; burnTime = 3600f; fromFormula = false; } // 60 minutes
else if (mobName == "ElakingMole") { foodHp = 100f; burnTime = 1800f; fromFormula = false; } // 30 minutes
else if (mobName.StartsWith("Dverger") && mobName != "DvergerDeepNorth") { foodHp = 90f; burnTime = 1500f; fromFormula = false; } // 25 minutes
else if (mobName == "DvergerDeepNorth") { foodHp = 100f; burnTime = 1800f; fromFormula = false; } // 30 minutes
else if (mobName == "Greyling") { foodHp = 20f; burnTime = 1200f; fromFormula = false; }
else if (mobName == "Greydwarf") { foodHp = 25f; burnTime = 1200f; fromFormula = false; }
else if (mobName == "Greydwarf_Shaman") { foodHp = 30f; burnTime = 1200f; fromFormula = false; }
else if (mobName == "Greydwarf_Elite") { foodHp = 60f; burnTime = 1800f; fromFormula = false; }
customItem.ItemDrop.m_itemData.m_shared.m_food = foodHp;
customItem.ItemDrop.m_itemData.m_shared.m_foodStamina = 0f;
customItem.ItemDrop.m_itemData.m_shared.m_foodEitr = 0f;
customItem.ItemDrop.m_itemData.m_shared.m_foodBurnTime = burnTime;
customItem.ItemDrop.m_itemData.m_shared.m_foodRegen = Mathf.Max(1f, foodHp / 15f);
if (fromFormula) formulaFoods.Add(foodName);
}
}
}
// What the item gives before any balance setting, kept so ApplyFoodBalance can be
// rerun from scratch whenever a setting changes or the server's values arrive.
var shared = customItem.ItemDrop.m_itemData.m_shared;
baseFoods[foodName] = new BaseFood
{
Mob = mobName,
Health = shared.m_food,
Stamina = shared.m_foodStamina,
Regen = shared.m_foodRegen,
Shared = shared
};
ApplyFoodBalance(foodName);
GameObject trophyPrefab = Jotunn.Managers.PrefabManager.Cache.GetPrefab<GameObject>(trophyName);
if (trophyPrefab != null)
{
@ -234,6 +253,81 @@ namespace RacesOfValheim
}
}
private class BaseFood
{
public string Mob;
public float Health;
public float Stamina;
public float Regen;
public ItemDrop.ItemData.SharedData Shared;
}
private static readonly Dictionary<string, BaseFood> baseFoods = new Dictionary<string, BaseFood>();
private static readonly HashSet<string> formulaFoods = new HashSet<string>();
/// <summary>
/// The biome each edible creature lives in, as a number from 1 (Meadows) to 8 (Deep North).
/// It decides two things: the cap on formula-made foods, and which creatures count as early
/// game (1 and 2) for the larger stamina share. A creature missing here counts as tier 8,
/// which means uncapped in practice and never early.
/// </summary>
private static readonly Dictionary<string, int> mobBiomeTier = new Dictionary<string, int>
{
{ "Boar", 1 }, { "Neck", 1 }, { "Deer", 1 }, { "Greyling", 1 },
{ "Greydwarf", 2 }, { "Greydwarf_Elite", 2 }, { "Greydwarf_Shaman", 2 }, { "Troll", 2 },
{ "Leech", 3 },
{ "Wolf", 4 }, { "Fenring", 4 }, { "Fenring_Cultist", 4 }, { "Ulv", 4 }, { "Hatchling", 4 },
{ "Lox", 5 }, { "Goblin", 5 }, { "GoblinArcher", 5 }, { "GoblinShaman", 5 }, { "GoblinBrute", 5 }, { "Deathsquito", 5 },
{ "Hare", 6 }, { "Seeker", 6 }, { "SeekerBrood", 6 }, { "SeekerBrute", 6 }, { "Gjall", 6 }, { "Tick", 6 },
{ "Dverger", 6 }, { "DvergerMage", 6 }, { "DvergerMageFire", 6 }, { "DvergerMageIce", 6 }, { "DvergerMageSupport", 6 },
{ "Asksvin", 7 }, { "Volture", 7 }, { "DvergerAshlands", 7 },
};
public const int EarlyBiomeTier = 2;
private static int GetBiomeTier(string mob) => mobBiomeTier.TryGetValue(mob, out int tier) ? tier : 8;
/// <summary>
/// Rewrites one devour food from its unbalanced base and the current settings. The Discord
/// reports said even weak kills fed too much health; Dissolution asked for about 10% less,
/// and for early creatures to feed stamina more than health. So: health is scaled first,
/// then a share of it moves over to stamina. Vanilla meals the food was cloned from keep
/// the stamina they already had, the share goes on top.
///
/// Writing the shared data is enough to reach every copy: eaten foods, the extra slot and
/// the tooltip all read the same SharedData through their ItemData.
/// </summary>
private static void ApplyFoodBalance(string foodName)
{
if (!baseFoods.TryGetValue(foodName, out BaseFood food) || food.Shared == null) return;
int tier = GetBiomeTier(food.Mob);
float health = food.Health;
if (formulaFoods.Contains(foodName))
{
health = Mathf.Min(health, AswidConfig.FoodCapBase.Value + AswidConfig.FoodCapPerBiome.Value * tier);
}
float healthMultiplier = AswidConfig.DevourHealthMultiplier.Value;
health *= healthMultiplier;
float share = tier <= EarlyBiomeTier ? AswidConfig.EarlyStaminaShare.Value : AswidConfig.DevourStaminaShare.Value;
float moved = health * share;
food.Shared.m_food = health - moved;
food.Shared.m_foodStamina = food.Stamina + moved;
// Regen follows the health the food ends up giving, cap included, so a troll capped
// to 40 health does not keep the 10 per tick its old 150 earned.
float healthRatio = food.Health > 0f ? food.Shared.m_food / food.Health : 0f;
food.Shared.m_foodRegen = Mathf.Max(1f, food.Regen * healthRatio);
}
/// <summary>Hooked to the balance settings, which also fire when the server's values arrive.</summary>
public static void ApplyAllFoodBalance()
{
foreach (string foodName in baseFoods.Keys) ApplyFoodBalance(foodName);
}
private float m_tintCheckTimer = 0f;
private float sensesCheckTimer = 0f;
@ -414,6 +508,8 @@ namespace RacesOfValheim
{
updateTimer = 0f;
UpdateAswidState();
UpdateSunlight(UpdateInterval);
UpdateOpenSea(UpdateInterval);
}
try
@ -580,9 +676,26 @@ namespace RacesOfValheim
return;
}
if (AswidConfig.BatEncumbered.Value == AswidConfig.EncumberedMode.Blocked && Player.m_localPlayer.IsEncumbered())
{
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_aswid_too_heavy_for_bat"));
return;
}
float cooldownLeft = AswidConfig.BatCooldown.Value - (Time.time - lastBatEndTime);
if (cooldownLeft > 0f)
{
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_aswid_bat_cooldown", Mathf.CeilToInt(cooldownLeft)));
return;
}
RunFormRoutine(TransformIntoBatRoutine(rules));
}
// When the bat form last ended, for the optional cooldown. Starts far enough back that a
// fresh session never begins on cooldown.
private float lastBatEndTime = -100000f;
// The one bat or mist routine in flight, if any. Kept so ResetRace can stop it: a
// TransformIntoBatRoutine left running through a reset finishes its 1.1s gesture and
// turns a freshly reset Human into a bat.
@ -656,7 +769,7 @@ namespace RacesOfValheim
/// Update() has already bailed out on IsDead(), so a coroutine started here would be the
/// only thing still running on a corpse.
///
/// Leaving the form up costs more than a missing animation: m_debugFly stays on, so the
/// Leaving the form up costs more than a missing animation: m_flying stays on, so the
/// respawned player floats; Aswid_IsBatForm stays true in the ZDO, so every other client
/// keeps drawing a bat over a body that is walking around as a person; and the 5% scale
/// stays on the transform. Called from Aswid_BatDiesAsBat_Patch.
@ -682,12 +795,13 @@ namespace RacesOfValheim
if (nview != null && nview.IsValid())
{
nview.GetZDO().Set("Aswid_IsBatForm", false);
nview.GetZDO().Set(ZDOVars.s_debugFly, false);
}
Traverse.Create(player).Field("m_debugFly").SetValue(false);
// Now, not when the destroyed model's OnDestroy gets round to it at the end of the frame.
BatFormBehavior.SetFlying(false);
player.transform.localScale = Vector3.one;
lastBatEndTime = Time.time;
IsTransformed = false;
activeRules = null;
isTransformingSequence = false;
@ -787,6 +901,7 @@ namespace RacesOfValheim
}
Player.m_localPlayer.transform.localScale = endScale;
lastBatEndTime = Time.time;
IsTransformed = false;
activeRules = null;
isTransformingSequence = false;
@ -1071,13 +1186,14 @@ namespace RacesOfValheim
private float damageTickTimer = 0f;
/// <summary>
/// The Vampiric Aura drains on its own, in every form, with no key to hold - but it does not
/// The Vampiric Aura drains on its own, with no key to hold (as a bat only once
/// BatAuraAllowed says so) - but it does not
/// distinguish traders from monsters, so it can execute Haldor/Hildir on approach. AuraEnabled
/// (toggled with Devour on the same key) is the escape hatch for that.
/// </summary>
private void HandleVampiricAura()
{
if (!AuraEnabled)
if (!AuraEnabled || (IsBatForm() && !BatAuraAllowed(BossProgressionManager.GetCurrentProgressionState())))
{
damageTickTimer = 0f;
return;
@ -1090,6 +1206,24 @@ namespace RacesOfValheim
PerformLifeDrain();
}
private static bool IsBatForm()
{
return Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_BatForm".GetStableHashCode());
}
/// <summary>
/// Whether the aura drains while the player is a bat. Off until the Queen by default: a bat
/// gliding over enemies that cannot reach it, draining them the whole way, was the "unfun
/// optimal way to play" Dissolution reported. The flag turns it back on for everyone; the
/// unlock state brings it back as a late-game reward, 0 meaning never.
/// </summary>
public static bool BatAuraAllowed(int state)
{
if (AswidConfig.AuraInBatForm.Value) return true;
int unlock = AswidConfig.BatAuraUnlockState.Value;
return unlock > 0 && state >= unlock;
}
/// <summary>Half damage as a human, full as a bat, double as mist.</summary>
private float GetAuraFormMultiplier()
{
@ -1271,7 +1405,10 @@ namespace RacesOfValheim
// up, but there used to be nothing to see either. Silence is what made
// a refused meal indistinguishable from a devour that never fired:
// vanilla's own "can't eat more" line, localized for free.
Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "$msg_nomore");
// The token carries a $1 for the food's name, which vanilla's CanEat
// fills in; sent bare, players read "can't eat more $1".
Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft,
Localization.instance.Localize("$msg_nomore", addedItem.m_shared.m_name));
}
}
else
@ -1320,6 +1457,136 @@ namespace RacesOfValheim
}
}
/// <summary>Fader's Surtling form ends it, unless the setting keeps it for good.</summary>
public static bool HasFireWeakness(int state)
{
if (!AswidConfig.FireWeaknessEnabled.Value) return false;
return !(AswidConfig.FaderRemovesFireWeakness.Value && state >= 8);
}
private static readonly int SunlightHash = "SE_AswidSunlight".GetStableHashCode();
/// <summary>
/// The V Rising weakness: by day, under open sky, the sun saps the Aswid. Anything that
/// keeps the sky off you counts as shade - a roof by vanilla's own shelter test, a dungeon,
/// the Swamp's and Mistlands' gloom, the night, and the Aswid's own Eclipse, which makes
/// that spell an answer to the sun rather than only a damage boost.
/// </summary>
private void UpdateSunlight(float dt)
{
Player player = Player.m_localPlayer;
SEMan seman = player.GetSEMan();
bool exposed = InSunlight(player);
bool has = seman.HaveStatusEffect(SunlightHash);
if (!exposed)
{
if (has) seman.RemoveStatusEffect(SunlightHash, true);
return;
}
if (!has) seman.AddStatusEffect(SunlightHash, true);
(seman.GetStatusEffect(SunlightHash) as SE_AswidSunlight)?.Refresh();
// SetHealth rather than Damage or UseHealth: a burn every second should not stagger,
// interrupt a swing or flash the screen red each time. Never below the floor, so
// the sun can wear you down but never be what kills you.
float floor = player.GetMaxHealth() * AswidConfig.SunHealthFloor.Value;
float health = player.GetHealth();
float loss = AswidConfig.SunHealthLossPerSecond.Value * dt;
if (loss > 0f && health > floor)
{
player.SetHealth(Mathf.Max(floor, health - loss));
}
}
private bool InSunlight(Player player)
{
if (!AswidConfig.SunlightEnabled.Value) return false;
if (EnvMan.instance == null || !EnvMan.IsDay()) return false;
if (IsEclipseActive) return false;
if (player.InInterior() || player.InShelter()) return false;
Heightmap.Biome biome = player.GetCurrentBiome();
return biome != Heightmap.Biome.Swamp && biome != Heightmap.Biome.Mistlands;
}
private static readonly int OpenSeaHash = "SE_AswidOpenSea".GetStableHashCode();
// How deep the water under an airborne Aswid has to be before it counts. Keeps a hop over
// a puddle or a swamp ditch from registering; a bat over a river or a lake still does.
private const float MinFlyOverDepth = 1f;
/// <summary>True while the local Aswid is out on the water, boat or not. Read by the camera sway.</summary>
public static bool OnWater { get; private set; }
/// <summary>
/// Dagaz's running water: open water burns and drains an Aswid in it or over it, swimming
/// or flying - a bat cannot simply cross a lake or the sea. A boat carries you across, as
/// the lore allows: on board there is no burn and no drain, but the sea still turns your
/// stomach, so the camera keeps swaying.
/// </summary>
private void UpdateOpenSea(float dt)
{
Player player = Player.m_localPlayer;
SEMan seman = player.GetSEMan();
bool onBoat = OnBoat(player);
bool exposed = !onBoat && InOpenWater(player);
OnWater = AswidConfig.RunningWaterEnabled.Value && (exposed || (onBoat && BiomeAllowed(player)));
bool has = seman.HaveStatusEffect(OpenSeaHash);
if (!exposed)
{
if (has) seman.RemoveStatusEffect(OpenSeaHash, true);
return;
}
if (!has) seman.AddStatusEffect(OpenSeaHash, true);
float drain = AswidConfig.SeaStaminaDrainPerSecond.Value * dt;
if (drain > 0f) player.UseStamina(drain);
// SetHealth for the same reasons as the sun: no stagger, no flash each second.
float floor = player.GetMaxHealth() * AswidConfig.SeaHealthFloor.Value;
float health = player.GetHealth();
float loss = AswidConfig.SeaHealthLossPerSecond.Value * dt;
if (loss > 0f && health > floor)
{
player.SetHealth(Mathf.Max(floor, health - loss));
}
}
private static bool OnBoat(Player player)
{
return player.GetStandingOnShip() != null || player.IsAttachedToShip() || player.GetControlledShip() != null;
}
/// <summary>The Ocean-only setting, if on, limits everything here to the sea.</summary>
private static bool BiomeAllowed(Player player)
{
return !AswidConfig.WaterOceanOnly.Value || player.GetCurrentBiome() == Heightmap.Biome.Ocean;
}
/// <summary>
/// In water or over it. Valheim has one water plane for the sea, the rivers and the lakes
/// alike, so "the terrain under you is below the water level" finds all three. Swimming
/// counts wherever it happens. In the air it takes a metre of water below, so a jump over
/// a puddle does not; standing on anything solid - a dock, a bridge, a shallow bank you
/// are wading on - does not count, since the ground ray only sees terrain and would
/// otherwise read a dock as open water.
/// </summary>
private static bool InOpenWater(Player player)
{
if (!AswidConfig.RunningWaterEnabled.Value) return false;
if (!BiomeAllowed(player)) return false;
if (player.IsSwimming()) return true;
if (player.IsOnGround() || ZoneSystem.instance == null) return false;
float depth = ZoneSystem.instance.m_waterLevel - ZoneSystem.instance.GetGroundHeight(player.transform.position);
return depth >= MinFlyOverDepth;
}
private void UpdateAswidState()
{
AswidSpectralClaw.PurgeAll(Player.m_localPlayer); // feature disabled for now, see AswidSpectralClaw.cs
@ -1344,6 +1611,12 @@ namespace RacesOfValheim
}
}
/// <summary>Max stamina the race adds on top of food, at the given progression state.</summary>
public static float GetStaminaBonus(int state)
{
return AswidConfig.BaseStaminaBonus.Value + AswidConfig.StaminaBonusPerState.Value * state;
}
public static bool IsAswid()
{
return Player.m_localPlayer != null &&

View file

@ -65,6 +65,45 @@ namespace RacesOfValheim
}
}
/// <summary>
/// Sunlight on an exposed Aswid. Its numbers are rewritten from AswidConfig every time
/// AswidRace.UpdateSunlight runs, so a slider moves them live; the health loss is not a stat
/// and is applied by that same tick.
/// </summary>
public class SE_AswidSunlight : SE_Stats
{
public override void Setup(Character character)
{
base.Setup(character);
name = "SE_AswidSunlight";
m_name = "$rov_se_aswid_sunlight_name";
m_tooltip = "$rov_se_aswid_sunlight_tooltip";
Refresh();
}
public void Refresh()
{
m_healthRegenMultiplier = 1f - AswidConfig.SunHealthRegenPenalty.Value;
m_staminaRegenMultiplier = 1f - AswidConfig.SunStaminaRegenPenalty.Value;
m_speedModifier = -AswidConfig.SunSpeedPenalty.Value;
}
}
/// <summary>
/// Open water under an Aswid off a boat. Only a marker: the burn and the drain are applied by
/// AswidRace.UpdateOpenSea, and the camera sway reads AswidRace.OnWater.
/// </summary>
public class SE_AswidOpenSea : SE_Stats
{
public override void Setup(Character character)
{
base.Setup(character);
name = "SE_AswidOpenSea";
m_name = "$rov_se_aswid_opensea_name";
m_tooltip = "$rov_se_aswid_opensea_tooltip";
}
}
public class SE_MistForm : SE_Stats
{
public override void Setup(Character character)
@ -124,6 +163,16 @@ namespace RacesOfValheim
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(batForm, fixReference: false));
var sunlight = ScriptableObject.CreateInstance<SE_AswidSunlight>();
sunlight.name = "SE_AswidSunlight";
sunlight.m_icon = PrefabManager.Cache.GetPrefab<ItemDrop>("TrophySurtling")?.m_itemData.m_shared.m_icons[0];
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(sunlight, fixReference: false));
var openSea = ScriptableObject.CreateInstance<SE_AswidOpenSea>();
openSea.name = "SE_AswidOpenSea";
openSea.m_icon = PrefabManager.Cache.GetPrefab<ItemDrop>("TrophySerpent")?.m_itemData.m_shared.m_icons[0];
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(openSea, fixReference: false));
var mistForm = ScriptableObject.CreateInstance<SE_MistForm>();
mistForm.name = "SE_MistForm";
mistForm.m_icon = PrefabManager.Cache.GetPrefab<ItemDrop>("TrophyWraith")?.m_itemData.m_shared.m_icons[0];

View file

@ -1,86 +1,134 @@
using HarmonyLib;
using UnityEngine;
using Jotunn.Managers;
namespace RacesOfValheim
{
/// <summary>
/// The bat's flight, held on for as long as the worn model exists.
///
/// Debug fly has two halves, and this used to write only one. The field Player.m_debugFly is
/// what the local player's own physics reads; ZDOVars.s_debugFly is what every OTHER client
/// reads, because Character.IsDebugFlying consults the ZDO whenever it is not the owner. With
/// only the field written, a bat flew on its own screen and fell, walked and swam on everyone
/// else's - the fault WarVultureMount.SetFlying already names in its own summary. Both halves
/// go through SetFlying below now, so there is one place that can ever get it wrong again.
/// The bat flies on Character.m_flying and is steered by DirectedFlightPatch, the same
/// controls as the Skadi's drake; this class only hands over the bat's own numbers and keeps
/// the flag up. It used to fly on vanilla's debug-fly flag, which ignored carry weight, cost
/// nothing, moved at 50 m/s and made every monster blind to the player - the Discord reports
/// that started the 2026 rebalance.
///
/// Writing the ZDO every frame is not network spam: ZDO.Set(int, bool) bottoms out in
/// ZDOExtraData.Set, which returns false when the value is unchanged, and only a true return
/// bumps the data revision. Read out of the assembly rather than assumed, because "every frame"
/// deserved the check.
/// Other clients learn the bat is airborne from Aswid_IsBatForm in the ZDO, which
/// Aswid_MultiplayerVisuals_Patch mirrors into their copy's m_flying.
/// </summary>
public class BatFormBehavior : MonoBehaviour
public class BatFormBehavior : MonoBehaviour, IDirectedFlyer
{
private static readonly System.Reflection.FieldInfo DebugFlyField =
AccessTools.Field(typeof(Player), "m_debugFly");
private static readonly System.Reflection.FieldInfo FlyingField =
AccessTools.Field(typeof(Character), "m_flying");
private Animator anim;
private AswidProgression.FormRules formRules;
private float startTime;
private bool warnedTooHeavy;
private bool expired;
public void Initialize(AswidProgression.FormRules rules)
{
this.formRules = rules;
}
// ─── IDirectedFlyer ─────────────────────────────────────────────────────
// A bat is never grounded on purpose: it flies for as long as the form lasts.
public bool IsFlying => true;
public float LastPoweredTime { get; set; }
public float TurnSpeed => AswidConfig.BatTurnSpeed.Value;
public float GlideSpeed => AswidConfig.BatGlideSpeed.Value;
public float BoostSpeed => AswidConfig.BatBoostSpeed.Value;
public float SprintSpeed => AswidConfig.BatSprintSpeed.Value;
public float ReverseSpeed => AswidConfig.BatReverseSpeed.Value;
public float LiftoffSpeed => AswidConfig.BatLiftoffSpeed.Value;
public float HoverSeconds => AswidConfig.BatHoverSeconds.Value;
public float PoweredStaminaPerSecond => AswidConfig.BatPoweredStaminaPerSecond.Value * EncumberedCostFactor();
public float SprintStaminaPerSecond => AswidConfig.BatSprintStaminaPerSecond.Value * EncumberedCostFactor();
public bool CanPower => !(IsEncumbered() && AswidConfig.BatEncumbered.Value == AswidConfig.EncumberedMode.Blocked);
private static bool IsEncumbered()
{
return Player.m_localPlayer != null && Player.m_localPlayer.IsEncumbered();
}
private static float EncumberedCostFactor()
{
return IsEncumbered() ? 1f + AswidConfig.BatEncumberedExtraCost.Value : 1f;
}
/// <summary>
/// The form's lifetime in seconds at the current state, or 0 for no limit. The per-state
/// bonus is Dissolution's "scales with boss progression", and only means anything on top
/// of a base limit.
/// </summary>
public static float MaxDuration()
{
float max = AswidConfig.BatMaxDuration.Value;
if (max <= 0f) return 0f;
return max + AswidConfig.BatDurationPerState.Value * BossProgressionManager.GetCurrentProgressionState();
}
private void Start()
{
anim = GetComponentInChildren<Animator>();
startTime = Time.time;
LastPoweredTime = Time.time;
DirectedFlight.Register(this);
SetFlying(true);
}
private void Update()
{
if (Player.m_localPlayer == null || Player.m_localPlayer.IsDead()) return;
Player player = Player.m_localPlayer;
if (player == null || player.IsDead()) return;
// Ensure flight remains on continuously
// Held every frame rather than set once, for the same reason the debug-fly flag was:
// anything that clears it mid-form (a vanilla reset, another mod) would drop the bat
// into walking with the model still on.
SetFlying(true);
// Sync Animator
if (!CanPower && !warnedTooHeavy)
{
warnedTooHeavy = true;
player.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_aswid_bat_too_heavy_to_beat"));
}
else if (CanPower)
{
warnedTooHeavy = false;
}
float max = MaxDuration();
if (max > 0f && !expired && Time.time - startTime >= max && AswidRace.Instance != null)
{
expired = true;
player.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_aswid_bat_form_fades"));
AswidRace.Instance.ForceRevert();
}
if (anim != null)
{
Vector3 vel = Player.m_localPlayer.GetVelocity();
Vector3 vel = player.GetVelocity();
vel.y = 0f;
float speed = vel.magnitude;
// Bats don't necessarily have a complex animator like players,
// but if they do have a speed or flying parameter, we set it here.
anim.SetFloat("forward_speed", speed);
anim.SetFloat("forward_speed", vel.magnitude);
anim.SetBool("flying", true);
}
}
private void OnDestroy()
{
DirectedFlight.Unregister(this);
SetFlying(false);
}
/// <summary>
/// Both halves of debug fly, always together. The field write survives a missing or invalid
/// ZNetView on purpose: without it a bat whose networking went away mid-flight would keep
/// flying on foot forever, which is the worse of the two failures.
/// The local half of flight. The remote half is the Aswid_IsBatForm ZDO flag AswidRace
/// already writes, so there is nothing to replicate here.
/// </summary>
private static void SetFlying(bool flying)
public static void SetFlying(bool flying)
{
Player player = Player.m_localPlayer;
if (player == null) return;
if (DebugFlyField != null) DebugFlyField.SetValue(player, flying);
ZNetView nview = player.GetComponent<ZNetView>();
if (nview != null && nview.IsValid() && nview.IsOwner())
{
nview.GetZDO().Set(ZDOVars.s_debugFly, flying);
}
if (player == null || FlyingField == null) return;
FlyingField.SetValue(player, flying);
}
}
}

View file

@ -42,6 +42,8 @@ namespace RacesOfValheim
private static readonly string[] LocalKeyParts =
{
"marker light", "tint", "colour", "color", "glow", "swarm scale", "log rounds", "debug",
// The Aswid's seasick camera: motion makes some players ill, so a server cannot force it.
"camera sway",
// Each player picks their own True Form: a player model mod (VRM and the like) breaks
// under the troll costume, so a server cannot be allowed to force the costume on.
"legacy true form",

View file

@ -0,0 +1,262 @@
using System.Reflection;
using HarmonyLib;
using UnityEngine;
namespace RacesOfValheim
{
/// <summary>
/// A form that flies on Character's native flying-creature movement (m_flying) and is steered
/// by DirectedFlightPatch. The Skadi's drakes were the first; the Aswid's bat moved onto it from
/// vanilla's debug-fly flag in the 2026 rebalance, so the two share one set of controls and
/// differ only in the numbers each form hands back here.
/// </summary>
public interface IDirectedFlyer
{
/// <summary>False while the form is on the ground on purpose (a landed drake).</summary>
bool IsFlying { get; }
/// <summary>Time.time of the last powered or grounded moment; the hover window counts from it.</summary>
float LastPoweredTime { get; set; }
float TurnSpeed { get; }
float GlideSpeed { get; }
float BoostSpeed { get; }
float SprintSpeed { get; }
float ReverseSpeed { get; }
float LiftoffSpeed { get; }
float HoverSeconds { get; }
/// <summary>Stamina per second for powered flight (forward or reverse). 0 is free.</summary>
float PoweredStaminaPerSecond { get; }
/// <summary>Stamina per second for the sprint, charged on top of the powered cost.</summary>
float SprintStaminaPerSecond { get; }
/// <summary>False forbids powered flight outright, so the form can only glide and sink.</summary>
bool CanPower { get; }
}
public static class DirectedFlight
{
/// <summary>The local player's flying form, if any. Set and cleared by the form itself.</summary>
public static IDirectedFlyer Active { get; private set; }
public static void Register(IDirectedFlyer flyer) { Active = flyer; }
public static void Unregister(IDirectedFlyer flyer)
{
if (Active == flyer) Active = null;
}
/// <summary>The active form, only while it is actually in the air.</summary>
public static IDirectedFlyer Flying => Active != null && Active.IsFlying ? Active : null;
}
// The form flips the player into Character's native flying-creature movement (m_flying = true)
// instead of the debug-fly noclip, which lets us feed it a full 3D move direction.
// Character.UpdateFlying normally reads whatever m_moveDir the vanilla input pipeline last
// wrote (ground-plane WASD relative to camera yaw only); this patch overwrites it every frame
// with the camera's actual look direction (pitch included) so the player always glides toward
// wherever the mouse is aiming, with W powering forward, Shift spending stamina for a burst of
// speed, and S beating backwards away from whatever you are looking at.
[HarmonyPatch(typeof(Character), "UpdateFlying")]
public static class DirectedFlightPatch
{
// Tangent of the unpowered descent angle: 0.4 sinks at roughly 22 degrees below level.
private const float DESCENT_SLOPE = 0.4f;
// How much of the aim heading survives the climb out of water. Mostly up, with enough
// forward in it that the player still chooses which shore they surface towards.
private const float LIFTOFF_HEADING_BLEND = 0.35f;
// How far the left stick has to be pushed before it counts as W or S.
private const float StickThreshold = 0.5f;
/// <summary>
/// True while the local player is beating backwards this frame. Read by
/// SkadiReverseFacingPatch, which keeps the body pointed at the camera while it happens.
/// </summary>
public static bool Reversing { get; private set; }
// The September 2026 hotfix dropped the bool parameter from ZInput.GetJoyLeftStickY.
// A direct call binds to whichever signature we compiled against and throws
// MissingMethodException on the other, so resolve it at runtime and accept either.
private static readonly MethodInfo JoyLeftStickYMethod =
AccessTools.Method(typeof(ZInput), "GetJoyLeftStickY", new System.Type[0]) ??
AccessTools.Method(typeof(ZInput), "GetJoyLeftStickY", new[] { typeof(bool) });
private static float JoyLeftStickY()
{
if (JoyLeftStickYMethod == null) return 0f;
return (float)JoyLeftStickYMethod.Invoke(null, JoyLeftStickYArgs);
}
// Old signature: pass smooth = true, which was its default.
private static readonly object[] JoyLeftStickYArgs =
JoyLeftStickYMethod != null && JoyLeftStickYMethod.GetParameters().Length == 1 ? new object[] { true } : null;
public static void Prefix(Character __instance, float dt)
{
if (__instance != Player.m_localPlayer) return;
IDirectedFlyer form = DirectedFlight.Flying;
if (form == null)
{
Reversing = false;
return;
}
var traverse = Traverse.Create(__instance);
Vector3 lookDir = Player.m_localPlayer.GetLookDir();
bool input = RaceInput.Allowed;
// The pad's half of W/S: the left stick, read with vanilla's own sign -
// PlayerController.FixedUpdate takes forward as the NEGATED GetJoyLeftStickY.
// Flight only knows powered forward, reverse or neither, so the stick is a
// threshold, not a throttle. Steering stays on the camera, i.e. the right stick.
float stick = -JoyLeftStickY();
bool forward = input && (Input.GetKey(KeyCode.W) || stick > StickThreshold);
// Forward wins a W+S mash rather than the two cancelling into a dead hover.
bool backward = input && !forward && (Input.GetKey(KeyCode.S) || stick < -StickThreshold);
// Sprint on a pad is vanilla's run button, wherever the chosen layout puts it.
bool sprintKey = input && (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift) ||
ZInput.GetButton("JoyRun"));
bool onGround = __instance.IsOnGround();
// IsSwimming is the exact test UpdateMotion uses to hand the frame to UpdateSwimming
// instead of UpdateFlying, so it is also the one condition DirectedFlightWaterPatch has
// to take back. Its half-second tail past leaving the water is welcome here - it
// keeps the climb going just long enough to clear the surface properly.
bool inWater = __instance.IsSwimming();
// Powered flight is paid for up front, per frame. A form that cannot pay - out of
// stamina, or barred from powering at all - falls through to the glide below rather
// than out of the sky.
if ((forward || backward) && !(form.CanPower && TrySpendStamina(form.PoweredStaminaPerSecond, dt)))
{
forward = false;
backward = false;
}
Reversing = backward;
// m_run only picks between the two fly speeds. Every mode now has its own speed, so
// leave it off and drive all of them through m_flySlowSpeed.
traverse.Field("m_run").SetValue(false);
// UpdateFlying rotates the body toward m_moveDir on its own, but at m_flyTurnSpeed,
// which sits at Character's 12 deg/s default because the Player prefab was never set
// up as a flying creature - a 90 degree turn would take over seven seconds, so the
// model reads as not turning at all. Give it a speed that suits a flying form.
traverse.Field("m_flyTurnSpeed").SetValue(form.TurnSpeed);
// Powered flight, ground contact and clawing out of water all refresh the hover
// window, so none of them can be followed by an immediate sink.
if (forward || backward || onGround || inWater) form.LastPoweredTime = Time.time;
Vector3 moveDir = lookDir;
float speed;
if (inWater)
{
// Wet wings still beat. Water used to be a trap: UpdateMotion hands a swimming
// character to UpdateSwimming before it ever looks at m_flying, so a form that
// touched the sea was stuck paddling with the flight controls doing nothing.
// DirectedFlightWaterPatch gives the frame back to flight, and this branch spends
// it climbing regardless of where the camera points, so the surface is always
// something you break out of rather than something you sit in. Free on purpose:
// a form that could not pay to leave the water would drown in it.
moveDir = (Vector3.up + FlatHeading(__instance, lookDir) * LIFTOFF_HEADING_BLEND).normalized;
speed = form.LiftoffSpeed;
}
else if (backward)
{
// Straight reverse thrust along the aim, pitch included: look down and beat back
// and you rise away from what you are looking at, which is the whole point of
// having a reverse - you can retreat without taking your eyes (or your breath
// attack, which fires along the same vector) off the target.
moveDir = -lookDir;
speed = form.ReverseSpeed;
}
else if (forward)
{
speed = form.BoostSpeed;
if (sprintKey && TrySpendStamina(form.SprintStaminaPerSecond, dt)) speed = form.SprintSpeed;
}
else if (onGround || Time.time - form.LastPoweredTime < form.HoverSeconds)
{
// Holding station: on the ground this keeps a touchdown from sliding the player
// forward forever, and in the air it gives the beats of level flight before the
// form starts to sink. m_moveDir stays full length so the body still turns to
// face the camera, and zeroing the speed (rather than the rigidbody velocity)
// avoids fighting the AddForce UpdateFlying queues, which caused visible jitter.
speed = 0f;
}
else
{
// Unpowered flight is a glide, not a hover with a joystick: drift along the
// heading the camera faces while losing height, so aiming at the sky without
// holding W no longer climbs.
moveDir = (FlatHeading(__instance, lookDir) + Vector3.down * DESCENT_SLOPE).normalized;
speed = form.GlideSpeed;
}
traverse.Field("m_moveDir").SetValue(moveDir);
traverse.Field("m_flySlowSpeed").SetValue(speed);
}
/// <summary>Aim flattened onto the ground plane, falling back to the body's own facing
/// when the player is looking straight up or down.</summary>
private static Vector3 FlatHeading(Character character, Vector3 lookDir)
{
Vector3 heading = new Vector3(lookDir.x, 0f, lookDir.z);
if (heading.sqrMagnitude < 0.0001f)
{
heading = character.transform.forward;
heading.y = 0f;
}
return heading.normalized;
}
/// <summary>
/// Charges this frame of a per-second cost. Returns false when the player cannot pay.
/// A rate of zero is always paid, so a free mode costs nothing and never fails.
/// </summary>
private static bool TrySpendStamina(float perSecond, float dt)
{
if (perSecond <= 0f) return true;
Player player = Player.m_localPlayer;
if (player == null) return false;
float cost = perSecond * dt;
if (!player.HaveStamina(cost)) return false;
player.UseStamina(cost);
return true;
}
}
/// <summary>
/// Character.UpdateMotion asks IsSwimming before it asks m_flying, so a flying form that
/// touched water was handed to UpdateSwimming every frame: the flight patch above never ran,
/// the form paddled on the surface, and there was no way back into the air short of finding
/// land. Hand those frames back to UpdateFlying, which is the only motion path the two methods
/// contend over: nothing else calls either of them, and everything that merely asks
/// IsSwimming - the Wet status, the animator, stamina - is left alone.
/// </summary>
[HarmonyPatch(typeof(Character), "UpdateSwimming")]
public static class DirectedFlightWaterPatch
{
private static readonly MethodInfo UpdateFlyingMethod = AccessTools.Method(typeof(Character), "UpdateFlying");
public static bool Prefix(Character __instance, float dt)
{
if (__instance != Player.m_localPlayer) return true;
if (DirectedFlight.Flying == null) return true;
// Fail open: if a game update ever renames the method, swim normally rather than
// freezing the player in place with no motion update at all.
if (UpdateFlyingMethod == null) return true;
UpdateFlyingMethod.Invoke(__instance, new object[] { dt });
return false;
}
}
}

View file

@ -19,11 +19,12 @@ This mod currently introduces 4 custom races:
### 4. Aswid
- **The Vampire**: A creature of the night with powerful life-draining abilities.
- **Bat Transformation**: Press `G` to transform into a bat, allowing you to fly over obstacles and travel quickly.
- **Blood Magic**: Block to channel a life-draining aura that saps the life of enemies in an area around you (doubled radius at night).
- **Bat Transformation**: Press `G` to transform into a bat. It flies where you look, like the Skadi's drake: W beats forward, Shift sprints, S beats backwards, and both cost stamina. Out of stamina you can only glide.
- **Vampiric Aura**: Always on (toggle with [I]): drains the life of nearby enemies, with a doubled radius at night. Silent in Bat form until The Queen falls (configurable).
- **Blood Magic Mastery**: You can cast Blood Magic items with infinite Eitr, relying purely on their health costs.
- **Night Prowler**: Your passive speed and jump bonuses double during the night.
- **Undead Vigor**: Like the skeleton, the Aswid has infinite stamina. You consume the lifeforce of fallen foes directly instead of eating standard food.
- **Undead Vigor**: The Aswid has a large stamina pool that grows with every boss, on top of its food. You consume the lifeforce of fallen foes directly instead of eating standard food.
- **The Curse's Price**: By day under open sky the sun slows you, weakens your regeneration and burns you down to 30% health; a roof, a dungeon, the Swamp, the Mistlands, the night or your Eclipse shield you. You also take 25% more fire damage (until Fader) and 20% more pierce damage. Running water rejects you: swimming costs double stamina, and open water (sea, river or lake) burns you while you swim in it or fly over it, unless a boat carries you. Every weakness can be switched off in the config.
## Installation (manual)
1. Install BepInExPack Valheim.
@ -67,14 +68,14 @@ This mod currently introduces 4 custom races:
## Race Progressions (Level-by-Level)
### Aswid Progression
- **Base (No Bosses)**: Vampiric Aura (heal 20% on magic AoE damage). Progressive stats (+3 Armor, +5 Damage, +3% Speed, +3% Jump per boss killed). All passive bonuses are doubled at night! You can cast Blood Magic items with infinite Eitr.
- **Eikthyr**: Bat Transformation (Night only).
- **The Elder**: Bat Transformation (Always active).
- **Bonemass**: Superhuman Senses (Aura reveals untamed creatures).
- **Moder**: Freezing Blood (Permanent immunity to Freezing and Poison).
- **Yagluth**: Enslavement Power (E Key - Enslave non-tameable enemies).
- **The Queen**: Mist Form (H Key - Immune to physical/poison, double aura damage, weak to fire/frost/spirit. Breaks at sunrise).
- **Fader**: +10% Size, +30 Physical Damage. Physical kills automatically consume enemies.
- **Base (No Bosses)**: Physical kills devour edible enemies, feeding you their blood (Vae Victis). Per boss defeated: +1 Armor, +2 physical damage, +1% Speed and Jump, +2% Lifesteal on physical hits, all doubled at night. +25 Maximum Stamina, plus 10 per boss. Blood Magic items cast with infinite Eitr. Vampiric Aura (toggle with I). Claws of the Beast. Weaknesses: sunlight, fire, pierce and running water (see above).
- **Eikthyr**: Bat Form (G Key, night only), flown on stamina. Tame boars (U Key).
- **The Elder**: Bat Form by day as well as night.
- **Bonemass**: No new power; the per-boss stats keep growing.
- **Moder**: Freezing Blood (immune to Freezing and Poison). Superhuman Senses (marks untamed creatures within 100m). Tame wolves.
- **Yagluth**: Eclipse (J Key, forces night around you for 60s, 15-minute cooldown). Dominate (Interact key, a non-boss enemy fights for you for 60s). Tame lox.
- **The Queen**: Mist Form (H Key: immune to physical and poison damage, double aura damage, breaks at sunrise). The Vampiric Aura works in Bat Form.
- **Fader**: Asmund: 10% taller, +30 damage on every attack. The fire weakness ends. Tame asksvin.
### Skadi Progression
- **Base (No Bosses)**: Immune to Cold, Bonus Frost Damage, 50% Frost Resistance.

View file

@ -22,11 +22,12 @@ This mod currently introduces 6 custom races:
### 4. Aswid
- **The Vampire**: A creature of the night with powerful life-draining abilities.
- **Bat Transformation**: Press G to transform into a bat, allowing you to fly over obstacles and travel quickly.
- **Blood Magic**: Block to channel a life-draining aura that saps the life of enemies in an area around you (doubled radius at night). **Only available while in Bat or Mist form.**
- **Bat Transformation**: Press G to transform into a bat. It flies where you look, like the Skadi's drake: W beats forward, Shift sprints, S beats backwards, and both cost stamina. Out of stamina you can only glide.
- **Vampiric Aura**: Always on (toggle with [I]): drains the life of nearby enemies, with a doubled radius at night. Silent in Bat form until The Queen falls (configurable).
- **Blood Magic Mastery**: You can cast Blood Magic items with infinite Eitr, relying purely on their health costs.
- **Day walker, Night stalker**: Your passive speed and jump bonuses double during the night.
- **Undead Vigor**: Like the skeleton, the Aswid has infinite stamina. You consume the lifeforce of fallen foes directly instead of eating standard food.
- **Undead Vigor**: The Aswid has a large stamina pool that grows with every boss, on top of its food. You consume the lifeforce of fallen foes directly instead of eating standard food.
- **The Curse's Price**: By day under open sky the sun slows you, weakens your regeneration and burns you down to 30% health; a roof, a dungeon, the Swamp, the Mistlands, the night or your Eclipse shield you. You also take 25% more fire damage (until Fader) and 20% more pierce damage. Running water rejects you: swimming costs double stamina, and open water (sea, river or lake) burns you while you swim in it or fly over it, unless a boat carries you. Every weakness can be switched off in the config.
### 5. Furling
- **Goblin Heritage**: You play as a Goblin (Fuling). No beard, no hair (for males).
@ -67,14 +68,14 @@ This mod currently introduces 6 custom races:
- **Fader**: Through Fire and Flames — permanently on fire (visual only), immune to fire damage, physical attacks set targets on fire.
### Aswid Progression
- **Base (No Bosses)**: Physical kills automatically consume enemies (if edible). Progressive stats (+1 Armor, +2 Damage, +1% Speed, +1% Jump per boss killed). All passive bonuses are doubled at night! You can cast Blood Magic items with infinite Eitr.
- **Eikthyr**: Bat Transformation (Night only). Vampiric Aura (heal 20% on magic AoE damage).
- **The Elder**: Bat Transformation (Always active).
- **Bonemass**: Superhuman Senses (Aura reveals untamed creatures).
- **Moder**: Freezing Blood (Permanent immunity to Freezing and Poison).
- **Yagluth**: Enslavement Power (E Key — Enslave non-tameable enemies).
- **The Queen**: Mist Form (H Key — Immune to physical/poison, double aura damage, weak to fire/frost/spirit. Breaks at sunrise).
- **Fader**: +10% Size, +30 Physical Damage. Physical kills automatically consume enemies.
- **Base (No Bosses)**: Physical kills devour edible enemies, feeding you their blood (Vae Victis). Per boss defeated: +1 Armor, +2 physical damage, +1% Speed and Jump, +2% Lifesteal on physical hits, all doubled at night. +25 Maximum Stamina, plus 10 per boss. Blood Magic items cast with infinite Eitr. Vampiric Aura (toggle with I). Claws of the Beast. Weaknesses: sunlight, fire, pierce and running water (see above).
- **Eikthyr**: Bat Form (G Key, night only), flown on stamina. Tame boars (U Key).
- **The Elder**: Bat Form by day as well as night.
- **Bonemass**: No new power; the per-boss stats keep growing.
- **Moder**: Freezing Blood (immune to Freezing and Poison). Superhuman Senses (marks untamed creatures within 100m). Tame wolves.
- **Yagluth**: Eclipse (J Key, forces night around you for 60s, 15-minute cooldown). Dominate (Interact key, a non-boss enemy fights for you for 60s). Tame lox.
- **The Queen**: Mist Form (H Key: immune to physical and poison damage, double aura damage, breaks at sunrise). The Vampiric Aura works in Bat Form.
- **Fader**: Asmund: 10% taller, +30 damage on every attack. The fire weakness ends. Tame asksvin.
### Skadi Progression
- **Base (No Bosses)**: Immune to Cold, Bonus Frost Damage, 50% Frost Resistance.

View file

@ -467,16 +467,59 @@ namespace RacesOfValheim
sb.AppendLine(ModText.Get("rov_compendium_aswid_benedictus_et_afflictus"));
sb.AppendLine(ModText.Get("rov_compendium_aswid_take_no_fall_damage_physical", arm, dmg, spd, lifesteal, (AswidConfig.BloodMagicSkillGainMultiplier.Value).ToString("0.#")));
sb.AppendLine(ModText.Get("rov_compendium_aswid_undead_vigor",
Mathf.RoundToInt(AswidRace.GetStaminaBonus(state)),
Mathf.RoundToInt(AswidConfig.StaminaBonusPerState.Value),
Mathf.RoundToInt(AswidConfig.StaminaCostMultiplier.Value * 100f)));
sb.AppendLine(ModText.Get("rov_compendium_aswid_devour_diet",
Mathf.RoundToInt(AswidConfig.DevourHealthMultiplier.Value * 100f),
Mathf.RoundToInt(AswidConfig.EarlyStaminaShare.Value * 100f),
Mathf.RoundToInt(AswidConfig.DevourStaminaShare.Value * 100f)));
bool fireNow = AswidRace.HasFireWeakness(state);
bool fireGone = AswidConfig.FireWeaknessEnabled.Value && !fireNow;
if (AswidConfig.SunlightEnabled.Value || AswidConfig.FireWeaknessEnabled.Value || AswidConfig.PierceWeaknessEnabled.Value || AswidConfig.RunningWaterEnabled.Value)
sb.AppendLine(ModText.Get("rov_compendium_aswid_weaknesses"));
if (AswidConfig.SunlightEnabled.Value)
sb.AppendLine(ModText.Get("rov_compendium_aswid_weakness_sunlight",
Mathf.RoundToInt(AswidConfig.SunHealthRegenPenalty.Value * 100f),
Mathf.RoundToInt(AswidConfig.SunStaminaRegenPenalty.Value * 100f),
Mathf.RoundToInt(AswidConfig.SunSpeedPenalty.Value * 100f),
AswidConfig.SunHealthLossPerSecond.Value.ToString("0.#"),
Mathf.RoundToInt(AswidConfig.SunHealthFloor.Value * 100f)));
if (fireNow)
sb.AppendLine(ModText.Get("rov_compendium_aswid_weakness_fire", Mathf.RoundToInt(AswidConfig.FireWeakness.Value * 100f)));
else if (fireGone)
sb.AppendLine(ModText.Get("rov_compendium_aswid_weakness_fire_gone"));
if (AswidConfig.PierceWeaknessEnabled.Value)
sb.AppendLine(ModText.Get("rov_compendium_aswid_weakness_pierce", Mathf.RoundToInt(AswidConfig.PierceWeakness.Value * 100f)));
if (AswidConfig.RunningWaterEnabled.Value)
sb.AppendLine(ModText.Get("rov_compendium_aswid_weakness_water",
AswidConfig.SwimStaminaMultiplier.Value.ToString("0.#"),
AswidConfig.SeaHealthLossPerSecond.Value.ToString("0.#"),
AswidConfig.SeaStaminaDrainPerSecond.Value.ToString("0.#")));
sb.AppendLine(ModText.Get("rov_compendium_aswid_vampiric_aura_passive_toggle"));
sb.AppendLine(ModText.Get("rov_compendium_aswid_always_active_every_form_with", auraRadiusDay, auraRadiusNight, auraExecute));
int batAuraUnlock = AswidConfig.BatAuraUnlockState.Value;
if (AswidRace.BatAuraAllowed(state))
sb.AppendLine(ModText.Get("rov_compendium_aswid_aura_bat_on"));
else if (batAuraUnlock > 0)
sb.AppendLine(ModText.Get("rov_compendium_aswid_aura_bat_locked", BossProgressionManager.GetBossTokenForState(batAuraUnlock)));
else
sb.AppendLine(ModText.Get("rov_compendium_aswid_aura_bat_never"));
// The live figure, so the entry cannot drift from the code: it is the same yardstick
// the Sverm's own claws are measured against, which is what keeps the three races even.
sb.AppendLine(ModText.Get("rov_compendium_aswid_claws_beast_s_grows_blackened", (RaceClawsConfig.DurationSeconds.Value).ToString("0"), (SvermClaws.GetDamagePercent(state) * 100f).ToString("0")));
if (state >= 2)
{
sb.AppendLine(ModText.Get("rov_compendium_aswid_bat_form_g_key_night"));
sb.AppendLine(ModText.Get("rov_compendium_aswid_bat_flight",
AswidConfig.BatPoweredStaminaPerSecond.Value.ToString("0.#"),
AswidConfig.BatSprintStaminaPerSecond.Value.ToString("0.#")));
}
if (state >= 2)
sb.AppendLine(ModText.Get("rov_compendium_aswid_tame_u_key_tame_boar"));

View file

@ -4,10 +4,10 @@ using Jotunn.Managers;
namespace RacesOfValheim
{
public class DrakeFormBehavior : MonoBehaviour
public class DrakeFormBehavior : MonoBehaviour, IDirectedFlyer
{
// Single active instance, read by SkadiDirectedFlightPatch to feed a
// look-direction-based m_moveDir into Character.UpdateFlying every frame.
// Single active instance, read by the Skadi patches that care about the drake itself
// (breath facing, attacks). Flight reads it through DirectedFlight.Active instead.
public static DrakeFormBehavior Active { get; private set; }
private Animator anim;
@ -41,9 +41,25 @@ namespace RacesOfValheim
if (nview != null && nview.IsValid()) nview.GetZDO().Set(FlyingKey, value);
}
// Time.time of the last powered/grounded moment. SkadiDirectedFlightPatch holds the form
// Time.time of the last powered/grounded moment. DirectedFlightPatch holds the form
// level for a short window past this before letting it start sinking.
public float LastPoweredTime;
public float LastPoweredTime { get; set; }
// The drake's numbers for DirectedFlightPatch. Base flight stays free on purpose - the
// drake arrives at the Elder, long before the player has the stamina pool to pay for
// simply staying airborne - so only the sprint costs anything.
public float TurnSpeed => SkadiConfig.FlightTurnSpeed.Value;
public float GlideSpeed => SkadiConfig.FlightGlideSpeed.Value;
public float BoostSpeed => SkadiConfig.FlightBoostSpeed.Value;
public float SprintSpeed => SkadiConfig.FlightSprintSpeed.Value;
public float ReverseSpeed => SkadiConfig.FlightReverseSpeed.Value;
// Climbing out of water is deliberately slower than a powered climb in open air - the
// wings are dragging themselves free, not racing.
public float LiftoffSpeed => SkadiConfig.FlightLiftoffSpeed.Value;
public float HoverSeconds => SkadiConfig.FlightHoverSeconds.Value;
public float PoweredStaminaPerSecond => 0f;
public float SprintStaminaPerSecond => SkadiConfig.FlightSprintStaminaPerSecond.Value;
public bool CanPower => true;
private SkadiProgression.FormRules formRules;
@ -97,6 +113,7 @@ namespace RacesOfValheim
private void Start()
{
Active = this;
DirectedFlight.Register(this);
anim = GetComponentInChildren<Animator>();
if (Player.m_localPlayer != null)
@ -609,6 +626,7 @@ namespace RacesOfValheim
private void OnDestroy()
{
if (Active == this) Active = null;
DirectedFlight.Unregister(this);
if (Player.m_localPlayer != null)
{
SetFlying(false);

View file

@ -316,221 +316,7 @@ namespace RacesOfValheim
// DrakeFormBehavior flips the player into Character's native flying-creature movement
// (m_flying = true) instead of the old debug-fly noclip, which lets us feed it a full 3D
// move direction. Character.UpdateFlying normally reads whatever m_moveDir the vanilla input
// pipeline last wrote (ground-plane WASD relative to camera yaw only); this patch overwrites
// it every frame with the camera's actual look direction (pitch included) so the player always
// glides toward wherever the mouse is aiming, with W powering forward, Shift spending stamina
// for a burst of speed, and S beating backwards away from whatever you are looking at.
[HarmonyPatch(typeof(Character), "UpdateFlying")]
public static class SkadiDirectedFlightPatch
{
// Read from SkadiConfig (BepInEx Config) rather than fixed constants, so flight can be
// retuned from Configuration Manager - see CONFIGURATION-MANAGER-HOWTO.md.
private static float TURN_SPEED => SkadiConfig.FlightTurnSpeed.Value;
private static float GLIDE_SPEED => SkadiConfig.FlightGlideSpeed.Value;
private static float BOOST_SPEED => SkadiConfig.FlightBoostSpeed.Value;
private static float SPRINT_SPEED => SkadiConfig.FlightSprintSpeed.Value;
private static float REVERSE_SPEED => SkadiConfig.FlightReverseSpeed.Value;
// Climbing out of water is deliberately slower than a powered climb in open air - the
// wings are dragging themselves free, not racing.
private static float LIFTOFF_SPEED => SkadiConfig.FlightLiftoffSpeed.Value;
private static float HOVER_SECONDS => SkadiConfig.FlightHoverSeconds.Value;
// Per second, drained only while the sprint is actually being granted.
private static float SPRINT_STAMINA_PER_SECOND => SkadiConfig.FlightSprintStaminaPerSecond.Value;
// Tangent of the unpowered descent angle: 0.4 sinks at roughly 22 degrees below level.
private const float DESCENT_SLOPE = 0.4f;
// How much of the aim heading survives the climb out of water. Mostly up, with enough
// forward in it that the player still chooses which shore they surface towards.
private const float LIFTOFF_HEADING_BLEND = 0.35f;
// How far the left stick has to be pushed before it counts as W or S.
private const float StickThreshold = 0.5f;
/// <summary>
/// True while the local player is beating backwards this frame. Read by
/// SkadiReverseFacingPatch, which keeps the body pointed at the camera while it happens.
/// </summary>
public static bool Reversing { get; private set; }
// The September 2026 hotfix dropped the bool parameter from ZInput.GetJoyLeftStickY.
// A direct call binds to whichever signature we compiled against and throws
// MissingMethodException on the other, so resolve it at runtime and accept either.
private static readonly MethodInfo JoyLeftStickYMethod =
AccessTools.Method(typeof(ZInput), "GetJoyLeftStickY", new System.Type[0]) ??
AccessTools.Method(typeof(ZInput), "GetJoyLeftStickY", new[] { typeof(bool) });
private static float JoyLeftStickY()
{
if (JoyLeftStickYMethod == null) return 0f;
return (float)JoyLeftStickYMethod.Invoke(null, JoyLeftStickYArgs);
}
// Old signature: pass smooth = true, which was its default.
private static readonly object[] JoyLeftStickYArgs =
JoyLeftStickYMethod != null && JoyLeftStickYMethod.GetParameters().Length == 1 ? new object[] { true } : null;
public static void Prefix(Character __instance, float dt)
{
if (__instance != Player.m_localPlayer) return;
DrakeFormBehavior form = DrakeFormBehavior.Active;
if (form == null || !form.IsFlying)
{
Reversing = false;
return;
}
var traverse = Traverse.Create(__instance);
Vector3 lookDir = Player.m_localPlayer.GetLookDir();
bool input = RaceInput.Allowed;
// The pad's half of W/S: the left stick, read with vanilla's own sign -
// PlayerController.FixedUpdate takes forward as the NEGATED GetJoyLeftStickY.
// Flight only knows powered forward, reverse or neither, so the stick is a
// threshold, not a throttle. Steering stays on the camera, i.e. the right stick.
float stick = -JoyLeftStickY();
bool forward = input && (Input.GetKey(KeyCode.W) || stick > StickThreshold);
// Forward wins a W+S mash rather than the two cancelling into a dead hover.
bool backward = input && !forward && (Input.GetKey(KeyCode.S) || stick < -StickThreshold);
// Sprint on a pad is vanilla's run button, wherever the chosen layout puts it.
bool sprintKey = input && (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift) ||
ZInput.GetButton("JoyRun"));
bool onGround = __instance.IsOnGround();
// IsSwimming is the exact test UpdateMotion uses to hand the frame to UpdateSwimming
// instead of UpdateFlying, so it is also the one condition SkadiWaterFlightPatch has
// to take back. Its half-second tail past leaving the water is welcome here - it
// keeps the climb going just long enough to clear the surface properly.
bool inWater = __instance.IsSwimming();
Reversing = backward;
// m_run only picks between the two fly speeds. Every mode now has its own speed, so
// leave it off and drive all of them through m_flySlowSpeed.
traverse.Field("m_run").SetValue(false);
// UpdateFlying rotates the body toward m_moveDir on its own, but at m_flyTurnSpeed,
// which sits at Character's 12 deg/s default because the Player prefab was never set
// up as a flying creature - a 90 degree turn would take over seven seconds, so the
// model reads as not turning at all. Give it a speed that suits a flying mount.
traverse.Field("m_flyTurnSpeed").SetValue(TURN_SPEED);
// Powered flight, ground contact and clawing out of water all refresh the hover
// window, so none of them can be followed by an immediate sink.
if (forward || backward || onGround || inWater) form.LastPoweredTime = Time.time;
Vector3 moveDir = lookDir;
float speed;
if (inWater)
{
// Wet wings still beat. Water used to be a trap: UpdateMotion hands a swimming
// character to UpdateSwimming before it ever looks at m_flying, so a dragon that
// touched the sea was stuck paddling with the flight controls doing nothing.
// SkadiWaterFlightPatch gives the frame back to flight, and this branch spends it
// climbing regardless of where the camera points, so the surface is always
// something you break out of rather than something you sit in.
moveDir = (Vector3.up + FlatHeading(__instance, lookDir) * LIFTOFF_HEADING_BLEND).normalized;
speed = LIFTOFF_SPEED;
}
else if (backward)
{
// Straight reverse thrust along the aim, pitch included: look down and beat back
// and you rise away from what you are looking at, which is the whole point of
// having a reverse - you can retreat without taking your eyes (or your breath
// attack, which fires along the same vector) off the target.
moveDir = -lookDir;
speed = REVERSE_SPEED;
}
else if (forward)
{
speed = BOOST_SPEED;
// The sprint is the only part of flight that costs anything. Base flight stays
// free on purpose - the drake arrives at the Elder, long before the player has
// the stamina pool to pay for simply staying airborne.
if (sprintKey && TrySpendSprintStamina(dt)) speed = SPRINT_SPEED;
}
else if (onGround || Time.time - form.LastPoweredTime < HOVER_SECONDS)
{
// Holding station: on the ground this keeps a touchdown from sliding the player
// forward forever, and in the air it gives the beats of level flight before the
// form starts to sink. m_moveDir stays full length so the body still turns to
// face the camera, and zeroing the speed (rather than the rigidbody velocity)
// avoids fighting the AddForce UpdateFlying queues, which caused visible jitter.
speed = 0f;
}
else
{
// Unpowered flight is a glide, not a hover with a joystick: drift along the
// heading the camera faces while losing height, so aiming at the sky without
// holding W no longer climbs.
moveDir = (FlatHeading(__instance, lookDir) + Vector3.down * DESCENT_SLOPE).normalized;
speed = GLIDE_SPEED;
}
traverse.Field("m_moveDir").SetValue(moveDir);
traverse.Field("m_flySlowSpeed").SetValue(speed);
}
/// <summary>Aim flattened onto the ground plane, falling back to the body's own facing
/// when the player is looking straight up or down.</summary>
private static Vector3 FlatHeading(Character character, Vector3 lookDir)
{
Vector3 heading = new Vector3(lookDir.x, 0f, lookDir.z);
if (heading.sqrMagnitude < 0.0001f)
{
heading = character.transform.forward;
heading.y = 0f;
}
return heading.normalized;
}
/// <summary>
/// Charges this frame of sprint. Returns false when the player cannot pay, which drops
/// them back to the free boost speed rather than out of the sky.
/// </summary>
private static bool TrySpendSprintStamina(float dt)
{
Player player = Player.m_localPlayer;
if (player == null) return false;
float cost = SPRINT_STAMINA_PER_SECOND * dt;
if (!player.HaveStamina(cost)) return false;
player.UseStamina(cost);
return true;
}
}
/// <summary>
/// Character.UpdateMotion asks IsSwimming before it asks m_flying, so a flying dragon that
/// touched water was handed to UpdateSwimming every frame: the flight patch above never ran,
/// the form paddled on the surface, and there was no way back into the air short of finding
/// land. (The Aswid's bat escapes this because debug-fly is checked at the very top of
/// UpdateMotion, before water is considered at all - which is exactly why it can take off
/// from the sea.) Hand those frames back to UpdateFlying, which is the only motion path the
/// two methods contend over: nothing else calls either of them, and everything that merely
/// asks IsSwimming - the Wet status, the animator, stamina - is left alone.
/// </summary>
[HarmonyPatch(typeof(Character), "UpdateSwimming")]
public static class SkadiWaterFlightPatch
{
private static readonly MethodInfo UpdateFlyingMethod = AccessTools.Method(typeof(Character), "UpdateFlying");
public static bool Prefix(Character __instance, float dt)
{
if (__instance != Player.m_localPlayer) return true;
DrakeFormBehavior form = DrakeFormBehavior.Active;
if (form == null || !form.IsFlying) return true;
// Fail open: if a game update ever renames the method, swim normally rather than
// freezing the player in place with no motion update at all.
if (UpdateFlyingMethod == null) return true;
UpdateFlyingMethod.Invoke(__instance, new object[] { dt });
return false;
}
}
// Directed flight (the controls) lives in DirectedFlight.cs, shared with the Aswid's bat.
/// <summary>
/// UpdateFlying turns the body to face m_moveDir, which is right for every direction of
@ -559,10 +345,8 @@ namespace RacesOfValheim
return false;
}
if (!SkadiDirectedFlightPatch.Reversing) return true;
DrakeFormBehavior form = DrakeFormBehavior.Active;
if (form == null || !form.IsFlying) return true;
if (!DirectedFlightPatch.Reversing) return true;
if (DirectedFlight.Flying == null) return true;
__result = true;
return false;

View file

@ -62,7 +62,8 @@ namespace RacesOfValheim
{
public static bool Prefix(Player __instance)
{
if ((SkeletonRace.IsSkeleton() || AswidRace.IsAswid() || DraughRace.IsDraugh()) && __instance == Player.m_localPlayer)
// The Aswid used to be on this list. It spends stamina now, see Aswid_UseStamina_Patch.
if ((SkeletonRace.IsSkeleton() || DraughRace.IsDraugh()) && __instance == Player.m_localPlayer)
{
// Infinite stamina: skip the original UseStamina method
return false;

View file

@ -23,10 +23,14 @@
"rov_compendium_alfar_crystals": "Crystals: the Nexus grows them slowly and stops at $1 until someone - you or a drone - collects them. An upgrade for $2 crystals makes it faster.\n",
"rov_compendium_alfar_ljosgard": "Ljosgard: a module of the Nexus that turns Magecap and Jotun Puffs into Sap, the slow way to farm magic.\n",
"rov_compendium_alfar_towers": "Prismavard: bronze and crystal turrets with their own shield, powered by the Nexus radius, repaired with the hammer.\n",
"rov_compendium_aswid_always_active_every_form_with": "Always active, in every form, with no key to hold - only the on/off toggle. Drains a $1m radius by day, $2m by night, for magic damage that scales with your Blood Magic skill, healing you for the damage dealt. Enemies at or below $3% health are executed outright. The aura hits for half in human form, full as a Bat, and double as Mist. It cannot tell traders from monsters, so switch it off with [I] before talking to Haldor or Hildir.\n",
"rov_compendium_aswid_always_active_every_form_with": "Always active, with no key to hold - only the on/off toggle. Drains a $1m radius by day, $2m by night, for magic damage that scales with your Blood Magic skill, healing you for the damage dealt. Enemies at or below $3% health are executed outright. The aura hits for half in human form and double as Mist. It cannot tell traders from monsters, so switch it off with [I] before talking to Haldor or Hildir.\n",
"rov_compendium_aswid_aura_bat_on": "As a Bat the aura drains at full strength.\n",
"rov_compendium_aswid_aura_bat_locked": "As a Bat you have no aura until $1 falls. From then on it drains at full strength.\n",
"rov_compendium_aswid_aura_bat_never": "As a Bat you have no aura.\n",
"rov_compendium_aswid_asmund_passive": "[Fader Unlock] Asmund (Passive):",
"rov_compendium_aswid_aswid_s_curse": "The Aswid's Curse\n",
"rov_compendium_aswid_bat_form_g_key_night": "[Eikthyr Unlock] Bat Form ('G' Key, night only): Take the shape of a bat.\n",
"rov_compendium_aswid_bat_flight": "The bat flies where you look: W beats forward for $1 stamina a second, Shift sprints for $2 more, S beats backwards, and letting go holds you still for a moment before you glide down. Out of stamina, you can only glide.\n",
"rov_compendium_aswid_bat_form_now_answers_by": "[The Elder Unlock] Bat Form now answers by day as well as night.\n",
"rov_compendium_aswid_benedictus_et_afflictus": "[Base Passive] Benedictus et Afflictus:",
"rov_compendium_aswid_claws_beast_s_grows_blackened": "[Base Passive] Claws of the Beast ([K], $1s): Grows blackened claws for a limited time instead of a weapon. Bare-handed blows land at $2% of a full-grown pair's weight, all of it as slash, and they grow with every boss that falls. Draw a sword and they wait, sheathe it and they are back, until the timer runs out and they retract on their own - no slot wasted between casts. They cannot be dropped, traded or stolen while grown - and in bat or mist form you have no hands to hold them with.\n",
@ -39,6 +43,14 @@
"rov_compendium_aswid_sense_every_untamed_creature_within": "You sense every untamed creature within $1m, marking it with a telltale glow.\n",
"rov_compendium_aswid_superhuman_senses_passive": "[Moder Unlock] Superhuman Senses (Passive):",
"rov_compendium_aswid_take_no_fall_damage_physical": "You take no fall damage, and physical kills automatically devour edible enemies (Vae Victis) for Blood Magic XP. Your physical stats scale with every boss you defeat: +$1 Armor, +$2 Damage, +$3% Speed and Jump, and +$4% Lifesteal on physical hits. All of these bonuses double during the night. You can cast Blood Magic items with infinite Eitr, and your Blood Magic skill rises $5x as fast.\n",
"rov_compendium_aswid_undead_vigor": "Undead Vigor: your endurance is unholy but not endless. You carry +$1 Maximum Stamina at your present standing (+$2 for every boss), on top of what your food gives, and every stamina cost lands at $3% of the normal price.\n",
"rov_compendium_aswid_devour_diet": "Blood is all you eat, and what it gives depends on whose it was. A devoured creature feeds $1% of the health it once did. Of that, Meadows and Black Forest prey turn $2% into stamina instead, anything from further afield $3%. Creatures without a meal of their own feed no more than their homeland allows: a troll is still Black Forest prey.\n",
"rov_compendium_aswid_weaknesses": "[Base Weakness] The Curse's Price:",
"rov_compendium_aswid_weakness_sunlight": "Sunlight: by day, under open sky, you regenerate $1% less health and $2% less stamina, move $3% slower, and burn $4 health a second down to $5% of your maximum. A roof, a dungeon, the Swamp, the Mistlands, the night or your own Eclipse keep the sun off you.\n",
"rov_compendium_aswid_weakness_fire": "Fire: you take $1% more fire damage, burning included. Defeating Fader ends it.\n",
"rov_compendium_aswid_weakness_fire_gone": "Fire: with Fader fallen, the flame is yours, and fire no longer hurts you more than anyone else.\n",
"rov_compendium_aswid_weakness_pierce": "The Stake: you take $1% more pierce damage. As Mist, nothing pierces you at all.\n",
"rov_compendium_aswid_weakness_water": "Running Water: swimming costs $1x the stamina. In open water or flying over it, sea, river or lake alike, you lose $2 health and $3 stamina a second. A boat carries you across unharmed, though your stomach still turns.\n",
"rov_compendium_aswid_tame_u_key_asksvin_join": "[Fader Unlock] Tame ('U' Key): Asksvin join the huntable list.\n",
"rov_compendium_aswid_tame_u_key_lox_join": "[Yagluth Unlock] Tame ('U' Key): Lox join the huntable list.\n",
"rov_compendium_aswid_tame_u_key_tame_boar": "[Eikthyr Unlock] Tame ('U' Key): Tame a boar under your cursor.\n",

View file

@ -17,6 +17,10 @@
"rov_msg_aswid_tamed": "Tamed!",
"rov_msg_aswid_vae_victis": "Vae Victis",
"rov_msg_aswid_what_horrible_night_have_curse": "what a horrible night to have a curse",
"rov_msg_aswid_bat_cooldown": "Your blood is not ready to take wing again ($1s)",
"rov_msg_aswid_bat_form_fades": "The bat form fades",
"rov_msg_aswid_bat_too_heavy_to_beat": "Too heavy to beat your wings. You can only glide",
"rov_msg_aswid_too_heavy_for_bat": "You carry too much to take bat form",
"rov_msg_build_limit_cooktable": "Another cook's table stands within forty paces. One cook to a yard.",
"rov_msg_build_limit_draugh_bodypile": "The ground here already carries $1 of these. Find another country.",
"rov_msg_build_limit_dvergar_contractbank": "There is already $1 contract bank within a day's walk. One ledger per valley.",

View file

@ -3,6 +3,10 @@
"rov_se_aswid_auspex_tooltip": "Sensing life force of nearby creatures.",
"rov_se_aswid_batform_name": "Like a Bat out of Hell",
"rov_se_aswid_batform_tooltip": "You have taken the form of a Bat. You can fly, but cannot attack.",
"rov_se_aswid_sunlight_name": "Sunlight",
"rov_se_aswid_sunlight_tooltip": "The sun is on you. Health and stamina regenerate more slowly, you move slower, and you burn, though the sun alone cannot kill you. Find a roof, the Swamp or the Mistlands.",
"rov_se_aswid_opensea_name": "Open Water",
"rov_se_aswid_opensea_tooltip": "Running water rejects you. It burns your health and drains your stamina while you swim in it or fly over it. Get on a boat or back to land.",
"rov_se_aswid_bloodpotion_tooltip": "Stomachs filled with blood. Healing $1% over $2 seconds.",
"rov_se_aswid_mistform_name": "Weight of Shadows",
"rov_se_aswid_mistform_tooltip": "You are mist. Immune to physical damage and poison. Cannot attack or run.",

View file

@ -23,10 +23,14 @@
"rov_compendium_alfar_crystals": "Cristalli: il Nexus li coltiva lentamente e si ferma a $1 finché qualcuno - tu o un drone - non li raccoglie. Un potenziamento da $2 cristalli lo rende più veloce.\n",
"rov_compendium_alfar_ljosgard": "Ljosgard: un modulo del Nexus che trasforma Magecap e Jotun Puffs in Linfa, il modo lento di coltivare la magia.\n",
"rov_compendium_alfar_towers": "Prismavard: torrette di bronzo e cristallo con uno scudo proprio, alimentate dal raggio del Nexus, riparabili con il martello.\n",
"rov_compendium_aswid_always_active_every_form_with": "Sempre attiva, in ogni forma, senza tasti da tenere premuti: solo l'interruttore acceso/spento. Prosciuga un raggio di $1m di giorno e $2m di notte, con danni magici che crescono con la tua abilità di Magia del sangue, e ti cura per i danni inflitti. I nemici al $3% di salute o meno vengono giustiziati all'istante. L'aura colpisce a metà in forma umana, piena da pipistrello e doppia da nebbia. Non distingue i mercanti dai mostri, quindi spegnila con [I] prima di parlare con Haldor o Hildir.\n",
"rov_compendium_aswid_always_active_every_form_with": "Sempre attiva, senza tasti da tenere premuti: solo l'interruttore acceso/spento. Prosciuga un raggio di $1m di giorno e $2m di notte, con danni magici che crescono con la tua abilità di Magia del sangue, e ti cura per i danni inflitti. I nemici al $3% di salute o meno vengono giustiziati all'istante. L'aura colpisce a metà in forma umana e doppia da nebbia. Non distingue i mercanti dai mostri, quindi spegnila con [I] prima di parlare con Haldor o Hildir.\n",
"rov_compendium_aswid_aura_bat_on": "Da pipistrello l'aura prosciuga a piena forza.\n",
"rov_compendium_aswid_aura_bat_locked": "Da pipistrello non hai aura finché $1 non cade. Da quel momento prosciuga a piena forza.\n",
"rov_compendium_aswid_aura_bat_never": "Da pipistrello non hai aura.\n",
"rov_compendium_aswid_asmund_passive": "[Sblocco Fader] Asmund (passiva):",
"rov_compendium_aswid_aswid_s_curse": "La maledizione degli Aswid\n",
"rov_compendium_aswid_bat_form_g_key_night": "[Sblocco Eikthyr] Forma di pipistrello (tasto 'G', solo di notte): prendi la forma di un pipistrello.\n",
"rov_compendium_aswid_bat_flight": "Il pipistrello vola dove guardi: W batte le ali in avanti per $1 stamina al secondo, Shift scatta per altri $2, S batte all'indietro, e se lasci tutto resti fermo un attimo prima di planare giù. Senza stamina puoi solo planare.\n",
"rov_compendium_aswid_bat_form_now_answers_by": "[Sblocco Antico] La forma di pipistrello ora risponde di giorno come di notte.\n",
"rov_compendium_aswid_benedictus_et_afflictus": "[Passiva base] Benedictus et Afflictus:",
"rov_compendium_aswid_claws_beast_s_grows_blackened": "[Passiva base] Artigli della Bestia ([K], $1s): per un tempo limitato fai crescere artigli anneriti al posto di un'arma. I colpi a mani nude valgono il $2% del peso di un paio adulto, tutto come danno da taglio, e crescono con ogni boss che cade. Sfodera una spada e aspettano, rinfoderala e tornano, finché il tempo non scade e si ritraggono da soli, senza sprecare uno slot tra un uso e l'altro. Mentre sono fuori non possono essere lasciati cadere, scambiati o rubati, e in forma di pipistrello o di nebbia non hai mani per tenerli.\n",
@ -39,6 +43,14 @@
"rov_compendium_aswid_sense_every_untamed_creature_within": "Percepisci ogni creatura non addomesticata entro $1m, e la segni con un bagliore rivelatore.\n",
"rov_compendium_aswid_superhuman_senses_passive": "[Sblocco Moder] Sensi sovrumani (passiva):",
"rov_compendium_aswid_take_no_fall_damage_physical": "Non subisci danni da caduta, e le uccisioni fisiche divorano automaticamente i nemici commestibili (Vae Victis) dandoti esperienza di Magia del sangue. Le tue statistiche fisiche crescono con ogni boss sconfitto: +$1 armatura, +$2 danni, +$3% velocità e salto, +$4% furto di vita sui colpi fisici. Di notte tutti questi bonus raddoppiano. Puoi usare gli oggetti di Magia del sangue con eitr infinito, e la tua abilità di Magia del sangue sale $5 volte più in fretta.\n",
"rov_compendium_aswid_undead_vigor": "Vigore non morto: la tua resistenza è empia, ma non infinita. Al tuo livello attuale hai +$1 stamina massima (+$2 per ogni boss), oltre a quella che ti dà il cibo, e ogni costo di stamina ti pesa il $3% del normale.\n",
"rov_compendium_aswid_devour_diet": "Ti nutri solo di sangue, e quello che ti dà dipende da chi lo versa. Una creatura divorata ti dà il $1% della salute di prima. Di questa, le prede di Prati e Foresta Nera ne trasformano il $2% in stamina, quelle delle terre più lontane il $3%. Le creature senza un pasto proprio non danno più di quanto concede la loro terra: un troll resta una preda della Foresta Nera.\n",
"rov_compendium_aswid_weaknesses": "[Debolezza di base] Il prezzo della maledizione:",
"rov_compendium_aswid_weakness_sunlight": "Luce del sole: di giorno, a cielo aperto, rigeneri il $1% di salute in meno e il $2% di stamina in meno, ti muovi il $3% più lentamente, e bruci $4 salute al secondo fino al $5% del massimo. Un tetto, un dungeon, la Palude, le Terre nebbiose, la notte o la tua Eclissi ti riparano dal sole.\n",
"rov_compendium_aswid_weakness_fire": "Fuoco: subisci il $1% di danni da fuoco in più, ustioni comprese. Sconfiggere Fader pone fine a questa debolezza.\n",
"rov_compendium_aswid_weakness_fire_gone": "Fuoco: caduto Fader, la fiamma è tua, e il fuoco non ti ferisce più di chiunque altro.\n",
"rov_compendium_aswid_weakness_pierce": "Il paletto: subisci il $1% di danni perforanti in più. Da nebbia, niente può perforarti.\n",
"rov_compendium_aswid_weakness_water": "Acqua corrente: nuotare costa $1 volte la stamina. In acque aperte o sorvolandole, che sia mare, fiume o lago, perdi $2 salute e $3 stamina al secondo. Una barca ti porta dall'altra parte senza danni, anche se lo stomaco ti si rivolta.\n",
"rov_compendium_aswid_tame_u_key_asksvin_join": "[Sblocco Fader] Addomesticare (tasto 'U'): gli asksvin si aggiungono alle prede.\n",
"rov_compendium_aswid_tame_u_key_lox_join": "[Sblocco Yagluth] Addomesticare (tasto 'U'): i lox si aggiungono alle prede.\n",
"rov_compendium_aswid_tame_u_key_tame_boar": "[Sblocco Eikthyr] Addomesticare (tasto 'U'): addomestica il cinghiale sotto il cursore.\n",

View file

@ -17,6 +17,10 @@
"rov_msg_aswid_tamed": "Addomesticato!",
"rov_msg_aswid_vae_victis": "Vae Victis",
"rov_msg_aswid_what_horrible_night_have_curse": "what a horrible night to have a curse",
"rov_msg_aswid_bat_cooldown": "Il tuo sangue non è pronto a spiccare il volo di nuovo ($1s)",
"rov_msg_aswid_bat_form_fades": "La forma di pipistrello svanisce",
"rov_msg_aswid_bat_too_heavy_to_beat": "Troppo pesante per battere le ali. Puoi solo planare",
"rov_msg_aswid_too_heavy_for_bat": "Porti troppo peso per prendere la forma di pipistrello",
"rov_msg_build_limit_cooktable": "C'è già un altro tavolo del cuoco entro quaranta passi. Un cuoco per cortile.",
"rov_msg_build_limit_draugh_bodypile": "Questo terreno ne porta già $1. Trova un'altra contrada.",
"rov_msg_build_limit_dvergar_contractbank": "C'è già $1 banca dei contratti a una giornata di cammino. Un registro per valle.",

View file

@ -3,6 +3,10 @@
"rov_se_aswid_auspex_tooltip": "Percepisci la forza vitale delle creature vicine.",
"rov_se_aswid_batform_name": "Like a Bat out of Hell",
"rov_se_aswid_batform_tooltip": "Hai preso la forma di un pipistrello. Puoi volare, ma non puoi attaccare.",
"rov_se_aswid_sunlight_name": "Luce del sole",
"rov_se_aswid_sunlight_tooltip": "Il sole ti colpisce. Salute e stamina si rigenerano più lentamente, ti muovi più piano e bruci, anche se il sole da solo non può ucciderti. Cerca un tetto, la Palude o le Terre nebbiose.",
"rov_se_aswid_opensea_name": "Acque aperte",
"rov_se_aswid_opensea_tooltip": "L'acqua corrente ti respinge. Ti brucia la salute e ti prosciuga la stamina mentre ci nuoti o la sorvoli. Sali su una barca o torna a terra.",
"rov_se_aswid_bloodpotion_tooltip": "Stomaci pieni di sangue. Cura il $1% in $2 secondi.",
"rov_se_aswid_mistform_name": "Weight of Shadows",
"rov_se_aswid_mistform_tooltip": "Sei nebbia. Immune ai danni fisici e al veleno. Non puoi attaccare né correre.",

View file

@ -23,10 +23,14 @@
"rov_compendium_alfar_crystals": "Кристаллы: Нексус медленно выращивает их и останавливается на $1, пока кто-нибудь - вы или дрон - их не соберёт. Улучшение за $2 кристаллов ускоряет его.\n",
"rov_compendium_alfar_ljosgard": "Льоскгард: модуль Нексуса, превращающий Магекап и Ётунские пуфы в Сок - медленный способ растить магию.\n",
"rov_compendium_alfar_towers": "Призмавард: башни из бронзы и кристалла со своим щитом, питаются от радиуса Нексуса, чинятся молотом.\n",
"rov_compendium_aswid_always_active_every_form_with": "Активна всегда и в любом облике, не требует зажатия клавиши — только переключение вкл/выкл. Высасывает жизнь в радиусе $1 м днем и $2 м ночью, нанося магический урон, зависящий от навыка «Магия крови», и исцеляя вас на величину нанесенного урона. Враги с запасом здоровья $3% и ниже погибают мгновенно. В человеческом облике аура наносит половинный урон, в облике летучей мыши — полный, а в облике тумана — удвоенный. Аура не отличает торговцев от монстров, поэтому отключайте ее клавишей [I] перед разговором с Хальдором или Хильдир.\n",
"rov_compendium_aswid_always_active_every_form_with": "Активна всегда, не требует зажатия клавиши — только переключение вкл/выкл. Высасывает жизнь в радиусе $1 м днем и $2 м ночью, нанося магический урон, зависящий от навыка «Магия крови», и исцеляя вас на величину нанесенного урона. Враги с запасом здоровья $3% и ниже погибают мгновенно. В человеческом облике аура наносит половинный урон, а в облике тумана — удвоенный. Аура не отличает торговцев от монстров, поэтому отключайте ее клавишей [I] перед разговором с Хальдором или Хильдир.\n",
"rov_compendium_aswid_aura_bat_on": "В облике летучей мыши аура действует в полную силу.\n",
"rov_compendium_aswid_aura_bat_locked": "В облике летучей мыши у вас нет ауры, пока не падет $1. После этого она действует в полную силу.\n",
"rov_compendium_aswid_aura_bat_never": "В облике летучей мыши у вас нет ауры.\n",
"rov_compendium_aswid_asmund_passive": "[Награда: Прародитель] Асмунд (Пассивное):",
"rov_compendium_aswid_aswid_s_curse": "Проклятие Асвида\n",
"rov_compendium_aswid_bat_form_g_key_night": "[Награда: Эйктюр] Облик летучей мыши (клавиша «G», только ночью): Примите облик летучей мыши.\n",
"rov_compendium_aswid_bat_flight": "Летучая мышь летит туда, куда вы смотрите: W — полет вперед за $1 выносливости в секунду, Shift — рывок еще за $2, S — полет назад, а если отпустить клавиши, вы ненадолго зависаете, а затем планируете вниз. Без выносливости можно только планировать.\n",
"rov_compendium_aswid_bat_form_now_answers_by": "[Награда: Древний] Облик летучей мыши теперь доступен как ночью, так и днем.\n",
"rov_compendium_aswid_benedictus_et_afflictus": "[Базовое пассивное] Benedictus et Afflictus:",
"rov_compendium_aswid_claws_beast_s_grows_blackened": "[Базовое пассивное] Когти зверя ([K], $1 с): На ограниченное время отращивает черные когти вместо оружия. Удары кулаками наносят $2% от урона зрелых когтей (полностью рубящий урон), и их сила растет с каждым поверженным боссом. Если достать меч — когти спрячутся, убрать его — вернутся, пока не истечет таймер. Не занимают ячейку экипировки. Их нельзя выбросить, передать или украсть, пока они активны. В облике летучей мыши или тумана когти недоступны, так как у вас нет рук.\n",
@ -39,6 +43,14 @@
"rov_compendium_aswid_sense_every_untamed_creature_within": "Вы чувствуете любое неприрученное существо в радиусе $1 м, подсвечивая его характерным свечением.\n",
"rov_compendium_aswid_superhuman_senses_passive": "[Награда: Матерь] Сверхчеловеческие чувства (Пассивное):",
"rov_compendium_aswid_take_no_fall_damage_physical": "Вы не получаете урона от падения, а убийства в ближнем бою автоматически пожирают съедобных врагов (Vae Victis), принося опыт магии крови. Ваши физические характеристики растут с каждым убитым боссом: +$1 к броне, +$2 к урону, +$3% к скорости и прыжку, и +$4% вампиризма при физ. атаках. Все эти бонусы удваиваются ночью. Вы можете использовать предметы магии крови с бесконечным эйтром, а навык «Магия крови» растет в $5 раз быстрее.\n",
"rov_compendium_aswid_undead_vigor": "Неживая стойкость: ваша выносливость нечестива, но не бесконечна. На текущем этапе у вас +$1 к максимальной выносливости (+$2 за каждого босса) сверх той, что дает еда, а любые траты выносливости составляют $3% от обычных.\n",
"rov_compendium_aswid_devour_diet": "Вы питаетесь только кровью, и ее сила зависит от того, чья она. Пожранное существо дает $1% прежнего здоровья. Из него добыча Лугов и Черного леса превращает $2% в выносливость, существа из дальних земель — $3%. Существа без собственного блюда дают не больше, чем позволяет их родной край: тролль остается добычей Черного леса.\n",
"rov_compendium_aswid_weaknesses": "[Базовая слабость] Цена проклятия:",
"rov_compendium_aswid_weakness_sunlight": "Солнечный свет: днем под открытым небом вы восстанавливаете на $1% меньше здоровья и на $2% меньше выносливости, двигаетесь на $3% медленнее и теряете $4 здоровья в секунду, пока оно не опустится до $5% от максимума. Крыша, подземелье, Болото, Туманные земли, ночь или ваше Затмение защищают от солнца.\n",
"rov_compendium_aswid_weakness_fire": "Огонь: вы получаете на $1% больше урона огнем, включая горение. Победа над Прародителем снимает эту слабость.\n",
"rov_compendium_aswid_weakness_fire_gone": "Огонь: после падения Прародителя пламя подвластно вам, и огонь ранит вас не сильнее, чем других.\n",
"rov_compendium_aswid_weakness_pierce": "Кол: вы получаете на $1% больше колющего урона. В облике тумана ничто не может вас пронзить.\n",
"rov_compendium_aswid_weakness_water": "Проточная вода: плавание стоит в $1 раза больше выносливости. В открытой воде или в полете над ней, будь то море, река или озеро, вы теряете $2 здоровья и $3 выносливости в секунду. Лодка переправит вас невредимым, хотя вас все равно мутит.\n",
"rov_compendium_aswid_tame_u_key_asksvin_join": "[Награда: Прародитель] Приручение (клавиша «U»): Пеплозавры добавляются в список доступных для приручения.\n",
"rov_compendium_aswid_tame_u_key_lox_join": "[Награда: Яглут] Приручение (клавиша «U»): Быкоящеры добавляются в список доступных для приручения.\n",
"rov_compendium_aswid_tame_u_key_tame_boar": "[Награда: Эйктюр] Приручение (клавиша «U»): Мгновенно приручает кабана под прицелом.\n",

View file

@ -17,6 +17,10 @@
"rov_msg_aswid_tamed": "Приручено!",
"rov_msg_aswid_vae_victis": "Vae Victis",
"rov_msg_aswid_what_horrible_night_have_curse": "Какая ужасная ночь для носителя проклятия...",
"rov_msg_aswid_bat_cooldown": "Ваша кровь еще не готова снова подняться в небо ($1 с)",
"rov_msg_aswid_bat_form_fades": "Облик летучей мыши рассеивается",
"rov_msg_aswid_bat_too_heavy_to_beat": "Слишком тяжело, чтобы махать крыльями. Вы можете только планировать",
"rov_msg_aswid_too_heavy_for_bat": "Вы несете слишком много, чтобы принять облик летучей мыши",
"rov_msg_build_limit_cooktable": "В пределах сорока шагов уже стоит стол повара. Один повар на двор.",
"rov_msg_build_limit_draugh_bodypile": "Здешняя земля уже несет на себе $1 таких построек. Найдите другое место.",
"rov_msg_build_limit_dvergar_contractbank": "В радиусе дневного перехода уже есть $1 контрактная контора. Один гроссбух на долину.",

View file

@ -3,6 +3,10 @@
"rov_se_aswid_auspex_tooltip": "Ощущение жизненной силы ближайших существ.",
"rov_se_aswid_batform_name": "Like a Bat out of Hell",
"rov_se_aswid_batform_tooltip": "Вы приняли форму летучей мыши. Вы умеете летать, но не можете нападать.",
"rov_se_aswid_sunlight_name": "Солнечный свет",
"rov_se_aswid_sunlight_tooltip": "Солнце жжет вас. Здоровье и выносливость восстанавливаются медленнее, вы двигаетесь медленнее и горите, хотя одно лишь солнце не может вас убить. Найдите крышу, Болото или Туманные земли.",
"rov_se_aswid_opensea_name": "Открытая вода",
"rov_se_aswid_opensea_tooltip": "Проточная вода отвергает вас. Пока вы плывете в ней или летите над ней, она сжигает здоровье и истощает выносливость. Поднимитесь на лодку или вернитесь на сушу.",
"rov_se_aswid_bloodpotion_tooltip": "Желудки наполнены кровью. Восстановление $1% здоровья за $2 с.",
"rov_se_aswid_mistform_name": "Weight of Shadows",
"rov_se_aswid_mistform_tooltip": "Вы — бесплотный туман. Неуязвимость к физическому урону и яду. Нельзя атаковать и бегать.",