public override UserMessage Show(CastleItem item) { UserMessage returnMessage = new UserMessage(); if (showItem == null) { returnMessage.AddLine(String.Format("The {0}", Name)); returnMessage.AddLine("looks at you"); returnMessage.AddLine("Funny!"); } else { if (String.Compare(item.InventoryName, showItem, StringComparison.CurrentCultureIgnoreCase) == 0) { this.IsVisible = false; returnMessage.AddLine(showDescription); } else { returnMessage.AddLine(String.Format("The {0}", Name)); returnMessage.AddLine("looks at you"); returnMessage.AddLine("Funny!"); } } return returnMessage; }
private void CreateWarpRooms() { // Sorcerers room UserMessage userMessage = new UserMessage(); userMessage.AddLine("There is a "); userMessage.AddLine("puff of smoke"); userMessage.AddLine("& you appear"); userMessage.AddLine("in the"); userMessage.AddLine("Sorcerers room"); FindRoom(66).AddWarp(new RoomWarp(66, 67, 16, 9, userMessage)); // Kings hidden room FindRoom(83).AddWarp(new RoomWarp(83, 77, 11, 16, new UserMessage())); // Add Doors in Room 68 Collection<Point> room68Door = new Collection<Point>(); room68Door.Add(new Point(8, 14)); room68Door.Add(new Point(9, 14)); Collection<Point> room68UnlockPoints = new Collection<Point>(); room68UnlockPoints.Add(new Point(8, 13)); room68UnlockPoints.Add(new Point(9, 13)); room68UnlockPoints.Add(new Point(8, 15)); room68UnlockPoints.Add(new Point(9, 15)); FindRoom(68).AddDoor(new Door(68, room68Door, room68UnlockPoints)); // Add Doors in Room 82 Collection<Point> room82Door = new Collection<Point>(); room82Door.Add(new Point(13, 8)); room82Door.Add(new Point(13, 9)); Collection<Point> room82UnlockPoints = new Collection<Point>(); room82UnlockPoints.Add(new Point(12, 8)); room82UnlockPoints.Add(new Point(12, 9)); room82UnlockPoints.Add(new Point(14, 8)); room82UnlockPoints.Add(new Point(14, 9)); FindRoom(82).AddDoor(new Door(82, room82Door, room82UnlockPoints)); // Add Trap room 76 Collection<Point> room76Trigger = new Collection<Point>(); room76Trigger.Add(new Point(13, 12)); room76Trigger.Add(new Point(13, 13)); Collection<Point> room76TrapWall = new Collection<Point>(); room76TrapWall.Add(new Point(10, 12)); room76TrapWall.Add(new Point(10, 13)); room76TrapWall.Add(new Point(16, 12)); room76TrapWall.Add(new Point(16, 13)); FindRoom(76).AddTrap(new Trap(76, room76Trigger, room76TrapWall, 10, 15, 12, 13)); // Add Trap room 78 Collection<Point> room78Trigger = new Collection<Point>(); room78Trigger.Add(new Point(17, 8)); room78Trigger.Add(new Point(17, 9)); Collection<Point> room78TrapWall = new Collection<Point>(); room78TrapWall.Add(new Point(11, 8)); room78TrapWall.Add(new Point(11, 9)); room78TrapWall.Add(new Point(23, 8)); room78TrapWall.Add(new Point(23, 9)); FindRoom(78).AddTrap(new Trap(78, room78Trigger, room78TrapWall, 11, 22, 8, 9)); }
public override UserMessage Hit(CastleItem sword) { UserMessage returnMessage = new UserMessage(); returnMessage.AddLine(String.Format("The {0}", Name)); returnMessage.AddLine("is blocking"); returnMessage.AddLine("your way. He"); returnMessage.AddLine("can't be hurt."); return returnMessage; }
public override UserMessage Play(CastleItem item) { UserMessage returnMessage = null; if (playItem != null) { if (String.Compare(item.InventoryName, playItem, StringComparison.CurrentCultureIgnoreCase) == 0) { returnMessage = new UserMessage(); this.IsVisible = false; returnMessage.AddLine(showDescription); } } return returnMessage; }
private void ShowRoom() { UserMessage userMessage = new UserMessage("Room : " + this.currentRoomIndex); PrintUserMessage(userMessage); }
private void PrintUserMessage(UserMessage userMessage) { ClearMessages(false); int index = Room.MapHeight - 5; foreach (string line in userMessage.Messages) { this.CellData.Print(Room.MapWidth + 1, index, line, Color.White); index++; } }
private void MovePlayer() { UserMessage message; int testRoomIndex; Point previewMove = player.PreviewMove(player.CurrentDirection); switch(CollisionDetection(previewMove)) { case ObjectType.None: player.Move(previewMove); break; case ObjectType.Door: if (currentRoom.RoomWarp == null) { testRoomIndex = currentRoom.GetNextRoom(player.CurrentDirection); if(testRoomIndex == -1) { this.GameResult = Castle.GameResult.Win; EndGame(); if (StopGamePlay != null) { StopGamePlay(this, new EventArgs()); } return; } if (mapReader.FindRoom(testRoomIndex).Dark) { if (ItemManager.FindItemInInventory("Lamp") != null) { currentRoomIndex = testRoomIndex; MovePlayerRoom(previewMove); DrawRoom(); } else { message = new UserMessage(); message.AddLine("It's too dark"); message.AddLine("to go that way"); PrintUserMessage(message); } } else { currentRoomIndex = testRoomIndex; MovePlayerRoom(previewMove); DrawRoom(); } } else { currentRoomIndex = currentRoom.RoomWarp.DestinationRoomId; previewMove.X = currentRoom.RoomWarp.X; previewMove.Y = currentRoom.RoomWarp.Y; message = currentRoom.RoomWarp.UserMessage; player.Move(previewMove); DrawRoom(); PrintUserMessage(message); } break; case ObjectType.UpStairs: currentRoomIndex = currentRoom.GetNextRoom(Direction.UpStairs); DrawRoom(); break; case ObjectType.DownStairs: testRoomIndex = currentRoom.GetNextRoom(Direction.DownStairs); if (mapReader.FindRoom(testRoomIndex).Dark) { if (ItemManager.FindItemInInventory("Lamp") != null) { currentRoomIndex = currentRoom.GetNextRoom(Direction.DownStairs); DrawRoom(); } else { message = new UserMessage(); message.AddLine("It's too dark"); message.AddLine("to go that way"); PrintUserMessage(message); } } else { currentRoomIndex = currentRoom.GetNextRoom(Direction.DownStairs); DrawRoom(); } break; case ObjectType.LockedDoor: message = new UserMessage(); message.AddLine("The Door is"); message.AddLine("locked"); PrintUserMessage(message); break; case ObjectType.Trap: if(ProcessTrap() == false) { player.Move(previewMove); } break; case ObjectType.Item: PickupItem(previewMove); break; case ObjectType.Monster: AttackMonster(previewMove); break; } }
public UserMessage CommandShow(Command command) { UserMessage returnMessage = new UserMessage(); CastleItem item = FindItemInInventory(command.Subject); if(item == null) { returnMessage.AddLine("I don't have"); returnMessage.AddLine(String.Format("a {0}", command.Subject)); return returnMessage; } Monster monster = FindMonsterInRoom(); if(monster == null) { returnMessage.AddLine("There's not"); returnMessage.AddLine("anyone to"); returnMessage.AddLine("show it to!"); return returnMessage; } returnMessage = monster.Show(item); if (monster.IsVisible == false) { CurrentRoomMonsters.Remove(monster); } return returnMessage; }
public UserMessage CommandWave(Command command, Point position) { UserMessage returnMessage = RunSpecialCommand(command.Verb, command.Subject, position); if(returnMessage == null) { returnMessage = new UserMessage(); CastleItem item = FindItemInInventory(command.Subject); if(item != null) { returnMessage.AddLine("You look awful"); returnMessage.AddLine("Silly waving"); returnMessage.AddLine(String.Format("that {0}", item.GetDescription)); } else { item = FindItem(command.Subject); if(item != null) { returnMessage.AddLine("You don't have"); returnMessage.AddLine(String.Format("a {0}", item.GetDescription)); } else { returnMessage.AddLine("You don't have"); returnMessage.AddLine(String.Format("a {0}", command.Subject)); } } } return returnMessage; }
public UserMessage CommandWear(Command command, Point position) { // Run the wear command UserMessage returnMessage = RunSpecialCommand(command.Verb, command.Subject, position); if (returnMessage == null) { returnMessage = new UserMessage(); CastleItem item = FindItemInInventory(command.Subject); if (item == null) { returnMessage.AddLine(" You don't"); returnMessage.AddLine(" have it!"); return returnMessage; } // Determine if it is a real item item = FindItem(command.Subject); if(item == null) { returnMessage.AddLine("You don't have"); returnMessage.AddLine(String.Format("a {0}!", command.Subject)); } else if(item.IsSpecialCommandSupported(CommandVerb.Wear)) { returnMessage.AddLine(" You don't"); returnMessage.AddLine(" have it!"); } else { returnMessage.AddLine("That could be"); returnMessage.AddLine("Difficult!"); } } return returnMessage; }
public override UserMessage RunAction(UpdateMapCb updateMapCb) { UserMessage returnMessage = new UserMessage(); returnMessage.AddLine("As you wave"); returnMessage.AddLine("the WAND...."); returnMessage.AddLine(" There is a"); returnMessage.AddLine("Puff of smoke"); returnMessage.AddLine("revealing"); returnMessage.AddLine("a Secret"); returnMessage.AddLine("passage!"); Collection<ReplacementPoint> replacementPoints = new Collection<ReplacementPoint>(); // Erase mirror replacementPoints.Add(new ReplacementPoint(18, 6, 32)); replacementPoints.Add(new ReplacementPoint(18, 7, 32)); replacementPoints.Add(new ReplacementPoint(18, 8, 32)); replacementPoints.Add(new ReplacementPoint(18, 9, 32)); replacementPoints.Add(new ReplacementPoint(18, 10, 32)); replacementPoints.Add(new ReplacementPoint(18, 11, 32)); // Erase Wall replacementPoints.Add(new ReplacementPoint(19, 8, 32)); replacementPoints.Add(new ReplacementPoint(19, 9, 32)); // Add Wall replacementPoints.Add(new ReplacementPoint(20, 7, 178)); replacementPoints.Add(new ReplacementPoint(21, 7, 178)); replacementPoints.Add(new ReplacementPoint(22, 7, 178)); replacementPoints.Add(new ReplacementPoint(23, 7, 178)); replacementPoints.Add(new ReplacementPoint(20, 10, 178)); replacementPoints.Add(new ReplacementPoint(21, 10, 178)); replacementPoints.Add(new ReplacementPoint(22, 10, 178)); replacementPoints.Add(new ReplacementPoint(23, 10, 178)); updateMapCb(replacementPoints); return returnMessage; }
private UserMessage Wave(string subject, int currentRoomIndex, Point location, FindItemInInventoryCb findItemInInventoryCb) { UserMessage userMessage = null; foreach(var specialRoomAction in specialRoomActions) { if(specialRoomAction.RoomId == currentRoomIndex) { userMessage = specialRoomAction.RunAction(updateMapCb); } } if (userMessage == null) { userMessage = new UserMessage(); userMessage.AddLine("As you wave"); userMessage.AddLine("the WAND...."); userMessage.AddLine(" "); userMessage.AddLine(" Nothing"); userMessage.AddLine(" Happens!"); } return userMessage; }
private UserMessage Read(string subject, int currentRoomIndex, Point location, FindItemInInventoryCb findItemInInventoryCb) { UserMessage userMessage = new UserMessage(); CastleItem glasses = findItemInInventoryCb("Glasses"); if(glasses == null) { userMessage.AddLine(" You can't see"); userMessage.AddLine(" well enough"); userMessage.AddLine(" It's all"); userMessage.AddLine(" Blurry."); } else { userMessage.AddLine("The book reads"); userMessage.AddLine(" Wave Scepter"); } return userMessage; }
private UserMessage Drink(string subject, int currentRoomIndex, Point location, FindItemInInventoryCb findItemInInventoryCb) { if(subject.StartsWith("water", StringComparison.CurrentCultureIgnoreCase) == false) { return null; } UserMessage returnMessage = new UserMessage(); if (Full) { returnMessage.AddLine("That was Good!"); if (Thirsty) { returnMessage.AddLine("I feel much"); returnMessage.AddLine("better now!"); Thirsty = false; Empty(); } } else { returnMessage.AddLine("You don't have"); returnMessage.AddLine("any WATER"); } return returnMessage; }
private UserMessage GetWater(string subject, int currentRoomIndex, Point location, FindItemInInventoryCb findItemInInventoryCb) { if (subject.StartsWith("water", StringComparison.CurrentCultureIgnoreCase) == false) { return null; } UserMessage returnMessage = new UserMessage(); if (this.CanTakeItem(location)) { CastleItem castleItem = findItemInInventoryCb("flask"); if(castleItem.IsSpecialCommandSupported(CommandVerb.Drink)) { DrinkableItem drinkableItem = castleItem as DrinkableItem; if (drinkableItem.Full == false) { drinkableItem.Fill(); returnMessage.AddLine("Done"); } else { returnMessage.AddLine(" The flask is full!"); } } else { returnMessage.AddLine("You don't have a Container!"); } } else { returnMessage.AddLine(" I can't reach it!"); } return returnMessage; }
public UserMessage CommandDrop(Command command, Point location, bool collision) { UserMessage returnMessage = new UserMessage(); // Verify item is in our inventory CastleItem item = FindItemInInventory(command.Subject); if (item == null) { returnMessage.AddLine("You don't have"); returnMessage.AddLine(String.Format("a {0}", command.Subject)); return returnMessage; } // Verify that nothing is in the way if(collision) { returnMessage.AddLine(" Something is"); returnMessage.AddLine(" in the way!"); return returnMessage; } // Drop the item currentInventory.Remove(item); CurrentRoomItems.Add(item); item.PutDown(currentRoomIndex, location); returnMessage.Character = item.Character; returnMessage.AddLine(" Done"); return returnMessage; }
public UserMessage CommandDrink(Command command, Point location) { UserMessage returnMessage = RunSpecialCommand(command.Verb, command.Subject, location); if( returnMessage == null) { returnMessage = new UserMessage(); returnMessage.AddLine("You don't have"); returnMessage.AddLine(String.Format("a {0}!", command.Subject)); } return returnMessage; }
public override UserMessage RunAction(UpdateMapCb updateMapCb) { UserMessage returnMessage = new UserMessage(); returnMessage.AddLine("As you wave"); returnMessage.AddLine("the WAND...."); returnMessage.AddLine(" There is a"); returnMessage.AddLine("Puff of smoke"); returnMessage.AddLine("revealing"); returnMessage.AddLine("a Secret"); returnMessage.AddLine("passage!"); Collection<ReplacementPoint> replacementPoints = new Collection<ReplacementPoint>(); // Erase Wall replacementPoints.Add(new ReplacementPoint(11, 17, 32)); replacementPoints.Add(new ReplacementPoint(12, 17, 32)); // Add Wall replacementPoints.Add(new ReplacementPoint(10, 17, 221)); replacementPoints.Add(new ReplacementPoint(13, 17, 222)); updateMapCb(replacementPoints); return returnMessage; }
public UserMessage CommandRead(Command command, Point position) { // Run the read command UserMessage returnMessage = RunSpecialCommand(command.Verb, command.Subject, position); if (returnMessage == null) { returnMessage = new UserMessage(); CastleItem item = FindItem(command.Subject); if (item != null) { returnMessage.AddLine("You don't"); returnMessage.AddLine(" have a book!"); } else { returnMessage.AddLine(" You can't"); returnMessage.AddLine(" read That!"); } } return returnMessage; }
public override UserMessage RunAction(UpdateMapCb updateMapCb) { UserMessage returnMessage = new UserMessage(); returnMessage.AddLine("As you wave"); returnMessage.AddLine("the SCEPTER..."); returnMessage.AddLine(" "); returnMessage.AddLine("The Gate opens"); returnMessage.AddLine("by itself!"); Collection<ReplacementPoint> replacementPoints = new Collection<ReplacementPoint>(); // Erase Wall replacementPoints.Add(new ReplacementPoint(10, 17, 32)); replacementPoints.Add(new ReplacementPoint(11, 17, 32)); replacementPoints.Add(new ReplacementPoint(12, 17, 32)); replacementPoints.Add(new ReplacementPoint(13, 17, 32)); updateMapCb(replacementPoints); return returnMessage; }
public UserMessage CommandOpen(Command command, Point position, Room currentRoom) { // Run the Open command UserMessage returnMessage = new UserMessage(); CastleItem key = FindItemInInventory("Key"); if(key == null) { returnMessage.AddLine(" You don't"); returnMessage.AddLine(" have a key!"); return returnMessage; } if(command.Subject.StartsWith("Door", StringComparison.CurrentCultureIgnoreCase) == false) { returnMessage.AddLine("Impossible!!"); return returnMessage; } // Is door in room if (currentRoom.Door == null) { returnMessage.AddLine(" I don't"); returnMessage.AddLine(" see a door."); return returnMessage; } if (currentRoom.Door.Locked) { foreach (Point point in currentRoom.Door.UnlockPoints) { if (position.X == point.X && position.Y == point.Y) { currentRoom.Door.Locked = false; returnMessage.AddLine("Done"); return returnMessage; } } } returnMessage.AddLine(" I can't"); returnMessage.AddLine(" reach it!."); return returnMessage; }
public UserMessage PickupItem(Point point) { UserMessage returnMessage = new UserMessage(); if (currentInventory.Count >= maxItems) { returnMessage.AddLine("Can't carry any more!"); } else { CastleItem pickupItem = null; foreach (var item in CurrentRoomItems) { if (item.Location.X == point.X && item.Location.Y == point.Y) { pickupItem = item; break; } } CurrentRoomItems.Remove(pickupItem); currentInventory.Add(pickupItem); pickupItem.PickUp(); } return returnMessage; }
public UserMessage CommandPlay(Command command, Point position) { // Run the play command var returnMessage = new UserMessage(); CastleItem item = FindItemInInventory(command.Subject); if (item == null) { returnMessage.AddLine(" You don't"); returnMessage.AddLine(" have it!"); return returnMessage; } Monster monster = FindMonsterInRoom(); if (monster != null) { UserMessage monsterMessage = monster.Play(item); if(monsterMessage != null) { if (monster.IsVisible == false) { CurrentRoomMonsters.Remove(monster); } return monsterMessage; } } returnMessage = RunSpecialCommand(command.Verb, command.Subject, position); if (returnMessage != null) { return returnMessage; } // Determine if it is a real item item = FindItem(command.Subject); if (item == null) { returnMessage.AddLine("You don't have"); returnMessage.AddLine(String.Format("a {0}!", command.Subject)); } else if (item.IsSpecialCommandSupported(CommandVerb.Play)) { returnMessage.AddLine(" You don't"); returnMessage.AddLine(" have it!"); } else { returnMessage.AddLine(String.Format("The {0}", item.InventoryName)); returnMessage.AddLine("makes Horrible"); returnMessage.AddLine("music!!"); } return returnMessage; }
public UserMessage AttackMonster(Point point) { UserMessage returnMessage = new UserMessage(); CastleItem sword = FindItemInInventory("Sword"); Monster monster = FindMonsterInRoom(); if(monster.Position.X == point.X && monster.Position.Y == point.Y) { returnMessage = monster.Hit(sword); } return returnMessage; }
private void MoveMonster(Monster monster) { Point previewMove = monster.PreviewMove(player.Position); if (previewMove.X == player.Position.X && previewMove.Y == player.Position.Y) { UserMessage message = new UserMessage(); bool hasHelmet = false; CastleItem helmet = ItemManager.FindItemInInventory("helmet"); if(helmet != null) { hasHelmet = true; } if (player.Hit(hasHelmet)) { message.AddLine(String.Format("The {0}", monster.Name)); message.AddLine("killed you!"); PrintUserMessage(message); GameResult = GameResult.Failed; EndGame(); gameOver = true; } else { message.AddLine(String.Format("The {0}", monster.Name)); message.AddLine("struck you!"); if (hasHelmet) { message.AddLine("The Helmet"); message.AddLine("helped."); } PrintUserMessage(message); } } else { switch (CollisionDetection(previewMove)) { case ObjectType.None: monster.Move(previewMove); break; } } }
public UserMessage CommandInventory() { UserMessage returnMessage = new UserMessage(); returnMessage.AddLine("- Inventory -"); if(currentInventory.Count == 0) { returnMessage.AddLine(String.Empty); returnMessage.AddLine(" Nothing"); } else { foreach(var item in currentInventory) { StringBuilder newLine = new StringBuilder(); newLine.Append(Convert.ToChar(item.Character)); newLine.Append(" "); newLine.Append(item.InventoryName); returnMessage.AddLine(newLine.ToString()); } } return returnMessage; }
private bool ProcessTrap() { if(ItemManager.FindItemInInventory("Necklace") != null) { return false; } GameResult = GameResult.Failed; // Draw Walls foreach(Point wallPoint in currentRoom.Trap.WallPoints) { this.CellData.SetCharacter(wallPoint.X, wallPoint.Y, 178, Color.White); } waterXStart = currentRoom.Trap.WaterFlowXStart; waterXEnd = currentRoom.Trap.WaterFlowXEnd - 1; waterYStart = currentRoom.Trap.WaterFlowYStart; waterYEnd = currentRoom.Trap.WaterFlowYEnd; // Animate the water animation = new InstructionSet(); animation.Instructions.AddLast(new Wait() { Duration = 0.2f }); var waterFillInstruction = new CodeInstruction(); waterFillInstruction.CodeCallback = (inst) => { waterXStart += 1; if (waterXStart > waterXEnd) { inst.IsFinished = true; gameOver = true; } this.CellData.SetCharacter(waterXStart, waterYStart, 176, Color.White); this.CellData.SetCharacter(waterXStart, waterYEnd, 176, Color.White); }; animation.Instructions.AddLast(waterFillInstruction); UserMessage userMessage = new UserMessage(); userMessage.AddLine("You have"); userMessage.AddLine("sprung a Trap!"); userMessage.AddLine("The room has"); userMessage.AddLine("filled with"); userMessage.AddLine("water and you"); userMessage.AddLine("drowned!"); // Kill Character this.player.Kill(); PrintUserMessage(userMessage); EndGame(); return true; }
public UserMessage CommandLook(Command command) { UserMessage returnMessage = new UserMessage(); CastleObject item = null; // Find all inventory objects item = FindItemInInventory(command.Subject); if(item != null) { returnMessage.AddLine(item.Description); return returnMessage; } // Find all Furnature objects item = FindFurnatureInRoom(command.Subject); if(item != null) { returnMessage.AddLine(item.Description); return returnMessage; } // Find all items item = FindItem(command.Subject); if (item != null) { returnMessage.AddLine(" You Don't"); returnMessage.AddLine(" Have it!"); return returnMessage; } // Find univesral item = FindFurnature(command.Subject); if (item != null) { CastleFurnature castleFurnature = item as CastleFurnature; if (castleFurnature.LookFailMessage != null) { returnMessage.AddLine("I don't see"); returnMessage.AddLine(castleFurnature.LookFailMessage); return returnMessage; } } // Find Monster Monster monster = FindMonsterInRoom(); if(monster != null) { if(monster.IsAlive) { returnMessage.AddLine(monster.Description); } else { returnMessage.AddLine(monster.DeadDescription); } return returnMessage; } returnMessage.AddLine("I don't see"); returnMessage.AddLine(String.Format("a {0}", command.Subject)); returnMessage.AddLine("and I don't"); returnMessage.AddLine("have a"); returnMessage.AddLine(String.Format("{0}!", command.Subject)); return returnMessage; }
private void ShowPoint() { UserMessage userMessage = new UserMessage(String.Format(" X: {0} Y: {1}", player.Position.X, player.Position.Y)); PrintUserMessage(userMessage); }
public UserMessage CommandTake(Command command, Point location) { UserMessage returnMessage = new UserMessage(); // Look in inventory CastleItem item = FindItemInInventory(command.Subject); if (item != null) { returnMessage.AddLine(" You already"); returnMessage.AddLine(" have it!"); return returnMessage; } // Look for hidden items CastleFurnatureContainer container = FindHiddenItem(command.Subject); if(container != null) { if (container.CanTakeItem(location)) { if (currentInventory.Count >= maxItems) { returnMessage.AddLine("Can't carry any more!"); return returnMessage; } CastleItem getItem = container.TakeItem(); currentInventory.Add(getItem); getItem.PickUp(); returnMessage.AddLine("Done."); return returnMessage; } else { returnMessage.AddLine(" I can't"); returnMessage.AddLine(" reach it!"); return returnMessage; } } // Look for items in the room we can take item = FindItemInRoom(command.Subject); if(item != null) { returnMessage.AddLine(" Get it"); returnMessage.AddLine(" Yourself!"); return returnMessage; } // Look for items in the room we can not take item = FindItem(command.Subject); if (item != null) { returnMessage.AddLine(" I don't see"); returnMessage.AddLine(String.Format(" a {0}", item.GetDescription)); return returnMessage; } // Look for furnature in the room CastleFurnature castleFurnature = FindFurnatureInRoom(command.Subject); if(castleFurnature != null) { if (castleFurnature.GetDescription != null) { returnMessage.AddLine(String.Format("{0}", castleFurnature.GetDescription)); returnMessage.AddLine("are too heavy!"); return returnMessage; } } // Look for furnature in any room castleFurnature = FindFurnature(command.Subject); if (castleFurnature != null) { if (castleFurnature.GetDescription != null) { returnMessage.AddLine(String.Format("{0}", castleFurnature.GetDescription)); returnMessage.AddLine("are too heavy!"); returnMessage.AddLine("and I don't"); returnMessage.AddLine("see any!"); return returnMessage; } } // Look for monsters in the room Monster monster = FindMonsterInRoom(); if(monster != null) { returnMessage.AddLine("I don't think"); returnMessage.AddLine("that would be"); returnMessage.AddLine("very safe!"); return returnMessage; } // Look for special Cases foreach(var roomItem in currentRoomFurnatureItems) { if (roomItem.IsSpecialCommandSupported(CommandVerb.Take)) { UserMessage message = roomItem.RunCommand(CommandVerb.Take, command.Subject, this.currentRoomIndex, location, FindItemInInventory); if(message != null) { return message; } } } returnMessage.AddLine("Impossible!!"); return returnMessage; }