using Photon.Pun; using System.Collections; using System.Collections.Generic; using UnityEngine; //[CreateAssetMenu(fileName = "BaseAbility", menuName = "RiftMayhem/AbilitySystem/Abilities/Base Ability", order = 1)] public class BaseAbility : ScriptableObject { public Sprite Icon; public List targettingTags = new List(); public List tags = new List(); public List abilityEffects = new List(); [Space] public float castTime; public float manaCost; public float healthCost = 0; public float cooldown; public bool castableWhileMoving; public AbilityAnimationType animationType; public virtual void Execute(PhotonView user, Taggable userTag) { user.GetComponent().ChangeValue(-manaCost); user.GetComponent().ChangeValue(-healthCost); //for (int i = 0; i < abilityEffects.Count; i++) //{ // Debug.Log($"Ability {this.name} applied {abilityEffects[i].name} effect at xtarget"); //} } public virtual void Execute(PhotonView user, Taggable userTag, Vector3 point) { user.GetComponent().ChangeValue(-manaCost); user.GetComponent().ChangeValue(-healthCost); } public virtual void Execute(PhotonView user, Taggable userTag, Transform target) { user.GetComponent().ChangeValue(-manaCost); user.GetComponent().ChangeValue(-healthCost); } private void OnValidate() { InitializeUniqueTags(); } private void OnEnable() { InitializeUniqueTags(); } public void InitializeUniqueTags() { tags.Clear(); // Iterate through each effect and add unique GameTags to uniqueTags list foreach (var effect in abilityEffects) { if (effect != null) { foreach (var tag in effect.tags) { if (!tags.Contains(tag)) { tags.Add(tag); } } foreach (var statTag in effect.influencingStats) { if(!tags.Contains(statTag)) { tags.Add(statTag); } } } } } }