Exemple #1
0
        public void Test_Initializing_Of_Creature_With_Same_Position()
        {
            var creat = _factory.CreateEnemyCreature("boss", new Position(5, 5));

            _world.WorldPlayGround[creat.Position.X, creat.Position.Y].Creature = creat;

            Assert.Throws <PositionAlreadyOccupiedException>(() =>
            {
                creat = _factory.CreateEnemyCreature("Lieutenant", new Position(5, 5));
                _world.WorldPlayGround[creat.Position.X, creat.Position.Y].Creature = creat;
            });
        }
Exemple #2
0
        public void SetUpEnemyCreatures(int amountOfEnemies)
        {
            var    rndRank    = rnd.Next(0, 3);
            string rankString = "";

            if (rndRank == 1)
            {
                rankString = "boss";
            }
            if (rndRank == 2)
            {
                rankString = "lieutenant";
            }
            if (rndRank == 3)
            {
                rankString = "minion";
            }
            var creature = CreatureFactory.CreateEnemyCreature(rankString, null);

            creature.AttackItems.AddAttackItem(ItemFactory.CreateAttackItem("sword", "Orchrist", 15, 1));
            creature.DefencesItems.AddDefenceItem(ItemFactory.CreateDefenceItem("armour", "BreastPlate of Salazar", 10));
            creature.DefencesItems.AddDefenceItem(ItemFactory.CreateDefenceItem("boots", "Boots of Thunder", 2));

            World.WorldPlayGround[creature.Position.X, creature.Position.Y].Creature = creature;
            if (amountOfEnemies - 1 > 0)
            {
                SetUpEnemyCreatures(--amountOfEnemies);
            }
        }
Exemple #3
0
 public CreatureAttackTests()
 {
     _logger     = new JsonTraceListener();
     _world      = new World(5, 5);
     _crtFactory = new CreatureFactory(_world, _logger);
     _itmFactory = new ItemFactory();
     _enemy      = _crtFactory.CreateEnemyCreature("boss", new Position(1, 1)) as EnemyCreature;
     _player     = _crtFactory.CreatePlayerCreature("Bilbo", new Position(2, 1)) as PlayerCreature;
     _world.WorldPlayGround[_enemy.Position.X, _enemy.Position.Y].Creature   = _enemy;
     _world.WorldPlayGround[_player.Position.X, _player.Position.Y].Creature = _player;
     _player.AttackItems.AddAttackItem(new Sword(40, "Sting"));
     _player.AttackItems.AddAttackItem(new Sword(40, "Sting"));
 }