diff --git a/JotunnModStub/Fenrir/FenrirBehaviors.cs b/JotunnModStub/Fenrir/FenrirBehaviors.cs index e2628aa..615a4a3 100644 --- a/JotunnModStub/Fenrir/FenrirBehaviors.cs +++ b/JotunnModStub/Fenrir/FenrirBehaviors.cs @@ -58,17 +58,17 @@ namespace RacesOfValheim } if (isGrounded && RaceInput.Allowed) { - if (Input.GetKeyDown(KeyCode.O)) + if (FenrirConfig.HowlKey.Value.IsDown()) { StartCoroutine(HowlRoutine()); } else if (Input.GetMouseButtonDown(1)) // Tasto destro (Heavy Claw) { - StartCoroutine(ClawRoutine("attack_claw1", 110f, 1.2f, 0.5f)); + StartCoroutine(ClawRoutine("attack_claw1", FenrirConfig.FenringHeavyClawDamage.Value, 1.2f, 0.5f)); } else if (Input.GetMouseButtonDown(0)) // Tasto sinistro { - StartCoroutine(ClawRoutine("attack_claw0", 60f, 1.0f, 0.4f)); + StartCoroutine(ClawRoutine("attack_claw0", FenrirConfig.FenringLightClawDamage.Value, 1.0f, 0.4f)); } else if (Input.GetMouseButtonDown(2)) // Tasto centrale { @@ -173,11 +173,11 @@ namespace RacesOfValheim Rigidbody rb = Player.m_localPlayer.GetComponent(); if (rb != null) { - Vector3 dashVelocity = Player.m_localPlayer.transform.forward * 31.5f; + Vector3 dashVelocity = Player.m_localPlayer.transform.forward * FenrirConfig.FenringJumpDashSpeed.Value; // Spinta verso l'alto solo nella prima metà dello scatto - if (elapsedDash < dashDuration / 2f) + if (elapsedDash < dashDuration / 2f) { - dashVelocity += Vector3.up * 13.1f; + dashVelocity += Vector3.up * FenrirConfig.FenringJumpDashUpwardSpeed.Value; } rb.MovePosition(rb.position + dashVelocity * Time.fixedDeltaTime); @@ -188,7 +188,7 @@ namespace RacesOfValheim } // Infliggiamo il danno al termine dello scatto - ExecuteClawDamage(95f); + ExecuteClawDamage(FenrirConfig.FenringJumpAttackDamage.Value); // Tempo per riprendersi dall'atterraggio prima di potersi muovere di nuovo yield return new WaitForSeconds(0.55f); @@ -203,7 +203,7 @@ namespace RacesOfValheim Vector3 playerPos = Player.m_localPlayer.transform.position; Vector3 attackPoint = playerPos + Player.m_localPlayer.transform.forward * 1.5f + Vector3.up * 1f; - float attackRadius = 2.5f; + float attackRadius = FenrirConfig.FenringAttackRadius.Value; float unarmedSkillLevel = Player.m_localPlayer.GetSkillLevel(Skills.SkillType.Unarmed); float totalDamage = baseDamage + unarmedSkillLevel; @@ -243,7 +243,7 @@ namespace RacesOfValheim { HitData hitData = new HitData(); hitData.m_damage.m_slash = totalDamage; - hitData.m_pushForce = 30f; + hitData.m_pushForce = FenrirConfig.FenringPushForce.Value; hitData.m_point = targetCenter; hitData.m_dir = Player.m_localPlayer.transform.forward; hitData.m_skill = Skills.SkillType.Unarmed; @@ -339,7 +339,7 @@ namespace RacesOfValheim StopFire(); } - if (canAct && Input.GetKeyDown(KeyCode.O)) + if (canAct && FenrirConfig.HowlKey.Value.IsDown()) { StartCoroutine(HowlRoutine()); } @@ -429,8 +429,7 @@ namespace RacesOfValheim private void UpdateFire() { - // Drain Eitr ridotto del 50% (da 25 a 12.5 per sec) - Player.m_localPlayer.UseEitr(12.5f * Time.deltaTime); + Player.m_localPlayer.UseEitr(FenrirConfig.CultistFireEitrDrainPerSecond.Value * Time.deltaTime); cultistAnim.SetFloat("forward_speed", 0f); cultistAnim.SetFloat("sideway_speed", 0f); @@ -460,11 +459,11 @@ namespace RacesOfValheim Vector3 playerPos = Player.m_localPlayer.transform.position; Vector3 attackPoint = playerPos + Player.m_localPlayer.transform.forward * 2.5f + Vector3.up * 1f; - float attackRadius = 3f; + float attackRadius = FenrirConfig.CultistFireAttackRadius.Value; float magicSkillLevel = Player.m_localPlayer.GetSkillLevel(Skills.SkillType.ElementalMagic); - float baseFireDamage = 20f; // per 0.2s - float totalDamage = baseFireDamage + (magicSkillLevel * 0.5f); + float baseFireDamage = FenrirConfig.CultistFireDamagePerTick.Value; + float totalDamage = baseFireDamage + (magicSkillLevel * FenrirConfig.CultistFireMagicSkillScaling.Value); int layerMask = LayerMask.GetMask("Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "character", "character_net", "character_ghost", "hitbox", "character_noenv", "vehicle"); Collider[] hits = Physics.OverlapSphere(attackPoint, attackRadius, layerMask); @@ -531,7 +530,7 @@ namespace RacesOfValheim PlaySFX("sfx_cultist_attack", "sfx_fenring_attack", "sfx_wolf_attack"); - ExecuteClawDamage(85f); + ExecuteClawDamage(FenrirConfig.CultistClawDamage.Value); float remainingTimeToIdle = 0.5f - 0.4f; if (remainingTimeToIdle > 0) @@ -557,7 +556,7 @@ namespace RacesOfValheim PlaySFX("sfx_cultist_attack_double", "sfx_cultist_attack", "sfx_fenring_attack"); - ExecuteClawDamage(140f); + ExecuteClawDamage(FenrirConfig.CultistDoubleClawDamage.Value); // Attendiamo che l'animazione finisca (locking del giocatore) // L'animazione doppia del cultista dura circa 1.5 - 2 secondi @@ -573,7 +572,7 @@ namespace RacesOfValheim Vector3 playerPos = Player.m_localPlayer.transform.position; Vector3 attackPoint = playerPos + Player.m_localPlayer.transform.forward * 1.5f + Vector3.up * 1f; - float attackRadius = 2.5f; + float attackRadius = FenrirConfig.CultistAttackRadius.Value; float unarmedSkillLevel = Player.m_localPlayer.GetSkillLevel(Skills.SkillType.Unarmed); float totalDamage = baseDamage + unarmedSkillLevel; @@ -613,7 +612,7 @@ namespace RacesOfValheim { HitData hitData = new HitData(); hitData.m_damage.m_slash = totalDamage; - hitData.m_pushForce = 30f; + hitData.m_pushForce = FenrirConfig.CultistPushForce.Value; hitData.m_point = targetCenter; hitData.m_dir = Player.m_localPlayer.transform.forward; hitData.m_skill = Skills.SkillType.Unarmed; @@ -679,15 +678,15 @@ namespace RacesOfValheim { if (Input.GetMouseButtonDown(0)) // Left Click { - StartCoroutine(WolfAttackRoutine("attack1", 40f, 0.6f, 0.2f)); + StartCoroutine(WolfAttackRoutine("attack1", FenrirConfig.WolfAttack1Damage.Value, 0.6f, 0.2f)); } else if (Input.GetMouseButtonDown(1)) // Right Click { - StartCoroutine(WolfAttackRoutine("attack2", 60f, 0.8f, 0.3f)); + StartCoroutine(WolfAttackRoutine("attack2", FenrirConfig.WolfAttack2Damage.Value, 0.8f, 0.3f)); } else if (Input.GetMouseButtonDown(2)) // Middle Click { - StartCoroutine(WolfAttackRoutine("attack3", 80f, 1.0f, 0.4f)); + StartCoroutine(WolfAttackRoutine("attack3", FenrirConfig.WolfAttack3Damage.Value, 1.0f, 0.4f)); } } } @@ -745,7 +744,7 @@ namespace RacesOfValheim Vector3 playerPos = Player.m_localPlayer.transform.position; // Il lupo è basso, abbassiamo l'altezza dell'attacco Vector3 attackPoint = playerPos + Player.m_localPlayer.transform.forward * 1.5f + Vector3.up * 0.5f; - float attackRadius = 2.0f; + float attackRadius = FenrirConfig.WolfAttackRadius.Value; float unarmedSkillLevel = Player.m_localPlayer.GetSkillLevel(Skills.SkillType.Unarmed); float totalDamage = baseDamage + unarmedSkillLevel; @@ -785,7 +784,7 @@ namespace RacesOfValheim { HitData hitData = new HitData(); hitData.m_damage.m_slash = totalDamage; - hitData.m_pushForce = 20f; + hitData.m_pushForce = FenrirConfig.WolfPushForce.Value; hitData.m_point = targetCenter; hitData.m_dir = Player.m_localPlayer.transform.forward; hitData.m_skill = Skills.SkillType.Unarmed; @@ -852,12 +851,12 @@ namespace RacesOfValheim { if (Input.GetMouseButtonDown(0)) // Left Click { - StartCoroutine(UlvAttackRoutine("attack_bite", 40f, 0.6f, 0.2f)); + StartCoroutine(UlvAttackRoutine("attack_bite", FenrirConfig.UlvBiteDamage.Value, 0.6f, 0.2f)); } else if (Input.GetMouseButtonDown(1)) // Right Click { // Right click uses bite but as a heavier attack since slash is moved to jump - StartCoroutine(UlvAttackRoutine("attack_bite", 60f, 0.8f, 0.3f)); + StartCoroutine(UlvAttackRoutine("attack_bite", FenrirConfig.UlvHeavyBiteDamage.Value, 0.8f, 0.3f)); } else if (Input.GetMouseButtonDown(2)) // Middle Click { @@ -928,7 +927,7 @@ namespace RacesOfValheim Vector3 playerPos = Player.m_localPlayer.transform.position; Vector3 attackPoint = playerPos + Player.m_localPlayer.transform.forward * 1.5f + Vector3.up * 0.5f; - float attackRadius = 2.0f; + float attackRadius = FenrirConfig.UlvAttackRadius.Value; float unarmedSkillLevel = Player.m_localPlayer.GetSkillLevel(Skills.SkillType.Unarmed); float totalDamage = baseDamage + unarmedSkillLevel; @@ -968,7 +967,7 @@ namespace RacesOfValheim { HitData hitData = new HitData(); hitData.m_damage.m_slash = totalDamage; - hitData.m_pushForce = 25f; + hitData.m_pushForce = FenrirConfig.UlvPushForce.Value; hitData.m_point = targetCenter; hitData.m_dir = Player.m_localPlayer.transform.forward; hitData.m_skill = Skills.SkillType.Unarmed; @@ -999,7 +998,7 @@ namespace RacesOfValheim // Leap forward (+50% range) float leapDuration = 0.25f; - float leapSpeed = 18f; // Increased from 12f to 18f + float leapSpeed = FenrirConfig.UlvLeapSpeed.Value; float elapsed = 0f; while (elapsed < leapDuration) @@ -1022,7 +1021,7 @@ namespace RacesOfValheim } } - ExecuteBiteDamage(80f); + ExecuteBiteDamage(FenrirConfig.UlvJumpAttackDamage.Value); yield return new WaitForSeconds(0.4f); diff --git a/JotunnModStub/Fenrir/FenrirConfig.cs b/JotunnModStub/Fenrir/FenrirConfig.cs new file mode 100644 index 0000000..0208a9a --- /dev/null +++ b/JotunnModStub/Fenrir/FenrirConfig.cs @@ -0,0 +1,211 @@ +using UnityEngine; +using BepInEx.Configuration; + +namespace RacesOfValheim +{ + /// + /// Every tunable number and keybind behind the Fenrir's abilities and special attacks, bound + /// as BepInEx ConfigEntry so they show up in Configuration Manager without touching code - see + /// CONFIGURATION-MANAGER-HOWTO.md. Bound once, from RacesOfValheim.Awake(). One section per + /// topic (matches SkadiConfig/AswidConfig/DraughConfig's layout). + /// + /// Only the four transform/howl keys are exposed as rebindable - unlike Skadi's dragon forms, + /// which share one unified attack-button scheme across all three forms, each of Fenrir's four + /// forms (Fenring, Cultist, Wolf, Ulv) is an independent MonoBehaviour with its own hardcoded + /// mouse-button reads. Rebinding all of those individually would be a much larger, more + /// error-prone change for comparatively little value over just leaving attacks on the mouse, + /// which is where an action game's combat inputs are expected to live. + /// + /// One caveat: the Form Buffs section is read once, into the status effects built by + /// FenrirRace.CreateModAssets on mod startup - not every frame. Retuning those values + /// mid-session needs a relog to take effect. Everything else (Passive Combat, every attack's + /// numbers) is read live on every use. + /// + public static class FenrirConfig + { + // ─── Keybinds ────────────────────────────────────────────────────────── + // Defaults match today's fixed inputs exactly, so nobody's controls change until they + // open Configuration Manager (or the .cfg) and rebind one on purpose. + public static ConfigEntry WolfFormKey; + public static ConfigEntry FenrirFormKey; + public static ConfigEntry CultistFormKey; + public static ConfigEntry HowlKey; + + // ─── Passive combat (scales with progression state) ────────────────── + public static ConfigEntry ArmorBonusPerState; + public static ConfigEntry DamageBonusPerState; + public static ConfigEntry FallDamageReductionPerState; + public static ConfigEntry SpeedBonusPerState; + public static ConfigEntry JumpBonusPerState; + public static ConfigEntry SunSicknessDuration; + + // ─── Form buffs (applied while transformed) ─────────────────────────── + public static ConfigEntry FullFormSpeedBonus; + public static ConfigEntry FullFormJumpBonus; + public static ConfigEntry FullFormFallDamageReduction; + public static ConfigEntry WolfFormSpeedBonus; + public static ConfigEntry WolfFormFallDamageReduction; + public static ConfigEntry FormStaminaRegenMultiplier; + public static ConfigEntry FormStaminaDrainReduction; + + // ─── Fenring form attacks ───────────────────────────────────────────── + public static ConfigEntry FenringHeavyClawDamage; + public static ConfigEntry FenringLightClawDamage; + public static ConfigEntry FenringJumpAttackDamage; + public static ConfigEntry FenringJumpDashSpeed; + public static ConfigEntry FenringJumpDashUpwardSpeed; + public static ConfigEntry FenringAttackRadius; + public static ConfigEntry FenringPushForce; + + // ─── Cultist form attacks ────────────────────────────────────────────── + public static ConfigEntry CultistClawDamage; + public static ConfigEntry CultistDoubleClawDamage; + public static ConfigEntry CultistAttackRadius; + public static ConfigEntry CultistPushForce; + public static ConfigEntry CultistFireDamagePerTick; + public static ConfigEntry CultistFireEitrDrainPerSecond; + public static ConfigEntry CultistFireMagicSkillScaling; + public static ConfigEntry CultistFireAttackRadius; + + // ─── Wolf form attacks ───────────────────────────────────────────────── + public static ConfigEntry WolfAttack1Damage; + public static ConfigEntry WolfAttack2Damage; + public static ConfigEntry WolfAttack3Damage; + public static ConfigEntry WolfAttackRadius; + public static ConfigEntry WolfPushForce; + + // ─── Ulv form attacks ────────────────────────────────────────────────── + public static ConfigEntry UlvBiteDamage; + public static ConfigEntry UlvHeavyBiteDamage; + public static ConfigEntry UlvJumpAttackDamage; + public static ConfigEntry UlvLeapSpeed; + public static ConfigEntry UlvAttackRadius; + public static ConfigEntry UlvPushForce; + + public static void Bind(ConfigFile config) + { + const string keybinds = "Fenrir - Keybinds"; + WolfFormKey = config.Bind(keybinds, "Wolf Form", new KeyboardShortcut(KeyCode.G), + new ConfigDescription("Transform into (or revert from) a Wolf/Ulv, tier 3+.")); + FenrirFormKey = config.Bind(keybinds, "Fenrir Form", new KeyboardShortcut(KeyCode.H), + new ConfigDescription("Transform into (or revert from) a Fenring/Ulv, tier 4+.")); + CultistFormKey = config.Bind(keybinds, "Cultist Form", new KeyboardShortcut(KeyCode.J), + new ConfigDescription("Transform into (or revert from) a Cultist, tier 6+.")); + HowlKey = config.Bind(keybinds, "Howl", new KeyboardShortcut(KeyCode.O), + new ConfigDescription("Howls in Fenring or Cultist form. Cosmetic only.")); + + const string combat = "Fenrir - Passive Combat"; + ArmorBonusPerState = config.Bind(combat, "Armor Bonus Per State", 3f, + new ConfigDescription("Flat armor added, per progression state.", new AcceptableValueRange(0f, 20f))); + DamageBonusPerState = config.Bind(combat, "Damage Bonus Per State", 5f, + new ConfigDescription("Flat physical damage added to equipped weapons, per progression state.", new AcceptableValueRange(0f, 20f))); + FallDamageReductionPerState = config.Bind(combat, "Fall Damage Reduction Per State", 0.1f, + new ConfigDescription("Fall damage reduction added per progression state, capped at 100%.", new AcceptableValueRange(0f, 1f))); + SpeedBonusPerState = config.Bind(combat, "Speed Bonus Per State", 0.03f, + new ConfigDescription("Move speed multiplier added, per progression state.", new AcceptableValueRange(0f, 0.2f))); + JumpBonusPerState = config.Bind(combat, "Jump Bonus Per State", 0.03f, + new ConfigDescription("Jump height multiplier added, per progression state.", new AcceptableValueRange(0f, 0.2f))); + SunSicknessDuration = config.Bind(combat, "Sun Sickness Duration", 60f, + new ConfigDescription("Seconds of forced human form after being reverted by sunrise.", new AcceptableValueRange(0f, 300f))); + + const string buffs = "Fenrir - Form Buffs"; + BindNote(config, buffs, "Note: these values need a relog to take effect."); + FullFormSpeedBonus = config.Bind(buffs, "Full Form Speed Bonus", 1.0f, + new ConfigDescription("Speed multiplier bonus while in Fenring or Cultist form.", new AcceptableValueRange(0f, 3f))); + FullFormJumpBonus = config.Bind(buffs, "Full Form Jump Bonus", 1.0f, + new ConfigDescription("Jump multiplier bonus while in Fenring or Cultist form.", new AcceptableValueRange(0f, 3f))); + FullFormFallDamageReduction = config.Bind(buffs, "Full Form Fall Damage Reduction", 1.0f, + new ConfigDescription("Fall damage reduction while in Fenring or Cultist form (1 = immune).", new AcceptableValueRange(0f, 1f))); + WolfFormSpeedBonus = config.Bind(buffs, "Wolf Form Speed Bonus", 0.5f, + new ConfigDescription("Speed multiplier bonus while in Wolf or Ulv form.", new AcceptableValueRange(0f, 3f))); + WolfFormFallDamageReduction = config.Bind(buffs, "Wolf Form Fall Damage Reduction", 0.5f, + new ConfigDescription("Fall damage reduction while in Wolf or Ulv form.", new AcceptableValueRange(0f, 1f))); + FormStaminaRegenMultiplier = config.Bind(buffs, "Stamina Regen Multiplier", 1.3f, + new ConfigDescription("Stamina regen multiplier in any transformed state.", new AcceptableValueRange(1f, 5f))); + FormStaminaDrainReduction = config.Bind(buffs, "Stamina Drain Reduction", 0.2f, + new ConfigDescription("Reduction to running stamina drain in any transformed state.", new AcceptableValueRange(0f, 1f))); + + const string fenring = "Fenrir - Fenring Attacks"; + FenringHeavyClawDamage = config.Bind(fenring, "Heavy Claw Damage", 110f, + new ConfigDescription("Base damage of the heavy claw (Right Mouse), before the Unarmed skill bonus.", new AcceptableValueRange(0f, 500f))); + FenringLightClawDamage = config.Bind(fenring, "Light Claw Damage", 60f, + new ConfigDescription("Base damage of the light claw (Left Mouse), before the Unarmed skill bonus.", new AcceptableValueRange(0f, 500f))); + FenringJumpAttackDamage = config.Bind(fenring, "Jump Attack Damage", 95f, + new ConfigDescription("Base damage of the leaping attack (Middle Mouse), before the Unarmed skill bonus.", new AcceptableValueRange(0f, 500f))); + FenringJumpDashSpeed = config.Bind(fenring, "Jump Dash Speed", 31.5f, + new ConfigDescription("Forward speed during the leap.", new AcceptableValueRange(0f, 60f))); + FenringJumpDashUpwardSpeed = config.Bind(fenring, "Jump Dash Upward Speed", 13.1f, + new ConfigDescription("Upward speed during the first half of the leap.", new AcceptableValueRange(0f, 30f))); + FenringAttackRadius = config.Bind(fenring, "Attack Radius", 2.5f, + new ConfigDescription("Hit-sweep radius for all three attacks.", new AcceptableValueRange(1f, 10f))); + FenringPushForce = config.Bind(fenring, "Push Force", 30f, + new ConfigDescription("Knockback applied on a hit.", new AcceptableValueRange(0f, 100f))); + + const string cultist = "Fenrir - Cultist Attacks"; + CultistClawDamage = config.Bind(cultist, "Claw Damage", 85f, + new ConfigDescription("Base damage of the single claw (Left Mouse), before the Unarmed skill bonus.", new AcceptableValueRange(0f, 500f))); + CultistDoubleClawDamage = config.Bind(cultist, "Double Claw Damage", 140f, + new ConfigDescription("Base damage of the double claw (Middle Mouse), before the Unarmed skill bonus.", new AcceptableValueRange(0f, 500f))); + CultistAttackRadius = config.Bind(cultist, "Claw Attack Radius", 2.5f, + new ConfigDescription("Hit-sweep radius for both claw attacks.", new AcceptableValueRange(1f, 10f))); + CultistPushForce = config.Bind(cultist, "Claw Push Force", 30f, + new ConfigDescription("Knockback applied by a claw hit.", new AcceptableValueRange(0f, 100f))); + CultistFireDamagePerTick = config.Bind(cultist, "Fire Damage Per Tick", 20f, + new ConfigDescription("Fire damage per 0.2s tick while channeling (Right Mouse held), before the Elemental Magic skill bonus.", new AcceptableValueRange(0f, 100f))); + CultistFireEitrDrainPerSecond = config.Bind(cultist, "Fire Eitr Drain Per Second", 12.5f, + new ConfigDescription("Eitr spent per second while channeling fire.", new AcceptableValueRange(0f, 100f))); + CultistFireMagicSkillScaling = config.Bind(cultist, "Fire Magic Skill Scaling", 0.5f, + new ConfigDescription("Extra fire damage per tick, per point of Elemental Magic skill.", new AcceptableValueRange(0f, 5f))); + CultistFireAttackRadius = config.Bind(cultist, "Fire Attack Radius", 3f, + new ConfigDescription("Hit-sweep radius for the fire breath.", new AcceptableValueRange(1f, 15f))); + + const string wolf = "Fenrir - Wolf Attacks"; + WolfAttack1Damage = config.Bind(wolf, "Attack 1 Damage", 40f, + new ConfigDescription("Base damage of the Left Mouse attack, before the Unarmed skill bonus.", new AcceptableValueRange(0f, 300f))); + WolfAttack2Damage = config.Bind(wolf, "Attack 2 Damage", 60f, + new ConfigDescription("Base damage of the Right Mouse attack, before the Unarmed skill bonus.", new AcceptableValueRange(0f, 300f))); + WolfAttack3Damage = config.Bind(wolf, "Attack 3 Damage", 80f, + new ConfigDescription("Base damage of the Middle Mouse attack, before the Unarmed skill bonus.", new AcceptableValueRange(0f, 300f))); + WolfAttackRadius = config.Bind(wolf, "Attack Radius", 2.0f, + new ConfigDescription("Hit-sweep radius for all three attacks.", new AcceptableValueRange(1f, 10f))); + WolfPushForce = config.Bind(wolf, "Push Force", 20f, + new ConfigDescription("Knockback applied on a hit.", new AcceptableValueRange(0f, 100f))); + + const string ulv = "Fenrir - Ulv Attacks"; + UlvBiteDamage = config.Bind(ulv, "Bite Damage", 40f, + new ConfigDescription("Base damage of the Left Mouse bite, before the Unarmed skill bonus.", new AcceptableValueRange(0f, 300f))); + UlvHeavyBiteDamage = config.Bind(ulv, "Heavy Bite Damage", 60f, + new ConfigDescription("Base damage of the Right Mouse bite, before the Unarmed skill bonus.", new AcceptableValueRange(0f, 300f))); + UlvJumpAttackDamage = config.Bind(ulv, "Jump Attack Damage", 80f, + new ConfigDescription("Base damage of the leaping Middle Mouse attack, before the Unarmed skill bonus.", new AcceptableValueRange(0f, 300f))); + UlvLeapSpeed = config.Bind(ulv, "Leap Speed", 18f, + new ConfigDescription("Forward speed during the leap attack.", new AcceptableValueRange(0f, 40f))); + UlvAttackRadius = config.Bind(ulv, "Attack Radius", 2.0f, + new ConfigDescription("Hit-sweep radius for all three attacks.", new AcceptableValueRange(1f, 10f))); + UlvPushForce = config.Bind(ulv, "Push Force", 25f, + new ConfigDescription("Knockback applied on a hit.", new AcceptableValueRange(0f, 100f))); + } + + /// + /// A non-editable line of text, standing in for the caveat comment this class carries at + /// the top - Configuration Manager has no label widget of its own, so this binds a real + /// (unused) bool ConfigEntry and replaces its value widget with nothing via CustomDrawer, + /// same trick used for section dividers earlier in this mod's config work. A high Order + /// keeps it above the section's other entries, which are left at the default Order and so + /// sort alphabetically among themselves. + /// + private static void BindNote(ConfigFile config, string section, string text) + { + config.Bind(section, text, false, new ConfigDescription( + "", null, new ConfigurationManagerAttributes + { + Order = 100, + CustomDrawer = DrawNothing, + HideDefaultButton = true, + ReadOnly = true + })); + } + + private static void DrawNothing(ConfigEntryBase entry) { } + } +} diff --git a/JotunnModStub/Fenrir/FenrirProgression.cs b/JotunnModStub/Fenrir/FenrirProgression.cs index 6a14551..94af2c2 100644 --- a/JotunnModStub/Fenrir/FenrirProgression.cs +++ b/JotunnModStub/Fenrir/FenrirProgression.cs @@ -32,27 +32,27 @@ namespace RacesOfValheim public static float GetArmorBonus(int state) { - return 3f * state; + return FenrirConfig.ArmorBonusPerState.Value * state; } public static float GetDamageBonus(int state) { - return 5f * state; + return FenrirConfig.DamageBonusPerState.Value * state; } public static float GetFallDamageModifier(int state) { - return Mathf.Clamp(-0.1f * state, -1f, 0f); + return Mathf.Clamp(-FenrirConfig.FallDamageReductionPerState.Value * state, -1f, 0f); } public static float GetSpeedModifier(int state) { - return 0.03f * state; + return FenrirConfig.SpeedBonusPerState.Value * state; } public static float GetJumpModifier(int state) { - return 0.03f * state; + return FenrirConfig.JumpBonusPerState.Value * state; } // --- Transformation Rules for Keys --- diff --git a/JotunnModStub/Fenrir/FenrirRace.cs b/JotunnModStub/Fenrir/FenrirRace.cs index fc2e349..1bf827d 100644 --- a/JotunnModStub/Fenrir/FenrirRace.cs +++ b/JotunnModStub/Fenrir/FenrirRace.cs @@ -67,32 +67,32 @@ namespace RacesOfValheim { formBuffSE = ScriptableObject.CreateInstance(); formBuffSE.name = "SE_FenrirForm"; formBuffSE.m_name = "Bestial Fury"; - formBuffSE.m_speedModifier = 1.0f; - formBuffSE.m_jumpModifier = new Vector3(0, 1.0f, 0); - formBuffSE.m_fallDamageModifier = -1f; - formBuffSE.m_staminaRegenMultiplier = 1.3f; - formBuffSE.m_runStaminaDrainModifier = -0.2f; + formBuffSE.m_speedModifier = FenrirConfig.FullFormSpeedBonus.Value; + formBuffSE.m_jumpModifier = new Vector3(0, FenrirConfig.FullFormJumpBonus.Value, 0); + formBuffSE.m_fallDamageModifier = -FenrirConfig.FullFormFallDamageReduction.Value; + formBuffSE.m_staminaRegenMultiplier = FenrirConfig.FormStaminaRegenMultiplier.Value; + formBuffSE.m_runStaminaDrainModifier = -FenrirConfig.FormStaminaDrainReduction.Value; formBuffSE.m_icon = fenringTrophyIcon; ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(formBuffSE, fixReference: false)); cultistFormBuffSE = ScriptableObject.CreateInstance(); cultistFormBuffSE.name = "SE_CultistForm"; cultistFormBuffSE.m_name = "Cultist Fury"; - cultistFormBuffSE.m_speedModifier = 1.0f; - cultistFormBuffSE.m_jumpModifier = new Vector3(0, 1.0f, 0); - cultistFormBuffSE.m_fallDamageModifier = -1f; - cultistFormBuffSE.m_staminaRegenMultiplier = 1.3f; - cultistFormBuffSE.m_runStaminaDrainModifier = -0.2f; + cultistFormBuffSE.m_speedModifier = FenrirConfig.FullFormSpeedBonus.Value; + cultistFormBuffSE.m_jumpModifier = new Vector3(0, FenrirConfig.FullFormJumpBonus.Value, 0); + cultistFormBuffSE.m_fallDamageModifier = -FenrirConfig.FullFormFallDamageReduction.Value; + cultistFormBuffSE.m_staminaRegenMultiplier = FenrirConfig.FormStaminaRegenMultiplier.Value; + cultistFormBuffSE.m_runStaminaDrainModifier = -FenrirConfig.FormStaminaDrainReduction.Value; cultistFormBuffSE.m_icon = fenringTrophyIcon; ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(cultistFormBuffSE, fixReference: false)); wolfFormBuffSE = ScriptableObject.CreateInstance(); wolfFormBuffSE.name = "SE_WolfForm"; wolfFormBuffSE.m_name = "Wolf Senses"; - wolfFormBuffSE.m_speedModifier = 0.5f; - wolfFormBuffSE.m_fallDamageModifier = -0.5f; - wolfFormBuffSE.m_staminaRegenMultiplier = 1.3f; - wolfFormBuffSE.m_runStaminaDrainModifier = -0.2f; + wolfFormBuffSE.m_speedModifier = FenrirConfig.WolfFormSpeedBonus.Value; + wolfFormBuffSE.m_fallDamageModifier = -FenrirConfig.WolfFormFallDamageReduction.Value; + wolfFormBuffSE.m_staminaRegenMultiplier = FenrirConfig.FormStaminaRegenMultiplier.Value; + wolfFormBuffSE.m_runStaminaDrainModifier = -FenrirConfig.FormStaminaDrainReduction.Value; wolfFormBuffSE.m_icon = fenringTrophyIcon; ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(wolfFormBuffSE, fixReference: false)); } @@ -125,8 +125,8 @@ namespace RacesOfValheim { } else if (!isNight && wasNight) { - // Sunrise: force revert and block for 60 seconds - sunSicknessTimer = 60f; + // Sunrise: force revert and block transforming again for a while + sunSicknessTimer = FenrirConfig.SunSicknessDuration.Value; ForceRevert(); } wasNight = isNight; @@ -147,9 +147,9 @@ namespace RacesOfValheim { int state = BossProgressionManager.GetCurrentProgressionState(); - if (Input.GetKeyDown(KeyCode.G)) { TryTransformWithRules(FenrirProgression.GetGKeyRules(state)); return; } - if (Input.GetKeyDown(KeyCode.H)) { TryTransformWithRules(FenrirProgression.GetHKeyRules(state)); return; } - if (Input.GetKeyDown(KeyCode.J)) { TryTransformWithRules(FenrirProgression.GetJKeyRules(state)); return; } + if (FenrirConfig.WolfFormKey.Value.IsDown()) { TryTransformWithRules(FenrirProgression.GetGKeyRules(state)); return; } + if (FenrirConfig.FenrirFormKey.Value.IsDown()) { TryTransformWithRules(FenrirProgression.GetHKeyRules(state)); return; } + if (FenrirConfig.CultistFormKey.Value.IsDown()) { TryTransformWithRules(FenrirProgression.GetJKeyRules(state)); return; } } private void TryTransformWithRules(FenrirProgression.FormRules rules) diff --git a/JotunnModStub/RacesOfValheim.cs b/JotunnModStub/RacesOfValheim.cs index 438a60d..dca76b4 100644 --- a/JotunnModStub/RacesOfValheim.cs +++ b/JotunnModStub/RacesOfValheim.cs @@ -30,6 +30,7 @@ namespace RacesOfValheim AswidConfig.Bind(Config); DraughConfig.Bind(Config); DvergarConfigManagement.Bind(Config); + FenrirConfig.Bind(Config); SkadiConfig.Bind(Config); harmony.PatchAll(); gameObject.AddComponent();