Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace FightingArena
- {
- public class Arena
- {
- List<Gladiator> Gladiators { get; set; }
- public int Count { get; private set; }
- public string Name { get; private set; }
- public Arena(string Name)
- {
- this.Name = Name;
- Gladiators = new List<Gladiator>();
- }
- public void Add(Gladiator gladiator)
- {
- Gladiators.Add(gladiator);
- Count = Gladiators.Count;
- }
- public void Remove(string name)
- {
- for (int i = 0; i < Gladiators.Count; i++)
- {
- if (Gladiators[i].Name == name)
- {
- Gladiators.RemoveAt(i);
- Count = Gladiators.Count;
- }
- }
- }
- public Gladiator GetGladitorWithHighestTotalPower()
- {
- Gladiator highestTotal = Gladiators[0];
- foreach (var glad in Gladiators)
- {
- if (glad.GetTotalPower() > highestTotal.GetTotalPower())
- {
- highestTotal = glad;
- }
- }
- return highestTotal;
- }
- public Gladiator GetGladitorWithHighestWeaponPower()
- {
- Gladiator highestWeapon = Gladiators[0];
- foreach (var glad in Gladiators)
- {
- if (glad.GetWeaponPower() > highestWeapon.GetWeaponPower())
- {
- highestWeapon = glad;
- }
- }
- return highestWeapon;
- }
- public Gladiator GetGladitorWithHighestStatPower()
- {
- Gladiator highestStat = Gladiators[0];
- foreach (var glad in Gladiators)
- {
- if (glad.GetStatPower() > highestStat.GetStatPower())
- {
- highestStat = glad;
- }
- }
- return highestStat;
- }
- public override string ToString()
- {
- return $"{this.Name} - {Gladiators.Count} gladiators are participating.";
- }
- }
- }
Add Comment
Please, Sign In to add comment