feat(aswid): make abilities and special attacks BepInEx-configurable
Adds AswidConfig.cs, following the SkadiConfig pattern: one Configuration Manager section per topic (Keybinds, Passive Combat, Vampiric Aura, Superhuman Senses, Eclipse, Devour, Domination), covering every tunable number and all five ability keybinds (Bat Form, Mist Form, Eclipse, Tame, Toggle Devour). Defaults match the previous hardcoded constants exactly. Also fixes a real mismatch found along the way: the tame hover-text hardcoded "[K] Tame" while the key that actually triggered taming was U. Both now read the same configured Tame key, so the hint stays correct if it's rebound. Config sections are bound alphabetically by race (Aswid before Skadi) in RacesOfValheim.Awake(), since Configuration Manager's category list follows bind order.
This commit is contained in:
parent
7708599ff9
commit
629a534bc3
6 changed files with 178 additions and 37 deletions
|
|
@ -185,7 +185,7 @@ namespace RacesOfValheim
|
|||
{
|
||||
DateTime lastTime = new DateTime(ticks);
|
||||
float elapsed = (float)(DateTime.Now - lastTime).TotalSeconds;
|
||||
float cooldown = (15f * 60f) - elapsed;
|
||||
float cooldown = AswidConfig.EnslaveCooldown.Value - elapsed;
|
||||
return Mathf.Max(0f, cooldown);
|
||||
}
|
||||
}
|
||||
|
|
@ -226,7 +226,7 @@ namespace RacesOfValheim
|
|||
sensesCheckTimer -= Time.deltaTime;
|
||||
if (sensesCheckTimer <= 0f)
|
||||
{
|
||||
sensesCheckTimer = 1.0f; // Refresh every 1 second (TTL is 2s)
|
||||
sensesCheckTimer = AswidConfig.SensesRefreshInterval.Value; // TTL is 2s
|
||||
|
||||
List<Character> allChars = Character.GetAllCharacters();
|
||||
Vector3 myPos = Player.m_localPlayer.transform.position;
|
||||
|
|
@ -239,7 +239,7 @@ namespace RacesOfValheim
|
|||
if (c == null || c == Player.m_localPlayer || c.IsDead() || c.IsTamed()) continue;
|
||||
|
||||
float dist = Vector3.Distance(c.transform.position, myPos);
|
||||
if (dist <= 100f) // 100 meters detection radius
|
||||
if (dist <= AswidConfig.SensesRadius.Value)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -256,8 +256,8 @@ namespace RacesOfValheim
|
|||
Light pLight = lightObj.AddComponent<Light>();
|
||||
pLight.type = LightType.Point;
|
||||
pLight.color = Color.green;
|
||||
pLight.range = 10f;
|
||||
pLight.intensity = 2f;
|
||||
pLight.range = AswidConfig.SensesLightRange.Value;
|
||||
pLight.intensity = AswidConfig.SensesLightIntensity.Value;
|
||||
pLight.shadows = LightShadows.None;
|
||||
|
||||
activeSensesLight[c] = lightObj;
|
||||
|
|
@ -379,14 +379,14 @@ namespace RacesOfValheim
|
|||
|
||||
if (RaceInput.Allowed)
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.G)) { TryTransformWithRules(AswidProgression.GetGKeyRules(state)); return; }
|
||||
if (Input.GetKeyDown(KeyCode.H)) { TryToggleMistForm(); return; }
|
||||
if (Input.GetKeyDown(KeyCode.J))
|
||||
{
|
||||
TryCastEclipse(state);
|
||||
return;
|
||||
if (AswidConfig.BatFormKey.Value.IsDown()) { TryTransformWithRules(AswidProgression.GetGKeyRules(state)); return; }
|
||||
if (AswidConfig.MistFormKey.Value.IsDown()) { TryToggleMistForm(); return; }
|
||||
if (AswidConfig.EclipseKey.Value.IsDown())
|
||||
{
|
||||
TryCastEclipse(state);
|
||||
return;
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.U))
|
||||
if (AswidConfig.TameKey.Value.IsDown())
|
||||
{
|
||||
TryTameHoverObject(state);
|
||||
return;
|
||||
|
|
@ -760,7 +760,7 @@ namespace RacesOfValheim
|
|||
|
||||
if (IsEclipseActive) return;
|
||||
|
||||
float cooldown = 900f; // 15 minutes
|
||||
float cooldown = AswidConfig.EclipseCooldown.Value;
|
||||
if (Time.time - lastEclipseTime < cooldown)
|
||||
{
|
||||
int remaining = (int)(cooldown - (Time.time - lastEclipseTime));
|
||||
|
|
@ -787,7 +787,7 @@ namespace RacesOfValheim
|
|||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "An Eclipse descends...");
|
||||
|
||||
float castTimer = 0f;
|
||||
while(castTimer < 2.0f)
|
||||
while(castTimer < AswidConfig.EclipseCastTime.Value)
|
||||
{
|
||||
// Force root player physically if possible without breaking their animator
|
||||
HarmonyLib.Traverse.Create(Player.m_localPlayer).Method("SetRun", false).GetValue();
|
||||
|
|
@ -802,7 +802,7 @@ namespace RacesOfValheim
|
|||
HarmonyLib.Traverse.Create(EnvMan.instance).Field("m_debugTimeOfDay").SetValue(0.5f); // Midnight
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(60f);
|
||||
yield return new WaitForSeconds(AswidConfig.EclipseDuration.Value);
|
||||
|
||||
// Revert to server time
|
||||
if (EnvMan.instance != null)
|
||||
|
|
@ -823,7 +823,7 @@ namespace RacesOfValheim
|
|||
private void HandleVampiricAura()
|
||||
{
|
||||
damageTickTimer += Time.deltaTime;
|
||||
if (damageTickTimer < 0.25f) return;
|
||||
if (damageTickTimer < AswidConfig.AuraTickInterval.Value) return;
|
||||
|
||||
damageTickTimer = 0f;
|
||||
PerformLifeDrain();
|
||||
|
|
@ -846,8 +846,8 @@ namespace RacesOfValheim
|
|||
try
|
||||
{
|
||||
Vector3 center = Player.m_localPlayer.transform.position;
|
||||
float radius = 3f;
|
||||
if (EnvMan.instance != null && EnvMan.IsNight()) radius = 6f;
|
||||
float radius = AswidConfig.AuraRadiusDay.Value;
|
||||
if (EnvMan.instance != null && EnvMan.IsNight()) radius = AswidConfig.AuraRadiusNight.Value;
|
||||
|
||||
int layerMask = LayerMask.GetMask("character", "character_net", "character_ghost");
|
||||
var colliders = Physics.OverlapSphere(center, radius, layerMask);
|
||||
|
|
@ -865,12 +865,12 @@ namespace RacesOfValheim
|
|||
float maxHp = c.GetMaxHealth();
|
||||
float currentHp = c.GetHealth();
|
||||
|
||||
float baseDamage = 1.0f;
|
||||
float baseDamage = AswidConfig.AuraBaseDamage.Value;
|
||||
float bloodMagicFactor = Player.m_localPlayer.GetSkillFactor(Skills.SkillType.BloodMagic);
|
||||
// Lo scaling aggiunge un massimo di +5.0 danni (al livello 100), indipendentemente dal danno base
|
||||
float totalDamage = (baseDamage + bloodMagicFactor * 5f) * GetAuraFormMultiplier();
|
||||
// Lo scaling aggiunge un massimo di +AuraBloodMagicScaling danni (al livello 100), indipendentemente dal danno base
|
||||
float totalDamage = (baseDamage + bloodMagicFactor * AswidConfig.AuraBloodMagicScaling.Value) * GetAuraFormMultiplier();
|
||||
|
||||
if (currentHp > 0 && currentHp <= maxHp * 0.20f && !c.IsBoss())
|
||||
if (currentHp > 0 && currentHp <= maxHp * AswidConfig.AuraExecuteThreshold.Value && !c.IsBoss())
|
||||
{
|
||||
totalDamage = currentHp * 2f; // Lethal damage for execute
|
||||
TryConsumeMob(c, maxHp, true); // Automatically devour when executed, bypassing cooldown
|
||||
|
|
@ -905,7 +905,7 @@ namespace RacesOfValheim
|
|||
{
|
||||
if (!DevourEnabled) return;
|
||||
|
||||
if (!bypassCooldown && Time.time - lastConsumeTime < 5f)
|
||||
if (!bypassCooldown && Time.time - lastConsumeTime < AswidConfig.DevourCooldown.Value)
|
||||
{
|
||||
return; // Cooldown active
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue