Exemple #1
0
        public static void NewVerb()
        {
            string inputString = InputFilter.ReadL();

            mods.Clear();
            inputString = inputString.ToLower();
            string[] inputAr = inputString.Split(' ');
            if (inputAr.Length != 0)
            {
                verb = inputAr[0];
                foreach (Verb item in Game.verbs)                 // goes through all verbs that are in the list Game.verbs
                {
                    if (verb == item.name.ToLower())              //if player first input is one of the verbs name
                    {
                        if (item.hasMods && inputAr.Length > 1)
                        {
                            foreach (string allowed in item.allowedMods)
                            {
                                if (allowed.ToLower() == inputAr[1])
                                {
                                    mods.Add(inputAr[1]);
                                }
                            }
                            if (mods.Count > 0)
                            {
                                return;
                            }
                        }
                        else if (!item.hasMods || (item.hasMods && item.allowedMods.Count == 0))
                        {
                            return;
                        }
                        else if (item.modsAllowedEmpty && mods.Count == 0)
                        {
                            return;
                        }
                        if (item.hasMods)
                        {
                            Output.ErrorText("Allowed mods: " + item.allowedMods.ReturnAllString(), true);
                        }
                    }
                }
            }

            Output.ErrorText("Incorrect input", true);
            NewVerb();
        }