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
|
|
@ -774,6 +774,7 @@ namespace RacesOfValheim
|
|||
Collider[] hits = Physics.OverlapSphere(attackPoint, attackRadius, layerMask);
|
||||
FormMelee.LogSwing(FormLabel, hits.Length);
|
||||
System.Collections.Generic.HashSet<GameObject> hitObjects = new System.Collections.Generic.HashSet<GameObject>();
|
||||
bool hitCreature = false;
|
||||
|
||||
foreach (Collider hit in hits)
|
||||
{
|
||||
|
|
@ -823,10 +824,13 @@ namespace RacesOfValheim
|
|||
FormMelee.LogHit(FormLabel, target, totalDamage);
|
||||
target.Damage(hitData);
|
||||
FormMelee.GrantAdrenaline(target);
|
||||
if (target is Character) hitCreature = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hitCreature) FormMelee.RaiseSkill(Skills.SkillType.Unarmed);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1067,6 +1071,7 @@ namespace RacesOfValheim
|
|||
Collider[] hits = Physics.OverlapSphere(attackPoint, attackRadius, layerMask);
|
||||
FormMelee.LogSwing(FormLabel, hits.Length);
|
||||
System.Collections.Generic.HashSet<GameObject> hitObjects = new System.Collections.Generic.HashSet<GameObject>();
|
||||
bool hitCreature = false;
|
||||
|
||||
foreach (Collider hit in hits)
|
||||
{
|
||||
|
|
@ -1106,6 +1111,7 @@ namespace RacesOfValheim
|
|||
FormMelee.LogHit(FormLabel, target, totalDamage);
|
||||
target.Damage(hitData);
|
||||
FormMelee.GrantAdrenaline(target, 0.2f); // one 0.2s tick: a full hit per second of breath
|
||||
if (target is Character) hitCreature = true;
|
||||
|
||||
if (ZNetScene.instance != null)
|
||||
{
|
||||
|
|
@ -1115,6 +1121,8 @@ namespace RacesOfValheim
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hitCreature) FormMelee.RaiseSkill(Skills.SkillType.ElementalMagic, 0.2f); // one 0.2s tick: a full swing's worth per second of breath
|
||||
}
|
||||
|
||||
private IEnumerator ClawRoutine()
|
||||
|
|
@ -1231,6 +1239,7 @@ namespace RacesOfValheim
|
|||
Collider[] hits = Physics.OverlapSphere(attackPoint, attackRadius, layerMask);
|
||||
FormMelee.LogSwing(FormLabel, hits.Length);
|
||||
System.Collections.Generic.HashSet<GameObject> hitObjects = new System.Collections.Generic.HashSet<GameObject>();
|
||||
bool hitCreature = false;
|
||||
|
||||
foreach (Collider hit in hits)
|
||||
{
|
||||
|
|
@ -1280,10 +1289,13 @@ namespace RacesOfValheim
|
|||
FormMelee.LogHit(FormLabel, target, totalDamage);
|
||||
target.Damage(hitData);
|
||||
FormMelee.GrantAdrenaline(target);
|
||||
if (target is Character) hitCreature = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hitCreature) FormMelee.RaiseSkill(Skills.SkillType.Unarmed);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1446,6 +1458,7 @@ namespace RacesOfValheim
|
|||
Collider[] hits = Physics.OverlapSphere(attackPoint, attackRadius, layerMask);
|
||||
FormMelee.LogSwing(FormLabel, hits.Length);
|
||||
System.Collections.Generic.HashSet<GameObject> hitObjects = new System.Collections.Generic.HashSet<GameObject>();
|
||||
bool hitCreature = false;
|
||||
|
||||
foreach (Collider hit in hits)
|
||||
{
|
||||
|
|
@ -1495,10 +1508,13 @@ namespace RacesOfValheim
|
|||
FormMelee.LogHit(FormLabel, target, totalDamage);
|
||||
target.Damage(hitData);
|
||||
FormMelee.GrantAdrenaline(target);
|
||||
if (target is Character) hitCreature = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hitCreature) FormMelee.RaiseSkill(Skills.SkillType.Unarmed);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1654,6 +1670,7 @@ namespace RacesOfValheim
|
|||
Collider[] hits = Physics.OverlapSphere(attackPoint, attackRadius, layerMask);
|
||||
FormMelee.LogSwing(FormLabel, hits.Length);
|
||||
System.Collections.Generic.HashSet<GameObject> hitObjects = new System.Collections.Generic.HashSet<GameObject>();
|
||||
bool hitCreature = false;
|
||||
|
||||
foreach (Collider hit in hits)
|
||||
{
|
||||
|
|
@ -1703,10 +1720,13 @@ namespace RacesOfValheim
|
|||
FormMelee.LogHit(FormLabel, target, totalDamage);
|
||||
target.Damage(hitData);
|
||||
FormMelee.GrantAdrenaline(target);
|
||||
if (target is Character) hitCreature = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hitCreature) FormMelee.RaiseSkill(Skills.SkillType.Unarmed);
|
||||
}
|
||||
|
||||
private IEnumerator UlvJumpAttackRoutine()
|
||||
|
|
|
|||
|
|
@ -368,6 +368,21 @@ namespace RacesOfValheim
|
|||
player.AddAdrenaline(perHit * character.m_enemyAdrenalineMultiplier * scale);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The skill experience vanilla gives for a weapon hit, which a hand-built hit never got.
|
||||
/// Vanilla raises the skill inside Attack (once per swing that landed on a creature) and
|
||||
/// inside Projectile.OnHit; Character.Damage never does, so a form that calls Damage
|
||||
/// directly left its skill at whatever level the player brought in. Call it once per
|
||||
/// swing or tick, after the loop, never once per target. amount lets a damage-over-time
|
||||
/// tick pay a fraction of a swing.
|
||||
/// </summary>
|
||||
public static void RaiseSkill(Skills.SkillType skill, float amount = 1f)
|
||||
{
|
||||
Player player = Player.m_localPlayer;
|
||||
if (player == null || amount <= 0f) return;
|
||||
player.RaiseSkill(skill, amount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Charges a form attack's stamina the way vanilla charges a weapon's (Attack.GetAttackStamina):
|
||||
/// the equipment modifier, status effects (meads, race passives), then up to a third off with
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue