///////////////////////////////////////////////////////// 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); }
public LootModel(string id, string name, LootKind kind, float weight) { Id = id; LootType = kind; Weight = weight; }
public int Count(LootKind lk) { return(GeneratedLoot.Where(i => i.LootKind == lk).Count()); }
public override int GetHashCode() { return((Name + "_" + LootKind.ToString() + "_" + EquipmentKind.ToString()).GetHashCode()); }