コード例 #1
0
 public bool CanReach(PlayerState state)
 {
     foreach (Connection entrance in Entrances)
     {
         if (state.CanReach(entrance))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #2
0
        public bool CanReach(PlayerState state)
        {
            foreach (Exit entrance in Entrances)
            {
                if (state.EscapeCheck && (entrance.ExitType == ExitType.PrisonExit || entrance.ExitType == ExitType.PrisonGate ||
                                          entrance.ExitType == ExitType.Pyramid || entrance.ExitType == ExitType.Corridor))
                {
                    continue;
                }

                if (state.CanReach(entrance))
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #3
0
 public bool CanReach(PlayerState state)
 {
     return(LogicTree.Evaluate(state) && state.CanReach(ParentAreaName));
 }
コード例 #4
0
        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);
        }