예제 #1
0
 private PotionFactory GetPotionFactory(PotionDescriptor p, DungeonMasterParser.Support.ItemDescriptor itemDescriptor)
 {
     return(new PotionFactory(
                p.Name,
                p.Weight,
                builder.ActionCombos[itemDescriptor.AttackCombo],
                builder.GetStorageTypes(itemDescriptor.CarryLocation),
                builder.RenderersSource.GetItemRenderer(ResourceProvider.Instance.Content.Load <Texture2D>(p.TexturePath))));
 }
예제 #2
0
 private IList<IAttackFactory> GetAttackFactories(ItemDescriptor itemsDescriptor)
 {
     // ReSharper disable once CoVariantArrayConversion
     return Data.FightCombos[itemsDescriptor.AttackCombo].Actions
        .Select(a =>
             new ComboAttackFactory(a.UseCharges == 1, a.MinimumSkillLevel,
                new HumanAttackFactory(a.ActionDescriptor.Name,
                    a.ActionDescriptor.ExperienceGain,
                    a.ActionDescriptor.DefenseModifier,
                    a.ActionDescriptor.HitProbability,
                    a.ActionDescriptor.Damage,
                    a.ActionDescriptor.Fatigue,
                    Skills[a.ActionDescriptor.ImprovedSkill],
                    a.ActionDescriptor.Stamina,
                    -1)))
        .ToArray();
 }
예제 #3
0
        private IList<ItemDescriptor> GetItemsDescriptors()
        {
            var documet = new HtmlDocument();
            documet.LoadHtml(File.ReadAllText("Data/itemDescriptors.html"));

            var decimalVal = new Regex(@"\((0|[1-9][0-9]*)\)");

            return documet.DocumentNode.SelectSingleNode("//table")
                .Descendants("tr")
                .Skip(1)//skipp header
                .Select(tr =>
                {
                    var columns = tr.Elements("td").Select(td => td.InnerText).ToArray();
                    var res = new ItemDescriptor()
                    {
                        GlobalItemIndex = int.Parse(decimalVal.Match(columns[0]).Groups[1].Value),
                        FloorGraphicsIndex = int.Parse(decimalVal.Match(columns[1]).Groups[1].Value),
                        AttackCombo = int.Parse(decimalVal.Match(columns[2]).Groups[1].Value),
                        CarryLocation = (CarrryLocations)int.Parse(decimalVal.Match(columns[3]).Groups[1].Value),
                        TableIndex = int.Parse(columns[5]),
                        InCategoryIndex = int.Parse(columns[6]),
                        Category = (ObjectCategory)Enum.Parse(typeof(ObjectCategory), columns[7].Trim(), ignoreCase: true),
                        Name = columns[8].Trim()
                    };
                    return res;

                })
                .ToArray();
        }