Exemplo n.º 1
0
        public static BuffInstance ApplyBuff(AbilityEffect origin, Buff buff, AbilityCaster caster, EventHandler target, AbilityData data)
        {
            BuffInstance buffInst = new BuffInstance(origin, buff, caster, target, data);

            buffInst.Start();
            return(buffInst);
        }
Exemplo n.º 2
0
 public override void ApplyEffect(AbilityCaster caster, EventHandler[] targets, AbilityData data)
 {
     for (int i = 0; i < targets.Length; i++)
     {
         _buff.Apply(this, caster, targets[i], data);
     }
 }
Exemplo n.º 3
0
        public AbilityInstance Cast(AbilityCaster caster)
        {
            if (CurrentCooldown <= 0)
            {
                EventHandler[] targets = null;

                // If the Ability targets at start, search for targets
                if (Template.Targeting.TargetAtStart)
                {
                    targets = _template.Targeting.GetTargets(caster);
                }
                if (!Template.Targeting.TargetAtStart || HasValidTarget(targets))
                {
                    AbilityInstance instance = AbilityInstance.Cast(this, caster, targets, new AbilityData(Data));

                    CurrentCooldown = Cooldown;

                    if (caster.Animator != null)
                    {
                        caster.Animator.SetTrigger(_template.AnimationName);
                    }

                    return(instance);
                }
            }
            return(null);
        }
Exemplo n.º 4
0
 public override void ApplyEffect(AbilityCaster caster, EventHandler[] targets, AbilityData data)
 {
     for (int i = 0; i < targets.Length; i++)
     {
         AttackInstance.Attack(this, caster, targets[i], data.MainValue, data.MainType, data.SFX);
     }
 }
Exemplo n.º 5
0
        public static AttackInstance Attack(AbilityEffect origin, AbilityCaster attacker, EventHandler target,
                                            float amount, DamageType type, AbilitySFXPool sfx)
        {
            AttackInstance atkInst = new AttackInstance(origin, attacker, target, amount, type, sfx);

            atkInst.Execute();
            return(atkInst);
        }
 public override void ApplyEffect(AbilityCaster caster,
                                  EventHandler[] targets, AbilityData data)
 {
     for (int i = 0; i < targets.Length; i++)
     {
         DamageInstance.Damage(this, caster, targets[i], data.SecondaryValue, data.SecondaryType);
     }
 }
Exemplo n.º 7
0
        public static AbilityInstance Cast(Ability originAbility, AbilityCaster caster,
                                           EventHandler[] targets, AbilityData data)
        {
            AbilityInstance instance = new AbilityInstance(originAbility, caster, targets, data);

            instance.Start();
            return(instance);
        }
Exemplo n.º 8
0
 AbilityInstance(Ability originAbility, AbilityCaster caster,
                 EventHandler[] targets, AbilityData data)
 {
     _ability = originAbility;
     _caster  = caster;
     _targets = targets;
     _data    = data;
 }
Exemplo n.º 9
0
 BuffInstance(AbilityEffect originEffect, Buff buff, AbilityCaster caster, EventHandler target, AbilityData data)
 {
     OriginEffect = originEffect;
     Buff         = buff;
     Caster       = caster;
     Target       = target;
     Data         = data;
 }
Exemplo n.º 10
0
        public static DamageInstance Damage(AbilityEffect origin, AbilityCaster dealer, EventHandler target,
                                            float amount, DamageType type, bool isCrit = false, bool isDefended = false)
        {
            DamageInstance dmgInst = new DamageInstance(origin, dealer, target,
                                                        amount, type, isCrit, isDefended);

            dmgInst.Deal();
            return(dmgInst);
        }
Exemplo n.º 11
0
 DamageInstance(AbilityEffect origin, AbilityCaster dealer, EventHandler target,
                float amount, DamageType type, bool isCrit, bool isDefended)
 {
     OriginEffect = origin;
     Dealer       = dealer;
     Target       = target;
     Amount       = amount;
     Type         = type;
     IsCrit       = isCrit;
     IsDefended   = isDefended;
 }
Exemplo n.º 12
0
 public void Apply(AbilityEffect origin, AbilityCaster caster, EventHandler target, AbilityData data)
 {
     if (!_doesStack)
     {
         BuffInstance existingBuff = target.Buffs.FirstOrDefault(
             (buffInst) => buffInst.Caster == caster && buffInst.Buff == this);
         if (existingBuff != null)
         {
             existingBuff.Remove();
         }
     }
     BuffInstance.ApplyBuff(origin, this, caster, target, data);
 }
Exemplo n.º 13
0
        public override EventHandler[] GetTargets(AbilityCaster caster)
        {
            CharacterMeleeVector meleeVector = caster.EventHandler.GetComponent <Character>().MeleeVector;

            if (meleeVector == null)
            {
                Debug.LogWarning("Caster has no melee vector.");
                return(new EventHandler[0]);
            }
            Collider[] targetColliders = Physics.OverlapSphere(meleeVector.HitTransform.position,
                                                               meleeVector.HitRadius, _layer);
            EventHandler[] targets = targetColliders.Select(collider => collider.GetComponent <EventHandler>()).ToArray();
            targets = targets.Where(target => target != caster.GetComponent <EventHandler>()).ToArray();
            return(targets);
        }
Exemplo n.º 14
0
        AttackInstance(AbilityEffect origin, AbilityCaster attacker, EventHandler target,
                       float amount, DamageType type, AbilitySFXPool sfx)
        {
            OriginEffect = origin;
            Attacker     = attacker;
            Target       = target;
            Damage       = amount;
            Type         = type;
            SFX          = sfx;

            HitChance      = 1f;
            IsHit          = true;
            CritChance     = attacker.CritChance;
            CritMultiplier = attacker.CritMultiplier;
        }
Exemplo n.º 15
0
 public override EventHandler[] GetTargets(AbilityCaster caster)
 {
     EventHandler[] targets = { caster.GetComponent <EventHandler>() };
     return(targets);
 }
Exemplo n.º 16
0
 public override EventHandler[] GetTargets(AbilityCaster caster)
 {
     EventHandler[] targets = { caster.EventHandler.GetComponent <Character>().Targeting.CurrentTarget };
     return(targets);
 }
Exemplo n.º 17
0
 public abstract EventHandler[] GetTargets(AbilityCaster caster);
Exemplo n.º 18
0
 public abstract void ApplyEffect(AbilityCaster caster, EventHandler[] targets, AbilityData data);