Ejemplo n.º 1
0
        public void UseMoveOnFoes(BattleSetup setup, TargetCollection targets)
        {
            Parties.Party party = null;
            if (owner.Player.IsInParty()) {
                party = Parties.PartyManager.FindPlayerParty(owner);
            }

            //List<ICharacter> targets = MoveProcessor.GetTargetsInRange(setup.Move.RangeType, setup.Move.Range, setup.AttackerMap, this, owner.Player.X, owner.Player.Y, owner.Player.Direction);

            Move move = setup.SetdownMove();

            foreach (ICharacter i in targets.Foes) {
                // Don't attack allies
                if (i.CharacterType == Enums.CharacterType.Recruit) {
                    Recruit recruit = i as Recruit;
                    if (Ranks.IsAllowed(recruit.Owner, Enums.Rank.Moniter) && !recruit.Owner.Player.Hunted
                        || (recruit.Owner.Player.Map.Tile[recruit.Owner.Player.X, recruit.Owner.Player.Y].Type == Enums.TileType.Arena) != (Owner.Player.Map.Tile[X, Y].Type == Enums.TileType.Arena)) {

                    } else {
                        setup.Defender = i;
                        BattleProcessor.MoveHitCharacter(setup);
                        setup.SetupMove(move);
                        if (setup.Cancel) {
                            return;
                        }
                    }
                } else if (i.CharacterType == Enums.CharacterType.MapNpc && (((MapNpc)i).Num <= 0 || ((MapNpc)i).HP <= 0)) {
                } else if (i.CharacterType == Enums.CharacterType.MapNpc) {
                    MapNpc npc = i as MapNpc;
                    if (Npcs.NpcManager.Npcs[npc.Num].Behavior == Enums.NpcBehavior.Scripted) {
                        if (setup.moveIndex == -1) {
                            Scripting.ScriptManager.InvokeSub("ScriptedNpc", setup.Attacker, Npcs.NpcManager.Npcs[npc.Num].AIScript, npc.Num, owner.Player.Map, i);
                        }
                    } else if (!string.IsNullOrEmpty(Npcs.NpcManager.Npcs[npc.Num].AttackSay) && (Npcs.NpcManager.Npcs[npc.Num].Behavior == Enums.NpcBehavior.Friendly || Npcs.NpcManager.Npcs[npc.Num].Behavior == Enums.NpcBehavior.Shopkeeper)) {
                        if (setup.moveIndex == -1) {
                            Stories.Story story = new Stories.Story();
                            Stories.StoryBuilderSegment segment = Stories.StoryBuilder.BuildStory();
                            Stories.StoryBuilder.AppendSaySegment(segment, Npcs.NpcManager.Npcs[npc.Num].Name.Trim() + ": " + Npcs.NpcManager.Npcs[npc.Num].AttackSay.Trim(),
                                Npcs.NpcManager.Npcs[npc.Num].Species, 0, 0);
                            segment.AppendToStory(story);
                            Stories.StoryManager.PlayStory(owner, story);
                        }
                    } else {
                        setup.Defender = i;
                        BattleProcessor.MoveHitCharacter(setup);
                        setup.SetupMove(move);
                        if (setup.Cancel) {
                            return;
                        }
                    }
                } else {
                    setup.Defender = i;
                    BattleProcessor.MoveHitCharacter(setup);
                    setup.SetupMove(move);
                    if (setup.Cancel) {
                        return;
                    }
                }

            }
        }
Ejemplo n.º 2
0
 public void UseMoveOnAllies(BattleSetup setup, TargetCollection targets)
 {
     Parties.Party party = null;
     if (owner.Player.IsInParty()) {
         party = Parties.PartyManager.FindPlayerParty(owner);
     }
     //List<ICharacter> targets = MoveProcessor.GetTargetsInRange(setup.Move.RangeType, setup.Move.Range, setup.AttackerMap, this, owner.Player.X, owner.Player.Y, owner.Player.Direction);
     Move move = setup.SetdownMove();
     // Attack any players that are on the map
     foreach (ICharacter i in targets.Friends) {
         if (i.CharacterType == Enums.CharacterType.Recruit && Ranks.IsAllowed(((Recruit)i).Owner, Enums.Rank.Moniter)
                 && !((Recruit)i).Owner.Player.Hunted && !((Recruit)i).Owner.Player.Dead) {
         } else {
             setup.Defender = i;
             BattleProcessor.MoveHitCharacter(setup);
             setup.SetupMove(move);
             if (setup.Cancel) {
                 return;
             }
         }
     }
 }
Ejemplo n.º 3
0
        public void UseMoveOnAllies(BattleSetup setup, TargetCollection targets)
        {
            //List<ICharacter> targets = MoveProcessor.GetTargetsInRange(setup.Move.RangeType, setup.Move.Range, setup.AttackerMap, this, X, Y, Direction);
            Move move = setup.SetdownMove();

            foreach (ICharacter i in targets.Friends) {
                if (i.CharacterType == Enums.CharacterType.MapNpc && ((MapNpc)i).Num <= 0) {

                } else {
                    setup.Defender = i;
                    BattleProcessor.MoveHitCharacter(setup);
                    setup.SetupMove(move);
                    if (setup.Cancel) {
                        return;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void UseMoveOnFoes(BattleSetup setup, TargetCollection targets)
        {
            // Attack any players that are on the map
            //List<ICharacter> targets = MoveProcessor.GetTargetsInRange(setup.Move.RangeType, setup.Move.Range, setup.AttackerMap, this, X, Y, Direction);
            Move move = setup.SetdownMove();

            foreach (ICharacter i in targets.Foes) {
                setup.Defender = i;
                BattleProcessor.MoveHitCharacter(setup);
                setup.SetupMove(move);
                if (setup.Cancel) {
                    return;
                }
            }
        }
Ejemplo n.º 5
0
        public static TargetCollection GetTargetsInRange(Enums.MoveRange rangeType, int range, IMap map, ICharacter user, int userX, int userY, Enums.Direction userDir, bool hitsFoes, bool hitsAllies, bool hitsSelf)
        {
            TargetCollection targetlist = new TargetCollection();

            switch (rangeType) {
                case Enums.MoveRange.Floor: {
                        #region Floor
                        foreach (Client i in map.GetClients()) {
                            if (user == i.Player.GetActiveRecruit() && hitsSelf || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                targetlist.Add(i.Player.GetActiveRecruit(), GetMatchupWith(user, i.Player.GetActiveRecruit()));
                            }
                        }
                        for (int i = 0; i < map.ActiveNpc.Length; i++) {
                            if (map.ActiveNpc[i].Num > 0) {
                                if (user == map.ActiveNpc[i] && hitsSelf || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                    targetlist.Add(map.ActiveNpc[i], GetMatchupWith(user, map.ActiveNpc[i]));
                                }
                            }
                        }
                        #endregion
                    }
                    break;
                case Enums.MoveRange.FrontOfUser: {
                        #region FrontOfUser
                        foreach (Client i in map.GetClients()) {
                            if (IsInFront(range, userDir, userX, userY, i.Player.X, i.Player.Y)) {
                                if (user == i.Player.GetActiveRecruit() && hitsSelf || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                    targetlist.Add(i.Player.GetActiveRecruit(), GetMatchupWith(user, i.Player.GetActiveRecruit()));
                                }
                            }
                        }
                        for (int i = 0; i < map.ActiveNpc.Length; i++) {
                            if (map.ActiveNpc[i].Num > 0 && IsInFront(range, userDir, userX, userY, map.ActiveNpc[i].X, map.ActiveNpc[i].Y)) {
                                if (user == map.ActiveNpc[i] && hitsSelf || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                    targetlist.Add(map.ActiveNpc[i], GetMatchupWith(user, map.ActiveNpc[i]));
                                }
                            }
                        }
                        #endregion
                    }
                    break;
                case Enums.MoveRange.FrontOfUserUntil: {
                        #region FrontOfUserUntil
                        bool stopattile = false;
                        for (int r = 0; r <= range; r++) {
                            foreach (Client i in map.GetClients()) {
                                Enums.CharacterMatchup matchup = GetMatchupWith(user, i.Player.GetActiveRecruit());
                                if (user != i.Player.GetActiveRecruit() && IsInFront(r, userDir, userX, userY, i.Player.X, i.Player.Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                    targetlist.Add(i.Player.GetActiveRecruit(), matchup);
                                    stopattile = true;
                                }
                            }
                            for (int i = 0; i < map.ActiveNpc.Length; i++) {
                                Enums.CharacterMatchup matchup = GetMatchupWith(user, map.ActiveNpc[i]);
                                if (map.ActiveNpc[i].Num > 0 && user != map.ActiveNpc[i] && IsInFront(r, userDir, userX, userY, map.ActiveNpc[i].X, map.ActiveNpc[i].Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                    targetlist.Add(map.ActiveNpc[i], matchup);
                                    stopattile = true;
                                }
                            }
                            if (stopattile) {
                                break;
                            }
                        }

            #endregion
                    }
                    break;
                case Enums.MoveRange.Room: {
                        #region Room
                        foreach (Client i in map.GetClients()) {
                            if (IsInAreaRange(range, userX, userY, i.Player.X, i.Player.Y)) {
                                if (user == i.Player.GetActiveRecruit() && hitsSelf || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                    targetlist.Add(i.Player.GetActiveRecruit(), GetMatchupWith(user, i.Player.GetActiveRecruit()));
                                }
                            }
                        }
                    for (int i = 0; i < map.ActiveNpc.Length; i++) {
                        if (map.ActiveNpc[i].Num > 0 && IsInAreaRange(range, userX, userY, map.ActiveNpc[i].X, map.ActiveNpc[i].Y)) {
                            if (user == map.ActiveNpc[i] && hitsSelf || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                targetlist.Add(map.ActiveNpc[i], GetMatchupWith(user, map.ActiveNpc[i]));
                            }
                            }
                        }
            #endregion
                    }
                    break;
                case Enums.MoveRange.ArcThrow: {
                        #region ArcThrow
                        bool stopAtTile = false;
                        for (int r = 0; r <= range; r++) {
                            //check directly forward
                            foreach (Client i in map.GetClients()) {
                                Enums.CharacterMatchup matchup = GetMatchupWith(user, i.Player.GetActiveRecruit());
                                if (user != i.Player.GetActiveRecruit() && IsInFront(r, userDir, userX, userY, i.Player.X, i.Player.Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                    targetlist.Add(i.Player.GetActiveRecruit(), matchup);
                                    stopAtTile = true;
                                }
                            }

                            for (int i = 0; i < map.ActiveNpc.Length; i++) {
                                Enums.CharacterMatchup matchup = GetMatchupWith(user, map.ActiveNpc[i]);
                                if (map.ActiveNpc[i].Num > 0 && user != map.ActiveNpc[i] && IsInFront(r, userDir, userX, userY, map.ActiveNpc[i].X, map.ActiveNpc[i].Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                    targetlist.Add(map.ActiveNpc[i], matchup);
                                    stopAtTile = true;
                                }
                            }
                            if (stopAtTile) {
                                break;
                            }

                            //check adjacent tiles
                            switch (userDir) {
                                case Enums.Direction.Down: {
                                        for (int s = 1; s <= r; s++) {
                                            foreach (Client i in map.GetClients()) {
                                                Enums.CharacterMatchup matchup = GetMatchupWith(user, i.Player.GetActiveRecruit());
                                                if (IsInFront(0, userDir, userX - s, userY + r, i.Player.X, i.Player.Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                                    targetlist.Add(i.Player.GetActiveRecruit(), matchup);
                                                    stopAtTile = true;
                                                }
                                            }

                                            for (int i = 0; i < map.ActiveNpc.Length; i++) {
                                                Enums.CharacterMatchup matchup = GetMatchupWith(user, map.ActiveNpc[i]);
                                                if (map.ActiveNpc[i].Num > 0 && IsInFront(0, userDir, userX - s, userY + r, map.ActiveNpc[i].X, map.ActiveNpc[i].Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                                    targetlist.Add(map.ActiveNpc[i], matchup);
                                                    stopAtTile = true;
                                                }
                                            }
                                            if (stopAtTile) {
                                                break;
                                            }

                                            foreach (Client i in map.GetClients()) {
                                                Enums.CharacterMatchup matchup = GetMatchupWith(user, i.Player.GetActiveRecruit());
                                                if (IsInFront(0, userDir, userX + s, userY + r, i.Player.X, i.Player.Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                                    targetlist.Add(i.Player.GetActiveRecruit(), matchup);
                                                    stopAtTile = true;
                                                }
                                            }

                                            for (int i = 0; i < map.ActiveNpc.Length; i++) {
                                                Enums.CharacterMatchup matchup = GetMatchupWith(user, map.ActiveNpc[i]);
                                                if (map.ActiveNpc[i].Num > 0 && IsInFront(0, userDir, userX + s, userY + r, map.ActiveNpc[i].X, map.ActiveNpc[i].Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                                    targetlist.Add(map.ActiveNpc[i], matchup);
                                                    stopAtTile = true;
                                                }
                                            }

                                            if (stopAtTile) {
                                                break;
                                            }

                                        }

                                    }
                                    break;
                                case Enums.Direction.Up: {
                                        for (int s = 1; s <= r; s++) {
                                            foreach (Client i in map.GetClients()) {
                                                Enums.CharacterMatchup matchup = GetMatchupWith(user, i.Player.GetActiveRecruit());
                                                if (IsInFront(0, userDir, userX - s, userY - r, i.Player.X, i.Player.Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                                    targetlist.Add(i.Player.GetActiveRecruit(), matchup);
                                                    stopAtTile = true;
                                                }
                                            }

                                            for (int i = 0; i < map.ActiveNpc.Length; i++) {
                                                Enums.CharacterMatchup matchup = GetMatchupWith(user, map.ActiveNpc[i]);
                                                if (map.ActiveNpc[i].Num > 0 && IsInFront(0, userDir, userX - s, userY - r, map.ActiveNpc[i].X, map.ActiveNpc[i].Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                                    targetlist.Add(map.ActiveNpc[i], matchup);
                                                    stopAtTile = true;
                                                }
                                            }
                                            if (stopAtTile) {
                                                break;
                                            }

                                            foreach (Client i in map.GetClients()) {
                                                Enums.CharacterMatchup matchup = GetMatchupWith(user, i.Player.GetActiveRecruit());
                                                if (IsInFront(0, userDir, userX + s, userY - r, i.Player.X, i.Player.Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                                    targetlist.Add(i.Player.GetActiveRecruit(), matchup);
                                                    stopAtTile = true;
                                                }
                                            }

                                            for (int i = 0; i < map.ActiveNpc.Length; i++) {
                                                Enums.CharacterMatchup matchup = GetMatchupWith(user, map.ActiveNpc[i]);
                                                if (map.ActiveNpc[i].Num > 0 && IsInFront(0, userDir, userX + s, userY - r, map.ActiveNpc[i].X, map.ActiveNpc[i].Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                                    targetlist.Add(map.ActiveNpc[i], matchup);
                                                    stopAtTile = true;
                                                }
                                            }

                                            if (stopAtTile) {
                                                break;
                                            }

                                        }

                                    }
                                    break;
                                case Enums.Direction.Left: {
                                        for (int s = 1; s <= r; s++) {
                                            foreach (Client i in map.GetClients()) {
                                                Enums.CharacterMatchup matchup = GetMatchupWith(user, i.Player.GetActiveRecruit());
                                                if (IsInFront(0, userDir, userX - r, userY - s, i.Player.X, i.Player.Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                                    targetlist.Add(i.Player.GetActiveRecruit(), matchup);
                                                    stopAtTile = true;
                                                }
                                            }

                                            for (int i = 0; i < map.ActiveNpc.Length; i++) {
                                                Enums.CharacterMatchup matchup = GetMatchupWith(user, map.ActiveNpc[i]);
                                                if (map.ActiveNpc[i].Num > 0 && IsInFront(0, userDir, userX - r, userY - s, map.ActiveNpc[i].X, map.ActiveNpc[i].Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                                    targetlist.Add(map.ActiveNpc[i], matchup);
                                                    stopAtTile = true;
                                                }
                                            }
                                            if (stopAtTile) {
                                                break;
                                            }

                                            foreach (Client i in map.GetClients()) {
                                                Enums.CharacterMatchup matchup = GetMatchupWith(user, i.Player.GetActiveRecruit());
                                                if (IsInFront(0, userDir, userX - r, userY + s, i.Player.X, i.Player.Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                                    targetlist.Add(i.Player.GetActiveRecruit(), matchup);
                                                    stopAtTile = true;
                                                }
                                            }

                                            for (int i = 0; i < map.ActiveNpc.Length; i++) {
                                                Enums.CharacterMatchup matchup = GetMatchupWith(user, map.ActiveNpc[i]);
                                                if (map.ActiveNpc[i].Num > 0 && IsInFront(0, userDir, userX - r, userY + s, map.ActiveNpc[i].X, map.ActiveNpc[i].Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                                    targetlist.Add(map.ActiveNpc[i], matchup);
                                                    stopAtTile = true;
                                                }
                                            }

                                            if (stopAtTile) {
                                                break;
                                            }

                                        }
                                    }
                                    break;
                                case Enums.Direction.Right: {
                                        for (int s = 1; s <= r; s++) {
                                            foreach (Client i in map.GetClients()) {
                                                Enums.CharacterMatchup matchup = GetMatchupWith(user, i.Player.GetActiveRecruit());
                                                if (IsInFront(0, userDir, userX + r, userY - s, i.Player.X, i.Player.Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                                    targetlist.Add(i.Player.GetActiveRecruit(), matchup);
                                                    stopAtTile = true;
                                                }
                                            }

                                            for (int i = 0; i < map.ActiveNpc.Length; i++) {
                                                Enums.CharacterMatchup matchup = GetMatchupWith(user, map.ActiveNpc[i]);
                                                if (map.ActiveNpc[i].Num > 0 && IsInFront(0, userDir, userX + r, userY - s, map.ActiveNpc[i].X, map.ActiveNpc[i].Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                                    targetlist.Add(map.ActiveNpc[i], matchup);
                                                    stopAtTile = true;
                                                }
                                            }
                                            if (stopAtTile) {
                                                break;
                                            }

                                            foreach (Client i in map.GetClients()) {
                                                Enums.CharacterMatchup matchup = GetMatchupWith(user, i.Player.GetActiveRecruit());
                                                if (IsInFront(0, userDir, userX + r, userY + s, i.Player.X, i.Player.Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                                    targetlist.Add(i.Player.GetActiveRecruit(), matchup);
                                                    stopAtTile = true;
                                                }
                                            }

                                            for (int i = 0; i < map.ActiveNpc.Length; i++) {
                                                Enums.CharacterMatchup matchup = GetMatchupWith(user, map.ActiveNpc[i]);
                                                if (map.ActiveNpc[i].Num > 0 && IsInFront(0, userDir, userX + r, userY + s, map.ActiveNpc[i].X, map.ActiveNpc[i].Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                                    targetlist.Add(map.ActiveNpc[i], matchup);
                                                    stopAtTile = true;
                                                }
                                            }

                                            if (stopAtTile) {
                                                break;
                                            }

                                        }
                                    }
                                    break;
                            }

                            if (stopAtTile) {
                                break;
                            }

                        }
                        #endregion
                    }
                    break;
                case Enums.MoveRange.StraightLine: {
                        #region StraightLine
                        foreach (Client i in map.GetClients()) {
                            if (IsInFront(range, userDir, userX, userY, i.Player.X, i.Player.Y)) {
                                if (user == i.Player.GetActiveRecruit() && hitsSelf || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                    targetlist.Add(i.Player.GetActiveRecruit(), GetMatchupWith(user, i.Player.GetActiveRecruit()));
                                }
                            }
                        }
                        for (int i = 0; i < map.ActiveNpc.Length; i++) {
                            if (map.ActiveNpc[i].Num > 0 && IsInFront(range, userDir, userX, userY, map.ActiveNpc[i].X, map.ActiveNpc[i].Y)) {
                                if (user == map.ActiveNpc[i] && hitsSelf || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                    targetlist.Add(map.ActiveNpc[i], GetMatchupWith(user, map.ActiveNpc[i]));
                                }
                            }
                        }
            #endregion
                    }
                    break;
                case Enums.MoveRange.FrontAndSides: {
                        #region FrontAndSides
                        foreach (Client i in map.GetClients()) {
                            if (IsInFront(range, userDir, userX, userY, i.Player.X, i.Player.Y)) {
                                if (user == i.Player.GetActiveRecruit() && hitsSelf || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                    targetlist.Add(i.Player.GetActiveRecruit(), GetMatchupWith(user, i.Player.GetActiveRecruit()));
                                }
                            }
                            switch (userDir) {
                                case Enums.Direction.Down: {
                                        for (int r = 1; r <= range; r++) {
                                            if (IsInFront(range - r, userDir, userX + r, userY + r, i.Player.X, i.Player.Y)) {
                                                if (user == i.Player.GetActiveRecruit() && hitsSelf || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                                    targetlist.Add(i.Player.GetActiveRecruit(), GetMatchupWith(user, i.Player.GetActiveRecruit()));
                                                }
                                            }
                                            if (IsInFront(range - r, userDir, userX - r, userY + r, i.Player.X, i.Player.Y)) {
                                                if (user == i.Player.GetActiveRecruit() && hitsSelf || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                                    targetlist.Add(i.Player.GetActiveRecruit(), GetMatchupWith(user, i.Player.GetActiveRecruit()));
                                                }
                                            }
                                        }

                                    }
                                    break;
                                case Enums.Direction.Up: {
                                        for (int r = 1; r <= range; r++) {
                                            if (IsInFront(range - r, userDir, userX + r, userY - r, i.Player.X, i.Player.Y)) {
                                                if (user == i.Player.GetActiveRecruit() && hitsSelf || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                                    targetlist.Add(i.Player.GetActiveRecruit(), GetMatchupWith(user, i.Player.GetActiveRecruit()));
                                                }
                                            }
                                            if (IsInFront(range - r, userDir, userX - r, userY - r, i.Player.X, i.Player.Y)) {
                                                if (user == i.Player.GetActiveRecruit() && hitsSelf || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                                    targetlist.Add(i.Player.GetActiveRecruit(), GetMatchupWith(user, i.Player.GetActiveRecruit()));
                                                }
                                            }
                                        }

                                    }
                                    break;
                                case Enums.Direction.Left: {
                                        for (int r = 1; r <= range; r++) {
                                            if (IsInFront(range - r, userDir, userX - r, userY + r, i.Player.X, i.Player.Y)) {
                                                if (user == i.Player.GetActiveRecruit() && hitsSelf || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                                    targetlist.Add(i.Player.GetActiveRecruit(), GetMatchupWith(user, i.Player.GetActiveRecruit()));
                                                }
                                            }
                                            if (IsInFront(range - r, userDir, userX - r, userY - r, i.Player.X, i.Player.Y)) {
                                                if (user == i.Player.GetActiveRecruit() && hitsSelf || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                                    targetlist.Add(i.Player.GetActiveRecruit(), GetMatchupWith(user, i.Player.GetActiveRecruit()));
                                                }
                                            }
                                        }
                                    }
                                    break;
                                case Enums.Direction.Right: {
                                        for (int r = 1; r <= range; r++) {
                                            if (IsInFront(range - r, userDir, userX + r, userY + r, i.Player.X, i.Player.Y)) {
                                                if (user == i.Player.GetActiveRecruit() && hitsSelf || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                                    targetlist.Add(i.Player.GetActiveRecruit(), GetMatchupWith(user, i.Player.GetActiveRecruit()));
                                                }
                                            }
                                            if (IsInFront(range - r, userDir, userX + r, userY - r, i.Player.X, i.Player.Y)) {
                                                if (user == i.Player.GetActiveRecruit() && hitsSelf || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                                    targetlist.Add(i.Player.GetActiveRecruit(), GetMatchupWith(user, i.Player.GetActiveRecruit()));
                                                }
                                            }
                                        }
                                    }
                                    break;
                            }
                        }

                        for (int i = 0; i < map.ActiveNpc.Length; i++) {
                            if (map.ActiveNpc[i].Num > 0 && IsInFront(range, userDir, userX, userY, map.ActiveNpc[i].X, map.ActiveNpc[i].Y)) {
                                if (user == map.ActiveNpc[i] && hitsSelf || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                    targetlist.Add(map.ActiveNpc[i], GetMatchupWith(user, map.ActiveNpc[i]));
                                }
                            }
                            switch (userDir) {
                                case Enums.Direction.Down: {
                                        for (int r = 1; r <= range; r++) {
                                            if (map.ActiveNpc[i].Num > 0 && IsInFront(range - r, userDir, userX + r, userY + r, map.ActiveNpc[i].X, map.ActiveNpc[i].Y)) {
                                                if (user == map.ActiveNpc[i] && hitsSelf || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                                    targetlist.Add(map.ActiveNpc[i], GetMatchupWith(user, map.ActiveNpc[i]));
                                                }
                                            }
                                            if (map.ActiveNpc[i].Num > 0 && IsInFront(range - r, userDir, userX - r, userY + r, map.ActiveNpc[i].X, map.ActiveNpc[i].Y)) {
                                                if (user == map.ActiveNpc[i] && hitsSelf || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                                    targetlist.Add(map.ActiveNpc[i], GetMatchupWith(user, map.ActiveNpc[i]));
                                                }
                                            }
                                        }

                                    }
                                    break;
                                case Enums.Direction.Up: {
                                        for (int r = 1; r <= range; r++) {
                                            if (map.ActiveNpc[i].Num > 0 && IsInFront(range - r, userDir, userX + r, userY - r, map.ActiveNpc[i].X, map.ActiveNpc[i].Y)) {
                                                if (user == map.ActiveNpc[i] && hitsSelf || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                                    targetlist.Add(map.ActiveNpc[i], GetMatchupWith(user, map.ActiveNpc[i]));
                                                }
                                            }
                                            if (map.ActiveNpc[i].Num > 0 && IsInFront(range - r, userDir, userX - r, userY - r, map.ActiveNpc[i].X, map.ActiveNpc[i].Y)) {
                                                if (user == map.ActiveNpc[i] && hitsSelf || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                                    targetlist.Add(map.ActiveNpc[i], GetMatchupWith(user, map.ActiveNpc[i]));
                                                }
                                            }
                                        }

                                    }
                                    break;
                                case Enums.Direction.Left: {
                                        for (int r = 1; r <= range; r++) {
                                            if (map.ActiveNpc[i].Num > 0 && IsInFront(range - r, userDir, userX - r, userY + r, map.ActiveNpc[i].X, map.ActiveNpc[i].Y)) {
                                                if (user == map.ActiveNpc[i] && hitsSelf || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                                    targetlist.Add(map.ActiveNpc[i], GetMatchupWith(user, map.ActiveNpc[i]));
                                                }
                                            }
                                            if (map.ActiveNpc[i].Num > 0 && IsInFront(range - r, userDir, userX - r, userY - r, map.ActiveNpc[i].X, map.ActiveNpc[i].Y)) {
                                                if (user == map.ActiveNpc[i] && hitsSelf || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                                    targetlist.Add(map.ActiveNpc[i], GetMatchupWith(user, map.ActiveNpc[i]));
                                                }
                                            }
                                        }
                                    }
                                    break;
                                case Enums.Direction.Right: {
                                        for (int r = 1; r <= range; r++) {
                                            if (map.ActiveNpc[i].Num > 0 && IsInFront(range - r, userDir, userX + r, userY + r, map.ActiveNpc[i].X, map.ActiveNpc[i].Y)) {
                                                if (user == map.ActiveNpc[i] && hitsSelf || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                                    targetlist.Add(map.ActiveNpc[i], GetMatchupWith(user, map.ActiveNpc[i]));
                                                }
                                            }
                                            if (map.ActiveNpc[i].Num > 0 && IsInFront(range - r, userDir, userX + r, userY - r, map.ActiveNpc[i].X, map.ActiveNpc[i].Y)) {
                                                if (user == map.ActiveNpc[i] && hitsSelf || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                                    targetlist.Add(map.ActiveNpc[i], GetMatchupWith(user, map.ActiveNpc[i]));
                                                }
                                            }
                                        }
                                    }
                                    break;
                            }
                        }

            #endregion
                    }
                    break;
                case Enums.MoveRange.LineUntilHit: {
                        #region LineUntilHit
                        bool stopattile = false;
                        for (int r = 0; r <= range; r++) {
                            foreach (Client i in map.GetClients()) {
                                Enums.CharacterMatchup matchup = GetMatchupWith(user, i.Player.GetActiveRecruit());
                                if (user != i.Player.GetActiveRecruit() && IsInFront(r, userDir, userX, userY, i.Player.X, i.Player.Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                    targetlist.Add(i.Player.GetActiveRecruit(), matchup);
                                    stopattile = true;
                                }
                            }
                            for (int i = 0; i < map.ActiveNpc.Length; i++) {
                                Enums.CharacterMatchup matchup = GetMatchupWith(user, map.ActiveNpc[i]);
                                if (map.ActiveNpc[i].Num > 0 && user != map.ActiveNpc[i] && IsInFront(r, userDir, userX, userY, map.ActiveNpc[i].X, map.ActiveNpc[i].Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                    targetlist.Add(map.ActiveNpc[i], matchup);
                                    stopattile = true;
                                }
                            }
                            if (stopattile) {
                                break;
                            }
                        }

                        #endregion
                    }
                    break;
                case Enums.MoveRange.User: {
                        targetlist.Add(user, Enums.CharacterMatchup.Self);
                    }
                    break;
                case Enums.MoveRange.Special: {
                        targetlist.Add(null, Enums.CharacterMatchup.None);
                    }
                    break;
            }

            return targetlist;
        }