Exemplo n.º 1
0
        public WinDuke()
        {
            InitializeComponent();

            grain = new Grain();
            land = new Land();
            population = new Population();
            war = new War();

            Year = 0; // Set Year
            KingStatus = 0;
            Dead = false;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Return a total amount of producing arcres
        /// </summary>
        /// <param name="LandPlanted"></param>
        /// <returns></returns>
        public int Plant(Grain grain, Population population)
        {
            int Amount;
            int Remaining;
            int RunningTotal = 0;
            float Per = 1;

            bool Loop = true;
            do
            {
                Amount = Functions.ReadInt("Land to be planted = ");
                if (Amount > Total)
                {
                    Functions.PrintF(ConsoleColor.Red, "But you don't have enough land.");
                    Functions.PrintF(ConsoleColor.Yellow, "You only have " + Total.ToString() + "HA. of land.");
                }
                else
                {
                    if ((Amount * 2) > grain.Total)
                    {
                        int Plantable = grain.Total / 2;
                        Functions.PrintF(ConsoleColor.Red, "Not enough grain.");
                        Functions.PrintF(ConsoleColor.Yellow, "You only have enough to plant " + Plantable.ToString() + "HA. of land.");
                    }
                    else
                    {
                        if (Amount > (population.Total * 4))
                        {
                            int Workable = population.Total * 4;
                            Functions.PrintF(ConsoleColor.Red, "But you don't have enoung peasants.");
                            Functions.PrintF(ConsoleColor.Yellow, "Your peasants can only plant " + Workable.ToString() + "HA. of land.");
                        }
                        else
                        {
                            //grain.Production(land.Plant(Amount));
                            Loop = false;
                        }
                    }
                }
            } while (Loop);

            Remaining = Amount;

            for (int buck = 0; buck < 6; buck++)
            {
                if (Remaining > Percent[buck])
                {
                    RunningTotal += (int)((float)Percent[buck] * Per);
                    Remaining -= Percent[buck];
                }
                else
                {
                    RunningTotal += Remaining;
                    Remaining = 0;
                }
                Per -= 0.20f;
            }

            return RunningTotal;
        }
Exemplo n.º 3
0
        /// <summary>
        /// WAR
        /// </summary>
        public Victory WithDuke(Grain grain, Land land, Population population)
        {
            int Casualties;
            int LandTaken;
            int Offense;
            int Defense;
            int Hired = 0;

            Functions.PrintF(ConsoleColor.Red, "A near by Duke threatens war; ");
            Offense = (85 + 18 * Functions.FNR(1, 6));
            Defense = (population.Total * Functions.FNR(1, 3)) + 13;

            if (Functions.ReadYesNo("Will you attack first?") == false)
            {
                if (Offense < Defense)
                {
                    Functions.PrintF(ConsoleColor.Green, "Peace negotiations successful");
                    return Victory.Draw;
                }
            }
            else
            {
                if (Functions.FNR(1, 20) != 1)
                {
                    Functions.PrintF(ConsoleColor.DarkYellow, "First strike failed - you need professionals");
                    Hired = HireMercinaries(40, 75);
                    GrainCost = Hired * 40;
                }
            }

            LandTaken = Offense - (Defense + (Hired * 2));

            if (-LandTaken > land.Total)
            {
                Functions.PrintF(ConsoleColor.Red, "You have been over run and have lost your entire Dukedom");
                return Victory.CompleteLoss;
            }

            if (LandTaken > 400)
            {
                Functions.PrintF(ConsoleColor.DarkGreen, "You have overrun the enemy and annexed his entire Dukedom");

                SoWGrain = 3513;
                SoWLand = LandTaken;
                DeathToll = Defense - 200;
                return Victory.CompleteWin;
            }

            if (LandTaken > 1)
            {
                Functions.PrintF(ConsoleColor.Green, "You have won the war");
                SoWGrain = (int)((float)LandTaken * 1.7);
                SoWLand = LandTaken;
                DeathToll = -Defense;
                return Victory.SimpleWin;
            }
            else
            {
                Functions.PrintF(ConsoleColor.Red, "You have lost the war");
                SoWGrain = -(int)((float)LandTaken * 1.7);
                SoWLand = -LandTaken;
                DeathToll = -Defense;
                return Victory.SimpleLoss;
            }

            return Victory.Draw;
        }
Exemplo n.º 4
0
        /// <summary>
        /// War with the King
        /// </summary>
        /// <returns></returns>
        public bool WithKing(Grain grain, Land land, Population population)
        {
            int Count = (grain.Total / 100);

            Functions.PrintF(ConsoleColor.Red, "\nThe king's army is about to attack your ducy!!!");
            Functions.PrintF(ConsoleColor.Yellow, "At 100 HL. each (pay in advance).");
            Functions.PrintF(ConsoleColor.Yellow, "You have hired " + Count.ToString() + " foreign mercinaries.");

            if (land.Total * Count + population.Total < 2500)
            {
                Functions.PrintF(ConsoleColor.DarkRed, "\nYour head is placed atop of the castle gate.");
                return false;
            }
            else
            {
                Functions.PrintF(ConsoleColor.DarkGreen, "\nWipe the blood from the crown - you are High King!");
                Functions.PrintF(ConsoleColor.Yellow, "A near by monarchy THREATENS WAR!");
                Functions.PrintF(ConsoleColor.Yellow, "HOW MANY ........\n\n\n");
                return true;
            }
        }