- Fixed issue on projectile hit events that triggered multiple times. - Implemented % costs for health and mana - Updated key binding UI slots to show health costs if present - New Necromancer projectile AoEOverTime ability: Bonestorm. - New Vamp/Cultist/Satanist summon ability: Bloody Shadow.
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.GetFinalManaCost(npc.Mana)))
|
|
continue;
|
|
else return false;
|
|
}
|
|
case NPCAbilityCastConditionType.Health:
|
|
{
|
|
if (npc.Health.EnoughHealth(ability.GetFinalHealthCost(npc.Health)))
|
|
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;
|
|
}
|
|
} |