public PartyFormationModel(PartyFormation formation)
        {
            Movements = string.Join(", ", formation.Movements.Select(s => s.ToDirection().ToString()));
            Rng       = formation.RngState;

            Lineups = new BindingList <LineupModel>(formation.Lineups.Select(s => new LineupModel(s, false)).ToList());
            Lineups.OrderBy(l => l.Count).First().IsFastest = true;
        }
예제 #2
0
        public LeaderBrain(NWCreature owner) : base(owner)
        {
            fDir      = Directions.DtNone;
            fList     = new ExtList <NWCreature>();
            Formation = PartyFormation.pfWedge;
            AddMember(owner);

            fOffsets = new PMPos[PartyMax + 1];
            for (int i = 0; i <= PartyMax; i++)
            {
                fOffsets[i] = new PMPos();
            }
        }
예제 #3
0
        private static int[, ] SelectMask(PartyFormation formation, int dir)
        {
            string[] srcMask = new string[MaskSize];
            switch (formation)
            {
            case PartyFormation.pfWedge:
                switch (dir)
                {
                case Directions.DtNorth:
                case Directions.DtEast:
                case Directions.DtSouth:
                case Directions.DtWest:
                    srcMask = WedgeN;
                    break;

                case Directions.DtNorthEast:
                case Directions.DtSouthEast:
                case Directions.DtSouthWest:
                case Directions.DtNorthWest:
                    srcMask = WedgeNE;
                    break;
                }
                break;

            case PartyFormation.pfRing:
                switch (dir)
                {
                case Directions.DtNorth:
                case Directions.DtEast:
                case Directions.DtSouth:
                case Directions.DtWest:
                    srcMask = RingN;
                    break;

                case Directions.DtNorthEast:
                case Directions.DtSouthEast:
                case Directions.DtSouthWest:
                case Directions.DtNorthWest:
                    srcMask = RingNE;
                    break;
                }
                break;

            case PartyFormation.pfSquare:
                switch (dir)
                {
                case Directions.DtNorth:
                case Directions.DtEast:
                case Directions.DtSouth:
                case Directions.DtWest:
                    srcMask = SquareN;
                    break;

                case Directions.DtNorthEast:
                case Directions.DtSouthEast:
                case Directions.DtSouthWest:
                case Directions.DtNorthWest:
                    srcMask = SquareNE;
                    break;
                }
                break;

            case PartyFormation.pfChain:
                switch (dir)
                {
                case Directions.DtNorth:
                case Directions.DtEast:
                case Directions.DtSouth:
                case Directions.DtWest:
                    srcMask = ChainN;
                    break;

                case Directions.DtNorthEast:
                case Directions.DtSouthEast:
                case Directions.DtSouthWest:
                case Directions.DtNorthWest:
                    srcMask = ChainNE;
                    break;
                }
                break;
            }

            int[, ] destMask = new int[MaskSize, MaskSize];
            for (int y = 0; y < MaskSize; y++)
            {
                string line = srcMask[y];
                for (int x = 0; x < MaskSize; x++)
                {
                    char sym = line[x];
                    int  cell;
                    switch (sym)
                    {
                    case ' ':
                        cell = -1;
                        break;

                    case 'L':
                        cell = 0;
                        break;

                    default:
                        string num = Convert.ToString(sym);
                        cell = Convert.ToInt32(num);
                        break;
                    }
                    destMask[y, x] = cell;
                }
            }

            int[, ] res;
            switch (dir)
            {
            case Directions.DtNorth:
            case Directions.DtNorthEast:
                res = destMask;
                break;

            case Directions.DtEast:
            case Directions.DtSouthEast:
                res = Rotate(destMask, RK_CW90);
                break;

            case Directions.DtSouth:
            case Directions.DtSouthWest:
                res = Rotate(destMask, RK_CW180);
                break;

            case Directions.DtWest:
            case Directions.DtNorthWest:
                res = Rotate(destMask, RK_CCW90);
                break;

            default:
                res = destMask;
                break;
            }

            return(res);
        }