Exemple #1
0
        public static void SkillInfo(StringBuilder sb, Skill skill)
        {
            sb.AppendLine(String.Format("{0} - Required Level: {1}", RPGHelper.WrapInColor(skill.Name, OC.LightBlue), skill.RequiredLevel));
            if (skill.SkillpointsPerLevel > 1)
                sb.AppendLine(String.Format("Each skill level costs {0} skillpoints",
                    skill.SkillpointsPerLevel));

            if (skill.RequiredStats.Count > 0)
            {
                StringBuilder sbs = new StringBuilder();
                foreach (var requiredStat in skill.RequiredStats)
                    sbs.Append(String.Format("{0}: {1} |", requiredStat.Key, requiredStat.Value));
                sb.AppendLine(String.Format("Required stats: {0}", sbs));
            }
            sb.AppendLine(String.Format("{0}", skill.Description));
            if (skill.Usage != null)
                sb.AppendLine(String.Format("{0}{1}",RPGHelper.WrapInColor("Usage: ", OC.Teal) ,skill.Usage));
            sb.AppendLine("-----------------");
        }
Exemple #2
0
        public int AddSkill(Skill skill, int points, out string reason)
        {
            int pointsToAdd = Math.Abs(points);
            var requiredPoints = pointsToAdd * skill.SkillpointsPerLevel;
            if (SkillPoints < requiredPoints)
            {
                reason = HMK.NotEnoughtPoints;
                return 0;
            }
            if (Level < skill.RequiredLevel)
            {
                reason = HMK.NotEnoughLevels;
                return 0;
            }
            foreach (var requiredStat in skill.RequiredStats)
            {
                switch (requiredStat.Key.ToLower())
                {
                    case "str":
                        if (Strength < requiredStat.Value)
                        {
                            reason = HMK.NotEnoughStrength;
                            return 0;
                        }
                    break;
                    case "agi":
                        if (Agility < requiredStat.Value)
                        {
                            reason = HMK.NotEnoughAgility;
                            return 0;
                        }
                    break;
                    case "int":
                        if (Intelligence < requiredStat.Value)
                        {
                            reason = HMK.NotEnoughIntelligence;
                            return 0;
                        }
                        break;
                }
            }
            if (Skills.ContainsKey(skill.Name))
            {
                int existingPoints = Skills[skill.Name];
                if (existingPoints + points > skill.MaxPoints)
                    pointsToAdd = skill.MaxPoints - existingPoints;
                if(pointsToAdd >  0)
                    Skills[skill.Name] += pointsToAdd;
            }
            else
            {
                if (points > skill.MaxPoints)
                    pointsToAdd = skill.MaxPoints;
                Skills.Add(skill.Name, pointsToAdd);
            }

            if (pointsToAdd <= 0)
            {
                reason = HMK.AlreadyAtMaxLevel;
                return 0;
            }
            reason = "";
            SkillPoints -= pointsToAdd * skill.SkillpointsPerLevel;
            return pointsToAdd;
        }
Exemple #3
0
 public static Dictionary<string, Skill> GenerateSkillTable()
 {
     var skillTable = new Dictionary<string, Skill>();
     var lumberJack = new Skill(HRK.LumberJack, "This skill allows you to gather wood faster. Each point gives you 10% more wood per hit.", 0, 20);
     var woodAndFleshModifier = new Modifier(HRK.GatherModifier, new List<object>(){10});
     lumberJack.AddModifier(HRK.GatherModifier, woodAndFleshModifier);
     skillTable.Add(HRK.LumberJack, lumberJack);
     var miner = new Skill(HRK.Miner, "This skill allows you to gather stones faster. Each point gives you 5% more stones per hit.", 0, 20);
     miner.AddModifier(HRK.GatherModifier, new Modifier(HRK.GatherModifier, new List<object>(){5}));
     skillTable.Add(HRK.Miner, miner);
     var hunter = new Skill(HRK.Hunter, "This skill allows you to gather resources faster from animals. Each point gives you 10% more resources per hit.", 0, 20);
     hunter.AddModifier(HRK.GatherModifier, woodAndFleshModifier);
     skillTable.Add(HRK.Hunter, hunter);
     var researcher = new Skill(HRK.Researcher, "This skill allows you to research items you have. Each level enables a type of type to be researched and decreases 2 minutes of cooldown. Table: Level 1 - Tools (10 min); Level 2 - Clothes (8 min); Level 3 - Construction and Resources (6 min); Level 4 - Ammunition and Medic (4 min); Level 5 - Weapons (2 min)", 30, 5);
     researcher.SkillpointsPerLevel = 7;
     researcher.Usage = "To research an item type \"/research \"Item Name\" \". In order to research an item, you must have it on your invetory, and have the required skill level for that item tier.";
     researcher.AddRequiredStat("int", (int) Math.Floor(researcher.RequiredLevel*2.5d));
     researcher.AddModifier(HRK.CooldownModifier, new Modifier(HRK.CooldownModifier, new List<object>() {10,2}));
     skillTable.Add(HRK.Researcher, researcher);
     var blacksmith = new Skill(HRK.Blacksmith, "This skill allows your furnaces to melt more resources each time. Each level gives increase the productivity by 1.",30, 5);
     blacksmith.SkillpointsPerLevel = 7;
     blacksmith.AddRequiredStat("str", (int)Math.Floor(blacksmith.RequiredLevel * 2.5d));
     skillTable.Add(HRK.Blacksmith, blacksmith);
     var blinkarrow = new Skill(HRK.BlinkArrow, "This skill allows you to blink to your arrow destination from time to time. Each level deacreases the cooldown in 2 minutes.", 70, 5);
     blinkarrow.Usage = "Just shoot an Arrow at desired blink location. To toogle this skill type \"/h ba\" . To change the auto toggle for this skill type \"/h aba\"";
     blinkarrow.AddModifier(HRK.CooldownModifier, new Modifier(HRK.CooldownModifier, new List<object>() {9, 2}));
     blinkarrow.SkillpointsPerLevel = 10;
     blinkarrow.AddRequiredStat("agi", (int)Math.Floor(blinkarrow.RequiredLevel * 2.5d));
     skillTable.Add(HRK.BlinkArrow, blinkarrow);
     return skillTable;
 }