- Necromancer class playable - Savage minion ability & npc - Mage minion ability & npc - rogue minion ability & npc - warrior minion ability & npc - golem minion ability & npc - minion abilities - Class resource (used to automatically summon minions based on the amount of souls drained, in case of necromancer) - class resource spender (auto cast from priority list) - class resource regen instant effect option
96 lines
3.3 KiB
C#
96 lines
3.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
[System.Serializable]
|
|
public class NPCAbilityConditionManager
|
|
{
|
|
public BaseAbility ability;
|
|
public List<NPCAbilityCastCondition> castConditions = new List<NPCAbilityCastCondition>();
|
|
|
|
|
|
public bool CanCastAbility(NPCControllerBase npc)
|
|
{
|
|
foreach (NPCAbilityCastCondition condition in castConditions)
|
|
{
|
|
switch (condition.conditionType)
|
|
{
|
|
case NPCAbilityCastConditionType.Mana:
|
|
{
|
|
if (npc.Mana.EnoughMana(ability.manaCost))
|
|
continue;
|
|
else return false;
|
|
}
|
|
case NPCAbilityCastConditionType.Health:
|
|
{
|
|
if (npc.Health.EnoughHealth(ability.manaCost))
|
|
continue;
|
|
else return false;
|
|
}
|
|
case NPCAbilityCastConditionType.MeleeDistance:
|
|
{
|
|
if (npc.IsCloseEnough(npc.currentTarget.transform.position, npc.MeleeRange))
|
|
continue;
|
|
else return false;
|
|
}
|
|
case NPCAbilityCastConditionType.RangedDistance:
|
|
{
|
|
if (npc.IsCloseEnough(npc.currentTarget.transform.position, npc.ProjectileRange))
|
|
continue;
|
|
else return false;
|
|
}
|
|
case NPCAbilityCastConditionType.Cooldown:
|
|
{
|
|
if (!npc.abilityCooldownTracker.OnCooldown(ability))
|
|
continue;
|
|
else return false;
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
[System.Serializable]
|
|
public class ClassAbilityConditionManager
|
|
{
|
|
public BaseAbility ability;
|
|
public List<ClassAbilityCastCondition> castConditions = new List<ClassAbilityCastCondition>();
|
|
|
|
|
|
public bool CanCastAbility(RiftPlayer player)
|
|
{
|
|
foreach (ClassAbilityCastCondition condition in castConditions)
|
|
{
|
|
switch (condition.conditionType)
|
|
{
|
|
case ClassAbilityCastConditionType.Mana:
|
|
{
|
|
if (player.mana.EnoughMana(ability.manaCost))
|
|
continue;
|
|
else return false;
|
|
}
|
|
case ClassAbilityCastConditionType.Health:
|
|
{
|
|
if (player.health.EnoughHealth(ability.manaCost))
|
|
continue;
|
|
else return false;
|
|
}
|
|
case ClassAbilityCastConditionType.Cooldown:
|
|
{
|
|
if (!player.abilityCooldownTracker.OnCooldown(ability))
|
|
continue;
|
|
else return false;
|
|
}
|
|
case ClassAbilityCastConditionType.ClassResource:
|
|
{
|
|
if (player.classResource.EnoughResource(ability.classResourceCost))
|
|
continue;
|
|
else return false;
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
} |