- Crafting stats cap now properly counts only the new added stats from stones instead of all stats from stones - Summon abilities now each have its own scaling with owners stats - Summon abilities time between attacks reduced (faster attacks overall)
112 lines
5.5 KiB
C#
112 lines
5.5 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;
|
|
|
|
public int numberOfSpawns = 1;
|
|
public bool instantlyReady = false;
|
|
public bool isImage = false;
|
|
|
|
[Space]
|
|
public float StrengthPercentFromMaster;
|
|
public float AgilityPercentFromMaster;
|
|
public float IntelligencePercentFromMaster;
|
|
public float SpiritPercentFromMaster;
|
|
public float VitalityPercentFromMaster;
|
|
|
|
[Space]
|
|
public float AttackDamagePercentFromMaster;
|
|
public float SpellDamagePercentFromMaster;
|
|
public float CritChancePercentFromMaster;
|
|
public float CritDamagePercentFromMaster;
|
|
public float MaxHealthPercentFromMaster;
|
|
public float ArmorPercentFromMaster;
|
|
public float MagicResistancePercentFromMaster;
|
|
|
|
|
|
|
|
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.");
|
|
|
|
for (int i = 0; i < numberOfSpawns; i++)
|
|
{
|
|
instantiatedMinion = PhotonNetwork.Instantiate("Abilities/" + minionPrefab.name, user.GetComponentInChildren<ProjectileSpawnLocationController>().transform.position + Vector3.one * i, 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.");
|
|
for (int i = 0; i < numberOfSpawns; i++)
|
|
{
|
|
instantiatedMinion = PhotonNetwork.Instantiate("Abilities/" + minionPrefab.name, user.GetComponentInChildren<ProjectileSpawnLocationController>().transform.position + Vector3.one * i, 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.");
|
|
|
|
for (int i = 0; i < numberOfSpawns; i++)
|
|
{
|
|
instantiatedMinion = PhotonNetwork.Instantiate("Abilities/" + minionPrefab.name, user.GetComponentInChildren<ProjectileSpawnLocationController>().transform.position + Vector3.one * i, user.GetComponentInChildren<ProjectileSpawnLocationController>().transform.rotation);
|
|
InitializeStatsBasedOnOwner(user);
|
|
}
|
|
}
|
|
|
|
public void AutoSummonOnSceneLoad(PhotonView user)
|
|
{
|
|
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 * StrengthPercentFromMaster, StatModType.Flat, ownerStats));
|
|
minionStats.Agility.AddModifier(new StatModifier(ownerStats.Agility.Value * AgilityPercentFromMaster, StatModType.Flat, ownerStats));
|
|
minionStats.Intelligence.AddModifier(new StatModifier(ownerStats.Intelligence.Value * IntelligencePercentFromMaster, StatModType.Flat, ownerStats));
|
|
minionStats.Spirit.AddModifier(new StatModifier(ownerStats.Spirit.Value * SpiritPercentFromMaster, StatModType.Flat, ownerStats));
|
|
minionStats.Vitality.AddModifier(new StatModifier(ownerStats.Vitality.Value * VitalityPercentFromMaster, StatModType.Flat, ownerStats));
|
|
|
|
minionStats.AttackDamage.AddModifier(new StatModifier(ownerStats.AttackDamage.Value * AttackDamagePercentFromMaster, StatModType.Flat, ownerStats));
|
|
minionStats.SpellDamage.AddModifier(new StatModifier(ownerStats.SpellDamage.Value * SpellDamagePercentFromMaster, StatModType.Flat, ownerStats));
|
|
|
|
minionStats.CritChance.AddModifier(new StatModifier(ownerStats.CritChance.Value * CritChancePercentFromMaster, StatModType.Flat, ownerStats));
|
|
minionStats.CritDamage.AddModifier(new StatModifier(ownerStats.CritDamage.Value * CritDamagePercentFromMaster, StatModType.Flat, ownerStats));
|
|
|
|
minionStats.MaxHealth.AddModifier(new StatModifier(ownerStats.MaxHealth.Value * MaxHealthPercentFromMaster, StatModType.Flat, ownerStats));
|
|
minionStats.Armor.AddModifier(new StatModifier(ownerStats.Armor.Value * ArmorPercentFromMaster, StatModType.Flat, ownerStats));
|
|
minionStats.MagicResistance.AddModifier(new StatModifier(ownerStats.MagicResistance.Value * MagicResistancePercentFromMaster, StatModType.Flat, ownerStats));
|
|
|
|
minionStats.onUpdateStatValues.Invoke();
|
|
|
|
if (instantlyReady)
|
|
{
|
|
instantiatedMinion.GetComponent<MinionNPCController>().SetMinionReadyWithoutAnimation();
|
|
}
|
|
}
|
|
}
|