Pedro Gomes 888171a4a9 New spell & status & instant effect updates
- burst of hope (second priest ability) added
- instant value effect with modifiers based on targets
- damage income modifier effect added
- status effect option to apply to targets hit
- status effect option to apply to self
2024-07-07 11:44:12 +01:00

44 lines
1.5 KiB
C#

using Kryz.CharacterStats;
using Kryz.CharacterStats.Examples;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "AbsorbEffect", menuName = "RiftMayhem/AbilitySystem/Effects/Absorb Effect", order = 1)]
public class AbsorbEffect : StatusEffect
{
public float amount;
public float percentStatInfluence;
AbsorbEffectInstance targetAbsorbEffect;
public override void ApplyEffect(Taggable user, List<Taggable> targets)
{
base.ApplyEffect(user, targets);
if(applyToTargetsHit)
{
foreach (Taggable target in targets)
{
if (IsAlliedTarget(user, target))
{
targetAbsorbEffect = target.GetComponent<AbsorbEffectInstance>();
targetAbsorbEffect.owner.RPC(nameof(targetAbsorbEffect.RPC_ApplyAbsorbEffect), targetAbsorbEffect.owner.Owner, StatusEffectIndexer.Instance.StatusEffects.IndexOf(this));
}
}
}
if (applyToSelf)
{
targetAbsorbEffect = user.GetComponent<AbsorbEffectInstance>();
targetAbsorbEffect.ApplyEffect(this);
//targetAbsorbEffect.owner.RPC(nameof(targetAbsorbEffect.RPC_ApplyAbsorbEffect), targetAbsorbEffect.owner.Owner, StatusEffectIndexer.Instance.StatusEffects.IndexOf(this));
}
}
private bool IsAlliedTarget(Taggable user, Taggable target)
{
return user.targetTag.AlliedTags.Contains(target.targetTag);
}
}