Пример #1
0
        private void InternalPerformAttack(Actor actor, IDamageable damageTarget, Damage damage, bool useCooldown = true)
        {
            var sourceDamage = new SourcedDamage(Actor, damage);
            var attackArgs   = new AttackerableEventArgs(sourceDamage, actor);

            OnAttacking(attackArgs);
            var critDamage = CalculateCritDamage(sourceDamage);
            var lifesteal  = CalculateLifestealModifier(sourceDamage);

            damageTarget.TakeDamage(critDamage);
            if (Actor.TryGetModule <IHealthable>(out var healthable))
            {
                healthable.Value += lifesteal;
            }
            if (useCooldown)
            {
                PutAttackOnCooldown();
            }
            var attackedArgs = new AttackerableEventArgs(critDamage, Actor);

            OnAttacked(attackedArgs);
        }
Пример #2
0
 protected abstract void OnAttack(object sender, AttackerableEventArgs e);
Пример #3
0
 protected void OnAttacked(AttackerableEventArgs e) => Attacked?.Invoke(this, e);