protected new void AddItem(string[] inputParams)
 {
     Character characterToAcceptIitem = GetCharacterById(inputParams[1]);
     Item itemToAdd;
     switch (inputParams[2].ToLower())
     {
         case "axe":
             itemToAdd = new Axe(inputParams[3]);
             characterToAcceptIitem.AddToInventory(itemToAdd);
             break;
         case "shield":
             itemToAdd = new Shield(inputParams[3]);
             characterToAcceptIitem.AddToInventory(itemToAdd);
             break;
         case "pill":
             itemToAdd = new Pill(inputParams[3]);
             characterToAcceptIitem.AddToInventory(itemToAdd);
             break;
         case "injection":
             itemToAdd = new Injection(inputParams[3]);
             characterToAcceptIitem.AddToInventory(itemToAdd);
             break;
         default:
             break;
     }
 }
        protected new void AddItem(string[] inputParams)
        {
            var characterId = inputParams[1];
            var character = this.characterList.Find(x => x.Id == characterId);

            var itemClass = inputParams[2];
            var itemId = inputParams[3];

            Item item;
            switch (itemClass)
            {
                case "axe":
                    item = new Axe(itemId);
                    break;
                case "shield":
                    item = new Shield(itemId);
                    break;
                case "pill":
                    item = new Pill(itemId);
                    break;
                case "injection":
                default:
                    item = new Injection(itemId);
                    break;
            }

            character.AddToInventory(item);
        }
Ejemplo n.º 3
0
        // add character itemClass itemId
        protected void AddItem(string[] inputParams)
        {
            Character champion = GetCharacterById(inputParams[1]);
            Item artifact;

            switch (inputParams[2].ToLower())
            {
                case "axe":
                    artifact = new Axe(
                        inputParams[3],
                        0,
                        0,
                        75);
                    champion.AddToInventory(artifact);
                    break;

                case "shield":
                    artifact = new Shield(
                        inputParams[3],
                        0,
                        50,
                        0);
                    champion.AddToInventory(artifact);
                    break;

                case "injection":
                    artifact = new Injection(
                        inputParams[3],
                        200,
                        0,
                        0);
                    champion.AddToInventory(artifact);
                    break;

                case "pill":
                    artifact = new Pill(
                        inputParams[3],
                        0,
                        0,
                        100);
                    champion.AddToInventory(artifact);
                    break;

                default :
                    break;
            }
        }
Ejemplo n.º 4
0
        private void AddItem(string[] inputParams)
        {
            Item item = null;
            switch (inputParams[2])
            {
                case "axe":
                    item = new Axe(inputParams[3]);
                    break;
                case "shield":
                    item = new Shield(inputParams[3]);
                    break;
                case "pill":
                    item = new Pill(inputParams[3]);
                    break;
                case "injection":
                    item = new Injection(inputParams[3]);
                    break;
            }

            var target = base.GetCharacterById(inputParams[1]);

            target.AddToInventory(item);
        }
Ejemplo n.º 5
0
        private new void AddItem(string[] inputParams)
        {
            Item item;
            switch (inputParams[2].ToLower())
            {
                case "axe":
                    item = new Axe(inputParams[3]);
                    break;
                case "shield":
                    item = new Shield(inputParams[3]);
                    break;
                case "injection":
                    item = new Injection(inputParams[3]);
                    break;
                case "pill":
                    item  =new Pill(inputParams[3]);
                    break;
                default:
                    throw new ApplicationException("No such kind of item.");
            }

            var character = this.characterList.First(c => c.Id == inputParams[1]);
            character.AddToInventory(item);
        }
Ejemplo n.º 6
0
        protected void AddItem(string[] inputParams)
        {
            string nameOfCharacter = inputParams[1];
            string typeOfItem = inputParams[2];
            string nameOfItem = inputParams[3];

            switch (typeOfItem)
            {
                case "axe":
                    Item axe = new Axe(nameOfItem);
                    characterList.Find(character => character.Id == nameOfCharacter).AddToInventory(axe);
                    break;
                case "injection":
                    Bonus injection = new Injection(nameOfItem);
                    characterList.Find(character => character.Id == nameOfCharacter).AddToInventory(injection);
                    break;
                case "pill":
                    Bonus pill = new Pill(nameOfItem);
                    characterList.Find(character => character.Id == nameOfCharacter).AddToInventory(pill);
                    break;
                case "shield":
                    Item shield = new Shield(nameOfItem);
                    characterList.Find(character => character.Id == nameOfCharacter).AddToInventory(shield);
                    break;
                default:
                    throw new GameException("No such item exists");
            }
        }