public int this[BattleInfo info] { get { int result = 0; switch (source) { case ResourceValueSource.Const: result = amount; break; case ResourceValueSource.MyDeadShipsAmount: result = info.GetDeadShipsAmount(info.teams.First(t => t.myTeam)); break; case ResourceValueSource.EnemyDeadShipsAmount: result = info.GetDeadShipsAmount(info.teams.First(t => !t.myTeam)); break; } return(positive ? result : -result); } }