コード例 #1
0
 public void ComponerItem(VaraDeAsclepio vara, IMagicItem itemMagico)
 {
     if (Items.Contains(itemMagico) && Items.Contains(vara))
     {
         vara.ItemMagico = itemMagico;
         Items.Remove(itemMagico);
     }
 }
コード例 #2
0
        public static string GetMagicItemName(IMagicItem item)
        {
            var(prefixes, suffixes) = GetAffixes(item);

            var prefix = prefixes.Any() ? $"{string.Join(' ', prefixes)} " : string.Empty;
            var suffix = suffixes.Any() ? $" of {string.Join(' ', suffixes)}" : string.Empty;

            var text = item is ICraftable {
                PlayerConstructed : true
            } craftable
                ? GetCraftableItemName(craftable)
            : $"{prefix}{GetItemDesc(item as Item)}{suffix}";

            return(text);
        }
コード例 #3
0
        public static string GetMagicItemName(IMagicItem item)
        {
            var(prefixes, suffixes) = GetAffixes(item);

            var prefix = prefixes.Any() ? $"{string.Join(' ', prefixes)} " : string.Empty;
            var suffix = suffixes.Any() ? $" of {string.Join(' ', suffixes)}" : string.Empty;

            string text;

            if (item is ICraftable {
                PlayerConstructed : true
            } craftableItem)
            {
                text = GetCraftableItemName(craftableItem);
            }
コード例 #4
0
        private static (IEnumerable <string>, IEnumerable <string>) GetAffixes(IMagicItem item)
        {
            var values = item.Enchantments.Values.Values.Where(v => !string.IsNullOrEmpty(v.AffixName));

            var prefixes = values
                           .Where(v => v.Info.Place == EnchantNameType.Prefix)
                           .Select(v => v.AffixName)
                           .ToList();

            var suffixes = values
                           .Where(v => v.Info.Place == EnchantNameType.Suffix)
                           .Select(v => v.AffixName)
                           .ToList();

            return(prefixes, suffixes);
        }
コード例 #5
0
 public string UseMagicItem(IMagicItem item)
 {
     foreach (IItem I in this.Items)
     {
         if (I == item)
         {
             item1          = this.MagicItem;
             this.MagicItem = item;
             Items.Remove(item);
             Items.Add(item1);
             return($"{this.Name} ahora está usando {item}");
         }
         else
         {
             return("Este personaje no contiene este item");
         }
     }
     return("");
 }
コード例 #6
0
 public DarkWizard(string name, IAttackItem attackItem, IDefenseItem defenseItem, IMagicItem magicItem)
     : base(name, attackItem, defenseItem)
 {
     this.MagicItem = magicItem;
 }