コード例 #1
0
        //Setzen der Standard Skills 'Angriff' und 'Ausruhen'
        public static void AddStandardSkills(Character member)
        {
            var skillCadreDataSection =
                ConfigurationManager.GetSection("SkillCadre") as SkillCadreDataSection;

            var attackSkill =
                     skillCadreDataSection.Skills.Cast<SkillElement>()
                         .SingleOrDefault(
                             cadreSkill => cadreSkill.Name == "Angriff");

            var recoverSkill =
                     skillCadreDataSection.Skills.Cast<SkillElement>()
                         .SingleOrDefault(
                             cadreSkill => cadreSkill.Name == "Ausruhen");

            var attackSkillEffects = new List<IEffect>();

            if (member.Class.Equals(Classes.Harasser) || member.Class.Equals(Classes.Patron))
            {
                foreach (EffectElement effect in attackSkill.Effects)
                {
                    if (effect.Name.Equals("MagicalDamage"))
                    {
                        attackSkillEffects.Add(GetEffectFactory.GetEffect(effect.Name));
                    }
                }
            }
            else
            {
                foreach (EffectElement effect in attackSkill.Effects)
                {
                    if (effect.Name.Equals("Damage"))
                    {
                        attackSkillEffects.Add(GetEffectFactory.GetEffect(effect.Name));
                    }
                }
            }

            var recoverSkillEffects = new List<IEffect>();
            foreach (EffectElement effect in recoverSkill.Effects)
            {
                recoverSkillEffects.Add(GetEffectFactory.GetEffect(effect.Name));
            }

            member.SetStandardSkills(
                new Skill(attackSkill.Name, LoadSkillHelperClass.GetManaCosts(Convert.ToInt32(attackSkill.Level)), attackSkill.Target, attackSkill.AreaOfEffect, attackSkill.Description, attackSkillEffects),
                new Skill(recoverSkill.Name, LoadSkillHelperClass.GetManaCosts(Convert.ToInt32(recoverSkill.Level)), recoverSkill.Target, recoverSkill.AreaOfEffect, recoverSkill.Description, recoverSkillEffects)
             );
        }