/// <summary> /// Finish casting the ability, damage units in the ability's area of effect. /// </summary> public override void OnEndCast(object tag, Fury.Behaviors.Unit caster, Fury.Behaviors.Targetable target, UnityEngine.Vector3 position) { // Reduce the caster's energy caster.ModifyEnergy(EnergyType, -EnergyCost); // Iterate through all unfriendly commanders foreach (var cmdr in Fury.Behaviors.Manager.Instance.Commanders) if (!caster.IsTeamOrNeutral(cmdr)) // Iterate through all units of unfriendly commanders foreach (var unit in cmdr.Units.Values) // Check if unit is inside the radius if (Vector3.Distance(unit.transform.position, position) < Radius) { // Damage the unit unit.ModifyHealth(-Damage, caster, this); // Apply status effect if set if (StatusEffect != null) unit.AddStatus(StatusEffect, caster); } // Create an effect where the ability is used if (Effect != null) { var effect = (UnityEngine.GameObject)UnityEngine.GameObject.Instantiate(Effect); effect.transform.position = position; } }
public override void OnEndCast(object tag, Fury.Behaviors.Unit caster, Fury.Behaviors.Targetable target, UnityEngine.Vector3 position) { var totalInt = 0; foreach (var stack in caster.Controllers.TokenController.Stacks) if (stack.Token is Equipment && stack.States[0] > 0) totalInt += (stack.Token as Equipment).Intelligence; (target as Fury.Behaviors.Unit).ModifyHealth(-(Damage + totalInt), caster, this); caster.ModifyEnergy(EnergyType, -EnergyCost); if (Effect != null) { var effect = (UnityEngine.GameObject)UnityEngine.GameObject.Instantiate(Effect); effect.transform.position = target.transform.position; } if (StatusEffect != null) (target as Fury.Behaviors.Unit).AddStatus(StatusEffect, caster); }