public static PlayerState GetStateWithItems(Randomiser randomiser, List <Item> currentItems) { PlayerState state = new PlayerState(randomiser); state.CollectItem(randomiser.StartingWeapon); foreach (Item item in currentItems) { state.CollectItem(item); } List <Location> requiredLocations = randomiser.GetPlacedRequiredItemLocations(); List <Location> reachableLocations; do { reachableLocations = state.GetReachableLocations(requiredLocations); foreach (Location location in reachableLocations) { state.CollectItem(location.Item); state.collectedLocations.Add(location.Name, true); } state.ResetCheckedAreasAndEntrances(); } while (reachableLocations.Count > 0); return(state); }
public static bool AnkhSoftlockCheck(Randomiser randomiser) { foreach (Location guardianToSkip in randomiser.GetPlacedLocationsOfType(LocationType.Guardian)) { PlayerState state = new PlayerState(randomiser) { SoftlockCheck = true }; state.CollectItem(randomiser.StartingWeapon); int guardiansEncountered = 0; List <Location> requiredLocations = randomiser.GetPlacedRequiredItemLocations(); List <Location> reachableLocations; do { reachableLocations = state.GetReachableLocations(requiredLocations); foreach (Location location in reachableLocations) { state.collectedLocations.Add(location.Name, true); if (location.LocationType == LocationType.Guardian) { if (!location.Equals(guardianToSkip)) { state.CollectItem(location.Item); guardiansEncountered++; } } else { state.CollectItem(location.Item); } } state.RemoveFalseCheckedAreasAndEntrances(); } while (reachableLocations.Count > 0); if (guardiansEncountered >= state.collectedItems["Ankh Jewel"]) { return(false); } } return(true); }
public static bool CanBeatGame(Randomiser randomiser) { PlayerState state = new PlayerState(randomiser); state.CollectItem(randomiser.StartingWeapon); List <Location> requiredLocations = randomiser.GetPlacedRequiredItemLocations(); 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); return(state.CanBeatGame()); }
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); }