fix(skills): hand-built attacks level the skill they scale with
Form attacks and powers called Damage directly, and vanilla only raises a skill inside Attack and Projectile.OnHit, so the skill never moved. FormMelee.RaiseSkill pays once per swing or tick that hit a creature. - Fenrir forms' claws and bites: Unarmed; Cultist fire: Elemental Magic - Skadi drake melee and Trenta stomp: Unarmed - Aswid aura: Blood Magic, 0.1 per second like the Frost Aura - Alfar Geisli and Ljosstorm: Elemental Magic; Sameining pulse 0.1/s - Trenta Purple Rain scales with Blood Magic (two new bonus keys) and levels it once per cast that reaches someone besides the caster
This commit is contained in:
parent
eeebfd4d06
commit
d9bca1934f
11 changed files with 105 additions and 9 deletions
|
|
@ -119,7 +119,10 @@ namespace RacesOfValheim
|
|||
if (Time.time >= nextPulse)
|
||||
{
|
||||
nextPulse = Time.time + AlfarPowerConfig.ArchonPulseInterval.Value;
|
||||
AlfarPowers.Pulse(player, AlfarPowerConfig.ArchonPulseRadius.Value, AlfarPowerConfig.ArchonPulseDamage.Value);
|
||||
// The pulse fires on its own while the form lasts, so it earns what an aura does:
|
||||
// a tenth of a hit per second, once per pulse that struck something.
|
||||
if (AlfarPowers.Pulse(player, AlfarPowerConfig.ArchonPulseRadius.Value, AlfarPowerConfig.ArchonPulseDamage.Value))
|
||||
FormMelee.RaiseSkill(Skills.SkillType.ElementalMagic, 0.1f * AlfarPowerConfig.ArchonPulseInterval.Value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -148,12 +148,17 @@ namespace RacesOfValheim
|
|||
}
|
||||
|
||||
/// <summary>A pulse of lightning on every hostile creature within a radius of the Alfr.</summary>
|
||||
public static void Pulse(Player player, float radius, float damage)
|
||||
/// <returns>True if it struck at least one creature.</returns>
|
||||
public static bool Pulse(Player player, float radius, float damage)
|
||||
{
|
||||
bool struck = false;
|
||||
foreach (Character character in CharactersIn(player.transform.position, radius))
|
||||
{
|
||||
if (IsHostile(player, character)) Strike(player, character, damage, character.GetCenterPoint());
|
||||
if (!IsHostile(player, character)) continue;
|
||||
Strike(player, character, damage, character.GetCenterPoint());
|
||||
struck = true;
|
||||
}
|
||||
return struck;
|
||||
}
|
||||
|
||||
private static IEnumerable<Character> CharactersIn(Vector3 center, float radius)
|
||||
|
|
@ -396,7 +401,11 @@ namespace RacesOfValheim
|
|||
AlfarEitr.Spend(player, cost);
|
||||
}
|
||||
|
||||
if (IsHostile(player, target)) Strike(player, target, AlfarPowerConfig.BeamDps.Value * tick, end);
|
||||
if (IsHostile(player, target))
|
||||
{
|
||||
Strike(player, target, AlfarPowerConfig.BeamDps.Value * tick, end);
|
||||
FormMelee.RaiseSkill(Skills.SkillType.ElementalMagic, tick); // a full hit per second on target
|
||||
}
|
||||
}
|
||||
|
||||
private static void RaiseHand(Player player)
|
||||
|
|
@ -548,14 +557,19 @@ namespace RacesOfValheim
|
|||
const float tick = 0.5f;
|
||||
nextTick = Time.time + tick;
|
||||
|
||||
bool struck = false;
|
||||
foreach (Collider collider in Physics.OverlapSphere(transform.position, Radius, ~0, QueryTriggerInteraction.Ignore))
|
||||
{
|
||||
Character character = collider.GetComponentInParent<Character>();
|
||||
if (character == null || character == Owner || character.IsDead() || character.IsTamed()) continue;
|
||||
if (!BaseAI.IsEnemy(Owner, character)) continue;
|
||||
AlfarPowers.Strike(Owner, character, DamagePerSecond * tick, character.GetCenterPoint());
|
||||
struck = true;
|
||||
}
|
||||
|
||||
// Once per tick, not per creature: a full hit per second the storm strikes something.
|
||||
if (struck && Owner == Player.m_localPlayer) FormMelee.RaiseSkill(Skills.SkillType.ElementalMagic, tick);
|
||||
|
||||
Vector2 offset = Random.insideUnitCircle * Radius;
|
||||
AlfarFx.Spawn("fx_JotunWitch_LightningBolt_Explosion", transform.position + new Vector3(offset.x, 0f, offset.y));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue