예제 #1
0
        public void ReturnSuccessMessageIfItIsNight()
        {
            //Arrange
            var tundra = new Tundra();

            tundra.IsDay = false;
            //Setup
            var abilityMock = new Mock <IAbility>();
            var heroMock    = new Mock <IHero>();
            var abilities   = new List <IAbility>();

            abilities.Add(abilityMock.Object);

            heroMock
            .SetupGet(hero => hero.Abilities)
            .Returns(abilities);

            heroMock
            .SetupGet(hero => hero.Name)
            .Returns("Gosho");

            string result = tundra.ContinuousEffect(heroMock.Object);

            Assert.AreEqual("Gosho's available abilities are on cool down", result);
        }
예제 #2
0
        public void ReturnSuccessMessageIfItIsDay()
        {
            //Arrange
            var tundra = new Tundra();
            //Setup
            var hotMock        = new Mock <IEffect>();
            var heroMock       = new Mock <IHero>();
            var appliedEffects = new List <IEffect>();

            appliedEffects.Add(hotMock.Object);

            hotMock.SetupGet(hot => hot.Type).Returns(EffectType.Incapacitated);

            heroMock
            .SetupGet(hero => hero.AppliedEffects)
            .Returns(appliedEffects);

            heroMock
            .SetupGet(hero => hero.Name)
            .Returns("Gosho");

            string result = tundra.ContinuousEffect(heroMock.Object);

            Assert.AreEqual("Gosho's duration of all applied incapacitating effects increased by 1", result);
        }
예제 #3
0
    /// <summary>
    /// Returns a specific LandTerrain class based on the value of parameter iRange
    /// </summary>
    /// <param name="iRange"></param>
    /// <returns></returns>
    LandTerrain SelectNewTerrain(int iRange)
    {
        //Select a new terrain
        LandTerrain tempTerrain = new LandTerrain();

        //Might randomize which Terrain the tempTerrain will be
        // Different terrain weighted differently

        switch (iRange)
        {
        case 0:     //Forest
            tempTerrain = new Forest();
            return(tempTerrain);

        case 1:     //Grassland
            tempTerrain = new Grassland();
            return(tempTerrain);

        case 2:     //Lake
            tempTerrain = new Lake();
            return(tempTerrain);

        case 3:     //Mountain
            tempTerrain = new Mountain();
            break;

        case 4:     //Desert
            tempTerrain = new Desert();
            break;

        case 5:     //Swamp
            tempTerrain = new Swamp();
            break;

        case 6:     //Tundra
            tempTerrain = new Tundra();
            break;

        case 7:     //Jungle
            tempTerrain = new Jungle();
            break;

        case 8:     //Wasteland
            tempTerrain = new Wasteland();
            break;
        }


        return(tempTerrain);
    }
예제 #4
0
        private void CreatePoles()
        {
            Log("Map: Creating poles");

            for (int x = 0; x < WIDTH; x++)
            {
                foreach (int y in new int[] { 0, (HEIGHT - 1) })
                {
                    _tiles[x, y] = new Arctic(x, y, false);
                }
            }

            for (int i = 0; i < (WIDTH / 4); i++)
            {
                foreach (int y in new int[] { 0, 1, (HEIGHT - 2), (HEIGHT - 1) })
                {
                    int x = Common.Random.Next(WIDTH);
                    _tiles[x, y] = new Tundra(x, y, false);
                }
            }
        }
예제 #5
0
        private void LoadMap(Bytemap bitmap)
        {
            _tiles = new ITile[WIDTH, HEIGHT];

            for (int x = 0; x < WIDTH; x++)
            {
                for (int y = 0; y < HEIGHT; y++)
                {
                    ITile tile;
                    bool  special = TileIsSpecial(x, y);
                    switch (bitmap[x, y])
                    {
                    case 2: tile = new Forest(x, y, special); break;

                    case 3: tile = new Swamp(x, y, special); break;

                    case 6: tile = new Plains(x, y, special); break;

                    case 7: tile = new Tundra(x, y, special); break;

                    case 9: tile = new River(x, y); break;

                    case 10: tile = new Grassland(x, y); break;

                    case 11: tile = new Jungle(x, y, special); break;

                    case 12: tile = new Hills(x, y, special); break;

                    case 13: tile = new Mountains(x, y, special); break;

                    case 14: tile = new Desert(x, y, special); break;

                    case 15: tile = new Arctic(x, y, special); break;

                    default: tile = new Ocean(x, y, special); break;
                    }
                    _tiles[x, y] = tile;
                }
            }
        }
예제 #6
0
        public void ChangeTileType(int x, int y, Terrain type)
        {
            bool special  = TileIsSpecial(x, y);
            bool road     = _tiles[x, y].Road;
            bool railRoad = _tiles[x, y].RailRoad;

            switch (type)
            {
            case Terrain.Forest: _tiles[x, y] = new Forest(x, y, special); break;

            case Terrain.Swamp: _tiles[x, y] = new Swamp(x, y, special); break;

            case Terrain.Plains: _tiles[x, y] = new Plains(x, y, special); break;

            case Terrain.Tundra: _tiles[x, y] = new Tundra(x, y, special); break;

            case Terrain.River: _tiles[x, y] = new River(x, y); break;

            case Terrain.Grassland1:
            case Terrain.Grassland2: _tiles[x, y] = new Grassland(x, y); break;

            case Terrain.Jungle: _tiles[x, y] = new Jungle(x, y, special); break;

            case Terrain.Hills: _tiles[x, y] = new Hills(x, y, special); break;

            case Terrain.Mountains: _tiles[x, y] = new Mountains(x, y, special); break;

            case Terrain.Desert: _tiles[x, y] = new Desert(x, y, special); break;

            case Terrain.Arctic: _tiles[x, y] = new Arctic(x, y, special); break;

            case Terrain.Ocean: _tiles[x, y] = new Ocean(x, y, special); break;
            }
            _tiles[x, y].Road     = road;
            _tiles[x, y].RailRoad = railRoad;
        }
예제 #7
0
        private void MergeElevationAndLatitude(int[,] elevation, int[,] latitude)
        {
            Log("Map: Stage 3 - Merge elevation and latitude into the map");

            // merge elevation and latitude into the map
            for (int y = 0; y < HEIGHT; y++)
            {
                for (int x = 0; x < WIDTH; x++)
                {
                    bool special = TileIsSpecial(x, y);
                    switch (elevation[x, y])
                    {
                    case 0: _tiles[x, y] = new Ocean(x, y, special); break;

                    case 1:
                    {
                        switch (latitude[x, y])
                        {
                        case 0: _tiles[x, y] = new Desert(x, y, special); break;

                        case 1: _tiles[x, y] = new Plains(x, y, special); break;

                        case 2: _tiles[x, y] = new Tundra(x, y, special); break;

                        case 3: _tiles[x, y] = new Arctic(x, y, special); break;
                        }
                    }
                    break;

                    case 2: _tiles[x, y] = new Hills(x, y, special); break;

                    default: _tiles[x, y] = new Mountains(x, y, special); break;
                    }
                }
            }
        }
예제 #8
0
        private void GenerateRectangleIsland(Rectangle island)
        {
            var random   = new Random();
            int distance = 1;
            var tiles    = _world.GetTilesInRectangle(island);

            foreach (var tile in tiles)
            {
                //
                if (tile.Y > _world.Height - 5)
                {
                    var winter = new Tundra(tile.X, tile.Y, tile.Cell);
                    _world.SetTileProperty(winter, tile.X, tile.Y, true, true, false);
                }
                else if (tile.Y > _world.Height - 10)
                {
                    var desert = new Dessert(tile.X, tile.Y, tile.Cell);
                    _world.SetTileProperty(desert, tile.X, tile.Y, true, true, false);
                }
                else if (tile.Y < 5)
                {
                    var winter = new Tundra(tile.X, tile.Y, tile.Cell);
                    _world.SetTileProperty(winter, tile.X, tile.Y, true, true, false);
                }
                else if (tile.Y < 10)
                {
                    var desert = new Dessert(tile.X, tile.Y, tile.Cell);
                    _world.SetTileProperty(desert, tile.X, tile.Y, true, true, false);
                }
                else
                {
                    var tileType = random.Next(0, 99);
                    if (tileType < 30)
                    {
                        var plains = new Plains(tile.X, tile.Y, tile.Cell);
                        _world.SetTileProperty(plains, tile.X, tile.Y, true, true, false);
                    }
                    else if (tileType < 50)
                    {
                        var Forest = new Plains(tile.X, tile.Y, tile.Cell);
                        _world.SetTileProperty(Forest, tile.X, tile.Y, true, true, false);
                    }
                    else if (tileType < 65)
                    {
                        var hill = new Hills(tile.X, tile.Y, tile.Cell);
                        _world.SetTileProperty(hill, tile.X, tile.Y, true, true, false);
                    }
                    else if (tileType < 75)
                    {
                        var mountain = new Mountain(tile.X, tile.Y, tile.Cell);
                        _world.SetTileProperty(mountain, tile.X, tile.Y, true, true, false);
                    }
                    else if (tileType < 90)
                    {
                        var marsh = new Marsh(tile.X, tile.Y, tile.Cell);
                        _world.SetTileProperty(marsh, tile.X, tile.Y, true, true, false);
                    }
                    else
                    {
                        var plain = new Plains(tile.X, tile.Y, tile.Cell);
                        _world.SetTileProperty(plain, tile.X, tile.Y, true, true, false);
                    }
                }
            }

            var beachTiles =
                _world.GetTilesAlongLine(island.Left - distance, island.Top - distance, island.Right, island.Top - distance).ToList();

            beachTiles.
            AddRange(_world.GetTilesAlongLine(island.Left - distance, island.Bottom, island.Right, island.Bottom));
            beachTiles.
            AddRange(_world.GetTilesAlongLine(island.Left - distance, island.Top - distance, island.Left - distance, island.Bottom));
            beachTiles.
            AddRange(_world.GetTilesAlongLine(island.Right, island.Top - distance, island.Right, island.Bottom));
            foreach (var t in beachTiles)
            {
                var coast = new Coast(t.X, t.Y, t.Cell);
                _world.SetTileProperty(coast, t.X, t.Y, true, true, false);
            }
        }