public override void ApplyAttack(Transform transform, List <CombatTarget> targets, CombatTarget WeaponUser) { if (targets == null || targets.Count <= 0) { return; } pointsScore = 0; foreach (CombatTarget target in targets) { if (target == WeaponUser) { continue; } Statistics targetStats = target.GetComponent <Statistics>(); pointsScore += targetStats.computePointsToAttack(); } isAttack = slotMachinePointAggegator.total >= pointsScore; if (isAttack) { damage = (weaponDamage * WeaponUser.GetComponent <Statistics>().Strength + slotMachinePointAggegator.total) / 100f; float randomDam = Random.Range(0, 100 / (WeaponUser.GetComponent <Health>().currentHealth) * (100 / betSize) * 100) / 4; // Debug.Log("Attacked "+damage+" random"+randomDam+" all together"+(damage+randomDam)+" max "+(100/(WeaponUser.GetComponent<Health>().currentHealth)*(100/betSize)*100)); damage += randomDam; foreach (CombatTarget target in targets) { if (target == WeaponUser) { continue; } target.GetComponent <Health>().doDamage(damage); target.AfterAttackCallback(); } } else { Debug.Log("Not Attacked"); Health health = WeaponUser.GetComponent <Health>(); damage = health.currentHealth * betSize / 100; health.doDamage(damage); } }
public override void ApplyAttack(Transform transform, List <CombatTarget> targets, CombatTarget WeaponUser) { // Debug.Log("Attacked"); foreach (CombatTarget target in targets) { if (target == WeaponUser) { continue; } Statistics statistics = WeaponUser.GetComponent <Statistics>(); float damage = Mathf.Min((float)statistics.Strength * 2, (float)int.MaxValue - 1); target.GetComponent <Health>().doDamage(damage); target.AfterAttackCallback(); } }