public bool CanReach(PlayerState state)
 {
     return(LogicTree.Evaluate(state) && state.CanReach(ParentAreaName));
 }
        public static bool EntrancePlacementCheck(Randomiser randomiser)
        {
            PlayerState state    = new PlayerState(randomiser);
            ItemPool    itemPool = new ItemPool(FileUtils.LoadItemFile());

            if (randomiser.Settings.ShopPlacement == ShopPlacement.Original)
            {
                randomiser.PlaceShopItems(itemPool);
            }

            if (randomiser.Settings.MantraPlacement == MantraPlacement.Original)
            {
                randomiser.PlaceMantras(itemPool);
            }

            foreach (Item item in itemPool)
            {
                state.CollectItem(item);
            }

            List <Location> requiredLocations = randomiser.GetPlacedLocations();
            List <Location> reachableLocations;

            do
            {
                reachableLocations = state.GetReachableLocations(requiredLocations);
                foreach (Location location in reachableLocations)
                {
                    state.CollectItem(location.Item);
                    state.collectedLocations.Add(location.Name, true);
                }

                state.RemoveFalseCheckedAreasAndEntrances();
            } while (reachableLocations.Count > 0);

            //check to see if its possible to beat the game with this configuration
            if (!state.CanBeatGame())
            {
                return(false);
            }

            //check to see if all locations are accessable
            foreach (Location location in randomiser.GetLocations())
            {
                if (!location.CanReach(state))
                {
                    return(false);
                }
            }

            //check to see if its possible to actually escape
            state.EscapeCheck  = true;
            state.StartingArea = randomiser.GetArea("Immortal Battlefield Main");
            List <string> exitNames = new List <string>()
            {
                "Cliff", "Gate of Guidance", "Mausoleum of Giants", "Village of Departure", "Gate of Illusion", "Nibiru"
            };

            foreach (string exitName in exitNames)
            {
                state.ClearCheckedAreasAndEntrances();
                if (state.CanReach(exitName))
                {
                    return(true);
                }
            }
            return(false);
        }