public void ShowTerritoryWeather(ITerritory territory)
 {
     Console.WriteLine($"Displaying weather statistics of {territory.Name}: ");
     Console.WriteLine($"    Weather status: {territory.WeatherStatistics.Weather}\r\n" +
                       $"    Temperature: {territory.WeatherStatistics.Temperature}\r\n" +
                       $"    Precipitation: {territory.WeatherStatistics.Precipitation}\r\n");
 }
Example #2
0
 /// <summary>
 /// Plot Constructor
 /// </summary>
 /// <param name="Territory">The Territory of the plot of land.</param>
 /// <param name="rand">Randomizer</param>
 public Plot(ITerritory Territory, IRandomizer rand) : base(rand)
 {
     //
     this.Territory = Territory;
     Maintenance    = new ProductAmountCollection();
     FailsInto      = new ProductAmountCollection();
 }
 public void Move(ITerritory source, ITerritory target, bool directed = false)
 {
     source.creatures.Remove(this);
     if (directed)
     {
         target.creatures.Add(this);
     }
 }
Example #4
0
        // unit test all this

        // negative test when there are more perks
        public void OnTile(Character character, ITerritory territory)
        {
            Console.WriteLine("Longer feathers help you to reach new territories");
            var openedTerritory = territory as IHiddenTerritory;

            openedTerritory.OpenTerritory(character);
            CoolDownSet();
        }
        public void Frighten(ITerritory currentTerritory, int coefficient)
        {
            int ahimoneuraThreshold = 5;

            if (coefficient > ahimoneuraThreshold)
            {
                Console.WriteLine($"{name} is running in fear!");
                currentTerritory.creatures.Remove(this);
                return;
            }
            Console.WriteLine($"{name} is not going to retreat.");
        }
Example #6
0
        // fix output type
        public ITerritory OnMovement(Character character, ITerritory department, ITerritory destination, ICreature.direction direction)
        {
            CoolDownSet();
            var midway = character.Move(department, direction);

            if (midway != department)
            {
                var finalDestination = character.Move(midway, direction);
                if (finalDestination != midway)
                {
                    Console.WriteLine("Longer feathers made your flight longer.");
                    return(finalDestination);
                }
                return(midway);
            }
            return(department);
        }
Example #7
0
        /// <summary>
        /// Draws coordinate system at map
        /// </summary>
        /// <param name="cs">The territory (coordinate system or country) to draw</param>
        public void DrawCoordinateSystem(ITerritory cs)
        {
            RemoveLayer(_handleCs);

            var sf  = new FeatureSet(GeometryType.Polygon);
            var shp = new Geometry(GeometryType.Polygon);

            double xMax = cs.Right;
            double xMin = cs.Left;
            double yMin = cs.Bottom;
            double yMax = cs.Top;

            if (xMax < xMin)
            {
                InsertPart(shp, -180, xMax, yMin, yMax);
                InsertPart(shp, xMin, 180, yMin, yMax);
            }
            else
            {
                InsertPart(shp, xMin, xMax, yMin, yMax);
            }


            int shpIndex = sf.Features.Count;

            sf.Features.EditInsert(shp, ref shpIndex);

            _handleCs = Layers.Add(sf);

            var style = sf.Style;

            style.Fill.Color        = Color.LightBlue;
            style.Fill.Transparency = 120;
            style.Line.Color        = Color.Blue;
            style.Line.DashStyle    = DashStyle.Dash;
            style.Line.Width        = 2;

            Redraw();
        }
Example #8
0
        /// <summary>
        /// Zooms map to the bounds of coordinate system
        /// </summary>
        public void ZoomToCoordinateSystem(ITerritory cs)
        {
            if (cs == null)
            {
                return;
            }

            var ext = new Envelope();

            double dx = cs.Right - cs.Left;
            double dy = cs.Top - cs.Bottom;

            if (dx >= 0)
            {
                ext.SetBounds(cs.Left - dx / 4.0, cs.Right + dx / 4.0, cs.Bottom - dy / 4.0, cs.Top + dy / 4.0);
            }
            else
            {
                dx = 360.0;
                ext.SetBounds(-180.0 - dx / 4.0, 180.0 + dx / 4.0, cs.Bottom - dy / 4.0, cs.Top + dy / 4.0);
            }

            ZoomToExtents(ext);
        }
 public void Frighten(ITerritory currentTerritory, int coefficient)
 {
 }
Example #10
0
 public static ITerritory Generate(ITerritory previousTerritory, Type thisTerritoryType)
 {
     return((ITerritory)Activator.CreateInstance(thisTerritoryType));
 }
Example #11
0
        public ITerritory Move(ITerritory source, ICreature.direction direction)
        {
            var tileSource = source as ITile;
            var target     = (ITile)Activator.CreateInstance(source.GetType());

            target.currentLevel = source.currentLevel;
            string movementDirection = "";

            switch (direction)
            {
            case ICreature.direction.N:
            {
                target.SetX(tileSource.X, 0);
                target.SetY(tileSource.Y, 1);
                movementDirection = "northwards";
                break;
            }

            case ICreature.direction.NE:
            {
                target.SetY(tileSource.Y, 1);
                target.SetX(tileSource.X, 1);
                movementDirection = "northeastwards";
                break;
            }

            case ICreature.direction.E:
            {
                target.SetX(tileSource.X, 1);
                target.SetY(tileSource.Y, 0);
                movementDirection = "eastwards";
                break;
            }

            case ICreature.direction.SE:
            {
                target.SetY(tileSource.Y, -1);
                target.SetX(tileSource.X, 1);
                movementDirection = "southeastwards";
                break;
            }

            case ICreature.direction.S:
            {
                target.SetX(tileSource.X, 0);
                target.SetY(tileSource.Y, -1);
                movementDirection = "southwards";
                break;
            }

            case ICreature.direction.SW:
            {
                target.SetY(tileSource.Y, -1);
                target.SetX(tileSource.X, -1);
                movementDirection = "southwestwards";
                break;
            }

            case ICreature.direction.W:
            {
                target.SetX(tileSource.X, -1);
                target.SetY(tileSource.Y, 0);
                movementDirection = "westwards";
                break;
            }

            case ICreature.direction.NW:
            {
                target.SetY(tileSource.Y, 1);
                target.SetX(tileSource.X, -1);
                movementDirection = "northwestwards";
                break;
            }

            default:
            {
                break;
            }
            }
            if (target.isAccessible)
            {
                // Generate with ITileFactory
                source.creatures.Remove(this);
                target.creatures.Add(this);
                if (pack != null)
                {
                    foreach (var creature in pack)
                    {
                        creature.Move(source, target, true);
                    }
                }
                Console.WriteLine($"{name} is moving {movementDirection}.");
                return(target);
            }
            else
            {
                Console.WriteLine("You are going too far away from your territory!");
                return(source);
            }
        }
Example #12
0
 // test when Frighten is ready at least for Anchiornis
 public void OnThem(Character character, ICreature them, ITerritory territory)
 {
     Console.WriteLine($"You are trying to scare {them.name}.");
     them.Frighten(territory, 20 + (character.attackCoefficient + character.socialCoefficient) * 2);
     CoolDownSet();
 }
Example #13
0
 public void OnUs(Character character, Anchiornis us, ITerritory territory)
 {
     Console.WriteLine($"You are spreading your feathers, trying to attract the attention of {us.name}");
     us.IncreaseFriendliness(character.socialCoefficient + 1);
     CoolDownSet();
 }