Exemplo n.º 1
0
 public void AddArmorSet(TArmorSet set)
 {
     if (!Armors.Contains(set))
     {
         Armors.Add(set);
     }
 }
Exemplo n.º 2
0
        public List <Armors> CreateBasicArmors()
        {
            List <Armors> theList = new List <Armors>();

            Armors none           = AddArmors("None", "Light Armor", 10, 10);
            Armors padded         = AddArmors("Padded", "Light Armor", 11, 10);
            Armors leather        = AddArmors("Leather", "Light Armor", 11, 10);
            Armors studdedLeather = AddArmors("Studded Leather", "Light Armor", 12, 10);
            Armors hide           = AddArmors("Hide", "Medium Armor", 12, 2);
            Armors chainShirt     = AddArmors("Chain shirt", "Medium Armor", 13, 2);
            Armors scaleMail      = AddArmors("Scale mail", "Medium Armor", 14, 2);
            Armors breastPlate    = AddArmors("Breastplate", "Medium Armor", 14, 2);
            Armors halfPlate      = AddArmors("Halfplate", "Medium Armor", 15, 2);
            Armors ringmail       = AddArmors("Ring mail", "Heavy Armor", 14, 0);
            Armors chainMail      = AddArmors("Chain mail", "Heavy Armor", 16, 0);
            Armors splint         = AddArmors("Splint", "Heavy Armor", 17, 0);
            Armors plate          = AddArmors("Plate", "Heavy Armor", 18, 0);

            theList.Add(none);
            theList.Add(padded);
            theList.Add(leather);
            theList.Add(studdedLeather);
            theList.Add(hide);
            theList.Add(chainShirt);
            theList.Add(scaleMail);
            theList.Add(breastPlate);
            theList.Add(halfPlate);
            theList.Add(ringmail);
            theList.Add(chainMail);
            theList.Add(splint);
            theList.Add(plate);

            return(theList);
        }
Exemplo n.º 3
0
 public Inventory Remove(Armor w)
 {
     if (Armors.Contains(w))
     {
         Armors.Remove(w);
     }
     return(this);
 }
Exemplo n.º 4
0
 public Inventory Add(Armor w)
 {
     if (Armors.Count >= MaxSize)
     {
         throw new ArgumentOutOfRangeException();
     }
     Armors.Add(w);
     return(this);
 }
Exemplo n.º 5
0
    // Unity


    private void Awake()
    {
        if (Instance != null)
        {
            Debug.LogError("More than one armors instance");
            Destroy(this);
            return;
        }
        Instance = this;
    }
Exemplo n.º 6
0
        private void newArmorAddButton_Click(object sender, EventArgs e)
        {
            List <Armors> newList = _newArmorsList;
            Armors        armor   = AddArmors(newArmorName.Text, newArmorType.Text, int.Parse(newArmorBaseAc.Text),
                                              int.Parse(newArmorMaxDex.Text), true);

            newList.Add(armor);
            _newArmorsList = newList;
            ItemsRefresh();
            ItemsApplyChanged();
        }
Exemplo n.º 7
0
 public void Pay(string selection)
 {
     if (selection.Substring(0, 1) == "W")
     {
         var weapon = (Weapon)NameItemList[selection];
         if (Hero.Gold >= weapon.OriginalValue)
         {
             Hero.Gold -= weapon.OriginalValue;
             Weapons.Remove(weapon);
             Hero.WeaponsBag.Add(weapon);
             Console.WriteLine($"You spent {weapon.OriginalValue} gold for a {weapon.Name}");
             Menu();
         }
         else
         {
             Console.WriteLine($"NO gold , No sell");
             Menu();
         }
     }
     else if (selection.Substring(0, 1) == "A")
     {
         var armor = (Armor)NameItemList[selection];
         if (Hero.Gold >= armor.OriginalValue)
         {
             Hero.Gold -= armor.OriginalValue;
             Armors.Remove(armor);
             Hero.ArmorsBag.Add(armor);
             Console.WriteLine($"You spent {armor.OriginalValue} gold for a {armor.Name}");
             Menu();
         }
         else
         {
             Console.WriteLine($"NO gold , No sell");
             Menu();
         }
     }
     else if (selection.Substring(0, 1) == "P")
     {
         var potion = (Potion)NameItemList[selection];
         if (Hero.Gold >= potion.OriginalValue)
         {
             Hero.Gold -= potion.OriginalValue;
             Potions.Remove(potion);
             Hero.PotionsBag.Add(potion);
             Console.WriteLine($"You spent {potion.OriginalValue} gold for a {potion.Name}");
             Menu();
         }
         else
         {
             Console.WriteLine($"NO gold , No sell");
             Menu();
         }
     }
 }
Exemplo n.º 8
0
        public Armors AddArmors(string name, string type, int baseAc, int maxDex, bool disposable = false)
        {
            Armors armor = new Armors();

            armor.Name         = name;
            armor.Type         = type;
            armor.BaseAc       = baseAc;
            armor.MaxDex       = maxDex;
            armor.IsDisposable = disposable;
            return(armor);
        }
Exemplo n.º 9
0
        public FormKey GetLeveledListUsingArmorSets(ISkyrimMod PatchMod, bool createLL = false)
        {
            LeveledItem ll = null;

            if (LLKey == FormKey.Null || createLL)
            {
                var list = Armors.Select(a => a.CreateLeveledList().AsLink <IItemGetter>());
                ll    = OutfitUtils.CreateLeveledList(PatchMod, list, Configuration.Patcher.LeveledListPrefix + Name, 1, Configuration.LeveledListFlag);
                LLKey = ll.FormKey;
            }
            return(LLKey);
        }
Exemplo n.º 10
0
        public FormKey CreateLeveledList(ISkyrimMod patchMod, bool forceCreate = false)
        {
            LeveledItem ll = null;

            if (forceCreate || LLFormKey == FormKey.Null)
            {
                var items = Armors.Select(a => a.FormKey.AsLink <IItemGetter>())
                            .Union(Weapons.Select(a => a.AsLink <IItemGetter>()).EmptyIfNull());
                ll        = OutfitUtils.CreateLeveledList(patchMod, items, Prefix, 1, LeveledItem.Flag.UseAll);
                LLFormKey = ll.FormKey;
            }
            return(LLFormKey);
        }
Exemplo n.º 11
0
 public TArmorSet(TArmor body, bool hasPatch = false)
 {
     Body     = body;
     Armors   = new();
     Weapons  = new();
     Material = body.Material;
     Type     = body.Type;
     Prefix   = Configuration.Patcher.LeveledListPrefix + Body.Gender + "_" + Body.EditorID;
     Armors.Add(body);
     if (!hasPatch)
     {
         Patch = FileUtils.GetOrAddPatch(Body.FormKey.ModKey.FileName, true);
     }
 }
Exemplo n.º 12
0
        public void CreateMatchingSetFrom(IEnumerable <IArmorGetter> others, bool addAll = false)
        {
            ConcurrentDictionary <string, ConcurrentDictionary <string, TArmor> > matchedArmors1 = new();
            IEnumerable <TArmor> armorParts = others
                                              .Where(x => (ArmorUtils.GetMaterial(x).Equals(Material) ||
                                                           x.HasKeyword(Skyrim.Keyword.ArmorJewelry)) &&
                                                     Type.Equals(ArmorUtils.GetArmorType(x)))
                                              .Select(x => new TArmor(x));

            if (!addAll)
            {
                var block = new ActionBlock <TArmor>(
                    armor =>
                {
                    var armorName = armor.Name;
                    if (HelperUtils.GetMatchingWordCount(Body.Name, armorName) > 0)
                    {
                        armor.BodySlots.Select(x => x.ToString()).ForEach(flag =>
                        {
                            if (!matchedArmors1.ContainsKey(flag))
                            {
                                matchedArmors1.TryAdd(flag,
                                                      new ConcurrentDictionary <string, TArmor>());
                            }
                            matchedArmors1.GetValueOrDefault(flag)
                            .TryAdd(HelperUtils.GetMatchingWordCount(Body.Name, armorName).ToString(), armor);
                        });
                    }
                }, new ExecutionDataflowBlockOptions {
                    MaxDegreeOfParallelism = 30
                });

                foreach (var armor in armorParts)
                {
                    block.Post(armor);
                }
                block.Complete();
                block.Completion.Wait();

                var armors = matchedArmors1.Values.Select(x => x.OrderBy(k => k.Key).Last().Value);
                this.AddArmors(armors);
                Logger.DebugFormat("Created Armors Set: {0}=> [{1}]", Body.FormKey.ModKey.FileName,
                                   string.Join(", ", Armors.Select(x => x.Name)));
            }
            else
            {
                this.AddArmors(armorParts);
            }
        }
Exemplo n.º 13
0
    public Enemy(int life, int strength)
    {
        Life        = life;
        Strength    = strength;
        _experience = Random.Range(5, 15);
        _gold       = Random.Range(5, 15);

        if (Random.Range(0, 100) % 2 == 0)
        {
            weapon = new Weapons(Random.Range(1, 11));
        }
        if (Random.Range(0, 100) % 2 == 1)
        {
            armor = new Armors(Random.Range(1, 11));
        }
    }
Exemplo n.º 14
0
    private void LoadFromJson()
    {
        for (int i = 0; i < swordsInt.Length; i++)
        {
            var jsonPath   = Application.dataPath + "/StreamingAssets/S" + (i + 1).ToString() + ".dt";
            var jsonString = Coder.EncodeDecrypt(File.ReadAllText(jsonPath));
            Swords.Add(JsonUtility.FromJson <WeaponItem>(jsonString));
            Swords[i].sprite = Resources.LoadAll <Sprite>("Swords")[swordsInt[i]];
        }

        for (int i = 0; i < 6; i++)
        {
            var jsonPath   = Application.dataPath + "/StreamingAssets/A" + (i + 1).ToString() + ".dt";
            var jsonString = Coder.EncodeDecrypt(File.ReadAllText(jsonPath));
            Armors.Add(JsonUtility.FromJson <ArmorItem>(jsonString));
            Armors[i].sprite = Resources.Load <Sprite>($"Armor/{(i + 1).ToString()}");
        }
    }
Exemplo n.º 15
0
 public void AddItem(string type, string id, int quantity)
 {
     if (type.ToLower() == "usable")
     {
         if (DataManager.Instance.SearchUsableID(id) != null)
         {
             for (int i = 0; i < Usables.Count; i++)
             {
                 if (Usables[i].usable.id == id)
                 {
                     Usables[i].amount += quantity;
                     return;
                 }
             }
             Usables.Add(new PlayerUsable(id, quantity));
         }
         else
         {
             Debug.LogError("Usable " + id + " not found!");
         }
     }
     else if (type.ToLower() == "weapon")
     {
         if (DataManager.Instance.SearchWeaponID(id) != null)
         {
             Weapons.Add(new PlayerWeapon(id));
         }
         else
         {
             Debug.LogError("Weapon " + id + " not found!");
         }
     }
     else if (type.ToLower() == "armor")
     {
         if (DataManager.Instance.SearchArmorID(id) != null)
         {
             Armors.Add(new PlayerArmor(id));
         }
         else
         {
             Debug.LogError("Armor " + id + " not found!");
         }
     }
 }
Exemplo n.º 16
0
        internal ItemTemplate GetItem(int id)
        {
            if (Armors.ContainsKey(id))
            {
                return(Armors[id]);
            }

            if (Weapons.ContainsKey(id))
            {
                return(Weapons[id]);
            }

            if (EtcItems.ContainsKey(id))
            {
                return(EtcItems[id]);
            }

            return(null);
        }
Exemplo n.º 17
0
        public void VanillaArmorsMatch()
        {
            var ourArmors = OurMod.Mod !.Armors.ToDictionary(a => a.FormKey);

            var butTop = LEMods.PriorityOrder.Skip(1).Armor().WinningOverrides().ToDictionary(a => a.FormKey);

            foreach (var theirArmor in TheirMod.Mod !.Armors)
            {
                if (theirArmor.FormKey.ModKey.Name == "PatchusMaximus")
                {
                    continue;
                }
                if (theirArmor.NameOrEmpty().StartsWith(SReforged))
                {
                    continue;
                }
                if (theirArmor.NameOrEmpty().StartsWith(SWarforged))
                {
                    continue;
                }
                if (theirArmor.NameOrEmpty().EndsWith("[" + SReplica + "]"))
                {
                    continue;
                }
                if (theirArmor.NameOrEmpty().EndsWith("[" + SQuality + "]"))
                {
                    continue;
                }

                var weHave = ourArmors.ContainsKey(theirArmor.FormKey);
                if (!weHave && butTop.TryGetValue(theirArmor.FormKey, out var vanillaArmor))
                {
                    if (AreEqual(vanillaArmor, theirArmor))
                    {
                        continue;
                    }
                }

                var ourArmor = ourArmors[theirArmor.FormKey];
                AssertEqual(theirArmor, ourArmor);
            }
        }
Exemplo n.º 18
0
        public Armors Map(IEnumerable <ArmorApi> armorApi)
        {
            Armors armors = new Armors()
            {
                ArmorList = armorApi.Select(armor => new Armor()
                {
                    Id      = armor.Id.Value,
                    Name    = armor.Name,
                    Rank    = armor.Rank,
                    Rarity  = armor.Rarity.Value,
                    Type    = armor.Type,
                    Defense = new Models.Armor.Defense()
                    {
                        Base      = armor.Defense.Base.Value,
                        Max       = armor.Defense.Max.Value,
                        Augmented = armor.Defense.Augmented.Value
                    }
                })
            };

            return(armors);
        }
Exemplo n.º 19
0
        public void ShowInventory()
        {
            for (var i = 0; i < Weapons.Count(); i++)
            {
                Console.WriteLine($"W{i} - Name: {Weapons[i].Name} / Original Value: {Weapons[i].OriginalValue}");
                buyProducts.Add($"W{i}", Weapons[i]);
            }
            for (var i = 0; i < Armors.Count(); i++)
            {
                Console.WriteLine($"A{i} - Name: {Armors[i].Name} / Original Value: {Armors[i].OriginalValue}");
                buyProducts.Add($"A{i}", Armors[i]);
            }
            for (var i = 0; i < Potions.Count(); i++)
            {
                Console.WriteLine($"P{i} - Name: {Potions[i].Name} / Original Value: {Potions[i].OriginalValue}");
                buyProducts.Add($"P{i}", Potions[i]);
            }
            Console.WriteLine("Buy item or return to menu");
            Console.WriteLine("If you want to buy item, type the b");
            Console.WriteLine("If you want to return to menu, type the r");

            var choose = Console.ReadLine();

            if (choose == "b")
            {
                Sell();
            }
            else if (choose == "r")
            {
                Menu();
            }
            else
            {
                Console.WriteLine("You type wrong letter. Please enter correct letter.");
                Console.WriteLine("");
                Menu();
            }
        }
Exemplo n.º 20
0
        public void ReforgedArmorsMatch()
        {
            var ourArmors = SEMods.PriorityOrder.Armor().WinningOverrides().GroupBy(a => a.EditorID)
                            .ToDictionary(a => a.Key);

            foreach (var theirArmor in TheirMod.Mod !.Armors.Where(t => t.NameOrEmpty().Contains(SReforged)))
            {
                var ourArmorsMatching = ourArmors[theirArmor.EditorID];

                foreach (var ourArmor in ourArmorsMatching)
                {
                    try
                    {
                        AssertEqual(theirArmor, ourArmor);
                    }
                    catch (XunitException)
                    {
                        OutputHelper.WriteLine($"{theirArmor.EditorID} {theirArmor.Name} {theirArmor.FormKey} | {ourArmor.EditorID} {ourArmor.Name} {ourArmor.FormKey}");
                        throw;
                    }
                }
            }
        }
Exemplo n.º 21
0
        public static List <IEquipable> CreateArmors(int level)
        {
            List <IEquipable> armors = new List <IEquipable>();

            IEquipable leatherVest = new Armors
            {
                Name     = "Leather vest",
                Type     = "Armor",
                StatType = 8 * level,
                Price    = 30 * level
            };

            armors.Add(leatherVest);

            IEquipable robe = new Armors
            {
                Name     = "Robe",
                Type     = "Armor",
                StatType = 5 * level,
                Price    = 45 * level
            };

            armors.Add(robe);

            IEquipable chainMail = new Armors
            {
                Name     = "ChainMail",
                Type     = "Armor",
                StatType = 12 * level,
                Price    = 130 * level
            };

            armors.Add(chainMail);

            return(armors);
        }
Exemplo n.º 22
0
    //checks for all the different armors - if one applies, change the armor state to that and call the UpdateArmors function
    public void Update()
    {
        if (whichArmorIsEquipped == "Unarmored")
        {
            currentSlot = Armors.Base;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "LeatherArmor")
        {
            currentSlot = Armors.LeatherArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "BoarHideArmor")
        {
            currentSlot = Armors.BoarHideArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "WolfSkinArmor")
        {
            currentSlot = Armors.WolfSkinArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "ChainmailArmor")
        {
            currentSlot = Armors.ChainmailArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "AncientArmor")
        {
            currentSlot = Armors.AncientArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "RunicArmor")
        {
            currentSlot = Armors.RunicArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "SlaughterersArmor")
        {
            currentSlot = Armors.SlaughterersArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "MithrilArmor")
        {
            currentSlot = Armors.MithrilArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "ValkyrieInfusedArmor")
        {
            currentSlot = Armors.ValkyrieInfusedArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "MuspelheimArmor")
        {
            currentSlot = Armors.MuspelheimArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "AlfheimArmor")
        {
            currentSlot = Armors.AlfheimArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "NiflheimArmor")
        {
            currentSlot = Armors.NiflheimArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "MidgardArmor")
        {
            currentSlot = Armors.MidgardArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "AsgardArmor")
        {
            currentSlot = Armors.AsgardArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "JotunheimArmor")
        {
            currentSlot = Armors.JotunheimArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "VanaheimArmor")
        {
            currentSlot = Armors.VanaheimArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "SvartalfheimArmor")
        {
            currentSlot = Armors.SvartalfheimArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "HelheimArmor")
        {
            currentSlot = Armors.HelheimArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "DoomGuyArmor")
        {
            currentSlot = Armors.DoomGuyArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "StormtrooperArmor")
        {
            currentSlot = Armors.StormtrooperArmor;
            UpdateArmors();
        }

        if (whichArmorIsEquipped == "GalaxyGlove")
        {
            currentSlot = Armors.GalaxyGlove;
            UpdateArmors();
        }
    }
Exemplo n.º 23
0
 public void Start()
 {
     //setting the current armor to unarmored
     currentSlot = Armors.Base;
 }
Exemplo n.º 24
0
 public Getting()
 {
     Armors.AddRange(storage.Armors);
     Weapons.AddRange(storage.Weapons);
     Units.AddRange(storage.Units);
 }
Exemplo n.º 25
0
    private void LoadData(List <string> heroData)
    {
        int index = 2;

        StringId = heroData[0].Split(' ')[1];

        while (heroData[index] != ".end")
        {
            List <string> data = heroData[index++].Replace("%", "").Replace("\"", "").
                                 Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).ToList();

            switch (data[0])
            {
            case "rendering:":
                RenderingRankOverride = int.Parse(data[2]);
                break;

            case "commonfx:":
                if (CommonEffects == null)
                {
                    CommonEffects = new CommonEffects(data);
                }
                else
                {
                    CommonEffects.LoadData(data);
                }
                break;

            case "combat_skill:":
                SkillArtInfo skillArt = new SkillArtInfo(data, false);
                SkillArtInfo.Add(skillArt);
                break;

            case "riposte_skill:":
                SkillArtInfo riposteArt = new SkillArtInfo(data, false);
                SkillArtInfo.Add(riposteArt);
                break;

            default:
                Debug.LogError("Unknown art token in hero: " + StringId);
                break;
            }
        }
        index += 2;

        while (heroData[index] != ".end")
        {
            List <string> data = heroData[index++].Replace("%", "").Replace("\"", "").
                                 Split(new [] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).ToList();

            switch (data[0])
            {
            case "resistances:":
                Resistanses.Add(AttributeType.Stun, float.Parse(data[2]) / 100);
                Resistanses.Add(AttributeType.Poison, float.Parse(data[4]) / 100);
                Resistanses.Add(AttributeType.Bleed, float.Parse(data[6]) / 100);
                Resistanses.Add(AttributeType.Disease, float.Parse(data[8]) / 100);
                Resistanses.Add(AttributeType.Move, float.Parse(data[10]) / 100);
                Resistanses.Add(AttributeType.Debuff, float.Parse(data[12]) / 100);
                Resistanses.Add(AttributeType.DeathBlow, float.Parse(data[14]) / 100);
                Resistanses.Add(AttributeType.Trap, float.Parse(data[16]) / 100);
                break;

            case "weapon:":
                Equipment weapon = new Equipment(data[2], Weapons.Count + 1, HeroEquipmentSlot.Weapon);
                weapon.EquipmentModifiers.Add(new FlatModifier(AttributeType.DamageLow, float.Parse(data[6]), false));
                weapon.EquipmentModifiers.Add(new FlatModifier(AttributeType.DamageHigh, float.Parse(data[7]), false));
                weapon.EquipmentModifiers.Add(new FlatModifier(AttributeType.CritChance, float.Parse(data[9]) / 100, false));
                weapon.EquipmentModifiers.Add(new FlatModifier(AttributeType.SpeedRating, float.Parse(data[11]), false));
                Weapons.Add(weapon);
                break;

            case "armour:":
                Equipment armor = new Equipment(data[2], Armors.Count + 1, HeroEquipmentSlot.Armor);
                armor.EquipmentModifiers.Add(new FlatModifier(AttributeType.DefenseRating, float.Parse(data[4]) / 100, false));
                armor.EquipmentModifiers.Add(new FlatModifier(AttributeType.HitPoints, float.Parse(data[8]), true));
                Armors.Add(armor);
                break;

            case "combat_skill:":
                List <string> combatData = new List <string>();
                data = heroData[index - 1].Split(new [] { '\"' }, StringSplitOptions.RemoveEmptyEntries).ToList();
                bool isEffectData = false;
                foreach (var item in data)
                {
                    if (isEffectData)
                    {
                        if (item.Trim(' ').StartsWith("."))
                        {
                            isEffectData = false;
                        }
                        else
                        {
                            combatData.Add(item);
                            continue;
                        }
                    }

                    string[] combatItems = item.Replace("%", "").Split(
                        new [] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                    if (combatItems[combatItems.Length - 1] == ".effect")
                    {
                        isEffectData = true;
                    }
                    combatData.AddRange(combatItems);
                }

                CombatSkillVariants.Add(new CombatSkill(combatData, true));
                break;

            case "combat_move_skill:":
                MoveSkill = new MoveSkill(data[2], int.Parse(data[8]), int.Parse(data[9]));
                break;

            case "riposte_skill:":
                List <string> riposteData = new List <string>();
                data = heroData[index - 1].Split('\"').ToList();
                bool isRiposteEffect = false;
                foreach (var item in data)
                {
                    if (isRiposteEffect)
                    {
                        if (item.Trim(' ')[0] == '.')
                        {
                            isRiposteEffect = false;
                        }
                        else
                        {
                            riposteData.Add(item);
                            continue;
                        }
                    }

                    string[] combatItems = item.Replace("%", "").Split(
                        new [] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                    if (combatItems[combatItems.Length - 1] == ".effect")
                    {
                        isRiposteEffect = true;
                    }
                    riposteData.AddRange(combatItems);
                }
                RiposteSkill = new CombatSkill(riposteData, true);
                break;

            case "incompatible_party_member:":
                IncompatiablePartyTag = data[4];
                break;

            case "tag:":
                Tags.Add(data[2]);
                break;

            case "controlled:":
                break;

            case "id_index:":
                IndexId = int.Parse(data[2]);
                break;

            case "skill_selection:":
                CanSelectCombatSkills        = bool.Parse(data[2]);
                NumberOfSelectedCombatSkills = int.Parse(data[4]);
                break;

            case "deaths_door:":
                if (DeathDoor == null)
                {
                    DeathDoor = new DeathDoor(data);
                }
                else
                {
                    DeathDoor.LoadData(data);
                }
                break;

            case "generation:":
                if (Generation == null)
                {
                    Generation = new HeroGeneration(data);
                }
                else
                {
                    Generation.LoadData(data);
                }
                break;

            case "extra_battle_loot:":
                if (ExtraBattleLoot == null)
                {
                    ExtraBattleLoot = new LootDefinition(data);
                }
                else
                {
                    ExtraBattleLoot.LoadData(data);
                }
                break;

            case "extra_curio_loot:":
                if (ExtraCurioLoot == null)
                {
                    ExtraCurioLoot = new LootDefinition(data);
                }
                else
                {
                    ExtraCurioLoot.LoadData(data);
                }
                break;

            case "extra_stack_limit:":
                ExtraStackLimit = data[2];
                break;

            case "mode:":
                Modes.Add(new CharacterMode(data));
                break;

            default:
                Debug.LogError("Unknown info token " + data[0] + " in hero: " + StringId);
                break;
            }
        }

        CombatSkills = new List <CombatSkill>(CombatSkillVariants.FindAll(skill => skill.Level == 0));
    }
Exemplo n.º 26
0
        public static IPlayer Shopping(IPlayer player)
        {
            weapons     = CreateWeapons(player.Level);
            armors      = CreateArmors(player.Level);
            consumables = CreateConsumables(player.Level);

            Console.WriteLine($"Welcome to my shop {player.Name}");
            Console.WriteLine("What do you want to purchase");
            Console.WriteLine($"you have {player.Gold} gold");
            IEquipable  weapon = new Weapons();
            IEquipable  armor  = new Armors();
            IConsumable drink  = new Potions();


            Console.WriteLine("1. A weapon");
            Console.WriteLine("2. An armor");
            Console.WriteLine("3. Some potions");
            Console.WriteLine("4. Nothing");


            var cki = Console.ReadKey();

            if (cki.Key == ConsoleKey.D1 || cki.Key == ConsoleKey.NumPad1)
            {
                weapon = weapon.BuyStuff(weapons, player);
                if (player.Gold < weapon.Price)
                {
                    Console.WriteLine("you don't have enough gold, press enter to continue");
                }
                else
                {
                    player.Gold  -= weapon.Price;
                    player.Weapon = weapon;
                    Console.WriteLine("Congratulation on your purchase, press enter to continue");
                }

                Console.ReadLine();
            }
            else if (cki.Key == ConsoleKey.D2 || cki.Key == ConsoleKey.NumPad2)
            {
                armor = armor.BuyStuff(armors, player);
                if (player.Gold < armor.Price)
                {
                    Console.WriteLine("you don't have enough gold, press enter to continue");
                }
                else
                {
                    player.Gold -= armor.Price;
                    player.Armor = armor;
                    Console.WriteLine("Congratulation on your purchase, press enter to continue");
                }
                Console.WriteLine($"You have {player.Gold} gold left");
                Console.ReadLine();
            }
            else if (cki.Key == ConsoleKey.D3 || cki.Key == ConsoleKey.NumPad3)
            {
                int ownedPotions;
                if (player.Consumable != null)
                {
                    ownedPotions = player.Consumable.Count;
                }
                else
                {
                    ownedPotions = 0;
                }
                consumables = drink.BuyStuff(consumables, player);
                var total            = consumables.Sum(item => item.Price);
                var potion           = consumables.FirstOrDefault();
                var reduction        = ownedPotions * potion.Price;
                var transactionPrice = total - reduction;
                if (player.Gold < transactionPrice)
                {
                    Console.WriteLine("you don't have enough gold, press enter to continue");
                }
                else
                {
                    player.Gold      -= transactionPrice;
                    player.Consumable = consumables;
                    Console.WriteLine("Congratulation on your purchase, press enter to continue");
                }

                Console.ReadLine();
            }
            else if (cki.Key == ConsoleKey.D4 || cki.Key == ConsoleKey.NumPad4)
            {
                Console.WriteLine("");
            }

            return(player);
        }
Exemplo n.º 27
0
        public void AddArmors(string name, int defense, int cost, int sellprice)
        {
            Armor armor = new Armor(name, defense, cost, sellprice);

            Armors.Add(armor);
        }
Exemplo n.º 28
0
        static void Main(string[] args)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            TimeSpan timeSpan = new TimeSpan();

            if (args.Contains("--items") || args.Contains("--all") || args.Length == 0)
            {
                var itemManager = new Items();
                itemManager.GetItemList().Wait();
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                Console.WriteLine("\n\nFinished with items! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Reset();
                stopwatch.Start();
            }

            if (args.Contains("--monsters") || args.Contains("--all") || args.Length == 0)
            {
                var monManager = new Monsters();
                Console.WriteLine("Starting monster data retrieval.");
                monManager.GetMonsters().Wait();
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                Console.WriteLine("Done with monsters! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Reset();
                stopwatch.Start();
            }

            if (args.Contains("--quests") || args.Contains("--all") || args.Length == 0)
            {
                var questManager = new Quests();
                Console.WriteLine("Starting quest data retrieval.");
                questManager.GetQuests("http://mhgen.kiranico.com/quest/village").Wait();
                questManager.GetQuests("http://mhgen.kiranico.com/quest/guild").Wait();
                questManager.GetQuests("http://mhgen.kiranico.com/quest/arena").Wait();
                questManager.GetQuests("http://mhgen.kiranico.com/quest/training").Wait();
                questManager.GetQuests("http://mhgen.kiranico.com/quest/special-permit").Wait();
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                Console.WriteLine("Done with all quests! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Reset();
                stopwatch.Start();
            }

            if (args.Contains("--weapons") || args.Contains("--all") || args.Length == 0)
            {
                Stopwatch indiv_weapon_watch = new Stopwatch();
                var       weaponManager      = new Weapons();
                string[]  weaponurls         = new string[] {
                    "heavybowgun",
                    "lightbowgun",
                    "bow",
                    "gunlance",
                    "chargeblade",
                    "switchaxe",
                    "huntinghorn",
                    "dualblades",
                    "greatsword",
                    "longsword",
                    "swordshield",
                    "hammer",
                    "lance",
                    "insectglaive"
                };
                indiv_weapon_watch.Start();
                foreach (string category in weaponurls)
                {
                    ConsoleWriters.InfoMessage($"Starting {category} retrieval...");
                    weaponManager.GetWeapons($"http://mhgen.kiranico.com/{category}").Wait();
                    timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(indiv_weapon_watch.Elapsed.TotalSeconds));
                    ConsoleWriters.InfoMessage($"Done with {category}s! Took {timeSpan.ToString("c")}.\n\n");
                    indiv_weapon_watch.Restart();
                }
                indiv_weapon_watch.Stop();
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                ConsoleWriters.InfoMessage("Done with all weapons! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Restart();
            }

            if (args.Contains("--skills") || args.Contains("--all") || args.Length == 0)
            {
                var skillManager = new Skills();
                ConsoleWriters.InfoMessage("Starting skill retrieval...\n\n");
                skillManager.GetSkills("http://mhgen.kiranico.com/skill").Wait();
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                ConsoleWriters.InfoMessage("Done with all skills! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Restart();
            }

            if (args.Contains("--arts") || args.Contains("--all") || args.Length == 0)
            {
                var artManager = new HunterArts();
                ConsoleWriters.InfoMessage("Starting hunter art retrieval...\n\n");
                artManager.GetArts("http://mhgen.kiranico.com/hunter-art").Wait();
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                ConsoleWriters.InfoMessage("Done with all hunter arts! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Restart();
            }

            if (args.Contains("--decorations") || args.Contains("--all") || args.Length == 0)
            {
                var decoManager = new Decorations();
                ConsoleWriters.InfoMessage("Starting decoration retrieval...\n\n");
                decoManager.GetDecorations("http://mhgen.kiranico.com/decoration").Wait();
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                ConsoleWriters.InfoMessage("Done with all decorations! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Restart();
            }

            if (args.Contains("--armor") || args.Contains("--all") || args.Length == 0)
            {
                var armor = new Armors();
                for (int i = 1; i < 9; i++)
                {
                    armor.GetArmors($"http://mhgen.kiranico.com/armor?rare={i}").Wait();
                }
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                ConsoleWriters.InfoMessage("Done with all armors! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Restart();
            }

            if (args.Contains("--palico-skills") || args.Contains("--all") || args.Length == 0)
            {
                var palico = new Palicoes();
                ConsoleWriters.StartingPageMessage("Starting palico skill retrieval...\n\n");
                palico.GetPalicoSkills("http://mhgen.kiranico.com/palico-skill").Wait();
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                ConsoleWriters.InfoMessage("Done with all palico skills! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Restart();
            }

            if (args.Contains("--palico-armor") || args.Contains("--all") || args.Length == 0)
            {
                var palico = new Palicoes();
                ConsoleWriters.StartingPageMessage("Starting palico armor retrieval...\n\n");
                for (int i = 1; i < 5; i++)
                {
                    palico.GetPalicoArmors($"http://mhgen.kiranico.com/palico-armor?page={i}").Wait();
                }
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                ConsoleWriters.InfoMessage("Done with all palico armors! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Restart();
            }

            if (args.Contains("--palico-weapons") || args.Contains("--all") || args.Length == 0)
            {
                var palico = new Palicoes();
                ConsoleWriters.StartingPageMessage("Starting palico weapon retrieval...\n\n");
                palico.GetPalicoWeapons("http://mhgen.kiranico.com/palico-weapon").Wait();
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                ConsoleWriters.InfoMessage("Done with all palico weapons! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Restart();
            }
            stopwatch.Stop();
        }
Exemplo n.º 29
0
 public Armor(int x, int y, int width, int height, Rarities rarity, Armors armorType, double defencePoints)
     : base(x, y, width, height, rarity)
 {
     this.ArmorType = armorType;
     this.DefencePoints = defencePoints;
 }
Exemplo n.º 30
0
 /// <summary>
 /// 类型:方法
 /// 名称:CancelEquipments
 /// 作者:taixihuase
 /// 作用:禁用装备属性
 /// 编写日期:2015/8/20
 /// </summary>
 public void CancelEquipments()
 {
     Armors.Cancel(this);
     Jewels.Cancel(this);
     Weapons.Cancel(this);
 }
Exemplo n.º 31
0
 /// <summary>
 /// 类型:方法
 /// 名称:ApplyEquipments
 /// 作者:taixihuase
 /// 作用:启用装备属性
 /// 编写日期:2015/8/20
 /// </summary>
 public void ApplyEquipments()
 {
     Armors.Apply(this);
     Jewels.Apply(this);
     Weapons.Apply(this);
 }
Exemplo n.º 32
0
 public Armor(Armors ar)
 {
     type = Equipment_Type.Armor;
     durability = 100;
     switch (ar)
     {
         case Armors.Light:
             name = Armors.Light.ToString();
             armor = -1;
             weight = 0;
             effects = new Effect[2];
             effects[0] = new Effect(Character_Stats.speed, 1);
             effects[1] = new Effect(Character_Stats.dexterity, 1);
             actions = new Actions[1];
             actions[0] = Actions.Blink;
             break;
         case Armors.Medium:
             name = Armors.Medium.ToString();
             armor = 2;
             weight = 1;
             effects = new Effect[2];
             effects[0] = new Effect(Character_Stats.strength, 1);
             effects[1] = new Effect(Character_Stats.coordination, 1);
             break;
         case Armors.Heavy:
             name = Armors.Heavy.ToString();
             armor = 5;
             weight = 2;
             effects = new Effect[2];
             effects[0] = new Effect(Character_Stats.vitality, 1);
             effects[1] = new Effect(Character_Stats.spirit, 1);
             actions = new Actions[1];
             actions[0] = Actions.Channel;
             break;
     }
 }