Beispiel #1
0
        static void Main(string[] args)
        {
            Barracks barracks = new Barracks();

            int count = 1;

            while (count < 10)
            {
                DefaultCharacter character = new DefaultCharacter("UNKNOWN", 0, 0, 0);
                character = barracks.SpawnCharacter("UNKNOWN", 0, 0, 0);
                count++;
                Console.WriteLine(character.ToString());

                if (character is Wizard)
                {
                    Wizard wizard = (Wizard)character;
                    wizard.HotPocketPercent = 60;
                    Console.WriteLine(wizard.ToString());
                }
                if (character is Warrior)
                {
                    Warrior warrior = (Warrior)character;
                    warrior.SmellFactor = 8;
                    Console.WriteLine(warrior.ToString());
                }
                if (character is Thief)
                {
                    Thief thief = (Thief)character;
                    thief.CellRings = 19;
                    Console.WriteLine(thief.ToString());
                }
            }
        }
Beispiel #2
0
        public DefaultCharacter SpawnCharacter(String name, int strength, int dexterity, int intelligence)
        {
            int chance = random.Next(0, 101);

            if (chance > 0 && chance <= 60)
            {
                DefaultCharacter warrior = new Warrior("Warrior", 15, 5, 5, 20);
                return(warrior);
            }
            else if (chance > 60 && chance <= 90)
            {
                DefaultCharacter wizard = new Wizard("Wizard", 5, 10, 10, 60);
                return(wizard);
            }
            else if (chance > 90 && chance <= 100)
            {
                DefaultCharacter thief = new Thief("Thief", 10, 5, 5, 10);
                return(thief);
            }
            DefaultCharacter dchar = new DefaultCharacter("UNKNOWN", 0, 0, 0);

            return(dchar);
        }