/** * Given a command, process (that is: execute) the command. * If this command ends the game, true is returned, otherwise false is * returned. */ private bool ProcessCommand(Command command) { bool wantToQuit = false; if (command.IsUnknown()) { TextEffects.ColoredMessage("I don't know what you mean...\n", "DarkRed"); return(false); } string commandWord = command.CommandWord; switch (commandWord) { case "help": PrintHelp(); break; case "go": if (inCombat) { TextEffects.ColoredMessage("You can't do that in combat!\n", "DarkRed"); break; } GoRoom(command); break; case "quit": if (inCombat) { TextEffects.ColoredMessage("You can't do that in combat!\n", "DarkRed"); break; } wantToQuit = true; break; case "look": if (inCombat) { TextEffects.ColoredMessage("You can't do that in combat!\n", "DarkRed"); break; } TextEffects.CheckNullWriteLine(player.CurrentRoom.GetLongDescription()); break; case "inventory": TextEffects.ColoredMessage(player.GetHealth(), "Red"); TextEffects.SecondaryColoredMessage(player.GetInventoryDesc(), "White", "DarkGray"); break; case "take": if (inCombat) { TextEffects.ColoredMessage("You can't do that in combat!\n", "DarkRed"); break; } TextEffects.CheckNullWriteLine(player.PickupItem(command)); break; case "drop": if (inCombat) { TextEffects.ColoredMessage("You can't do that in combat!\n", "DarkRed"); break; } TextEffects.CheckNullWriteLine(player.DropItem(command)); break; case "use": TextEffects.CheckNullWriteLine(player.UseItem(command)); break; case "attack": if (inCombat) { TextEffects.CheckNullWriteLine(player.AttackEnemy()); break; } TextEffects.CheckNullWriteLine(player.Attack()); break; case "equip": TextEffects.CheckNullWriteLine(player.EquipItem(command)); break; case "unequip": TextEffects.CheckNullWriteLine(player.Unequip()); break; } return(wantToQuit); }