public void GenerateWand() { var wand = wandGenerator.GenerateAtPower(power); Assert.That(wand.Name, Does.StartWith("Wand of ")); Assert.That(wand.ItemType, Is.EqualTo(ItemTypeConstants.Wand)); Assert.That(wand.IsMagical, Is.True); Assert.That(wand.Attributes, Contains.Item(AttributeConstants.Charged)); Assert.That(wand.Attributes, Contains.Item(AttributeConstants.OneTimeUse)); Assert.That(wand.Quantity, Is.EqualTo(1)); Assert.That(wand.Contents, Is.Empty); }
public void GenerateScroll() { var scroll = scrollGenerator.GenerateAtPower(PowerConstants.Minor); Assert.That(scroll.ItemType, Is.EqualTo(ItemTypeConstants.Scroll)); Assert.That(scroll.Name, Is.EqualTo(ItemTypeConstants.Scroll)); Assert.That(scroll.IsMagical, Is.True); Assert.That(scroll.Attributes.Single(), Is.EqualTo(AttributeConstants.OneTimeUse)); Assert.That(scroll.Quantity, Is.EqualTo(1)); }
public Item GenerateAtPower(string power) { eventQueue.Enqueue("TreasureGen", $"Beginning {power} magical item generation"); var item = innerGenerator.GenerateAtPower(power); eventQueue.Enqueue("TreasureGen", $"Completed generation of {power} {item.ItemType} {item.Name}"); return(item); }
public Item GenerateAtPower(string power) { if (power == PowerConstants.Mundane) { throw new ArgumentException(); } return(innerGenerator.GenerateAtPower(power)); }
public void GenerateRod() { var rod = rodGenerator.GenerateAtPower(power); Assert.That(rod.ItemType, Is.EqualTo(ItemTypeConstants.Rod)); Assert.That(rod.IsMagical, Is.True); Assert.That(rod.Name, Is.EqualTo("rod of ability")); }
public void GeneratePotion() { var potion = potionGenerator.GenerateAtPower(power); Assert.That(potion.Attributes, Contains.Item(AttributeConstants.OneTimeUse)); Assert.That(potion.IsMagical, Is.True); Assert.That(potion.Name, Is.EqualTo("potion")); Assert.That(potion.Magic.Bonus, Is.EqualTo(9266)); Assert.That(potion.Quantity, Is.EqualTo(1)); Assert.That(potion.ItemType, Is.EqualTo(ItemTypeConstants.Potion)); }
public Item GenerateAtPower(string power) { var item = innerGenerator.GenerateAtPower(power); if (intelligenceGenerator.IsIntelligent(item.ItemType, item.Attributes, item.IsMagical)) { item.Magic.Intelligence = intelligenceGenerator.GenerateFor(item); } return(item); }
public void GetArmor() { var armor = magicalArmorGenerator.GenerateAtPower(power); Assert.That(armor.ItemType, Is.EqualTo(ItemTypeConstants.Armor)); Assert.That(armor.Quantity, Is.EqualTo(1)); }
public Item GenerateAtPower(string power) { var item = innerGenerator.GenerateAtPower(power); if (item.Magic.Curse == CurseConstants.SpecificCursedItem) { return(item); } item = AddSpecialMaterials(item); return(item); }
public Item GenerateAtPower(string power) { var item = innerGenerator.GenerateAtPower(power); if (item.IsMagical == false) { return(item); } item = AddTraits(item); return(item); }
public void GenerateStaff() { var staff = staffGenerator.GenerateAtPower(power); Assert.That(staff.ItemType, Is.EqualTo(ItemTypeConstants.Staff)); Assert.That(staff.Attributes, Contains.Item(AttributeConstants.Charged)); Assert.That(staff.Attributes, Contains.Item(AttributeConstants.OneTimeUse)); Assert.That(staff.Attributes.Count(), Is.EqualTo(2)); Assert.That(staff.Magic.Bonus, Is.EqualTo(0)); }
public void LogGenerationEvents() { var innerItem = new Item(); innerItem.Name = Guid.NewGuid().ToString(); innerItem.ItemType = Guid.NewGuid().ToString(); mockInnerGenerator.Setup(g => g.GenerateAtPower("power")).Returns(innerItem); var item = decorator.GenerateAtPower("power"); Assert.That(item, Is.EqualTo(innerItem)); mockEventQueue.Verify(q => q.Enqueue(It.IsAny <string>(), It.IsAny <string>()), Times.Exactly(2)); mockEventQueue.Verify(q => q.Enqueue("TreasureGen", "Beginning power magical item generation"), Times.Once); mockEventQueue.Verify(q => q.Enqueue("TreasureGen", $"Completed generation of power {innerItem.ItemType} {innerItem.Name}"), Times.Once); }
public Item GenerateAtPower(string power) { var item = innerGenerator.GenerateAtPower(power); if (curseGenerator.HasCurse(item.IsMagical)) { var curse = curseGenerator.GenerateCurse(); if (curse == TableNameConstants.Percentiles.Set.SpecificCursedItems) { return(curseGenerator.GenerateSpecificCursedItem()); } item.Magic.Curse = curse; } return(item); }
public void GetItemFromInnerGenerator() { var item = decorator.GenerateAtPower("power"); Assert.That(item, Is.EqualTo(innerItem)); }
public void GenerateRing() { var ring = ringGenerator.GenerateAtPower(power); Assert.That(ring.Name, Is.EqualTo("ring of ability")); Assert.That(ring.IsMagical, Is.True); Assert.That(ring.ItemType, Is.EqualTo(ItemTypeConstants.Ring)); Assert.That(ring.Magic.Bonus, Is.EqualTo(9266)); }
public void GenerateWeapon() { var weapon = weaponGenerator.GenerateAtPower(power); Assert.That(weapon.ItemType, Is.EqualTo(ItemTypeConstants.Weapon)); Assert.That(weapon.Quantity, Is.Positive); Assert.That(weapon.Name, Is.EqualTo("weapon name")); }
protected override Item GenerateItem() { var power = GetNewPower(allowMinor); return(magicalItemGenerator.GenerateAtPower(power)); }
public void GenerateWondrousItem() { var item = wondrousItemGenerator.GenerateAtPower(power); Assert.That(item.Name, Is.EqualTo(result.Type)); Assert.That(item.ItemType, Is.EqualTo(ItemTypeConstants.WondrousItem)); Assert.That(item.IsMagical, Is.True); }