示例#1
0
        private void affect(L2Character target)
        {
            Random rn = new Random();

            if (Template.Skills != null)
            {
                foreach (Skill sk in Template.Skills.Where(sk => rn.Next(0, 100) <= Template.SkillProb))
                {
                    target.AddAbnormal(sk, target, true, false);
                }
            }

            if (Template.Skill != null)
            {
                if (rn.Next(0, 100) > Template.SkillProb)
                {
                    return;
                }

                target.AddAbnormal(Template.Skill, target, true, false);
            }

            //надо бы как то найти и вынести эту фичу. она недокументирована
            if (!Template.Name.StartsWithIgnoreCase("[spa_") || !Template.Name.EndsWithIgnoreCase("1]"))
            {
                return;
            }

            if (rn.Next(0, 100) > Template.SkillProb)
            {
                return;
            }

            const int a = 4551,
                      b = 4552,
                      c = 4553,
                      d = 4554;

            int x1 = 0,
                x2 = 0;
            int id = int.Parse(Template.Name.Substring(5).Replace("]", string.Empty));

            switch (id)
            {
            case 11:
                x1 = a;
                x2 = c;
                break;     //bd

            case 21:
                x1 = c;
                x2 = b;
                break;     //ad

            case 31:
                x1 = a;
                x2 = b;
                break;     //cd

            case 41:
                x1 = c;
                x2 = b;
                break;     //ad

            case 51:
                x1 = a;
                x2 = b;
                break;     //cd

            case 61:
                x1 = a;
                x2 = c;
                break;     //bd

            case 71:
                x1 = b;
                x2 = c;
                break;     //ad

            case 81:
                x1 = a;
                x2 = b;
                break;     //cd

            case 91:
                x1 = a;
                x2 = c;
                break;     //bd
            }

            if (rn.Next(0, 100) <= Template.SkillProb)
            {
                target.AddAbnormalSpa(x1, false);
            }

            if (rn.Next(0, 100) <= Template.SkillProb)
            {
                target.AddAbnormalSpa(x2, false);
            }

            if (rn.Next(0, 100) <= Template.SkillProb)
            {
                target.AddAbnormalSpa(d, false);
            }
        }