Пример #1
0
        /////////////////////////////////////////////////////////
        public void KilledEnemyLevelAffectsEnchanter(LootKind kind, int enemyLevel, EnchanterSize[] expectedSizes)
        {
            var env = CreateTestEnv(true, 10, 2);

            env.LootGenerator.Probability = new Roguelike.Probability.Looting();
            env.LootGenerator.Probability.SetLootingChance(LootSourceKind.Enemy, kind, 1);

            var enemies = AllEnemies;

            Assert.GreaterOrEqual(enemies.Count, 5);
            enemies.ForEach(i =>
            {
                SetEnemyLevel(i, enemyLevel);
            });

            var li = new LootInfo(game, null);

            env.KillAllEnemies();

            var res                  = new List <LootKind>();
            var lootItems            = li.GetDiff();
            int expectedKindsCounter = 0;

            {
                foreach (var loot in lootItems)
                {
                    var expected = kind == loot.LootKind;

                    if (expected)
                    {
                        var ench = loot as Enchanter;
                        Assert.True(expectedSizes.Contains(ench.EnchanterSize));
                        expectedKindsCounter++;
                    }

                    res.Add(loot.LootKind);
                }
            }
            Assert.Greater(expectedKindsCounter, 0);
        }
Пример #2
0
 public LootModel(string id, string name, LootKind kind, float weight)
 {
     Id       = id;
     LootType = kind;
     Weight   = weight;
 }
Пример #3
0
 public int Count(LootKind lk)
 {
     return(GeneratedLoot.Where(i => i.LootKind == lk).Count());
 }
Пример #4
0
 public override int GetHashCode()
 {
     return((Name + "_" + LootKind.ToString() + "_" + EquipmentKind.ToString()).GetHashCode());
 }