예제 #1
0
 private int GetVictoryPoints()
 {
     return(CardsInPlay
            .Select(n => n.VictoryPoints)
            .Concat(Nobles.Select(c => c.VictoryPoints))
            .Sum());
 }
예제 #2
0
        public void Same_nobles_of_list_should_be_compared_correctly()
        {
            var nobles  = Nobles.GetNobles();
            var isabel1 = nobles.ElementAt(0);
            var isabel2 = nobles.ElementAt(0);

            isabel1.Should().Be(isabel2);

            isabel1.Equals(isabel2).Should().BeTrue();
        }
예제 #3
0
        public void Should_distinguish_nobles_in_a_list()
        {
            var nobles  = Nobles.GetNobles();
            var isabel1 = nobles.ElementAt(0);
            var isabel2 = nobles.ElementAt(0);

            var list = new List <Noble>()
            {
                isabel1,
                isabel2
            };

            list.Distinct().Count().Should().Be(1);
        }
예제 #4
0
        public void Noble_requirements_should_be_compensated()
        {
            var nobles = Nobles.GetNobles();

            var list = new List <(Gem gem, int count)>();

            foreach (var gem in Gems.GetAllGems())
            {
                int count = 0;
                foreach (var noble in nobles)
                {
                    count += noble.RequiredQuantity(gem);
                }
                list.Add((gem, count));
            }

            list.Select(x => x.count).Distinct().Count().Should().Be(1);
        }
        public MainWindow()
        {
            InitializeComponent();

            provinia = new Map(Map.Region.Provinia);
            undercity = new Map(Map.Region.Undercity);
            faery = new Map(Map.Region.Faery);
            hades = new Map(Map.Region.Hades);
            cloud = new Map(Map.Region.Cloud);

            nobles = new Nobles(new[] { provinia, undercity, faery, hades, cloud });
            gateLayer = new GatesLayer(provinia);
            tradeRoutesLayer = new TradeRoutesLayer(provinia);
            garrisonLayer = new GarrisonLayer(provinia);

            Provinces.ItemsSource = provinia;
            Tunnels.ItemsSource = undercity;
            Faery.ItemsSource = faery;
            Hades.ItemsSource = hades;
            Cloud.ItemsSource = cloud;

            GatesLayer.ItemsSource = gateLayer.Gates;
            GateHitsLayer.ItemsSource = gateLayer.GateHitsAndDetections;
            TradeRoutesLayer.ItemsSource = tradeRoutesLayer.TradeRoutes;
            GarrisonLayer.ItemsSource = garrisonLayer.Garrisons;
            search.DataContext = provinia;

            Filename = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "olyviewer-temp.txt");

            textEditor.SyntaxHighlighting = LoadHighlightingDefinition("oly.xshd");

            textEditor.TextChanged += new EventHandler(textEditor_TextChanged);
            textEditor.TextArea.TextEntered += new TextCompositionEventHandler(TextArea_TextEntered);
            textEditor.TextArea.TextEntering += new TextCompositionEventHandler(TextArea_TextEntering);
            textEditor.MouseHover += new MouseEventHandler(textEditor_MouseHover);
            textEditor.MouseHoverStopped += new MouseEventHandler(textEditor_MouseHoverStopped);
            textEditor.TextArea.DefaultInputHandler.InputBindings.Add(new InputBinding(new MoveCommand(textEditor,"w"), new KeyGesture(Key.Left, ModifierKeys.Control)));
            textEditor.TextArea.DefaultInputHandler.InputBindings.Add(new InputBinding(new MoveCommand(textEditor,"n"), new KeyGesture(Key.Up, ModifierKeys.Control)));
            textEditor.TextArea.DefaultInputHandler.InputBindings.Add(new InputBinding(new MoveCommand(textEditor,"e"), new KeyGesture(Key.Right, ModifierKeys.Control)));
            textEditor.TextArea.DefaultInputHandler.InputBindings.Add(new InputBinding(new MoveCommand(textEditor,"s"), new KeyGesture(Key.Down, ModifierKeys.Control)));

            foreach (var order in Orders.All)
            {
                var o = new CompletionData(order.Name, order.Help);
                orderCompletionData.Add(o);
            }
        }