Example #1
0
        private void DealDamage(Health target)
        {
            bool  isCrit      = false;
            float finalDamage = (damageType == DamageType.physicalDamage)
        ? DamageCalculator.CalculatePhysicalDamage(source.GetComponent <CharacterStats>(), target.GetComponent <CharacterStats>(), baseDamage, baseDamageModifier, ref isCrit)
        : DamageCalculator.CalculateMagicDamage(source.GetComponent <CharacterStats>(), target.GetComponent <CharacterStats>(), baseDamage, baseDamageModifier);

            target.ApplyDamage(source, finalDamage);
        }
Example #2
0
        //animation event (called from animator)
        void Hit()
        {
            if (equipedWeapon.hitArea.TargetsInArea.Count == 0)
            {
                return;
            }
            if (!target)
            {
                return;
            }

            float damage = DamageCalculator.CalculatePhysicalDamage(stats, target.GetComponent <CharacterStats>(), equipedWeapon.GetDamage(), 1);

            //if deleted change damage in weapon to private
            Debug.Log("Enemy Dealt " + damage + " Damage. (Plain Weapon Damage: " + equipedWeapon.baseItem.damage);

            equipedWeapon.WeaponAction(target, gameObject, collisionLayer, damage);
        }
Example #3
0
        void Hit()
        {
            List <Health> targets = currentWeapon.GetHitTargets();

            foreach (var target in targets)
            {
                Debug.Log("----------------");
                bool isCrit = false;
                onBeforeAttack?.Invoke(ref isCrit);
                float damage = DamageCalculator.CalculatePhysicalDamage(stats, target.GetComponent <CharacterStats>(), currentWeapon.GetDamage(), 1, ref isCrit);
                onDealDamage?.Invoke(ref damage);
                isCrit = false;

                //if deleted change damage in weapon to private
                Debug.Log("Player Dealt " + damage + " Damage. (Plain Weapon Damage: " + currentWeapon.GetDamage().ToString());
                Debug.Log("----------------");

                if (target.ApplyDamage(gameObject, damage))
                {
                    ;
                }
            }
        }