コード例 #1
0
ファイル: Dukedom.cs プロジェクト: objoekenobi/Dukedom
        /// <summary>
        /// DUKEDOM - Quick Basic
        /// </summary>
        public Dukedom()
        {
            ///
            /// Intro to the game
            ///
            Functions.PrintF(ConsoleColor.Yellow, "D U K E D O M");
            Functions.PrintF(ConsoleColor.Gray, "Converted by");
            Functions.PrintF(ConsoleColor.White, "Bob Anderson");
            Reports = !Functions.ReadYesNo("Do you want to skip detailed reports?");

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

            ///
            /// Start New Game
            ///
            Year = 0; // Set Year
            KingStatus = 0;
            Dead = false;
        }
コード例 #2
0
ファイル: War.cs プロジェクト: objoekenobi/Dukedom
        /// <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;
            }
        }
コード例 #3
0
ファイル: War.cs プロジェクト: objoekenobi/Dukedom
        /// <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;
        }
コード例 #4
0
ファイル: Population.cs プロジェクト: objoekenobi/Dukedom
        /// <summary>
        /// Food for Peasants
        /// </summary>
        public void FeedPeasant(Grain grain, Land land)
        {
            int Amount;
            bool Loop = true;

            do
            {
                Amount = Functions.ReadInt("Grain for food = ");
                if (Amount < grain.Total)
                {
                    Loop = false;
                }
                else
                {
                    Functions.PrintF(ConsoleColor.Gray, "You only have " + grain.Total.ToString() + "HL.");
                }
            }
            while (Loop);

            int Fed = Amount / Total;
            Starvations = 0; // So far....

            if (Fed < 14 && Amount < grain.Total)
            {
                Functions.PrintF(ConsoleColor.Red, "The peasent demonstrate before the castle.");
            }
            if (Fed < 13)
            {
                Functions.PrintF(ConsoleColor.DarkYellow, "Some peasants have starved");
                Starvations = -(Total - (Amount / 13));
            }

            UnhappyStavation = UnhappyStavation - (3 * Starvations) - (2 * Fed);

            return;
        }