Pedro Gomes bc4019ffdf Necromancer updates & bugfix
- Added Necromancer ultimate ability (Summon Golem)
- Updated and bugfixed golem minion
- Added New slam ability for golem
- Bugfixed damage over time effect calculate final damage when owner no longer exists
- Fixed an issue causing items to be vendored even with vendor closed
2024-07-23 21:26:32 +01:00

61 lines
3.1 KiB
C#

using Kryz.CharacterStats;
using Kryz.CharacterStats.Examples;
using Photon.Pun;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "SummonAbility", menuName = "RiftMayhem/AbilitySystem/Abilities/Summon Ability", order = 0)]
public class SummonAbility : BaseAbility
{
public GameObject minionPrefab;
private GameObject instantiatedMinion;
private CharacterStats ownerStats;
private CharacterStats minionStats;
public override void Execute(PhotonView user, Taggable userTag)
{
base.Execute(user, userTag);
Debug.Log($"Player {user.name} casted {this.name} and spent {manaCost} mana.");
instantiatedMinion = PhotonNetwork.Instantiate("Abilities/" + minionPrefab.name, user.GetComponentInChildren<ProjectileSpawnLocationController>().transform.position, user.GetComponentInChildren<ProjectileSpawnLocationController>().transform.rotation);
InitializeStatsBasedOnOwner(user);
}
public override void Execute(PhotonView user, Taggable userTag, Vector3 point)
{
base.Execute(user, userTag);
Debug.Log($"Player {user.name} casted {this.name} and spent {manaCost} mana.");
instantiatedMinion = PhotonNetwork.Instantiate("Abilities/" + minionPrefab.name, user.GetComponentInChildren<ProjectileSpawnLocationController>().transform.position, user.GetComponentInChildren<ProjectileSpawnLocationController>().transform.rotation);
InitializeStatsBasedOnOwner(user);
}
public override void Execute(PhotonView user, Taggable userTag, Transform target)
{
base.Execute(user, userTag);
Debug.Log($"Player {user.name} casted {this.name} and spent {manaCost} mana.");
instantiatedMinion = PhotonNetwork.Instantiate("Abilities/" + minionPrefab.name, user.GetComponentInChildren<ProjectileSpawnLocationController>().transform.position, user.GetComponentInChildren<ProjectileSpawnLocationController>().transform.rotation);
InitializeStatsBasedOnOwner(user);
}
private void InitializeStatsBasedOnOwner(PhotonView user)
{
ownerStats = user.GetComponent<CharacterStats>();
minionStats = instantiatedMinion.GetComponent<CharacterStats>();
minionStats.Strength.AddModifier(new StatModifier(ownerStats.Strength.Value * GameConstants.CharacterBalancing.PercentageStatScaleForMinions, StatModType.Flat, ownerStats));
minionStats.Agility.AddModifier(new StatModifier(ownerStats.Agility.Value * GameConstants.CharacterBalancing.PercentageStatScaleForMinions, StatModType.Flat, ownerStats));
minionStats.Intelligence.AddModifier(new StatModifier(ownerStats.Intelligence.Value * GameConstants.CharacterBalancing.PercentageStatScaleForMinions, StatModType.Flat, ownerStats));
minionStats.Spirit.AddModifier(new StatModifier(ownerStats.Spirit.Value * GameConstants.CharacterBalancing.PercentageStatScaleForMinions, StatModType.Flat, ownerStats));
minionStats.Vitality.AddModifier(new StatModifier(ownerStats.Vitality.Value * GameConstants.CharacterBalancing.PercentageStatScaleForMinions, StatModType.Flat, ownerStats));
minionStats.onUpdateStatValues.Invoke();
}
}