Example #1
0
 public void MoveSouth()
 {
     if (CurrentLocation.LocationToSouth != null)
     {
         lastTraveledDirection = LastTraveledDirection.south;
         MoveTo(CurrentLocation.LocationToSouth);
     }
 }
Example #2
0
 public void MoveWest()
 {
     if (CurrentLocation.LocationToWest != null)
     {
         lastTraveledDirection = LastTraveledDirection.west;
         MoveTo(CurrentLocation.LocationToWest);
     }
 }
Example #3
0
        public void MoveTo(Location location)
        {
            if (PlayerDoesNotHaveTheRequiredItemToEnter(location))
            {
                RaiseMessage("You must have a " + location.ItemRequiredToEnter.Name + " to enter the " + location.Name + ".");
                return;
            }

            if (PlayerDoesNotHaveRequiredLevelToEnter(location))
            {
                RaiseMessage("You must be level " + location.MinimumLevelRequiredToEnter + " to enter the " + location.Name + ".");
                return;
            }

            if (CurrentMonster != null && CurrentMonster.IsDead == false && !IsDead)
            {
                RaiseMessage("You run away from the " + CurrentMonster.Name, true);
            }

            // The player can enter this location
            switch (lastTraveledDirection)
            {
            case LastTraveledDirection.north:
                RaiseMessage(CurrentLocation.NorthTravelText);
                break;

            case LastTraveledDirection.east:
                //if (location.EastTravelText != null)
                //{
                RaiseMessage(CurrentLocation.EastTravelText);
                //}
                break;

            case LastTraveledDirection.south:
                //if (location.SouthTravelText != null)
                //{
                RaiseMessage(CurrentLocation.SouthTravelText);
                //}
                break;

            case LastTraveledDirection.west:
                //if (location.WestTravelText != null)
                //{
                RaiseMessage(CurrentLocation.WestTravelText);
                // }
                break;

            case LastTraveledDirection.noDirection:
                break;

            default:
                break;
            }
            lastTraveledDirection = LastTraveledDirection.noDirection;

            CurrentLocation = location;

            CompletelyHeal();

            if (location.HasAQuest)
            {
                if (PlayerDoesNotHaveThisQuest(location.QuestAvailableHere))
                {
                    GiveQuestToPlayer(location.QuestAvailableHere);
                }
                else
                {
                    if (PlayerHasNotCompleted(location.QuestAvailableHere) &&
                        PlayerHasAllQuestCompletionItemsFor(location.QuestAvailableHere))
                    {
                        GivePlayerQuestRewards(location.QuestAvailableHere);
                    }
                }
            }

            SetTheCurrentMonsterForTheCurrentLocation(location);
        }