public void UseAbility(Monster opponent, string[] input) { StringBuilder inputName = new StringBuilder(); for (int i = 1; i < input.Length; i++) { inputName.Append(input[i]); if (i != input.Length - 1) { inputName.Append(" "); } } int index = Abilities.FindIndex( f => f.Name == inputName.ToString() || f.Name == input[1] || f.Name.Contains(input[1]) || f.Name.Contains(inputName.ToString())); if (index != -1 && RagePoints >= Abilities[index].RageCost && PlayerClass == PlayerClassType.Warrior) { switch (Abilities[index].WarAbilityCategory) { case WarriorAbility.Slash: PlayerAbility.UseOffenseDamageAbility(opponent, this, index); return; case WarriorAbility.Rend: PlayerAbility.UseOffenseDamageAbility(opponent, this, index); return; case WarriorAbility.Charge: PlayerAbility.UseStunAbility(opponent, this, index); return; case WarriorAbility.Block: PlayerAbility.UseDefenseAbility(this, index); return; case WarriorAbility.Berserk: PlayerAbility.UseBerserkAbility(this, index); return; case WarriorAbility.Disarm: PlayerAbility.UseDisarmAbility(opponent, this, index); return; case WarriorAbility.Bandage: PlayerAbility.UseBandageAbility(this, index); return; case WarriorAbility.PowerAura: PlayerAbility.UsePowerAura(this, index); return; case WarriorAbility.WarCry: PlayerAbility.UseWarCry(this, index); return; case WarriorAbility.Onslaught: for (int i = 0; i < 2; i++) { if (RagePoints >= Abilities[index].RageCost) { PlayerAbility.UseOffenseDamageAbility(opponent, this, index); } else { OutputHelper.Display.StoreUserOutput( Settings.FormatAttackFailText(), Settings.FormatDefaultBackground(), "You didn't have enough rage points for the second attack!"); } } return; default: throw new ArgumentOutOfRangeException(); } } if (index != -1 && ComboPoints >= Abilities[index].ComboCost && PlayerClass == PlayerClassType.Archer) { switch (Abilities[index].ArcAbilityCategory) { case ArcherAbility.Distance: return; case ArcherAbility.Gut: if (PlayerWeapon?.WeaponGroup != WeaponType.Bow) { throw new InvalidOperationException(); } PlayerAbility.UseOffenseDamageAbility(opponent, this, index); return; case ArcherAbility.Precise: if (PlayerWeapon?.WeaponGroup != WeaponType.Bow) { throw new InvalidOperationException(); } PlayerAbility.UseOffenseDamageAbility(opponent, this, index); return; case ArcherAbility.Stun: if (PlayerWeapon?.WeaponGroup != WeaponType.Bow) { throw new InvalidOperationException(); } PlayerAbility.UseStunAbility(opponent, this, index); return; case ArcherAbility.Double: if (PlayerWeapon?.WeaponGroup != WeaponType.Bow) { throw new InvalidOperationException(); } for (int i = 0; i < 2; i++) { if (ComboPoints >= Abilities[index].ComboCost) { PlayerAbility.UseOffenseDamageAbility(opponent, this, index); } else { OutputHelper.Display.StoreUserOutput( Settings.FormatAttackFailText(), Settings.FormatDefaultBackground(), "You didn't have enough combo points for the second shot!"); } } return; case ArcherAbility.Wound: if (PlayerWeapon?.WeaponGroup != WeaponType.Bow) { throw new InvalidOperationException(); } PlayerAbility.UseOffenseDamageAbility(opponent, this, index); return; case ArcherAbility.Bandage: PlayerAbility.UseBandageAbility(this, index); return; case ArcherAbility.SwiftAura: PlayerAbility.UseSwiftAura(this, index); return; case ArcherAbility.ImmolatingArrow: if (PlayerWeapon?.WeaponGroup != WeaponType.Bow) { throw new InvalidOperationException(); } PlayerAbility.UseOffenseDamageAbility(opponent, this, index); return; case ArcherAbility.Ambush: if (PlayerWeapon?.WeaponGroup != WeaponType.Bow) { throw new InvalidOperationException(); } if (!InCombat) { PlayerAbility.UseOffenseDamageAbility(opponent, this, index); } else { OutputHelper.Display.StoreUserOutput( Settings.FormatAttackFailText(), Settings.FormatDefaultBackground(), $"You can't ambush {opponent.Name}, you're already in combat!"); } return; default: throw new ArgumentOutOfRangeException(); } } if (index != -1) { throw new InvalidOperationException(); } throw new IndexOutOfRangeException(); }