public void GetArmor()
        {
            var tableName = string.Format(TableNameConstants.Percentiles.Formattable.POWERArmorTypes, "power", ItemTypeConstants.Armor);

            mockPercentileSelector.Setup(s => s.SelectFrom(tableName)).Returns("armor type");

            tableName = string.Format(TableNameConstants.Percentiles.Formattable.ARMORTYPETypes, "armor type");
            mockPercentileSelector.Setup(s => s.SelectFrom(tableName)).Returns("armor name");

            tableName = string.Format(TableNameConstants.Percentiles.Formattable.POWERITEMTYPEs, "power", ItemTypeConstants.Armor);
            mockPercentileSelector
            .SetupSequence(s => s.SelectFrom(tableName))
            .Returns(9266.ToString());

            var mundaneArmor = new Armor();

            mundaneArmor.Name = "armor name";
            mockMundaneArmorGenerator.Setup(g => g.Generate(It.Is <Item>(i => i.NameMatches("armor name")), false)).Returns(mundaneArmor);

            var armor = magicalArmorGenerator.GenerateRandom("power");

            Assert.That(armor, Is.EqualTo(mundaneArmor));
            Assert.That(armor.Name, Is.EqualTo("armor name"));
            Assert.That(armor.Magic.Bonus, Is.EqualTo(9266));
            Assert.That(armor.Traits, Contains.Item(TraitConstants.Masterwork));
        }
Example #2
0
        public void GenerateWand()
        {
            var wand = wandGenerator.GenerateRandom(power);

            Assert.That(wand.Name, Does.StartWith("Wand of "));
            Assert.That(wand.BaseNames.Single(), Is.EqualTo(ItemTypeConstants.Wand));
            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 Item GenerateRandom(string power)
        {
            if (power == PowerConstants.Mundane)
            {
                throw new ArgumentException();
            }

            return(innerGenerator.GenerateRandom(power));
        }
        public Item GenerateRandom(string power)
        {
            var item = innerGenerator.GenerateRandom(power);

            if (intelligenceGenerator.IsIntelligent(item.ItemType, item.Attributes, item.IsMagical))
            {
                item.Magic.Intelligence = intelligenceGenerator.GenerateFor(item);
            }

            return(item);
        }
        public void GeneratePotion()
        {
            var potion = potionGenerator.GenerateRandom(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.BaseNames.Single(), 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));
        }
Example #6
0
        public Item GenerateRandom(string power)
        {
            var item = innerGenerator.GenerateRandom(power);

            if (!item.IsMagical)
            {
                return(item);
            }

            item = AddTraits(item);

            return(item);
        }
        public Item GenerateRandom(string power)
        {
            var item = innerGenerator.GenerateRandom(power);

            if (item.Magic.Curse == CurseConstants.SpecificCursedItem)
            {
                var specialMaterials = TraitConstants.SpecialMaterials.All();
                foreach (var specialMaterial in specialMaterials)
                {
                    item.Traits.Remove(specialMaterial);
                }

                return(item);
            }

            item = AddSpecialMaterials(item, true);

            return(item);
        }
        public Item GenerateRandom(string power)
        {
            var item = innerGenerator.GenerateRandom(power);

            if (curseGenerator.HasCurse(item))
            {
                var canBeSpecific = curseGenerator.ItemTypeCanBeSpecificCursedItem(item.ItemType);

                do
                {
                    item.Magic.Curse = curseGenerator.GenerateCurse();
                }while (item.Magic.Curse == TableNameConstants.Percentiles.Set.SpecificCursedItems && !canBeSpecific);

                if (item.Magic.Curse == TableNameConstants.Percentiles.Set.SpecificCursedItems && canBeSpecific)
                {
                    return(curseGenerator.GenerateSpecificCursedItem(item.ItemType));
                }
            }

            return(item);
        }
        public void GetItemFromInnerGenerator()
        {
            var decoratedItem = decorator.GenerateRandom("power");

            Assert.That(decoratedItem, Is.EqualTo(item));
        }
Example #10
0
        public void GenerateRing()
        {
            var ring = ringGenerator.GenerateRandom(power);

            Assert.That(ring.Name, Is.EqualTo("ring of ability"));
            Assert.That(ring.BaseNames.Single(), 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 GetItemFromInnerGenerator()
        {
            var item = mundaneProxy.GenerateRandom("power");

            Assert.That(item, Is.EqualTo(innerItem));
        }
Example #12
0
        public void GetItemFromInnerGenerator()
        {
            var item = intelligenceDecorator.GenerateRandom("power");

            Assert.That(item, Is.EqualTo(innerItem));
        }
        protected override Item GenerateItem()
        {
            var power = GetNewPower(allowMinor);

            return(magicalItemGenerator.GenerateRandom(power));
        }
        public void GenerateScroll()
        {
            var scroll = scrollGenerator.GenerateRandom(PowerConstants.Minor);

            AssertScroll(scroll);
        }