public Item Generate() { var item = innerGenerator.Generate(); item = AddSpecialMaterials(item); return(item); }
public Item Generate(string itemName, params string[] traits) { var item = innerGenerator.Generate(itemName, traits); item = AddSpecialMaterials(item); return(item); }
public Item Generate(Item template, bool allowRandomDecoration = false) { eventQueue.Enqueue("TreasureGen", $"Beginning mundane item generation from template: {template.ItemType} {template.Name}"); var item = innerGenerator.Generate(template, allowRandomDecoration); eventQueue.Enqueue("TreasureGen", $"Completed generation of {item.ItemType} {item.Name}"); return(item); }
protected void GenerateAndAssertCustomItem() { var name = GetRandomName(); var template = ItemVerifier.CreateRandomTemplate(name); var item = mundaneItemGenerator.Generate(template); AssertItem(item); Assert.That(item.Name, Is.EqualTo(name)); ItemVerifier.AssertMundaneItemFromTemplate(item, template); }
public void GenerateAlchemicalItem() { result.Type = "alchemical item"; result.Amount = 9266; mockTypeAndAmountPercentileSelector.Setup(p => p.SelectFrom(TableNameConstants.Percentiles.Set.AlchemicalItems)).Returns(result); var item = generator.Generate(); Assert.That(item.Name, Is.EqualTo(result.Type)); Assert.That(item.Quantity, Is.EqualTo(9266)); Assert.That(item.ItemType, Is.EqualTo(ItemTypeConstants.AlchemicalItem)); }
public void GenerateCustomTool() { var name = Guid.NewGuid().ToString(); var template = itemVerifier.CreateRandomTemplate(name); var tool = toolGenerator.Generate(template); itemVerifier.AssertMundaneItemFromTemplate(tool, template); Assert.That(tool.BaseNames.Single(), Is.EqualTo(name)); Assert.That(tool.ItemType, Is.EqualTo(ItemTypeConstants.Tool)); Assert.That(tool.Attributes, Is.Empty); Assert.That(tool.IsMagical, Is.False); Assert.That(tool.Quantity, Is.EqualTo(1)); }
public void GenerateTool() { mockPercentileSelector.Setup(p => p.SelectFrom(TableNameConstants.Percentiles.Set.Tools)).Returns("tool"); var tool = generator.Generate(); Assert.That(tool.Name, Is.EqualTo("tool")); Assert.That(tool.Attributes, Is.Empty); Assert.That(tool.ItemType, Is.EqualTo(ItemTypeConstants.Tool)); Assert.That(tool.IsMagical, Is.False); Assert.That(tool.Contents, Is.Empty); Assert.That(tool.Quantity, Is.EqualTo(1)); Assert.That(tool.Traits, Is.Empty); }
public void LogGenerationEvents() { var innerItem = new Item(); innerItem.Name = Guid.NewGuid().ToString(); innerItem.ItemType = Guid.NewGuid().ToString(); mockInnerGenerator.Setup(g => g.Generate()).Returns(innerItem); var Items = decorator.Generate(); Assert.That(Items, Is.EqualTo(innerItem)); mockEventQueue.Verify(q => q.Enqueue(It.IsAny <string>(), It.IsAny <string>()), Times.Exactly(2)); mockEventQueue.Verify(q => q.Enqueue("TreasureGen", "Beginning mundane item generation"), Times.Once); mockEventQueue.Verify(q => q.Enqueue("TreasureGen", $"Completed generation of {innerItem.ItemType} {innerItem.Name}"), Times.Once); }
public void GenerateCustomAlchemicalItem() { var name = Guid.NewGuid().ToString(); var template = itemVerifier.CreateRandomTemplate(name); var item = alchemicalItemGenerator.Generate(template); itemVerifier.AssertMundaneItemFromTemplate(item, template); Assert.That(item.BaseNames.Single(), Is.EqualTo(name)); Assert.That(item.ItemType, Is.EqualTo(ItemTypeConstants.AlchemicalItem)); Assert.That(item.Attributes, Is.Empty); }
public void DecorateCustomItem() { var template = new Item(); mockInnerGenerator.Setup(g => g.Generate(template, true)).Returns(item); mockMaterialGenerator.SetupSequence(g => g.CanHaveSpecialMaterial(It.IsAny <string>(), It.IsAny <IEnumerable <string> >(), It.IsAny <IEnumerable <string> >())) .Returns(true).Returns(false); mockMaterialGenerator.Setup(g => g.GenerateFor(It.IsAny <string>(), It.IsAny <IEnumerable <string> >(), It.IsAny <IEnumerable <string> >())) .Returns("special material"); var decoratedItem = decorator.Generate(template, true); Assert.That(decoratedItem, Is.Not.EqualTo(template)); Assert.That(decoratedItem, Is.EqualTo(item)); Assert.That(decoratedItem.Traits, Contains.Item("special material")); Assert.That(decoratedItem.Traits.Count, Is.EqualTo(1)); }
protected override Item GenerateItem() { return(mundaneItemGenerator.Generate()); }
public void GenerateCustomMundaneArmor() { var name = Guid.NewGuid().ToString(); var template = itemVerifier.CreateRandomArmorTemplate(name); var attributes = new[] { "attribute 1", "attribute 2" }; var tableName = string.Format(TableNameConstants.Collections.Formattable.ITEMTYPEAttributes, ItemTypeConstants.Armor); mockCollectionsSelector.Setup(p => p.SelectFrom(tableName, name)).Returns(attributes); mockPercentileSelector.Setup(p => p.SelectFrom(TableNameConstants.Percentiles.Set.MundaneGearSizes)).Returns("size"); mockPercentileSelector.Setup(p => p.SelectFrom <bool>(TableNameConstants.Percentiles.Set.IsMasterwork)).Returns(true); var baseNames = new[] { "base name", "other base name" }; mockCollectionsSelector.Setup(s => s.SelectFrom(TableNameConstants.Collections.Set.ItemGroups, name)).Returns(baseNames); armorSelection.ArmorBonus = 9266; armorSelection.ArmorCheckPenalty = -90210; armorSelection.MaxDexterityBonus = 42; mockArmorDataSelector.Setup(s => s.Select(name)).Returns(armorSelection); var item = mundaneArmorGenerator.Generate(template); var armor = item as Armor; itemVerifier.AssertMundaneItemFromTemplate(armor, template); Assert.That(armor.ItemType, Is.EqualTo(ItemTypeConstants.Armor)); Assert.That(armor.Attributes, Is.EquivalentTo(attributes)); Assert.That(armor.Traits, Is.All.Not.EqualTo("size")); Assert.That(armor.Size, Is.EqualTo("size")); Assert.That(armor.Traits, Is.All.Not.EqualTo(TraitConstants.Masterwork)); Assert.That(armor.Quantity, Is.EqualTo(1)); Assert.That(armor.BaseNames, Is.EqualTo(baseNames)); Assert.That(armor.ArmorBonus, Is.EqualTo(9266)); Assert.That(armor.ArmorCheckPenalty, Is.EqualTo(-90210)); Assert.That(armor.MaxDexterityBonus, Is.EqualTo(42)); }
public void GenerateAlchemicalItem(string itemName) { var item = alchemicalItemGenerator.Generate(itemName); itemVerifier.AssertItem(item); }
public void GenerateArmor(string itemName) { var item = armorGenerator.Generate(itemName); itemVerifier.AssertItem(item); }
public void GenerateWeapon(string itemName) { var item = weaponGenerator.Generate(itemName); itemVerifier.AssertItem(item); }
public void GenerateWeapon() { var weapon = mundaneWeaponGenerator.Generate(); Assert.That(weapon.Name, Is.EqualTo("weapon name")); }
public void ReturnArmor() { var armor = mundaneArmorGenerator.Generate(); Assert.That(armor, Is.Not.Null); }
public void GenerateTool(string itemName) { var item = toolGenerator.Generate(itemName); itemVerifier.AssertItem(item); }
public void GetItemFromInnerGenerator() { var decoratedItem = decorator.Generate(); Assert.That(decoratedItem, Is.EqualTo(item)); }