Beispiel #1
0
        public static bool UseSkill(Skill skill, Entity entity, DifficultyLevel difficulty)
        {
            bool result = false;
            int target = skill.SkillValue + (int)difficulty;

            foreach (string s in skill.ClassModifiers.Keys)
            {
                if (s == entity.EntityClass)
                {
                    target += skill.ClassModifiers[s];
                }
            }

            foreach (Modifier m in entity.SkillModifiers)
            {
                if (m.Modifying == skill.SkillName)
                {
                    target += m.Amount;
                }
            }

            string lower = skill.PrimaryAttribute.ToLower();

            switch (lower)
            {
                case "strength":
                    target += Skill.AttributeModifier(entity.Strength);
                    break;
                case "dexterity":
                    target += Skill.AttributeModifier(entity.Dexterity);
                    break;
                case "intelligence":
                    target += Skill.AttributeModifier(entity.Intelligence);
                    break;
                case "agility":
                    target += Skill.AttributeModifier(entity.Agility);
                    break;
                case "wisdom":
                    target += Skill.AttributeModifier(entity.Wisdom);
                    break;
                case "vitality":
                    target += Skill.AttributeModifier(entity.Vitality);
                    break;
            }

            if (Mechanics.RollDie(DieType.D100) <= target)
            {
                result = true;
            }

            return result;
        }
Beispiel #2
0
        public static bool UseSkill(Skill skill, Entity entity, DifficultyLevel difficulty)
        {
            bool result = false;

            int target = skill.SkillValue + (int)difficulty;

            foreach (string s in skill.ClassModifiers.Keys)
                if (s == entity.EntityClass)
                    target += skill.ClassModifiers[s];

            foreach (Modifier m in entity.SkillModifiers)
            {
                if (m.Modifying == skill.SkillName)
                    target += m.Amount;
            }

            string lower = skill.PrimaryAttribute.ToLower();

            switch (lower)
            {
                case "strength":
                    target += Skill.AttributeModifier(entity.Strength);
                    break;
                case "dexterity":
                    target += Skill.AttributeModifier(entity.Dexterity);
                    break;
                case "cunning":
                    target += Skill.AttributeModifier(entity.Cunning);
                    break;
                case "willpower":
                    target += Skill.AttributeModifier(entity.Willpower);
                    break;
                case "magic":
                    target += Skill.AttributeModifier(entity.Magic);
                    break;
                case "constitution":
                    target += Skill.AttributeModifier(entity.Constitution);
                    break;
            }

            if (Mechanics.RollDie(DieType.D100) <= target)
                result = true;

            return result;
        }
Beispiel #3
0
        public static Skill SkillFromSkillData(SkillData data)
        {
            Skill skill = new Skill();

            skill.SkillName = data.Name;
            skill.SkillValue = 0;

            foreach (string s in data.ClassModifiers.Keys)
            {
                skill.ClassModifiers.Add(s, data.ClassModifiers[s]);
            }

            return skill;
        }