Beispiel #1
0
        public string JoinParty(string[] args)
        {
            var faction       = args[0];
            var characterType = args[1];
            var name          = args[2];
            var character     = characterFactory.CreateCharacter(faction, characterType, name);

            players.Add(character);
            return($"{name} joined the party!");
        }
Beispiel #2
0
        public string JoinParty(string[] args)
        {
            var fation = args[0];
            var type   = args[1];
            var name   = args[2];
            var cc     = character.CreateCharacter(fation, type, name);

            characters.Add(cc);
            return($"{name} joined the party!");
        }
Beispiel #3
0
        public string JoinParty(string[] args)
        {
            string faction       = args[0];
            string characterType = args[1];
            string name          = args[2];

            Character character = characterFactory.CreateCharacter(name, characterType, faction);

            party.Add(character);
            return($"{args[2]} joined the party!");
        }
Beispiel #4
0
        public string JoinParty(string[] args)
        {
            string    faction   = args[0];
            string    type      = args[1];
            string    name      = args[2];
            Character character = characterFactory.CreateCharacter(faction, type, name);

            charaters.Add(character);

            return($"{name} joined the party!");
        }
Beispiel #5
0
        public string JoinParty(string[] args)
        {
            var characterFactory = new CharacterFactory();
            var faction          = args[0];
            var type             = args[1];
            var name             = args[2];
            var newCharacter     = characterFactory.CreateCharacter(faction, type, name);

            Party.Add(newCharacter);
            LastSurvivorRounds = 0;
            return($"{newCharacter.Name} joined the party!");
        }
        public string JoinParty(string[] args)
        {
            string inputFaction  = args[0];
            string characterType = args[1];
            string characterName = args[2];

            Character character = characterFactory.CreateCharacter(inputFaction, characterType, characterName);

            this.party.Add(character);

            return($"{character.Name} joined the party!");
        }
Beispiel #7
0
        public string JoinParty(string[] args)
        {
            string           faction          = args[0];
            string           characterType    = args[1];
            string           name             = args[2];
            CharacterFactory characterFactory = new CharacterFactory();
            var character = characterFactory.CreateCharacter(faction, characterType, name);

            characterParty.Add(character);

            return($"{character.Name} joined the party!");
        }
        //        Parameters
        //•	faction – a string
        //•	characterType – string
        //•	name – string
        //Functionality
        //Creates a character and adds them to the party.
        //If the faction is invalid, throw an ArgumentException with the message Invalid faction "{faction}"!
        //If the character type is invalid, throw an ArgumentException with the message “Invalid character type "{characterType}"!”
        //Returns the string “{name} joined the party!”

        public string JoinParty(string[] args)
        {
            string factionString = args[0];
            string charType      = args[1];
            string name          = args[2];

            Faction faction;

            if (!Enum.TryParse(factionString, out faction))
            {
                throw new ArgumentException($"Invalid faction \"{factionString}\"!");
            }

            Character newCharacter = CharacterFactory.CreateCharacter(factionString, charType, name);

            this.CharacterParty.Add(newCharacter);
            return($"{name} joined the party!");
        }