Esempio n. 1
0
        public SortedList <int, L2Object> GetAffectedTargets(L2Character actor)
        {
            SortedList <int, L2Object> targets = new SortedList <int, L2Object>();

            switch (AffectScope)
            {
            case SkillScope.Single:
            {
                switch (TargetType)
                {
                case SkillTarget.Self:
                    targets.Add(actor.ObjId, actor);
                    break;

                case SkillTarget.Friend:
                case SkillTarget.Enemy:
                case SkillTarget.Any:
                case SkillTarget.Target:
                    if (actor.CurrentTarget != null)
                    {
                        targets.Add(actor.CurrentTarget.ObjId, actor.CurrentTarget);
                    }
                    break;

                case SkillTarget.Master:
                    if (actor is L2Summon)
                    {
                        targets.Add(((L2Summon)actor).Owner.ObjId, ((L2Summon)actor).Owner);
                    }
                    break;

                case SkillTarget.Unlockable:
                {
                    if (actor.CurrentTarget is L2Door)
                    {
                        targets.Add(actor.CurrentTarget.ObjId, actor.CurrentTarget);
                    }
                }
                break;
                }
            }

            break;

            case SkillScope.Party:
                L2Character[] members = actor.GetPartyCharacters();
                targets = members.Where(member => Calcs.CalculateDistance(actor, member, true) < CastRange).ToSortedList(member => member.ObjId, member => (L2Object)member);
                break;
            }

            return(targets);
        }