using System.Collections;
using System.Collections.Generic;
using UnityEngine;


[CreateAssetMenu(fileName = "DamageIncomeModifierEffect", menuName = "RiftMayhem/AbilitySystem/Effects/DamageIncomeModifier Effect", order = 1)]
public class DamageIncomeModifierEffect : StatusEffect
{
    public float damageIncomeModifierPercentage;

    DamageIncomeModifierEffectInstance targetDamageIncomeModifierEffect;

    public override void ApplyEffect(Taggable user, List<Taggable> targets)
    {
        base.ApplyEffect(user, targets);

        if (applyToTargetsHit)
        {
            foreach (Taggable target in targets)
            {
                targetDamageIncomeModifierEffect = target.GetComponent<DamageIncomeModifierEffectInstance>();
                targetDamageIncomeModifierEffect.owner.RPC(nameof(targetDamageIncomeModifierEffect.RPC_ApplyDamageIncomeModifierEffect), targetDamageIncomeModifierEffect.owner.Owner, StatusEffectIndexer.Instance.StatusEffects.IndexOf(this));
            }
        }
        if(applyToSelf)
        {
            targetDamageIncomeModifierEffect = user.GetComponent<DamageIncomeModifierEffectInstance>();
            targetDamageIncomeModifierEffect.ApplyEffect(this);
        }
    }

}
