Ejemplo n.º 1
0
        public void DarkCastleRegion_UnlockedAfterBeatingOtherAreas()
        {
            Region fieldsRegion       = new Region(WorldRegion.Fields, new BattleMove[0], new SubRegion[0]);
            Region desertRegion       = new Region(WorldRegion.Desert, new BattleMove[0], new SubRegion[0]);
            Region casinoRegion       = new Region(WorldRegion.Casino, new BattleMove[0], new SubRegion[0]);
            Region crystalCavesRegion = new Region(WorldRegion.CrystalCaves, new BattleMove[0], new SubRegion[0]);
            Region darkCastleRegion   = new Region(WorldRegion.DarkCastle, new BattleMove[0], new SubRegion[0]);

            AreaMap <Region, WorldRegion> regionalMap = _mapManager.GetRegionalMap(fieldsRegion, desertRegion, casinoRegion, crystalCavesRegion, darkCastleRegion);

            MapGroupingItem <Region, WorldRegion> darkCastleGroupItem = regionalMap.MapPaths.First(mp => mp.To.Values.FirstOrDefault(gi => gi.Item == darkCastleRegion) != null).To.Values.First(gi => gi.Item == darkCastleRegion);

            MockDecisionManager decisionManager = new MockDecisionManager(new GodRelationshipManager());

            int i = 0;

            for (; i < 3; ++i)
            {
                Assert.True(darkCastleGroupItem.IsLocked, "Dark Castle should be locked, not all requisite areas have been completed");
                decisionManager.SetGroupingChoice(i);
                regionalMap.Advance(decisionManager, new TestTeam());
            }

            decisionManager.SetGroupingChoice(i);
            Region finalRegion = null;

            Assert.DoesNotThrow(() => finalRegion = regionalMap.Advance(decisionManager, new TestTeam()));

            Assert.False(darkCastleGroupItem.IsLocked, "Dark Castle should be unlocked, all requisite areas have been completed");

            Assert.AreEqual(darkCastleRegion, finalRegion);
        }
Ejemplo n.º 2
0
        public void RegionalMap_CorrectlyFiresOnRegionCompletedEvent()
        {
            SubRegion fakeSubRegion = new SubRegion(WorldSubRegion.Fields, 0, new ChanceEvent <int> [0],
                                                    new FighterType[0], new BattlefieldConfiguration(new TeamConfiguration(new EnemyConfiguration(FighterType.Egg, 1, MagicType.Fire))));

            Region fakeRegion = new Region(WorldRegion.Fields, new BattleMove[0], new List <SubRegion> {
                fakeSubRegion
            });

            _logger.Subscribe(fakeRegion, EventType.RegionCompleted);

            AreaMap <Region, WorldRegion> fakeRegionalMap =
                new AreaMap <Region, WorldRegion>(fakeRegion, new MapPath <Region, WorldRegion>(fakeRegion));

            fakeRegionalMap.Advance(new MockDecisionManager(new GodRelationshipManager()), new TestTeam());

            List <EventLog> logs = _logger.Logs;

            Assert.AreEqual(1, logs.Count);

            EventLog log = logs[0];

            Assert.AreEqual(EventType.RegionCompleted, log.Type);

            RegionCompletedEventArgs e = log.E as RegionCompletedEventArgs;

            Assert.AreEqual(fakeRegion, e?.CompletedRegion);
        }