Rework Skadi combat costs, fix dead melee, add cooldown icons
Dragon melee never dealt damage at all: the damage block sat behind !isMelee, so bite, claw and spin played an animation, charged eitr and did nothing. Melee now sweeps for targets the way Fenrir's claws do, and costs nothing - it is the baseline attack that has to work at every tier. Everything Skadi casts now runs on stamina rather than eitr. Eitr food only exists from the Mistlands on, while the Cold Spell unlocks at Eikthyr and the drake at the Elder, so the old costs were either unpayable or, in the drake's case, silently ignored because UseEitr never checked affordability. Ranged volleys are charged per projectile so the sixty shard breath no longer costs the same as a three shard spit, capped so the widest one stays castable. The Cold Spell also stopped borrowing the Staff of Frost's damage, which handed out Mistlands numbers from Eikthyr and multiplied them by every shard. It now scales with progression, and the improved cast spreads one budget across its shards: wider, not stronger. The kick that played over every cast was Valheim's own SecondaryAttack, bound to the same Middle Mouse button - suppressed for a Skadi holding the spell. Moder now keeps its ranged attack on Middle Mouse in the air as on the ground, with no left hand attack aloft, and Fader's airborne branch is gone since its form cannot fly. Ability cooldowns finally show on the HUD, each with its own icon and a live countdown.
This commit is contained in:
parent
a8a14f0416
commit
fc7fd54404
4 changed files with 251 additions and 56 deletions
|
|
@ -49,9 +49,25 @@ namespace RacesOfValheim
|
||||||
return live != null && live.Form == formRules.Form && live.CanAttackInForm;
|
return live != null && live.Form == formRules.Form && live.CanAttackInForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
private const float ATTACK_COST = 20f;
|
|
||||||
private const float ATTACK_COOLDOWN = 3f;
|
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()
|
private void Start()
|
||||||
{
|
{
|
||||||
Active = this;
|
Active = this;
|
||||||
|
|
@ -126,7 +142,7 @@ namespace RacesOfValheim
|
||||||
{
|
{
|
||||||
if (Input.GetMouseButtonDown(0))
|
if (Input.GetMouseButtonDown(0))
|
||||||
{
|
{
|
||||||
if (Time.time - lastAttackTime >= ATTACK_COOLDOWN)
|
if (HasAttackForButton(0) && Time.time - lastAttackTime >= ATTACK_COOLDOWN)
|
||||||
{
|
{
|
||||||
StartCoroutine(PerformAttackCoroutine(0));
|
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)
|
private IEnumerator PerformAttackCoroutine(int button)
|
||||||
{
|
{
|
||||||
lastAttackTime = Time.time;
|
lastAttackTime = Time.time;
|
||||||
|
SkadiRace.ApplyCooldownIcon(SkadiRace.ATTACK_COOLDOWN_SE, ATTACK_COOLDOWN);
|
||||||
|
|
||||||
if (formRules.Form == SkadiProgression.FormType.Drake)
|
if (formRules.Form == SkadiProgression.FormType.Drake)
|
||||||
{
|
{
|
||||||
if (button == 2) yield break; // Drake only uses LMB
|
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");
|
if (anim != null) anim.SetTrigger("attack");
|
||||||
|
|
||||||
// Delay to match animation spit timing
|
// Delay to match animation spit timing
|
||||||
|
|
@ -230,11 +275,16 @@ namespace RacesOfValheim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Player.m_localPlayer.UseEitr(ATTACK_COST);
|
if (!isMelee && !TrySpendVolleyStamina(projCount)) yield break;
|
||||||
if (anim != null) anim.SetTrigger(attackTrigger);
|
if (anim != null) anim.SetTrigger(attackTrigger);
|
||||||
|
|
||||||
yield return new WaitForSeconds(projDelay);
|
yield return new WaitForSeconds(projDelay);
|
||||||
|
|
||||||
|
if (isMelee)
|
||||||
|
{
|
||||||
|
ExecuteMeleeDamage(MODER_MELEE_DAMAGE, MELEE_RADIUS);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isMelee && projName != null)
|
if (!isMelee && projName != null)
|
||||||
{
|
{
|
||||||
GameObject projPrefab = PrefabManager.Cache.GetPrefab<GameObject>(projName);
|
GameObject projPrefab = PrefabManager.Cache.GetPrefab<GameObject>(projName);
|
||||||
|
|
@ -277,51 +327,50 @@ namespace RacesOfValheim
|
||||||
int projCount = 1;
|
int projCount = 1;
|
||||||
float projDelay = 0.5f;
|
float projDelay = 0.5f;
|
||||||
bool isMelee = true;
|
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)
|
// Ground MMB (Frost Breath stream)
|
||||||
attackTrigger = "attack_roar"; // taunt animation has issues in air
|
attackTrigger = "attack_flamebreath";
|
||||||
projName = "dragon_ice_projectile"; // spawn_fader_meteors is buggy without Fader boss script
|
projName = "hatchling_cold_projectile";
|
||||||
projCount = 16;
|
projCount = 60; // Tripled!
|
||||||
projDelay = 1.0f;
|
projDelay = 0.5f;
|
||||||
isMelee = false;
|
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
|
else
|
||||||
{
|
{
|
||||||
if (button == 2)
|
// Ground LMB (Melee mix - bite/claws)
|
||||||
{
|
float rand = UnityEngine.Random.value;
|
||||||
// Ground MMB (Frost Breath stream)
|
if (rand < 0.33f) attackTrigger = "attack_bite";
|
||||||
attackTrigger = "attack_flamebreath";
|
else if (rand < 0.66f) attackTrigger = "attack_ClawL";
|
||||||
projName = "hatchling_cold_projectile";
|
else attackTrigger = "attack_ClawR";
|
||||||
projCount = 60; // Tripled!
|
isMelee = true;
|
||||||
projDelay = 0.5f;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Player.m_localPlayer.UseEitr(ATTACK_COST);
|
if (!isMelee && !TrySpendVolleyStamina(projCount)) yield break;
|
||||||
if (anim != null) anim.SetTrigger(attackTrigger);
|
if (anim != null) anim.SetTrigger(attackTrigger);
|
||||||
|
|
||||||
yield return new WaitForSeconds(projDelay);
|
yield return new WaitForSeconds(projDelay);
|
||||||
|
|
||||||
|
if (isMelee)
|
||||||
|
{
|
||||||
|
ExecuteMeleeDamage(meleeDamage, meleeRadius);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isMelee && projName != null)
|
if (!isMelee && projName != null)
|
||||||
{
|
{
|
||||||
GameObject projPrefab = PrefabManager.Cache.GetPrefab<GameObject>(projName);
|
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()
|
private void OnDestroy()
|
||||||
{
|
{
|
||||||
if (Active == this) Active = null;
|
if (Active == this) Active = null;
|
||||||
|
|
|
||||||
|
|
@ -282,12 +282,28 @@ namespace RacesOfValheim
|
||||||
[HarmonyPatch(typeof(Humanoid), "StartAttack")]
|
[HarmonyPatch(typeof(Humanoid), "StartAttack")]
|
||||||
public static class SkadiAttackPatch
|
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;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,21 @@ namespace RacesOfValheim
|
||||||
private float lastAuraTime = 0f;
|
private float lastAuraTime = 0f;
|
||||||
private GameObject frostAuraVFX = null;
|
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()
|
private void Awake()
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
|
@ -52,7 +67,7 @@ namespace RacesOfValheim
|
||||||
|
|
||||||
// Timed forms and their cooldown are Moder's, so they carry her trophy rather than the
|
// Timed forms and their cooldown are Moder's, so they carry her trophy rather than the
|
||||||
// drake one used for the passive blessing.
|
// 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 = ScriptableObject.CreateInstance<SE_FormCooldown>();
|
||||||
skadiCdSE.name = "SE_SkadiCooldown";
|
skadiCdSE.name = "SE_SkadiCooldown";
|
||||||
|
|
@ -66,9 +81,40 @@ namespace RacesOfValheim
|
||||||
skadiFormSE.m_tooltip = "Your dragon shape holds for a while longer.";
|
skadiFormSE.m_tooltip = "Your dragon shape holds for a while longer.";
|
||||||
skadiFormSE.m_icon = dragonIcon;
|
skadiFormSE.m_icon = dragonIcon;
|
||||||
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(skadiFormSE, fixReference: false));
|
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;
|
GameObject trophy = PrefabManager.Cache.GetPrefab<ItemDrop>(prefabName)?.gameObject;
|
||||||
ItemDrop drop = trophy != null ? trophy.GetComponent<ItemDrop>() : null;
|
ItemDrop drop = trophy != null ? trophy.GetComponent<ItemDrop>() : null;
|
||||||
|
|
@ -264,24 +310,29 @@ namespace RacesOfValheim
|
||||||
// Middle Mouse Button to cast
|
// Middle Mouse Button to cast
|
||||||
if (Input.GetMouseButtonDown(2))
|
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 (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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player.m_localPlayer.UseEitr(10f);
|
Player.m_localPlayer.UseStamina(SPELL_STAMINA_COST);
|
||||||
lastSpellTime = Time.time;
|
lastSpellTime = Time.time;
|
||||||
|
ApplyCooldownIcon(SPELL_COOLDOWN_SE, cooldown);
|
||||||
|
|
||||||
var zanim = HarmonyLib.Traverse.Create(Player.m_localPlayer).Field<ZSyncAnimation>("m_zanim").Value;
|
var zanim = HarmonyLib.Traverse.Create(Player.m_localPlayer).Field<ZSyncAnimation>("m_zanim").Value;
|
||||||
if (zanim != null)
|
if (zanim != null)
|
||||||
{
|
{
|
||||||
// Raised-arms Galdr cast gesture instead of the unarmed kick, so the cast
|
// "galdr_cast" is not one of the triggers Valheim actually defines, so it
|
||||||
// reads as a spell instead of a leg swing near the ground.
|
// never fired and the unarmed kick stayed. "gpower" is the guardian power
|
||||||
zanim.SetTrigger("galdr_cast");
|
// raise: both arms up, which reads as casting rather than a leg swing.
|
||||||
|
zanim.SetTrigger("gpower");
|
||||||
}
|
}
|
||||||
|
|
||||||
StartCoroutine(ColdSpellKickCoroutine(rules));
|
StartCoroutine(ColdSpellKickCoroutine(rules));
|
||||||
|
|
@ -313,7 +364,16 @@ namespace RacesOfValheim
|
||||||
}
|
}
|
||||||
if (projPrefab == null) yield break;
|
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++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -336,7 +396,7 @@ namespace RacesOfValheim
|
||||||
if (proj != null)
|
if (proj != null)
|
||||||
{
|
{
|
||||||
HitData hitData = new HitData();
|
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);
|
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);
|
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 class SE_SkadiStats : SE_Stats
|
||||||
{
|
{
|
||||||
public override void Setup(Character character)
|
public override void Setup(Character character)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue