- ALOT of new icons - Network Area of EffectOverTime With Tick Event ability type - Movement Speed modifier effect - Vampire class signature ability - vampire new ultimate ability
56 lines
2.0 KiB
C#
56 lines
2.0 KiB
C#
using UnityEngine;
|
|
using UnityEngine.AI;
|
|
using System.Collections.Generic;
|
|
using Kryz.CharacterStats.Examples;
|
|
using Kryz.CharacterStats;
|
|
|
|
[CreateAssetMenu(fileName = "MovementSpeedModifierEffect", menuName = "RiftMayhem/AbilitySystem/Effects/Movement Speed Modifier Effect", order = 1)]
|
|
public class MovementSpeedModifierEffect : StatusEffect
|
|
{
|
|
public float speedModifierPercentage;
|
|
|
|
MovementSpeedModifierEffectInstance targetMovementSpeedModifierEffect;
|
|
|
|
public override void ApplyEffect(Taggable user, List<Taggable> targets)
|
|
{
|
|
base.ApplyEffect(user, targets);
|
|
|
|
if (applyToTargetsHit)
|
|
{
|
|
foreach (Taggable target in targets)
|
|
{
|
|
if (IsAlliedTarget(user, target))
|
|
{
|
|
targetMovementSpeedModifierEffect = target.GetComponent<MovementSpeedModifierEffectInstance>();
|
|
targetMovementSpeedModifierEffect.owner.RPC(nameof(targetMovementSpeedModifierEffect.RPC_ApplyMovementSpeedModifierEffect), targetMovementSpeedModifierEffect.owner.Owner, StatusEffectIndexer.Instance.StatusEffects.IndexOf(this), CalculateFinalAmount(user));
|
|
}
|
|
}
|
|
}
|
|
if (applyToSelf)
|
|
{
|
|
targetMovementSpeedModifierEffect = user.GetComponent<MovementSpeedModifierEffectInstance>();
|
|
targetMovementSpeedModifierEffect.ApplyEffect(this, CalculateFinalAmount(user));
|
|
}
|
|
}
|
|
|
|
private bool IsAlliedTarget(Taggable user, Taggable target)
|
|
{
|
|
return user.AlliedTagsContains(target.targetTag);
|
|
}
|
|
|
|
private float CalculateFinalAmount(Taggable user)
|
|
{
|
|
float finalAmount = speedModifierPercentage;
|
|
CharacterStats stats = user.GetComponent<CharacterStats>();
|
|
|
|
foreach (var statInfluence in influencingStats)
|
|
{
|
|
if (stats.statsDictionary.TryGetValue(statInfluence.statTag.name.ToLower(), out CharacterStat stat))
|
|
{
|
|
finalAmount += stat.Value * statInfluence.percentInfluence;
|
|
}
|
|
}
|
|
|
|
return finalAmount;
|
|
}
|
|
} |