public void KilledEnemyGivesFoodOfAllKinds() { var env = CreateTestEnv(numEnemies: 100); env.LootGenerator.Probability = new Roguelike.Probability.Looting(); env.LootGenerator.Probability.SetLootingChance(LootSourceKind.Enemy, LootKind.Food, 1); var enemies = env.Enemies; Assert.AreEqual(enemies.Count, 100); var li = new LootInfo(game, null); env.KillAllEnemies(); var lootItems = li.GetDiff(); Assert.Greater(lootItems.Count, 0); var foods = li.Get <Food>().ToList(); Assert.Greater(foods.Count, 40); var kinds = Enum.GetValues(typeof(FoodKind)).Cast <FoodKind>().Where(i => i != FoodKind.Unset).ToList(); foreach (var kind in kinds) { Assert.IsTrue(foods.Any(i => i.Kind == kind)); } }
public void KilledEnemyGivesPotionFromTimeToTime() { for (int i = 0; i < loopCount; i++) { var env = CreateTestEnv(numEnemies: 100); var li = new LootInfo(game, null); env.KillAllEnemies(); var lootItems = li.GetDiff(); Assert.Greater(lootItems.Count, 10); var potions = li.Get <Potion>(); Assert.Greater(potions.Count, 2); Assert.Less(potions.Count, 10); } }