public void useStrongestAbility(CharacterCharacter user, CharacterCharacter target) { Ability abilityToUse = null; foreach (Ability a in user.specialAbilities) { if (a.ultimate == true && a.cooldownTimer <= 0) { abilityToUse = a; } } for (int i = 0; i < 10; i++) { if (abilityToUse == null || abilityToUse.cooldownTimer > 0) { abilityToUse = user.specialAbilities[(int)UnityEngine.Random.Range(0, user.specialAbilities.Length - 1)]; } } if (abilityToUse.cooldownTimer > 0) { abilityToUse.AIUse(target); } }