public decimal GetLabourPower(UnitCollection units) { if (units == null) { throw new ArgumentNullException(nameof(units)); } return(units.GetAll().Sum(u => (u.Amount * u.Unit.Workload))); }
public decimal GetMilitaryPower(UnitCollection units, MilitarySide side) { if (units == null) { throw new ArgumentNullException(nameof(units)); } switch (side) { case MilitarySide.Ofense: return(units.GetAll().Sum(u => (u.Amount * (u.Unit.Ofense)))); case MilitarySide.Defense: return(units.GetAll().Sum(u => (u.Amount * (u.Unit.Defense)))); case MilitarySide.Both: return(units.GetAll().Sum(u => (u.Amount * (u.Unit.Ofense + u.Unit.Defense)))); default: throw new ArgumentOutOfRangeException(nameof(side), side, null); } }