Exemplo n.º 1
0
        private Item GetItemWithBasePowerUp()
        {
            var item = this.GetItem();

            item.Definition !.BasePowerUpAttributes.Add(this.GetBasePowerUpDefinition());
            return(item);
        }
Exemplo n.º 2
0
        /// <inheritdoc/>
        protected override CraftingResult?TryGetRequiredItems(Player player, out IList <CraftingRequiredItemLink> items, out byte successRateByItems)
        {
            successRateByItems = 0;
            items = new List <CraftingRequiredItemLink>(4);
            var inputItems           = player.TemporaryStorage !.Items.ToList();
            var itemsLevelAndOption4 = inputItems
                                       .Where(item => item.Level >= 4 &&
                                              item.ItemOptions.Any(o => o.ItemOption?.OptionType == ItemOptionTypes.Option))
                                       .ToList();
            var randomWeapons = itemsLevelAndOption4
                                .Where(item => item.IsWearable() &&
                                       item.Definition !.BasePowerUpAttributes.Any(a =>
                                                                                   a.TargetAttribute == Stats.MinimumPhysBaseDmg ||
                                                                                   a.TargetAttribute == Stats.MinimumCurseBaseDmg ||
                                                                                   a.TargetAttribute == Stats.MinimumWizBaseDmg))
                                .ToList();

            var randomArmors = itemsLevelAndOption4
                               .Where(item => item.IsWearable() && item.Definition !.BasePowerUpAttributes.Any(a => a.TargetAttribute == Stats.DefenseBase))
                               .ToList();

            if (randomArmors.Any() && randomWeapons.Any())
            {
                // Either Weapons or Armors, not both
                return(CraftingResult.IncorrectMixItems);
            }

            if (!randomArmors.Any() && !randomWeapons.Any())
            {
                return(CraftingResult.LackingMixItems);
            }

            var hornOfFenrir = inputItems.FirstOrDefault(item => item.Definition?.Name == "Horn of Fenrir");
            var chaos        = inputItems.FirstOrDefault(item => item.Definition?.Name == "Jewel of Chaos");
            var jewelsOfLife = inputItems.Where(item => item.Definition?.Name == "Jewel of Life").Take(5).ToList();

            if (hornOfFenrir is null ||
                chaos is null ||
                jewelsOfLife.Count < 5)
            {
                return(CraftingResult.LackingMixItems);
            }

            inputItems.Remove(hornOfFenrir);
            inputItems.Remove(chaos);
            jewelsOfLife.ForEach(item => inputItems.Remove(item));
            randomWeapons.ForEach(item => inputItems.Remove(item));
            randomArmors.ForEach(item => inputItems.Remove(item));

            if (inputItems.Any())
            {
                return(CraftingResult.TooManyItems);
            }

            items.Add(new CraftingRequiredItemLink(hornOfFenrir.GetAsEnumerable(), new ItemCraftingRequiredItem {
                PossibleItems = { hornOfFenrir.Definition ! }, MinimumAmount = 1, MaximumAmount = 1, Reference = 1, SuccessResult = MixResult.StaysAsIs