RacesOfValheim/JotunnModStub/Skadi/SkadiProgression.cs
2026-07-30 19:00:13 +02:00

128 lines
4 KiB
C#

using System;
using UnityEngine;
namespace RacesOfValheim
{
public static class SkadiProgression
{
public class FormRules
{
public bool ImmuneToCold = false;
public bool ImmuneToFreezing = false;
public bool FreezingToCold = false;
public bool BonusFrostDamage = false;
public bool FrostAura = false;
public float FrostResistance = 0f;
public float EitrRegenMultiplier = 1f;
public bool ColdSpell = false;
public bool ImprovedColdSpell = false;
public FormType Form = FormType.None;
public float DurationMinutes = 0f;
public float CooldownMinutes = 0f;
public bool CanAttackInForm = false;
}
public enum FormType
{
None,
Drake,
Moder,
SkeletonDragon
}
public static FormRules GetRules(int state)
{
FormRules rules = new FormRules();
if (state >= 1)
{
rules.ImmuneToCold = true;
rules.BonusFrostDamage = true;
rules.FrostResistance = 0.5f; // 50% resistance? Valheim uses DamageModifiers.
// Wait, FrostResistance isn't a percentage, it's a category.
// We'll map this to DamageModifier.Resistant (which is 50% reduction).
}
if (state >= 2)
{
rules.EitrRegenMultiplier = 1.20f;
rules.FreezingToCold = true;
rules.ColdSpell = true;
}
if (state >= 6)
{
rules.EitrRegenMultiplier = 1.50f;
rules.ImmuneToFreezing = true;
rules.FreezingToCold = false; // Immunity overrides conversion
rules.ImprovedColdSpell = true;
}
if (state >= 7)
{
// Immunity to frost damage => DamageModifier.Immune
rules.FrostResistance = 1f; // 1 means Immune in our logic
rules.FrostAura = true;
}
return rules;
}
public static FormRules GetGKeyRules(int state)
{
FormRules rules = new FormRules();
if (state >= 4) // Bonemass
{
rules.Form = FormType.Drake;
rules.CanAttackInForm = true;
}
else if (state >= 3) // Elder
{
rules.Form = FormType.Drake;
rules.CanAttackInForm = false;
}
return rules.Form != FormType.None ? rules : null;
}
public static FormRules GetHKeyRules(int state)
{
FormRules rules = new FormRules();
if (state >= 7) // Queen
{
rules.Form = FormType.Moder;
rules.DurationMinutes = 0f;
rules.CooldownMinutes = 0f;
rules.CanAttackInForm = true;
}
else if (state >= 6) // Yagluth
{
rules.Form = FormType.Moder;
rules.DurationMinutes = 1f;
rules.CooldownMinutes = 5f;
rules.CanAttackInForm = true;
}
else if (state >= 5) // Moder
{
rules.Form = FormType.Moder;
rules.DurationMinutes = 1f;
rules.CooldownMinutes = 10f;
rules.CanAttackInForm = true;
}
return rules.Form != FormType.None ? rules : null;
}
public static FormRules GetJKeyRules(int state)
{
FormRules rules = new FormRules();
if (state >= 8) // Fader
{
rules.Form = FormType.SkeletonDragon;
rules.DurationMinutes = 0f; // Assuming unlimited
rules.CooldownMinutes = 0f;
rules.CanAttackInForm = true;
}
return rules.Form != FormType.None ? rules : null;
}
}
}