balancing-skadi-progression #3
7 changed files with 319 additions and 62 deletions
|
|
@ -153,7 +153,66 @@ namespace RacesOfValheim
|
|||
|
||||
private static void GenerateSkadiText(Dictionary<string, string> knownTexts, int state)
|
||||
{
|
||||
knownTexts["Skadi Secrets"] = "The secrets of winter will be revealed soon...";
|
||||
// Mirrors the live values so the entry cannot drift from the code: the frost bonus is
|
||||
// SkadiDamagePatch's 2 per state, the spell figure SkadiRace's 15 + 8 per state.
|
||||
int frostBonus = state * 2;
|
||||
int spellDamage = 15 + 8 * state;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("The Secrets of Winter\n");
|
||||
|
||||
sb.AppendLine("[Base Passive] Ice Affinity:");
|
||||
sb.AppendLine($"The cold cannot touch you, and frost answers to your hand. You are immune to the Cold status, take only half damage from frost, and every blow you land carries +{frostBonus} Frost damage - a bonus that grows as each boss falls.\n");
|
||||
|
||||
if (state >= 2)
|
||||
{
|
||||
sb.AppendLine("[Eikthyr Unlock] Cold Spell (Middle Mouse):");
|
||||
sb.AppendLine($"Hurl a shard of ice at whatever you look upon, for {spellDamage} Frost damage. It draws on 20 stamina rather than eitr, so it serves you from your very first winter.\n");
|
||||
}
|
||||
|
||||
if (state >= 3)
|
||||
{
|
||||
sb.AppendLine("[The Elder Unlock] Drake Form ('G' Key):");
|
||||
sb.AppendLine("Take the shape of a frost drake. Right Mouse lifts you into flight: you glide wherever you aim, hold W to climb and gather speed, and release to hold level a moment before settling into a slow descent. In this shape you cannot yet strike.\n");
|
||||
}
|
||||
|
||||
if (state >= 4)
|
||||
{
|
||||
sb.AppendLine("[Bonemass Unlock] Winter's Welcome (Passive):");
|
||||
sb.AppendLine("The killing gales of the mountains soften to a mere chill - you suffer Cold where others would freeze.\n");
|
||||
sb.AppendLine("[Bonemass Unlock] Drake Breath (Left Mouse):");
|
||||
sb.AppendLine("Your drake form may now spit ice at your enemies.\n");
|
||||
}
|
||||
|
||||
if (state >= 5)
|
||||
{
|
||||
sb.AppendLine("[Moder Unlock] Moder Form ('H' Key):");
|
||||
sb.AppendLine("Become the great frost dragon herself for 1 minute, then wait 10 before calling her again. Afoot, Left Mouse bites and claws for no cost at all, while Middle Mouse breathes a stream of ice. On the wing, Left Mouse looses a barrage of shards. Only the breath and the barrage draw upon eitr.\n");
|
||||
}
|
||||
|
||||
if (state >= 6)
|
||||
{
|
||||
sb.AppendLine("[Yagluth Unlock] Heart of Winter (Passive):");
|
||||
sb.AppendLine("Freezing can no longer reach you at all, and your eitr returns half again as fast.\n");
|
||||
sb.AppendLine("[Yagluth Unlock] Improved Cold Spell:");
|
||||
sb.AppendLine("Your Cold Spell scatters into ten shards, spreading its bite across all before you. The wider cast needs 4 seconds to gather itself.\n");
|
||||
sb.AppendLine("Moder Form now answers you again after only 5 minutes.\n");
|
||||
}
|
||||
|
||||
if (state >= 7)
|
||||
{
|
||||
sb.AppendLine("[The Queen Unlock] Winter Incarnate (Passive):");
|
||||
sb.AppendLine("Frost cannot wound you at all, and a freezing aura bleeds from your skin, gnawing at every untamed creature within 3 meters.\n");
|
||||
sb.AppendLine("Moder Form may now be held as long as you wish, with no wait between callings.\n");
|
||||
}
|
||||
|
||||
if (state >= 8)
|
||||
{
|
||||
sb.AppendLine("[Fader Unlock] Skeleton Dragon Form ('J' Key):");
|
||||
sb.AppendLine("The bones of a dragon rise at your call, wreathed in frost. It rends with bite and claw, sweeps all around it with a spinning tail (Right Mouse), and its breath carries thrice the fury of Moder's.\n");
|
||||
}
|
||||
|
||||
knownTexts["Skadi Secrets"] = sb.ToString();
|
||||
}
|
||||
|
||||
private static void GenerateSkeletonText(Dictionary<string, string> knownTexts, int state)
|
||||
|
|
|
|||
|
|
@ -49,9 +49,25 @@ namespace RacesOfValheim
|
|||
return live != null && live.Form == formRules.Form && live.CanAttackInForm;
|
||||
}
|
||||
|
||||
private const float ATTACK_COST = 20f;
|
||||
private const float ATTACK_COOLDOWN = 3f;
|
||||
|
||||
// Ranged volleys charge per projectile rather than a flat fee, so the 20- and 60-shard
|
||||
// breaths cost what they are worth instead of the same as a three-shard drake spit.
|
||||
// Stamina rather than eitr, for the same reason the Cold Spell uses it: eitr food only
|
||||
// exists from the Mistlands on, while the drake form arrives at the Elder, so an eitr
|
||||
// cost left the earliest dragon tiers with no attack they could actually pay for.
|
||||
private const float STAMINA_PER_PROJECTILE = 1.5f;
|
||||
// Ceiling so the widest breath stays castable: 60 shards would otherwise ask 90 stamina.
|
||||
private const float MAX_VOLLEY_STAMINA = 85f;
|
||||
|
||||
// Melee costs nothing at all - it is the baseline attack that has to work at every tier,
|
||||
// including the long stretch where the player has no eitr whatsoever.
|
||||
private const float MELEE_RADIUS = 3f;
|
||||
private const float MODER_MELEE_DAMAGE = 90f;
|
||||
private const float FADER_MELEE_DAMAGE = 120f;
|
||||
private const float FADER_SPIN_DAMAGE = 100f;
|
||||
private const float FADER_SPIN_RADIUS = 5f;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Active = this;
|
||||
|
|
@ -126,7 +142,7 @@ namespace RacesOfValheim
|
|||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
if (Time.time - lastAttackTime >= ATTACK_COOLDOWN)
|
||||
if (HasAttackForButton(0) && Time.time - lastAttackTime >= ATTACK_COOLDOWN)
|
||||
{
|
||||
StartCoroutine(PerformAttackCoroutine(0));
|
||||
}
|
||||
|
|
@ -148,15 +164,44 @@ namespace RacesOfValheim
|
|||
}
|
||||
}
|
||||
|
||||
// Airborne Moder keeps the same hand as the ground: the ranged breath is Middle Mouse, and
|
||||
// Left Mouse has no attack in the air (its ground bite and claws cannot reach from up
|
||||
// there). Checked before the cooldown so a stray left click does not eat the next volley.
|
||||
private bool HasAttackForButton(int button)
|
||||
{
|
||||
if (formRules == null) return false;
|
||||
|
||||
bool airborne = isFlying || isLanding;
|
||||
if (airborne && formRules.Form == SkadiProgression.FormType.Moder && button != 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool TrySpendVolleyStamina(int projCount)
|
||||
{
|
||||
float cost = Mathf.Min(STAMINA_PER_PROJECTILE * projCount, MAX_VOLLEY_STAMINA);
|
||||
if (!Player.m_localPlayer.HaveStamina(cost))
|
||||
{
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "Not enough stamina");
|
||||
return false;
|
||||
}
|
||||
Player.m_localPlayer.UseStamina(cost);
|
||||
return true;
|
||||
}
|
||||
|
||||
private IEnumerator PerformAttackCoroutine(int button)
|
||||
{
|
||||
lastAttackTime = Time.time;
|
||||
SkadiRace.ApplyCooldownIcon(SkadiRace.ATTACK_COOLDOWN_SE, ATTACK_COOLDOWN);
|
||||
|
||||
if (formRules.Form == SkadiProgression.FormType.Drake)
|
||||
{
|
||||
if (button == 2) yield break; // Drake only uses LMB
|
||||
|
||||
Player.m_localPlayer.UseEitr(ATTACK_COST);
|
||||
|
||||
if (!TrySpendVolleyStamina(3)) yield break;
|
||||
if (anim != null) anim.SetTrigger("attack");
|
||||
|
||||
// Delay to match animation spit timing
|
||||
|
|
@ -229,12 +274,17 @@ namespace RacesOfValheim
|
|||
projDelay = 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
Player.m_localPlayer.UseEitr(ATTACK_COST);
|
||||
|
||||
if (!isMelee && !TrySpendVolleyStamina(projCount)) yield break;
|
||||
if (anim != null) anim.SetTrigger(attackTrigger);
|
||||
|
||||
|
||||
yield return new WaitForSeconds(projDelay);
|
||||
|
||||
if (isMelee)
|
||||
{
|
||||
ExecuteMeleeDamage(MODER_MELEE_DAMAGE, MELEE_RADIUS);
|
||||
}
|
||||
|
||||
if (!isMelee && projName != null)
|
||||
{
|
||||
GameObject projPrefab = PrefabManager.Cache.GetPrefab<GameObject>(projName);
|
||||
|
|
@ -277,51 +327,50 @@ namespace RacesOfValheim
|
|||
int projCount = 1;
|
||||
float projDelay = 0.5f;
|
||||
bool isMelee = true;
|
||||
float meleeDamage = FADER_MELEE_DAMAGE;
|
||||
float meleeRadius = MELEE_RADIUS;
|
||||
|
||||
if (isFlying || isLanding)
|
||||
// No airborne branch here: the flight toggle in Update excludes SkeletonDragon,
|
||||
// so this form never leaves the ground and any air attack would be unreachable.
|
||||
if (button == 2)
|
||||
{
|
||||
// Air attack (Meteors replacement -> Ice Barrage)
|
||||
attackTrigger = "attack_roar"; // taunt animation has issues in air
|
||||
projName = "dragon_ice_projectile"; // spawn_fader_meteors is buggy without Fader boss script
|
||||
projCount = 16;
|
||||
projDelay = 1.0f;
|
||||
// Ground MMB (Frost Breath stream)
|
||||
attackTrigger = "attack_flamebreath";
|
||||
projName = "hatchling_cold_projectile";
|
||||
projCount = 60; // Tripled!
|
||||
projDelay = 0.5f;
|
||||
isMelee = false;
|
||||
}
|
||||
else if (button == 1)
|
||||
{
|
||||
// Ground RMB (Spin) - hits all around rather than in a forward arc
|
||||
attackTrigger = "attack_Spin";
|
||||
isMelee = true;
|
||||
projDelay = 0.5f;
|
||||
meleeDamage = FADER_SPIN_DAMAGE;
|
||||
meleeRadius = FADER_SPIN_RADIUS;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (button == 2)
|
||||
{
|
||||
// Ground MMB (Frost Breath stream)
|
||||
attackTrigger = "attack_flamebreath";
|
||||
projName = "hatchling_cold_projectile";
|
||||
projCount = 60; // Tripled!
|
||||
projDelay = 0.5f;
|
||||
isMelee = false;
|
||||
}
|
||||
else if (button == 1)
|
||||
{
|
||||
// Ground RMB (Spin)
|
||||
attackTrigger = "attack_Spin";
|
||||
isMelee = true;
|
||||
projDelay = 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ground LMB (Melee mix - bite/claws)
|
||||
float rand = UnityEngine.Random.value;
|
||||
if (rand < 0.33f) attackTrigger = "attack_bite";
|
||||
else if (rand < 0.66f) attackTrigger = "attack_ClawL";
|
||||
else attackTrigger = "attack_ClawR";
|
||||
isMelee = true;
|
||||
projDelay = 0.5f;
|
||||
}
|
||||
// Ground LMB (Melee mix - bite/claws)
|
||||
float rand = UnityEngine.Random.value;
|
||||
if (rand < 0.33f) attackTrigger = "attack_bite";
|
||||
else if (rand < 0.66f) attackTrigger = "attack_ClawL";
|
||||
else attackTrigger = "attack_ClawR";
|
||||
isMelee = true;
|
||||
projDelay = 0.5f;
|
||||
}
|
||||
|
||||
Player.m_localPlayer.UseEitr(ATTACK_COST);
|
||||
if (!isMelee && !TrySpendVolleyStamina(projCount)) yield break;
|
||||
if (anim != null) anim.SetTrigger(attackTrigger);
|
||||
|
||||
|
||||
yield return new WaitForSeconds(projDelay);
|
||||
|
||||
if (isMelee)
|
||||
{
|
||||
ExecuteMeleeDamage(meleeDamage, meleeRadius);
|
||||
}
|
||||
|
||||
if (!isMelee && projName != null)
|
||||
{
|
||||
GameObject projPrefab = PrefabManager.Cache.GetPrefab<GameObject>(projName);
|
||||
|
|
@ -377,6 +426,69 @@ namespace RacesOfValheim
|
|||
}
|
||||
}
|
||||
|
||||
// The dragon forms never go through Humanoid.StartAttack - SkadiAttackPatch blocks it, and
|
||||
// they carry no weapon - so the bite, claw and spin animations landed no damage at all and
|
||||
// simply burned eitr. Sweep for targets the way FenrirBehaviors does for its claws.
|
||||
private void ExecuteMeleeDamage(float baseDamage, float radius)
|
||||
{
|
||||
if (Player.m_localPlayer == null) return;
|
||||
|
||||
Vector3 playerPos = Player.m_localPlayer.transform.position;
|
||||
Vector3 forward = Player.m_localPlayer.transform.forward;
|
||||
Vector3 attackPoint = playerPos + forward * 2f + Vector3.up * 1f;
|
||||
|
||||
// Spin sweeps all around; the directional attacks stay in a forward arc.
|
||||
bool fullCircle = radius >= FADER_SPIN_RADIUS;
|
||||
float totalDamage = baseDamage + Player.m_localPlayer.GetSkillLevel(Skills.SkillType.Unarmed);
|
||||
if (fullCircle) attackPoint = playerPos + Vector3.up * 1f;
|
||||
|
||||
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, radius, layerMask);
|
||||
System.Collections.Generic.HashSet<GameObject> hitObjects = new System.Collections.Generic.HashSet<GameObject>();
|
||||
|
||||
foreach (Collider hit in hits)
|
||||
{
|
||||
if (hit.gameObject == Player.m_localPlayer.gameObject) continue;
|
||||
if (hit.attachedRigidbody != null && hit.attachedRigidbody.gameObject == Player.m_localPlayer.gameObject) continue;
|
||||
|
||||
IDestructible target = hit.GetComponentInParent<IDestructible>();
|
||||
if (target == null) continue;
|
||||
|
||||
Character characterTarget = target as Character;
|
||||
if (characterTarget != null && characterTarget == Player.m_localPlayer) continue;
|
||||
|
||||
GameObject targetObj = (target as MonoBehaviour)?.gameObject;
|
||||
if (targetObj != null)
|
||||
{
|
||||
if (hitObjects.Contains(targetObj)) continue;
|
||||
hitObjects.Add(targetObj);
|
||||
}
|
||||
|
||||
Vector3 targetCenter = hit.bounds.center;
|
||||
Vector3 dirToTarget = (targetCenter - playerPos).normalized;
|
||||
if (!fullCircle && Vector3.Angle(forward, dirToTarget) >= 70f) continue;
|
||||
|
||||
Vector3 eyePos = playerPos + Vector3.up * 1.5f;
|
||||
if (Physics.Linecast(eyePos, targetCenter, out RaycastHit rayHit, LayerMask.GetMask("Default", "static_solid", "terrain", "piece"))) continue;
|
||||
|
||||
HitData hitData = new HitData();
|
||||
// Frost-flavoured maul; SkadiDamagePatch tops this up with the per-tier frost bonus.
|
||||
hitData.m_damage.m_blunt = totalDamage * 0.6f;
|
||||
hitData.m_damage.m_frost = totalDamage * 0.4f;
|
||||
hitData.m_pushForce = 40f;
|
||||
hitData.m_point = targetCenter;
|
||||
hitData.m_dir = dirToTarget;
|
||||
hitData.m_skill = Skills.SkillType.Unarmed;
|
||||
hitData.m_dodgeable = true;
|
||||
hitData.m_blockable = true;
|
||||
hitData.m_hitType = HitData.HitType.PlayerHit;
|
||||
hitData.m_toolTier = 0;
|
||||
hitData.SetAttacker(Player.m_localPlayer);
|
||||
|
||||
target.Damage(hitData);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (Active == this) Active = null;
|
||||
|
|
|
|||
|
|
@ -282,12 +282,28 @@ namespace RacesOfValheim
|
|||
[HarmonyPatch(typeof(Humanoid), "StartAttack")]
|
||||
public static class SkadiAttackPatch
|
||||
{
|
||||
public static bool Prefix(Humanoid __instance)
|
||||
public static bool Prefix(Humanoid __instance, bool secondaryAttack)
|
||||
{
|
||||
if (__instance == Player.m_localPlayer && __instance.GetComponentInChildren<DrakeFormBehavior>() != null)
|
||||
if (__instance != Player.m_localPlayer) return true;
|
||||
|
||||
if (__instance.GetComponentInChildren<DrakeFormBehavior>() != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Valheim binds its own SecondaryAttack action to Middle Mouse, the same button the
|
||||
// Cold Spell casts on, so pressing it also swung the unarmed secondary - the kick that
|
||||
// kept showing up alongside the cast no matter which animation trigger we used. For a
|
||||
// Skadi who has the spell, Middle Mouse belongs to the spell. Keyed off the live button
|
||||
// state rather than a flag set during our Update, so it does not depend on whether
|
||||
// PlayerController's FixedUpdate happens to run first.
|
||||
if (secondaryAttack && Input.GetMouseButton(2) &&
|
||||
SkadiRace.Instance != null && SkadiRace.Instance.IsSkadi())
|
||||
{
|
||||
var rules = SkadiProgression.GetRules(BossProgressionManager.GetCurrentProgressionState());
|
||||
if (rules.ColdSpell) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,11 +46,14 @@ namespace RacesOfValheim
|
|||
|
||||
if (state >= 2)
|
||||
{
|
||||
rules.EitrRegenMultiplier = 1.20f;
|
||||
rules.FreezingToCold = true;
|
||||
rules.ColdSpell = true;
|
||||
}
|
||||
|
||||
if (state >= 4)
|
||||
{
|
||||
rules.FreezingToCold = true;
|
||||
}
|
||||
|
||||
if (state >= 6)
|
||||
{
|
||||
rules.EitrRegenMultiplier = 1.50f;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,21 @@ namespace RacesOfValheim
|
|||
private float lastAuraTime = 0f;
|
||||
private GameObject frostAuraVFX = null;
|
||||
|
||||
// Cold Spell tuning. Damage is 15 + 8 per progression state, so it runs from roughly 31 at
|
||||
// Eikthyr to 79 at Fader - deliberately a notch under the melee options of the other races
|
||||
// at each tier, which is the trade for hitting at range on a short cooldown.
|
||||
public const string SPELL_COOLDOWN_SE = "SE_SkadiSpellCooldown";
|
||||
public const string ATTACK_COOLDOWN_SE = "SE_SkadiAttackCooldown";
|
||||
|
||||
private const float SPELL_STAMINA_COST = 20f;
|
||||
private const float SPELL_COOLDOWN = 1.5f;
|
||||
private const float IMPROVED_SPELL_COOLDOWN = 4f;
|
||||
private const float SPELL_BASE_DAMAGE = 15f;
|
||||
private const float SPELL_DAMAGE_PER_STATE = 8f;
|
||||
private const int IMPROVED_SPELL_SHARDS = 10;
|
||||
// The improved cast spreads 1.6 casts worth of damage over its shards: wider, not stronger.
|
||||
private const float IMPROVED_SPELL_DAMAGE_BUDGET = 1.6f;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
|
|
@ -52,7 +67,7 @@ namespace RacesOfValheim
|
|||
|
||||
// Timed forms and their cooldown are Moder's, so they carry her trophy rather than the
|
||||
// drake one used for the passive blessing.
|
||||
Sprite dragonIcon = GetTrophyIcon("TrophyDragonQueen") ?? GetTrophyIcon("TrophyHatchling");
|
||||
Sprite dragonIcon = GetItemIcon("TrophyDragonQueen") ?? GetItemIcon("TrophyHatchling");
|
||||
|
||||
skadiCdSE = ScriptableObject.CreateInstance<SE_FormCooldown>();
|
||||
skadiCdSE.name = "SE_SkadiCooldown";
|
||||
|
|
@ -66,9 +81,40 @@ namespace RacesOfValheim
|
|||
skadiFormSE.m_tooltip = "Your dragon shape holds for a while longer.";
|
||||
skadiFormSE.m_icon = dragonIcon;
|
||||
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(skadiFormSE, fixReference: false));
|
||||
|
||||
// Per-ability cooldowns. Each gets its own icon so a spell on cooldown reads
|
||||
// differently from a dragon attack on cooldown at a glance.
|
||||
var spellCd = ScriptableObject.CreateInstance<SE_SkadiAbilityCooldown>();
|
||||
spellCd.name = SPELL_COOLDOWN_SE;
|
||||
spellCd.m_name = "Cold Spell";
|
||||
spellCd.m_tooltip = "The frost must gather again before you may cast.";
|
||||
spellCd.m_icon = GetItemIcon("StaffIceShards") ?? dragonIcon;
|
||||
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(spellCd, fixReference: false));
|
||||
|
||||
var attackCd = ScriptableObject.CreateInstance<SE_SkadiAbilityCooldown>();
|
||||
attackCd.name = ATTACK_COOLDOWN_SE;
|
||||
attackCd.m_name = "Dragon Attack";
|
||||
attackCd.m_tooltip = "Your dragon shape must ready itself to strike again.";
|
||||
attackCd.m_icon = GetItemIcon("TrophyHatchling") ?? dragonIcon;
|
||||
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(attackCd, fixReference: false));
|
||||
}
|
||||
|
||||
private static Sprite GetTrophyIcon(string prefabName)
|
||||
// Drives the HUD countdown: Valheim prints the remaining time on any status effect whose
|
||||
// m_ttl is set, so the cooldown only has to exist for the icon to tick down by itself.
|
||||
public static void ApplyCooldownIcon(string effectName, float seconds)
|
||||
{
|
||||
if (Player.m_localPlayer == null || seconds <= 0f) return;
|
||||
|
||||
int hash = effectName.GetStableHashCode();
|
||||
SEMan seman = Player.m_localPlayer.GetSEMan();
|
||||
seman.RemoveStatusEffect(hash, true);
|
||||
seman.AddStatusEffect(hash, true);
|
||||
|
||||
StatusEffect se = seman.GetStatusEffect(hash);
|
||||
if (se != null) se.m_ttl = seconds;
|
||||
}
|
||||
|
||||
private static Sprite GetItemIcon(string prefabName)
|
||||
{
|
||||
GameObject trophy = PrefabManager.Cache.GetPrefab<ItemDrop>(prefabName)?.gameObject;
|
||||
ItemDrop drop = trophy != null ? trophy.GetComponent<ItemDrop>() : null;
|
||||
|
|
@ -264,24 +310,29 @@ namespace RacesOfValheim
|
|||
// Middle Mouse Button to cast
|
||||
if (Input.GetMouseButtonDown(2))
|
||||
{
|
||||
float cooldown = rules.ImprovedColdSpell ? 2.0f : 1.5f;
|
||||
// The improved cast is a burst rather than a rapid-fire, so it waits longer.
|
||||
float cooldown = rules.ImprovedColdSpell ? IMPROVED_SPELL_COOLDOWN : SPELL_COOLDOWN;
|
||||
if (Time.time - lastSpellTime < cooldown) return;
|
||||
|
||||
if (!Player.m_localPlayer.HaveEitr(10f))
|
||||
// Stamina, never eitr: the spell unlocks at Eikthyr but eitr food only exists from
|
||||
// the Mistlands onward, so the old HaveEitr gate left it unusable for five tiers.
|
||||
if (!Player.m_localPlayer.HaveStamina(SPELL_STAMINA_COST))
|
||||
{
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "Not enough Eitr");
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "Not enough stamina");
|
||||
return;
|
||||
}
|
||||
|
||||
Player.m_localPlayer.UseEitr(10f);
|
||||
Player.m_localPlayer.UseStamina(SPELL_STAMINA_COST);
|
||||
lastSpellTime = Time.time;
|
||||
ApplyCooldownIcon(SPELL_COOLDOWN_SE, cooldown);
|
||||
|
||||
var zanim = HarmonyLib.Traverse.Create(Player.m_localPlayer).Field<ZSyncAnimation>("m_zanim").Value;
|
||||
if (zanim != null)
|
||||
{
|
||||
// Raised-arms Galdr cast gesture instead of the unarmed kick, so the cast
|
||||
// reads as a spell instead of a leg swing near the ground.
|
||||
zanim.SetTrigger("galdr_cast");
|
||||
// "galdr_cast" is not one of the triggers Valheim actually defines, so it
|
||||
// never fired and the unarmed kick stayed. "gpower" is the guardian power
|
||||
// raise: both arms up, which reads as casting rather than a leg swing.
|
||||
zanim.SetTrigger("gpower");
|
||||
}
|
||||
|
||||
StartCoroutine(ColdSpellKickCoroutine(rules));
|
||||
|
|
@ -307,14 +358,23 @@ namespace RacesOfValheim
|
|||
{
|
||||
projPrefab = PrefabManager.Cache.GetPrefab<GameObject>(projName);
|
||||
}
|
||||
if (projPrefab == null)
|
||||
if (projPrefab == null)
|
||||
{
|
||||
projPrefab = staffDrop.m_itemData.m_shared.m_attack.m_attackProjectile; // Default Staff of Frost projectile
|
||||
}
|
||||
if (projPrefab == null) yield break;
|
||||
|
||||
int count = rules.ImprovedColdSpell ? 10 : 1;
|
||||
|
||||
int count = rules.ImprovedColdSpell ? IMPROVED_SPELL_SHARDS : 1;
|
||||
|
||||
// The staff prefab is borrowed for its projectile visuals and velocity only. Its damage
|
||||
// is Mistlands-tier, which the spell used to hand out in full from Eikthyr onward, and
|
||||
// once per shard - so the improved cast was a ten times nuke rather than a wider one.
|
||||
// Scale with progression instead, and split one budget across the shards.
|
||||
int state = BossProgressionManager.GetCurrentProgressionState();
|
||||
float castDamage = SPELL_BASE_DAMAGE + SPELL_DAMAGE_PER_STATE * state;
|
||||
if (count > 1) castDamage *= IMPROVED_SPELL_DAMAGE_BUDGET;
|
||||
float shardDamage = castDamage / count;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (Player.m_localPlayer == null || Player.m_localPlayer.IsDead()) break;
|
||||
|
|
@ -336,7 +396,7 @@ namespace RacesOfValheim
|
|||
if (proj != null)
|
||||
{
|
||||
HitData hitData = new HitData();
|
||||
hitData.m_damage = staffDrop.m_itemData.m_shared.m_damages;
|
||||
hitData.m_damage.m_frost = shardDamage;
|
||||
hitData.SetAttacker(Player.m_localPlayer);
|
||||
proj.Setup(Player.m_localPlayer, lookDir * staffDrop.m_itemData.m_shared.m_attack.m_projectileVel, -1f, hitData, staffDrop.m_itemData, null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,13 @@ namespace RacesOfValheim
|
|||
{
|
||||
}
|
||||
|
||||
// Short ability cooldowns, shown purely so the HUD can count them down. Silent by design,
|
||||
// unlike SE_FormCooldown which announces "... is Ready!" when it stops: tolerable once every
|
||||
// few minutes for a dragon form, unbearable every three seconds for an attack.
|
||||
public class SE_SkadiAbilityCooldown : StatusEffect
|
||||
{
|
||||
}
|
||||
|
||||
public class SE_SkadiStats : SE_Stats
|
||||
{
|
||||
public override void Setup(Character character)
|
||||
|
|
|
|||
|
|
@ -81,11 +81,11 @@ This mod currently introduces 6 custom races:
|
|||
|
||||
### Skadi Progression
|
||||
- **Base (No Bosses)**: Immune to Cold, Bonus Frost Damage, 50% Frost Resistance.
|
||||
- **Eikthyr**: +20% Eitr Regen, Freezing to Cold, Cold Spell (Middle Mouse).
|
||||
- **Eikthyr**: Cold Spell (Middle Mouse).
|
||||
- **The Elder**: Drake Form ('G' Key) (Cannot attack).
|
||||
- **Bonemass**: Drake Form ('G' Key) (Can attack).
|
||||
- **Bonemass**: Freezing to Cold. Drake Form ('G' Key) (Can attack).
|
||||
- **Moder**: Moder Form ('H' Key) (1 min duration, 10 min cooldown).
|
||||
- **Yagluth**: Improved Cold Spell. Moder Form ('H' Key) (1 min duration, 5 min cooldown).
|
||||
- **Yagluth**: +50% Eitr Regen. Improved Cold Spell. Moder Form ('H' Key) (1 min duration, 5 min cooldown).
|
||||
- **The Queen**: Moder Form ('H' Key) (Unlimited duration, no cooldown).
|
||||
- **Fader**: Skeleton Dragon Form ('J' Key).
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue