Open water now means any water: swimming in it, or flying over a metre or more of it, sea, river or lake. Standing on anything solid stays safe, so docks, bridges and wading do not count. On a boat there is still no burn or drain, but the camera keeps swaying. 'Ocean Only' restores the sea-only behaviour, and the settings say Open Water instead of Open Sea. Also rewrites the README's per-boss Aswid section from the code: it listed stats, unlocks and an aura that no longer exist.
194 lines
7.9 KiB
C#
194 lines
7.9 KiB
C#
using Jotunn.Managers;
|
|
using Jotunn.Entities;
|
|
using System;
|
|
using UnityEngine;
|
|
|
|
namespace RacesOfValheim
|
|
{
|
|
public class SE_AswidStats : SE_Stats
|
|
{
|
|
public override void Setup(Character character)
|
|
{
|
|
base.Setup(character);
|
|
name = "SE_AswidStats";
|
|
m_name = "$rov_se_aswid_stats_name";
|
|
m_tooltip = "$rov_se_aswid_stats_tooltip";
|
|
}
|
|
|
|
public void UpdateStats(int state)
|
|
{
|
|
m_fallDamageModifier = -1f; // No fall damage
|
|
|
|
float multiplier = (EnvMan.instance != null && EnvMan.IsNight()) ? AswidConfig.NightMultiplier.Value : 1f;
|
|
|
|
m_speedModifier = AswidConfig.SpeedBonusPerState.Value * state * multiplier;
|
|
|
|
// For jump, Valheim SE_Stats typically adds the y value to 1
|
|
m_jumpModifier = new Vector3(0f, AswidConfig.SpeedBonusPerState.Value * state * multiplier, 0f);
|
|
|
|
if (state >= 5)
|
|
{
|
|
if (m_mods == null) m_mods = new System.Collections.Generic.List<HitData.DamageModPair>();
|
|
m_mods.Clear(); // Refresh to avoid duplicates
|
|
m_mods.Add(new HitData.DamageModPair() { m_type = HitData.DamageType.Poison, m_modifier = HitData.DamageModifier.Immune });
|
|
}
|
|
else
|
|
{
|
|
if (m_mods != null) m_mods.Clear();
|
|
}
|
|
}
|
|
|
|
public override void ModifyAttack(Skills.SkillType skill, ref HitData hitData)
|
|
{
|
|
base.ModifyAttack(skill, ref hitData);
|
|
if (m_character is Player p && p.GetComponent<ZNetView>() != null && p.GetComponent<ZNetView>().GetZDO() != null)
|
|
{
|
|
int state = BossProgressionManager.GetCurrentProgressionState();
|
|
var rules = AswidProgression.GetRules(state);
|
|
if (rules != null && rules.HasSurtlingForm)
|
|
{
|
|
hitData.m_damage.m_damage += AswidConfig.SurtlingFormDamageBonus.Value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public class SE_BatForm : SE_Stats
|
|
{
|
|
public override void Setup(Character character)
|
|
{
|
|
base.Setup(character);
|
|
name = "SE_BatForm";
|
|
m_name = "$rov_se_aswid_batform_name";
|
|
m_tooltip = "$rov_se_aswid_batform_tooltip";
|
|
m_fallDamageModifier = -1f; // Immune to fall damage just in case
|
|
}
|
|
}
|
|
|
|
/// <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)
|
|
{
|
|
base.Setup(character);
|
|
name = "SE_MistForm";
|
|
m_name = "$rov_se_aswid_mistform_name";
|
|
m_tooltip = "$rov_se_aswid_mistform_tooltip";
|
|
m_fallDamageModifier = -1f;
|
|
m_mods = new System.Collections.Generic.List<HitData.DamageModPair>
|
|
{
|
|
new HitData.DamageModPair { m_type = HitData.DamageType.Blunt, m_modifier = HitData.DamageModifier.Immune },
|
|
new HitData.DamageModPair { m_type = HitData.DamageType.Slash, m_modifier = HitData.DamageModifier.Immune },
|
|
new HitData.DamageModPair { m_type = HitData.DamageType.Pierce, m_modifier = HitData.DamageModifier.Immune },
|
|
new HitData.DamageModPair { m_type = HitData.DamageType.Poison, m_modifier = HitData.DamageModifier.Immune }
|
|
};
|
|
}
|
|
}
|
|
|
|
public class SE_AswidSensesMark : SE_Stats
|
|
{
|
|
public override void Setup(Character character)
|
|
{
|
|
base.Setup(character);
|
|
name = "SE_AswidSensesMark";
|
|
m_name = "$rov_se_aswid_sensed_name";
|
|
m_tooltip = "";
|
|
m_ttl = 2f;
|
|
m_icon = null; // No icon needed for mobs
|
|
}
|
|
}
|
|
|
|
public class SE_SuperhumanSenses : SE_Stats
|
|
{
|
|
public override void Setup(Character character)
|
|
{
|
|
base.Setup(character);
|
|
name = "SE_SuperhumanSenses";
|
|
m_name = "$rov_se_aswid_auspex_name";
|
|
m_tooltip = "$rov_se_aswid_auspex_tooltip";
|
|
}
|
|
}
|
|
|
|
public class AswidStatusEffects
|
|
{
|
|
public static void RegisterStatusEffects()
|
|
{
|
|
var aswidStats = ScriptableObject.CreateInstance<SE_AswidStats>();
|
|
aswidStats.name = "SE_AswidStats";
|
|
aswidStats.m_icon = PrefabManager.Cache.GetPrefab<ItemDrop>("TrophyDeathsquito")?.m_itemData.m_shared.m_icons[0];
|
|
|
|
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(aswidStats, fixReference: false));
|
|
|
|
var batForm = ScriptableObject.CreateInstance<SE_BatForm>();
|
|
batForm.name = "SE_BatForm";
|
|
batForm.m_icon = PrefabManager.Cache.GetPrefab<ItemDrop>("TrophyDeathsquito")?.m_itemData.m_shared.m_icons[0];
|
|
|
|
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];
|
|
|
|
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(mistForm, fixReference: false));
|
|
|
|
var sensesMark = ScriptableObject.CreateInstance<SE_AswidSensesMark>();
|
|
sensesMark.name = "SE_AswidSensesMark";
|
|
sensesMark.m_name = "$rov_se_aswid_sensed_name";
|
|
sensesMark.m_ttl = 2f;
|
|
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(sensesMark, fixReference: false));
|
|
|
|
var senses = ScriptableObject.CreateInstance<SE_SuperhumanSenses>();
|
|
senses.name = "SE_SuperhumanSenses";
|
|
senses.m_icon = PrefabManager.Cache.GetPrefab<ItemDrop>("TrophyWolf")?.m_itemData.m_shared.m_icons[0];
|
|
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(senses, fixReference: false));
|
|
}
|
|
}
|
|
}
|