Beispiel #1
0
        private string ProcessSingleCommand(IComand command)
        {
            string nameOfPlayer = (string)command.Parameters[1];

            switch (command.Parameters[0])
            {
            case "Create":
                if (command.Parameters.Count < 3)
                {
                    return("Create command should have 3 parameters");    // We could change this
                }

                string typeOfPlayer = command.Parameters[2];

                return(this.CreatePlayer(nameOfPlayer, typeOfPlayer));

            case "Equip":
                if (command.Parameters.Count < 3)
                {
                    return("Equip command should have 3 parameters");    // We could change this
                }

                string typeOfItem = command.Parameters[2];

                return(this.EquipPlayer(nameOfPlayer, typeOfItem));

            case "Cast":
                string enemyPlayer = command.Parameters[3];
                if (command.Parameters.Count < 4)
                {
                    return("Cast command should have 4 parameters");    // We could change this
                }

                string skillName = command.Parameters[2];

                return(this.CastPlayer(nameOfPlayer, skillName, enemyPlayer));
            }

            return(string.Format(InvalidCommand, command.Parameters[0]));
        }
Beispiel #2
0
 public void SetCommand(IComand com)
 {
     comand = com;
 }
Beispiel #3
0
 public void SetCommand(int number, IComand comand)
 {
     Command[number] = comand;
 }
Beispiel #4
0
 public CommandWithChangeFlag(IComand cmd)
 {
     _cmd = cmd;
 }
Beispiel #5
0
 public void Add(IComand comand)
 {
     comands.Add(comand.Name, comand);
 }
Beispiel #6
0
 public User(IComand booking)
 {
     Booking = booking;
 }
Beispiel #7
0
 public void SetCommand(IComand command)
 {
   this.commandToBePerformed = command;
 }