public AttackInfo(Ability ability, Unit tUnit, bool useAOE = true) { tgtUnit = tUnit; damageMin = ability.GetDamageMin(); damageMax = ability.GetDamageMax(); aoeRange = useAOE ? ability.GetAOERange() : 0; critChance = ability.GetCrit(); critMultiplier = tUnit.GetImmunedToCrit() ? 0 : ability.GetCritMultiplier(); //~ useEffect=ability.UseEffectOnHit(); //~ if(useEffect) effect=ability.GetEffectOnHit().Clone(); if (Random.value < ability.GetEffectOnHitChance()) { effect = ability.GetEffectOnHit(); } critical = Random.value < critChance; damage = Mathf.Round(Random.Range(damageMin, damageMax)) * (critical ? critMultiplier : 1); damage *= DamageTable.GetModifier(tgtUnit.GetArmorType(), ability.GetDamageType()); damage *= (1 - tUnit.GetDmgReduction()); if (Random.value < ability.GetHit() - tgtUnit.GetDodge()) { hit = true; } }