Beispiel #1
0
        public static Position Move(Gladiator gladiator, MoveDirection moveDir)
        {//each move costs a 1 stamina per encumberance
            Position oldPos = gladiator.Position;
            Position newPos = gladiator.Position;

            switch (moveDir)
            {
            case MoveDirection.N: newPos.Y--; break;

            case MoveDirection.E: newPos.X++; break;

            case MoveDirection.S: newPos.Y++; break;

            case MoveDirection.W: newPos.X--; break;

            case MoveDirection.NE: newPos.Y--; newPos.X++; break;

            case MoveDirection.SE: newPos.Y++; newPos.X++; break;

            case MoveDirection.NW: newPos.Y--; newPos.X--; break;

            case MoveDirection.SW: newPos.Y++; newPos.X--; break;
            }

            if (newPos.X > 7 || newPos.X < 0 || newPos.Y > 7 || newPos.Y < 0)
            {
                return(oldPos);
            }
            else
            {
                return(newPos);
            }
        }
Beispiel #2
0
        static void Main()
        {
            Gladiator spartacus = CharacterCreator.CreateGladiator(FightingStyle.Thraex,
                                                                   new Position {
                X = 1, Y = 1, Facing = Direction.SouthWest
            });

            Gladiator opponent = CharacterCreator.CreateGladiator(FightingStyle.Cestus,
                                                                  new Position {
                X = 6, Y = 6, Facing = Direction.NorthEast
            });

            ArenaMapper.DrawArena(spartacus, opponent);

            InputSystem.WaitForUserInput(spartacus, opponent);
        }
Beispiel #3
0
        public static void WaitForUserInput(Gladiator spartacus, Gladiator opponent)
        {
            //Check for available legal actions by comparing gladiators
            //(grey out unavailable actions?)(maybe with paranthesis)
            //

            var key = Console.ReadKey();

            Gladiator[] gladiators = new Gladiator[2] {
                spartacus, opponent
            };

            switch (key.KeyChar)
            {
            case 'w': gladiators[0].Position = ActionSystem.Move(spartacus, MoveDirection.N); break;

            case 'a': gladiators[0].Position = ActionSystem.Move(spartacus, MoveDirection.W); break;

            case 's': gladiators[0].Position = ActionSystem.Move(spartacus, MoveDirection.S); break;

            case 'd': gladiators[0].Position = ActionSystem.Move(spartacus, MoveDirection.E); break;

            case 'f': gladiators[0].Position.Facing = ActionSystem.Rotate(spartacus, RotateDirection.Left).Facing; break;

            case 'g': gladiators[0].Position.Facing = ActionSystem.Rotate(spartacus, RotateDirection.Right).Facing; break;

            //case 'u': gladiators = ActionSystem.PerformActions(gladiators, Actions.Avoid); break;
            //case 'i': gladiators = ActionSystem.PerformActions(gladiators, Actions.Check); break;
            //case 'j': gladiators = ActionSystem.PerformActions(gladiators, Actions.Hurt); break;
            //case 'l': gladiators = ActionSystem.PerformActions(gladiators, Actions.Maim); break;
            //case 'k': gladiators = ActionSystem.PerformActions(gladiators, Actions.Kill); break;
            case 'q': return;    //fine(end)
            }

            spartacus = gladiators[0];
            opponent  = gladiators[1];

            Console.Clear();
            ArenaMapper.DrawArena(spartacus, opponent);
            WaitForUserInput(spartacus, opponent);
        }
Beispiel #4
0
        public static Position Rotate(Gladiator gladiator, RotateDirection rotateDirection)
        {
            //switch (rotDir)
            //{
            //    case RotateDirection.Left:
            //        gladiator.Position.Facing = gladiator.Position.Facing - 1;
            //        break;
            //}

            //TODO each rotate costs 1/64 per encumberance

            switch (gladiator.Position.Facing)
            {
            case Direction.North:
                switch (rotateDirection)
                {
                case RotateDirection.Left: gladiator.Position.Facing = Direction.NorthWest; break;

                case RotateDirection.Right: gladiator.Position.Facing = Direction.NorthEast; break;
                }
                break;

            case Direction.East:
                switch (rotateDirection)
                {
                case RotateDirection.Left: gladiator.Position.Facing = Direction.NorthEast; break;

                case RotateDirection.Right: gladiator.Position.Facing = Direction.SouthEast; break;
                }
                break;

            case Direction.South:
                switch (rotateDirection)
                {
                case RotateDirection.Left: gladiator.Position.Facing = Direction.SouthEast; break;

                case RotateDirection.Right: gladiator.Position.Facing = Direction.SouthWest; break;
                }
                break;

            case Direction.West:
                switch (rotateDirection)
                {
                case RotateDirection.Left: gladiator.Position.Facing = Direction.SouthWest; break;

                case RotateDirection.Right: gladiator.Position.Facing = Direction.NorthWest; break;
                }
                break;

            case Direction.NorthEast:
                switch (rotateDirection)
                {
                case RotateDirection.Left: gladiator.Position.Facing = Direction.North; break;

                case RotateDirection.Right: gladiator.Position.Facing = Direction.East; break;
                }
                break;

            case Direction.NorthWest:
                switch (rotateDirection)
                {
                case RotateDirection.Left: gladiator.Position.Facing = Direction.West; break;

                case RotateDirection.Right: gladiator.Position.Facing = Direction.North; break;
                }
                break;

            case Direction.SouthEast:
                switch (rotateDirection)
                {
                case RotateDirection.Left: gladiator.Position.Facing = Direction.East; break;

                case RotateDirection.Right: gladiator.Position.Facing = Direction.South; break;
                }
                break;

            case Direction.SouthWest:
                switch (rotateDirection)
                {
                case RotateDirection.Left: gladiator.Position.Facing = Direction.South; break;

                case RotateDirection.Right: gladiator.Position.Facing = Direction.West; break;
                }
                break;
            }

            return(gladiator.Position);
        }
Beispiel #5
0
        public static void DrawArena(Gladiator spartacus, Gladiator opponent)
        {
            ArenaCell[,] arenaCells = new ArenaCell[size, size];
            for (int x = 0; x < size; x++)
            {
                for (int y = 0; y < size; y++)
                {
                    char cGladiatorA = ' '; char cGladiatorB = ' ';
                    char cGladiatorC = ' '; char cGladiatorD = ' ';

                    if (spartacus.Position.X == x && spartacus.Position.Y == y)
                    {
                        switch (spartacus.Position.Facing)
                        {
                        case Direction.North:
                            cGladiatorA = '|'; cGladiatorB = ' ';
                            cGladiatorC = 'Ø'; cGladiatorD = ' '; break;

                        case Direction.East:
                            cGladiatorA = ' '; cGladiatorB = ' ';
                            cGladiatorC = 'Ø'; cGladiatorD = '-'; break;

                        case Direction.South:
                            cGladiatorA = 'Ø'; cGladiatorB = ' ';
                            cGladiatorC = '|'; cGladiatorD = ' '; break;

                        case Direction.West:
                            cGladiatorA = '-'; cGladiatorB = 'Ø';
                            cGladiatorC = ' '; cGladiatorD = ' '; break;

                        case Direction.NorthEast:
                            cGladiatorA = ' '; cGladiatorB = '/';
                            cGladiatorC = 'Ø'; cGladiatorD = ' '; break;

                        case Direction.SouthEast:
                            cGladiatorA = 'Ø'; cGladiatorB = ' ';
                            cGladiatorC = ' '; cGladiatorD = '\\'; break;

                        case Direction.SouthWest:
                            cGladiatorA = ' '; cGladiatorB = 'Ø';
                            cGladiatorC = '/'; cGladiatorD = ' '; break;

                        case Direction.NorthWest:
                            cGladiatorA = '\\'; cGladiatorB = ' ';
                            cGladiatorC = ' '; cGladiatorD = 'Ø'; break;
                        }
                    }

                    if (opponent.Position.X == x && opponent.Position.Y == y)
                    {
                        switch (opponent.Position.Facing)
                        {
                        case Direction.North:
                            cGladiatorA = '|'; cGladiatorB = ' ';
                            cGladiatorC = 'O'; cGladiatorD = ' '; break;

                        case Direction.East:
                            cGladiatorA = ' '; cGladiatorB = ' ';
                            cGladiatorC = 'O'; cGladiatorD = '-'; break;

                        case Direction.South:
                            cGladiatorA = 'O'; cGladiatorB = ' ';
                            cGladiatorC = '|'; cGladiatorD = ' '; break;

                        case Direction.West:
                            cGladiatorA = '-'; cGladiatorB = 'O';
                            cGladiatorC = ' '; cGladiatorD = ' '; break;

                        case Direction.NorthEast:
                            cGladiatorA = '\\'; cGladiatorB = ' ';
                            cGladiatorC = ' '; cGladiatorD = 'O'; break;

                        case Direction.SouthEast:
                            cGladiatorA = ' '; cGladiatorB = 'O';
                            cGladiatorC = '/'; cGladiatorD = ' '; break;

                        case Direction.SouthWest:
                            cGladiatorA = 'O'; cGladiatorB = ' ';
                            cGladiatorC = ' '; cGladiatorD = '\\'; break;

                        case Direction.NorthWest:
                            cGladiatorA = ' '; cGladiatorB = '/';
                            cGladiatorC = 'O'; cGladiatorD = ' '; break;
                        }
                    }

                    arenaCells[x, y] = CreateArenaCell(cGladiatorA, cGladiatorB,
                                                       cGladiatorC, cGladiatorD);

                    if (y == size - 1)
                    {
                        arenaCells[x, y].Bottom = "·····";
                    }

                    if (x == size - 1)
                    {
                        arenaCells[x, y].Top     = "......";
                        arenaCells[x, y].Middle1 = $": {cGladiatorA}{cGladiatorB} :";
                        arenaCells[x, y].Middle2 = $": {cGladiatorC}{cGladiatorD} :";
                    }
                    if (y == size - 1 && x == size - 1)
                    {
                        arenaCells[x, y].Bottom = "······";
                    }
                }
            }

            StringBuilder ASCIIArena = new();

            for (int y = 0; y < arenaCells.GetLength(1); y++)
            {
                ASCIIArena.Append("          ");

                for (int x = 0; x < arenaCells.GetLength(0); x++)
                {
                    ASCIIArena.Append(arenaCells[x, y].Top);
                }

                ASCIIArena.Append("\n          ");

                for (int x = 0; x < arenaCells.GetLength(0); x++)
                {
                    ASCIIArena.Append(arenaCells[x, y].Middle1);
                }

                ASCIIArena.Append("\n          ");

                for (int x = 0; x < arenaCells.GetLength(0); x++)
                {
                    ASCIIArena.Append(arenaCells[x, y].Middle2);
                }

                ASCIIArena.Append("\n");

                if (y == size - 1)
                {
                    ASCIIArena.Append("          ");
                }

                for (int x = 0; x < arenaCells.GetLength(0); x++)
                {
                    ASCIIArena.Append(arenaCells[x, y].Bottom);
                }
            }

            Console.Clear();
            Console.WriteLine("KEY: W = North, A = West, S = South, D = East, F = Left, G = Right, Q = QUIT");
            Console.WriteLine("\n\n\n");
            Console.WriteLine(ASCIIArena);
        }
Beispiel #6
0
        public static Gladiator CreateGladiator(FightingStyle fightingStyle, Position position)
        {
            Gladiator gladiator = new Gladiator {
            };

            switch (fightingStyle)
            {//TODO assign proper equipment
            case FightingStyle.Cestus:
                gladiator.PrimaryWeapon = PrimaryWeapon.Cestus;
                gladiator.OffHand       = OffHand.Cestus;
                gladiator.Armor         = new Armor[2] {
                    Armor.LeftArm, Armor.RightArm
                };
                gladiator.Helmet       = Helmet.None;
                gladiator.Encumberance = Encumberance.Light;
                gladiator.Fatigue      = 0;
                gladiator.Pain         = 0;
                gladiator.Wounds       = new();
                gladiator.Position     = position;
                break;

            case FightingStyle.Dimachaerus:
                gladiator.PrimaryWeapon = PrimaryWeapon.Cestus;
                gladiator.OffHand       = OffHand.Cestus;
                gladiator.Armor         = new Armor[2] {
                    Armor.LeftArm, Armor.RightArm
                };
                gladiator.Helmet       = Helmet.None;
                gladiator.Encumberance = Encumberance.Light;
                gladiator.Fatigue      = 0;
                gladiator.Pain         = 0;
                gladiator.Wounds       = new();
                gladiator.Position     = new();
                break;

            case FightingStyle.Hoplomachus:
                gladiator.PrimaryWeapon = PrimaryWeapon.Cestus;
                gladiator.OffHand       = OffHand.Cestus;
                gladiator.Armor         = new Armor[2] {
                    Armor.LeftArm, Armor.RightArm
                };
                gladiator.Helmet       = Helmet.None;
                gladiator.Encumberance = Encumberance.Light;
                gladiator.Fatigue      = 0;
                gladiator.Pain         = 0;
                gladiator.Wounds       = new();
                gladiator.Position     = new();
                break;

            case FightingStyle.Laqueraius:
                gladiator.PrimaryWeapon = PrimaryWeapon.Cestus;
                gladiator.OffHand       = OffHand.Cestus;
                gladiator.Armor         = new Armor[2] {
                    Armor.LeftArm, Armor.RightArm
                };
                gladiator.Helmet       = Helmet.None;
                gladiator.Encumberance = Encumberance.Light;
                gladiator.Fatigue      = 0;
                gladiator.Pain         = 0;
                gladiator.Wounds       = new();
                gladiator.Position     = new();
                break;

            case FightingStyle.Murmillo:
                gladiator.PrimaryWeapon = PrimaryWeapon.Cestus;
                gladiator.OffHand       = OffHand.Cestus;
                gladiator.Armor         = new Armor[2] {
                    Armor.LeftArm, Armor.RightArm
                };
                gladiator.Helmet       = Helmet.None;
                gladiator.Encumberance = Encumberance.Light;
                gladiator.Fatigue      = 0;
                gladiator.Pain         = 0;
                gladiator.Wounds       = new();
                gladiator.Position     = new();
                break;

            case FightingStyle.Secutor:
                gladiator.PrimaryWeapon = PrimaryWeapon.Cestus;
                gladiator.OffHand       = OffHand.Cestus;
                gladiator.Armor         = new Armor[2] {
                    Armor.LeftArm, Armor.RightArm
                };
                gladiator.Helmet       = Helmet.None;
                gladiator.Encumberance = Encumberance.Light;
                gladiator.Fatigue      = 0;
                gladiator.Pain         = 0;
                gladiator.Wounds       = new();
                gladiator.Position     = new();
                break;

            case FightingStyle.Veles:
                gladiator.PrimaryWeapon = PrimaryWeapon.Veles;
                gladiator.OffHand       = OffHand.SmallShield;
                gladiator.Armor         = new Armor[1] {
                    Armor.LeftArm
                };
                gladiator.Helmet       = Helmet.Helmet;
                gladiator.Encumberance = Encumberance.Medium;
                gladiator.Fatigue      = 0;
                gladiator.Pain         = 0;
                gladiator.Wounds       = new();
                gladiator.Position     = new();
                break;

            case FightingStyle.Thraex:
                gladiator.PrimaryWeapon = PrimaryWeapon.Cestus;
                gladiator.OffHand       = OffHand.Cestus;
                gladiator.Armor         = new Armor[2] {
                    Armor.LeftArm, Armor.RightArm
                };
                gladiator.Helmet       = Helmet.None;
                gladiator.Encumberance = Encumberance.Light;
                gladiator.Fatigue      = 0;
                gladiator.Pain         = 0;
                gladiator.Wounds       = new();
                gladiator.Position     = position;
                break;
            }

            return(gladiator);
        }