Exemplo n.º 1
0
        public void GetBestWayTest()
        {
            var map       = new SmallMap().BuildMap();
            var race      = new Cyclops();
            var unit      = race.ProduceWarrior(Position.ZERO);
            var positions = unit.FindReachablePositions(map);

            var reacheablePositions = new List <Position>()
            {
                new Position(0, 0),
                new Position(0, 1),
                new Position(0, 2),
                new Position(0, 3),
                new Position(1, 0),
                new Position(2, 0),
                new Position(3, 0),
                new Position(1, 1),
                new Position(1, 2),
                new Position(2, 1)
            };

            foreach (var reachablePosition in reacheablePositions)
            {
                if (!positions.Contains(reachablePosition))
                {
                    Assert.Fail();
                }
            }
            Assert.AreEqual(positions.Count, reacheablePositions.Count);
        }
Exemplo n.º 2
0
        public void TestInit()
        {
            var policies = new Policies();

            var sub20Interfaces = new Sub20Interfaces();

            _s20 = new CSub20(Sub20SerialNumber, sub20Interfaces);

            II2C i2C = new Sub20I2C(_s20);
            var  gpioConfiguration = new GpioConfiguration(0x00380000, 0x00380000);
            var  gpio = new Sub20Gpio(_s20, gpioConfiguration);

            gpio.GpioInitialize();
            var dutGpio = new DutGpio.DutGpio(null, gpio, new DutGpioBits(16, 17, 18));

            var modPres = dutGpio.ModPresentAsserted;

            Assert.IsTrue(modPres);

            var deviceIO    = new DeviceIO(i2C, dutGpio, policies.PolicyWrap);
            var cyclops     = new Cyclops(deviceIO);
            var qsfp100GFRS = new Qsfp100G(deviceIO);
            var maCom       = new MaCom(deviceIO);

            _module = new Module(deviceIO, qsfp100GFRS, cyclops, maCom, policies.PolicyWrap);
        }
        public Character CreateCharacter(CharacterType profesionType)
        {
            Character character = null;

            switch (profesionType)
            {
            case CharacterType.Druid:
                character = new Druid();
                break;

            case CharacterType.Sorcerer:
                character = new Sorcerer();
                break;

            case CharacterType.Paladin:
                character = new Paladin();
                break;

            case CharacterType.Knight:
                character = new Knight();
                break;

            case CharacterType.Gnome:
                character = new Gnome();
                break;

            case CharacterType.Cyclops:
                character = new Cyclops();
                break;
            }

            return(character);
        }
Exemplo n.º 4
0
        public void CyclopsTest()
        {
            var race = new Cyclops();

            Assert.AreEqual(race.VictoryPointsOnDesert, 3);
            Assert.AreEqual(race.VictoryPointsOnPlain, 2);
            Assert.AreEqual(race.VictoryPointsOnSwamp, 1);
            Assert.AreEqual(race.VictoryPointsOnVolcano, 0);
        }
Exemplo n.º 5
0
        public void TestCyclopsVictoryPoint()
        {
            Race r = new Cyclops();

            Assert.AreEqual(r.GetVictoryPoint(TileFactory.INSTANCE.TileVolcano), 1);
            Assert.AreEqual(r.GetVictoryPoint(TileFactory.INSTANCE.TileSwamp), 0);
            Assert.AreEqual(r.GetVictoryPoint(TileFactory.INSTANCE.TileDesert), 3);
            Assert.AreEqual(r.GetVictoryPoint(TileFactory.INSTANCE.TilePlain), 2);
        }
Exemplo n.º 6
0
        public void TestCyclopsMovePoint()
        {
            Race r = new Cyclops();

            Assert.AreEqual(r.GetMovePointCost(TileFactory.INSTANCE.TileDesert), 1);
            Assert.AreEqual(r.GetMovePointCost(TileFactory.INSTANCE.TilePlain), 1);
            Assert.AreEqual(r.GetMovePointCost(TileFactory.INSTANCE.TileVolcano), 1);
            Assert.AreEqual(r.GetMovePointCost(TileFactory.INSTANCE.TileSwamp), 1);
        }
Exemplo n.º 7
0
        public void ComputeVictoryPointsCyclopsTest()
        {
            var grid        = new ITile[2, 2];
            var tileFactory = TileFactory.Instance;

            grid[0, 0] = tileFactory.Desert;
            grid[0, 1] = tileFactory.Plain;
            grid[1, 0] = tileFactory.Swamp;
            grid[1, 1] = tileFactory.Volcano;
            var map      = new Map(grid);
            var race     = new Cyclops();
            var warrior1 = race.ProduceWarrior(Position.ZERO);
            var warrior2 = race.ProduceWarrior(new Position(0, 1));
            var warrior3 = race.ProduceWarrior(new Position(1, 0));
            var warrior4 = race.ProduceWarrior(new Position(1, 1));

            Assert.AreEqual(race.ComputeVictoryPoints(map, warrior1), 3);
            Assert.AreEqual(race.ComputeVictoryPoints(map, warrior2), 2);
            Assert.AreEqual(race.ComputeVictoryPoints(map, warrior3), 1);
            Assert.AreEqual(race.ComputeVictoryPoints(map, warrior4), 0);
        }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            Console.WriteLine($"Loading mods from {Environment.CurrentDirectory}");
            var unitsMod = UnitLoader.LoadUnits();

            Console.WriteLine($"Loaded {unitsMod.Count()} units: {unitsMod}");
            var devil = unitsMod.First();

            var angel   = new Angel();
            var lich    = new Lich();
            var shaman  = new Shaman();
            var fury    = new Fury();
            var cyclops = new Cyclops();

            var menu = new Menu(new List <Unit>()
            {
                devil, angel, lich, shaman, fury, cyclops
            });

            menu.Start();
        }
 public CyclopsToggleEngineStateProcessor(IPacketSender packetSender, Cyclops cyclops)
 {
     this.packetSender = packetSender;
     this.cyclops      = cyclops;
 }
Exemplo n.º 10
0
        public void HandleUpgrades()
        {
            if (!initialized)
            {
                InitializeUpgradeHandlers();
            }

            QuickLogger.Debug($"UpgradeManager clearing cyclops upgrades");

            // Turn off all upgrades and clear all values
            for (int i = 0; i < upgradeHandlers.Length; i++)
            {
                UpgradeHandler upgradeType = upgradeHandlers[i];

                if (upgradeType.HasUpgrade)
                {
                    QuickLogger.Debug($"UpgradeManager clearing {upgradeType.TechType.AsString()}");
                }

                upgradeType.UpgradesCleared(); // UpgradeHandler event
            }

            var foundUpgrades = new List <TechType>();

            // Go through all slots and check what upgrades are available
            QuickLogger.Debug($"UpgradeManager checking upgrade slots");
            foreach (UpgradeSlot upgradeSlot in this.UpgradeSlots)
            {
                Equipment modules = upgradeSlot.Modules;
                string    slot    = upgradeSlot.Slot;

                TechType techTypeInSlot = modules.GetTechTypeInSlot(slot);

                if (techTypeInSlot == TechType.None)
                {
                    continue;
                }

                foundUpgrades.Add(techTypeInSlot);

                if (KnownsUpgradeModules.TryGetValue(techTypeInSlot, out UpgradeHandler handler))
                {
                    QuickLogger.Debug($"UpgradeManager counting cyclops upgrade '{techTypeInSlot.AsString()}'");
                    handler.UpgradeCounted(modules, slot); // UpgradeHandler event
                }
                else
                {
                    QuickLogger.Warning($"UpgradeManager encountered unmanaged cyclops upgrade '{techTypeInSlot.AsString()}'");
                }
            }

            for (int i = 0; i < upgradeHandlers.Length; i++)
            {
                upgradeHandlers[i].UpgradesFinished(); // UpgradeHandler event
            }
            // If any upgrades were found, play the sound to alert the player
            if (foundUpgrades.Count > 0)
            {
                Cyclops.slotModSFX?.Play();
                PdaOverlayManager.RemapItems();
            }

            Cyclops.BroadcastMessage("RefreshUpgradeConsoleIcons", foundUpgrades.ToArray(), SendMessageOptions.RequireReceiver);
        }
Exemplo n.º 11
0
        public void ProduceWarriorCyclopsTest()
        {
            var warrior = new Cyclops().ProduceWarrior(Position.ZERO);

            Assert.IsInstanceOfType(warrior, typeof(CyclopsWarrior));
        }
Exemplo n.º 12
0
 public CyclopsToggleFloodlightsProcessor(IPacketSender packetSender, Cyclops cyclops)
 {
     this.packetSender = packetSender;
     this.cyclops      = cyclops;
 }
 public CyclopsChangeSilentRunningProcessor(IPacketSender packetSender, Cyclops cyclops)
 {
     this.packetSender = packetSender;
     this.cyclops      = cyclops;
 }
Exemplo n.º 14
0
 public CyclopsChangeSonarModeProcessor(Cyclops cyclops)
 {
     this.cyclops = cyclops;
 }
 public CyclopsToggleInternalLightingProcessor(IPacketSender packetSender, Cyclops cyclops)
 {
     this.packetSender = packetSender;
     this.cyclops      = cyclops;
 }
Exemplo n.º 16
0
        public void TestCyclopsAttackPoint()
        {
            Race r = new Cyclops();

            Assert.AreEqual(r.GetAtkPoint(), 4);
        }
 public CyclopsFireSuppressionProcessor(IPacketSender packetSender, Cyclops cyclops)
 {
     this.packetSender = packetSender;
     this.cyclops      = cyclops;
 }
Exemplo n.º 18
0
        public void TestCyclopsLifePoint()
        {
            Race r = new Cyclops();

            Assert.AreEqual(r.GetLifePoint(), 12);
        }
Exemplo n.º 19
0
        public void TestCyclopsDefencePoint()
        {
            Race r = new Cyclops();

            Assert.AreEqual(r.GetDefPoint(), 6);
        }
 public CyclopsChangeEngineModeProcessor(IPacketSender packetSender, Cyclops cyclops)
 {
     this.packetSender = packetSender;
     this.cyclops      = cyclops;
 }
Exemplo n.º 21
0
        static void Main(string[] args)
        {
            short killCount = 0;

            Console.Title = $"Kills: {killCount}";

            // Create a Player
            Console.Write("Enter your name: ");
            string name = Console.ReadLine();

            Console.Clear();
            Race playerRace = Race.Humans;

            Console.WriteLine("Choose your race:\nH) Human\nP) Pygmy Faun\nE) Elated Ghoul");
            ConsoleKey raceChoice = Console.ReadKey(true).Key;

            switch (raceChoice)
            {
            case ConsoleKey.H:
                playerRace = Race.Humans;
                break;

            case ConsoleKey.P:
                playerRace = Race.PygmyFaun;
                break;

            case ConsoleKey.E:
                playerRace = Race.ElatedGhouls;
                break;

            default:
                Console.WriteLine("That was not a valid choice! You will be a human!");
                playerRace = Race.Humans;
                break;
            }
            Console.Clear();
            Console.WriteLine($"Welcome, {name} the {playerRace}! Your journey begins...\n");
            Weapon EveningStar = new Weapon("Eveningstar", 5, 15, 5, false);
            Player player      = new Player(name, 30, 15, 50, 50, playerRace, EveningStar);

            Console.WriteLine(player);
            bool exit = false;

            do
            {
                // Get a room description
                Console.WriteLine(GetRoom());
                // Create a monster
                Dragon  d1  = new Dragon("Young Red Dragon", 20, 20, 50, 10, 3, 8, "Puff the magic dragon!", false);
                Dragon  d2  = new Dragon("Ancient Red Dragon", 40, 40, 70, 10, 2, 15, "You better hide!", true);
                Cyclops cy1 = new Cyclops("One Eyed Willy", 10, 10, 10, 10, 05, 15, "The Eye sees all!", false);
                Cyclops cy2 = new Cyclops("Blood Shot Arges", 20, 20, 10, 10, 05, 17, "The one eyed freak brings lightning!", true);
                Wendigo w1  = new Wendigo("Chained Wendigo", 30, 30, 2, 10, 10, 10, "A horrific creature formed by necessity driven hunger gone mad.", false);
                Wendigo w2  = new Wendigo("Unchained Wendigo", 30, 30, 5, 15, 10, 20, "There is a curse that dwells in these mountains… Should any resort to cannibalism in this realm, the spirit of the Wendigo shall be loosed unto them…", true);
                Mummies m1  = new Mummies("Web Mummy Tomb Spider", 10, 10, 30, 5, 5, 8, "These mummies are wrapped up tight!", false);
                Mummies m2  = new Mummies("Egyptian God Set", 25, 25, 10, 9, 10, 15, "You have awaken the powerful Egyptian God, Set!", true);
                //becuase all of our creatures will be of type monster, they can be put into a collection of Monsters.
                List <Monster> monsters = new List <Monster>()
                {
                    d1, cy1, cy1, cy1, cy1, cy1, cy2, w1, w2, d2, m1, m1, m1, m1, m2
                };
                Monster monster = monsters[new Random().Next(monsters.Count)];

                Console.WriteLine("In this room: " + monster.Name);

                bool reload = false;
                do
                {
                    Console.Title = $"Kills: {killCount}               Life: {player.Life}";
                    Console.WriteLine("\nPlease choose an action:\n" +
                                      "A) ATTACK\n" +
                                      "R) RUN AWAY\n" +
                                      "P) Player stats\n" +
                                      "M) Monster stats\n" +
                                      "X) Exit");
                    ConsoleKey userChoice = Console.ReadKey(true).Key;
                    Console.Clear();

                    switch (userChoice)
                    {
                    case ConsoleKey.A:
                        //Console.WriteLine("You attack the monster!");
                        Combat.DoBattle(player, monster);
                        if (monster.Life <= 0)
                        {
                            killCount++;
                            //future xp leveling logic goes here
                            Console.ForegroundColor = ConsoleColor.Green;
                            Console.WriteLine($"You killed {monster.Name}!");
                            Console.ResetColor();
                            reload = true;
                        }    //end if

                        //TODO HANDLE IF PLAYER KILLS MONSTER & VICE VERSA
                        break;

                    case ConsoleKey.R:
                        Console.WriteLine("You attempt to run away!");
                        Combat.DoAttack(monster, player);

                        //TODO MONSTER GETS A FREE ATTACK
                        reload = true;
                        break;

                    case ConsoleKey.P:
                        Console.WriteLine(player);

                        break;

                    case ConsoleKey.M:
                        Console.WriteLine(monster);
                        break;

                    case ConsoleKey.X:
                        exit = true;
                        break;

                    default:
                        Console.WriteLine("Press one of the available menu options");
                        break;
                    }//end switch
                    if (player.Life <= 0)
                    {
                        Console.WriteLine("You have perished!");
                        exit = true;
                    }//end if
                } while (!exit && !reload);
            } while (!exit);
            Console.Clear();
            Console.WriteLine($"GAME OVER\nYou killed {killCount} monsters");
            //Reverse logic, while Exit == false, or while exit != true;
        }//end Main()
Exemplo n.º 22
0
 public CyclopsDecoyLaunchProcessor(IPacketSender packetSender, Cyclops cyclops)
 {
     this.packetSender = packetSender;
     this.cyclops      = cyclops;
 }
 public CyclopsToggleEngineStateProcessor(Cyclops cyclops)
 {
     this.cyclops = cyclops;
 }
Exemplo n.º 24
0
 public CyclopsSonarPingProcessor(IPacketSender packetSender, Cyclops cyclops)
 {
     this.packetSender = packetSender;
     this.cyclops      = cyclops;
 }
 public CyclopsChangeEngineModeProcessor(Cyclops cyclops)
 {
     this.cyclops = cyclops;
 }