Пример #1
0
        public void TestDropFail()
        {
            var config    = this.GetGameConfig();
            var generator = new DefaultDropGenerator(config, this.GetRandomizer(9999));
            var item      = generator.GetItemDropsOrAddMoney(this.GetMonster(1), 0, TestHelper.GetPlayer()).FirstOrDefault();

            Assert.That(item, Is.Null);
        }
Пример #2
0
        public void TestBaseItemDropItem()
        {
            var config    = this.GetGameConfig();
            var generator = new DefaultDropGenerator(config, this.GetRandomizer(0));
            var item      = generator.GetItemDropsOrAddMoney(this.GetMonster(1), 0, TestHelper.GetPlayer()).FirstOrDefault();

            var possibleItemDefinition = config.BaseDropItemGroups.First().PossibleItems.First();

            Assert.That(item, Is.Not.Null);

            // ReSharper disable once PossibleNullReferenceException
            Assert.That(item.Definition, Is.SameAs(possibleItemDefinition));
        }
Пример #3
0
        public void TestItemDropItemByMonster()
        {
            var config  = this.GetGameConfig();
            var monster = this.GetMonster(1);

            monster.DropItemGroups.Add(this.GetDropItemGroup(3000, SpecialItemType.Ancient, true));
            var generator = new DefaultDropGenerator(config, this.GetRandomizer2(0, 0.5));
            var item      = generator.GetItemDropsOrAddMoney(monster, 1, TestHelper.GetPlayer()).FirstOrDefault();

            Assert.That(item, Is.Not.Null);

            // ReSharper disable once PossibleNullReferenceException
            Assert.That(item.Definition, Is.SameAs(monster.DropItemGroups.First().PossibleItems.First()));
        }
Пример #4
0
        public void TestItemDropMoney()
        {
            const int startMoney = 10000;
            var       experience = 1;
            var       moneyDrop  = experience + DefaultDropGenerator.BaseMoneyDrop;

            var player = TestHelper.GetPlayer();

            player.GameContext.Configuration.MaximumInventoryMoney = int.MaxValue;
            player.Money = startMoney;
            var config    = this.GetGameConfig();
            var generator = new DefaultDropGenerator(config, this.GetRandomizer(4000));
            var item      = generator.GetItemDropsOrAddMoney(this.GetMonster(1), experience, player).FirstOrDefault();

            Assert.That(player.Money, Is.EqualTo(startMoney + moneyDrop));
            Assert.That(item, Is.Null);
        }