public FullRandomItemLocationRandomizer( Seed seed, ItemInfoProvider itemInfoProvider, ItemUnlockingMap unlockingMap ) : base(seed, itemInfoProvider, unlockingMap) { }
public static ItemLocationMap Randomize(Seed seed, FillingMethod fillingMethod, GameSave saveGame, bool progressionOnly = false) { var unlockingMap = new ItemUnlockingMap(seed); var itemInfoProvider = new ItemInfoProvider(seed.Options, unlockingMap); ItemLocationRandomizer randomizer; switch (fillingMethod) { case FillingMethod.Forward: randomizer = new ForwardFillingItemLocationRandomizer(seed, itemInfoProvider, unlockingMap); break; case FillingMethod.Random: randomizer = new FullRandomItemLocationRandomizer(seed, itemInfoProvider, unlockingMap); break; case FillingMethod.Archipelago: randomizer = new ArchipelagoItemLocationRandomizer(seed, itemInfoProvider, unlockingMap, saveGame); break; default: throw new NotImplementedException($"filling method {fillingMethod} is not implemented"); } return(randomizer.GenerateItemLocationMap(progressionOnly)); }
void AddRandomItemsToLocationMap(Random random, SeedOptions options) { PlaceStarterProgressionItems(random); if (!options.GassMaw) { PlaceGassMaskInALegalSpot(random); } var alreadyAssingedItems = ItemLocations .Where(l => l.IsUsed) .Select(l => l.ItemInfo) .ToArray(); var itemsThatUnlockProgression = UnlockingMap.AllProgressionItems .Where(i => alreadyAssingedItems.All(x => x.Identifier != i)) .Select(i => ItemInfoProvider.Get(i)) .ToList(); var unusedItemLocations = ItemLocations .Where(l => !l.IsUsed) .ToList(); while (itemsThatUnlockProgression.Count > 0) { var item = itemsThatUnlockProgression.PopRandom(random); var location = unusedItemLocations.PopRandom(random); PutItemAtLocation(item, location); } FillRemainingChests(random); }
private void Button_Click_2(object sender, RoutedEventArgs e) { bool cacheReset = MessageBox.Show( "Do you wish to purge offline content?", "Cache Reset", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes; bool charactersReset = MessageBox.Show( "Do you wish to reset the character list?", "Character List Reset", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes; if (cacheReset) { CharacterInfoProvider.ResetCache(); ItemInfoProvider.ResetCache(); } if (charactersReset) { Microsoft.Win32.Registry.CurrentUser.CreateSubKey("Software").CreateSubKey("SEWilson").CreateSubKey("ScreenSaver").DeleteValue("ArmoryMRU", false); } }
public static void AddRandomItemsToLocationMap( Seed seed, ItemInfoProvider itemInfoProvider, ItemUnlockingMap unlockingMap, ItemLocationMap itemLocationMap, bool progressionOnly) { var random = new Random((int)seed.Id); new FullRandomItemLocationRandomizer(seed.Options, itemInfoProvider, unlockingMap, itemLocationMap, progressionOnly) .AddRandomItemsToLocationMap(random, seed.Options); }
FullRandomItemLocationRandomizer( SeedOptions options, ItemInfoProvider itemInfoProvider, ItemUnlockingMap unlockingMap, ItemLocationMap itemLocationMap, bool progressionOnly ) : base(options, itemInfoProvider, itemLocationMap, unlockingMap, progressionOnly) { }
ForwardFillingItemLocationRandomizer( Seed seed, ItemInfoProvider itemProvider, ItemUnlockingMap unlockingMap, ItemLocationMap itemLocationMap, bool progressionOnly) : base(seed.Options, itemProvider, itemLocationMap, unlockingMap, progressionOnly) { random = new Random((int)seed.Id); availableRequirements = Requirement.None; unlockableRequirements = unlockingMap.AllUnlockableRequirements; placedItems = new Dictionary <ItemInfo, ItemLocation>(); paths = new Dictionary <ItemInfo, Gate>(); }
public ForwardFillingItemLocationRandomizer( Seed seed, ItemInfoProvider itemProvider, ItemUnlockingMap unlockingMap ) : base(seed, itemProvider, unlockingMap) { random = new Random((int)seed.Id); availableRequirements = Requirement.None; unlockableRequirements = unlockingMap.AllUnlockableRequirements; placedItems = new Dictionary <ItemInfo, ItemLocation>(); paths = new Dictionary <ItemInfo, Gate>(); }
public void Should_equal_across_provider() { var providerA = new ItemInfoProvider(SeedOptions.None, new ItemUnlockingMap(Seed.Zero)); var a = providerA.Get(EInventoryRelicType.Dash); var providerB = new ItemInfoProvider(SeedOptions.None, new ItemUnlockingMap(Seed.Zero)); var b = providerB.Get(EInventoryRelicType.Dash); Assert.That(a, Is.EqualTo(b)); }
public void Should_generate_beatable_seed_in_1_pass() { var seed = new Seed(1U, SeedOptions.None); var unlockingMap = new ItemUnlockingMap(seed); var itemProvder = new ItemInfoProvider(SeedOptions.None, unlockingMap); var itemLocations = new ItemLocationMap(itemProvder, unlockingMap, SeedOptions.None); ForwardFillingItemLocationRandomizer.AddRandomItemsToLocationMap(seed, itemProvder, unlockingMap, itemLocations, true); Assert.That(itemLocations.IsBeatable(), Is.True); }
public ArchipelagoItemLocationRandomizer( Seed seed, ItemInfoProvider itemInfoProvider, ItemUnlockingMap unlockingMap, GameSave saveGame ) : base(seed, itemInfoProvider, unlockingMap) { this.saveGame = saveGame; TimeSpinnerGame.Localizer.OverrideKey("inv_use_MagicMarbles", "Archipelago Item"); TimeSpinnerGame.Localizer.OverrideKey("inv_use_MagicMarbles_desc", "Item that belongs to a distant timeline somewhere in the Archipelago (cannot be sold)"); }
public void Should_fill_tuturial_with_melee_and_spellorb(uint seedIndex) { var seed = new Seed(seedIndex, SeedOptions.None); var unlockingMap = new ItemUnlockingMap(seed); var itemProvider = new ItemInfoProvider(SeedOptions.None, unlockingMap); var itemLocations = new ItemLocationMap(itemProvider, unlockingMap, SeedOptions.None); FullRandomItemLocationRandomizer.AddRandomItemsToLocationMap(seed, itemProvider, unlockingMap, itemLocations, true); Assert.That(itemLocations[ItemKey.TutorialMeleeOrb].ItemInfo.Identifier.LootType, Is.EqualTo(LootType.Orb)); Assert.That(itemLocations[ItemKey.TutorialMeleeOrb].ItemInfo.Identifier.OrbSlot, Is.EqualTo(EOrbSlot.Melee)); Assert.That(itemLocations[ItemKey.TutorialSpellOrb].ItemInfo.Identifier.LootType, Is.EqualTo(LootType.Orb)); Assert.That(itemLocations[ItemKey.TutorialSpellOrb].ItemInfo.Identifier.OrbSlot, Is.EqualTo(EOrbSlot.Spell)); }
void CalculateTutorial() { var orbTypes = ((EInventoryOrbType[])Enum.GetValues(typeof(EInventoryOrbType))).ToList(); var spellOrbTypes = orbTypes .Where(orbType => orbType != EInventoryOrbType.Barrier); //To OP to give as starter item var spellOrbType = spellOrbTypes.SelectRandom(random); PutItemAtLocation(ItemInfoProvider.Get(spellOrbType, EOrbSlot.Spell), itemLocations[ItemKey.TutorialSpellOrb]); orbTypes.Remove(EInventoryOrbType.Pink); //To annoying as each attack consumes aura power var meleeOrbType = orbTypes.SelectRandom(random); PutItemAtLocation(ItemInfoProvider.Get(meleeOrbType, EOrbSlot.Melee), itemLocations[ItemKey.TutorialMeleeOrb]); RecalculateAvailableItemLocations(); }
public static ItemLocationMap Randomize(Seed seed, FillingMethod fillingMethod, bool progressionOnly = false) { var unlockingMap = new ItemUnlockingMap(seed); var itemInfoProvider = new ItemInfoProvider(seed.Options, unlockingMap); var itemLocations = new ItemLocationMap(itemInfoProvider, unlockingMap, seed.Options); switch (fillingMethod) { case FillingMethod.Forward: ForwardFillingItemLocationRandomizer.AddRandomItemsToLocationMap(seed, itemInfoProvider, unlockingMap, itemLocations, progressionOnly); break; case FillingMethod.Random: FullRandomItemLocationRandomizer.AddRandomItemsToLocationMap(seed, itemInfoProvider, unlockingMap, itemLocations, progressionOnly); break; default: throw new NotImplementedException($"filling method {fillingMethod} is not implemented"); } return(itemLocations); }
public ItemLocationMap(ItemInfoProvider itemInfoProvider, ItemUnlockingMap itemUnlockingMap, SeedOptions options) : base(CalculateCapacity(options), l => l.Key) { itemProvider = itemInfoProvider; unlockingMap = itemUnlockingMap; seedOptions = options; SetupGates(); AddPresentItemLocations(); AddPastItemLocations(); AddPyramidItemLocations(); if (options.DownloadableItems) { AddDownloadTerminals(); } if (options.StartWithTalaria) { PutTalariaIntoDummyLocation(itemInfoProvider); } }
public static void AddRandomItemsToLocationMap( Seed seed, ItemInfoProvider itemInfoProvider, ItemUnlockingMap unlockingMap, ItemLocationMap itemLocationMap, bool progressionOnly) { new ForwardFillingItemLocationRandomizer(seed, itemInfoProvider, unlockingMap, itemLocationMap, progressionOnly) .AddRandomItemsToLocationMap(); }
void PutTalariaIntoDummyLocation(ItemInfoProvider itemInfoProvider) { Add(ItemKey.TalariaSeedOption, "SeedOptions", null); this[ItemKey.TalariaSeedOption].SetItem(itemInfoProvider.Get(EInventoryRelicType.Dash)); }
public ArchipelagoItemLocationMap(ItemInfoProvider itemInfoProvider, ItemUnlockingMap itemUnlockingMap, SeedOptions options, int slot) : base(itemInfoProvider, itemUnlockingMap, options) { this.slot = slot; }
protected ItemLocationRandomizer( SeedOptions options, ItemInfoProvider itemInfoProvider, ItemLocationMap itemLocations, ItemUnlockingMap unlockingMap, bool progressionOnly ) { SeedOptions = options; ItemInfoProvider = itemInfoProvider; ItemLocations = itemLocations; UnlockingMap = unlockingMap; ProgressionOnly = progressionOnly; itemsToRemoveFromGame = new List <ItemInfo> { ItemInfoProvider.Get(EInventoryUseItemType.MagicMarbles), ItemInfoProvider.Get(EInventoryUseItemType.GoldRing), ItemInfoProvider.Get(EInventoryUseItemType.GoldNecklace), ItemInfoProvider.Get(EInventoryUseItemType.SilverOre), ItemInfoProvider.Get(EInventoryUseItemType.EssenceCrystal), }; if (SeedOptions.StartWithJewelryBox) { itemsToRemoveFromGame.Add(ItemInfoProvider.Get(EInventoryRelicType.JewelryBox)); } if (SeedOptions.StartWithMeyef) { itemsToRemoveFromGame.Add(ItemInfoProvider.Get(EInventoryFamiliarType.Meyef)); } if (SeedOptions.StartWithTalaria) { itemsToRemoveFromGame.Add(ItemInfoProvider.Get(EInventoryRelicType.Dash)); } itemsToAddToGame = new[] { ItemInfoProvider.Get(EInventoryEquipmentType.SelenBangle), ItemInfoProvider.Get(EInventoryEquipmentType.GlassPumpkin), ItemInfoProvider.Get(EInventoryEquipmentType.EternalCoat), ItemInfoProvider.Get(EInventoryEquipmentType.EternalTiara), ItemInfoProvider.Get(EInventoryEquipmentType.LibrarianHat), ItemInfoProvider.Get(EInventoryEquipmentType.LibrarianRobe), ItemInfoProvider.Get(EInventoryEquipmentType.MetalWristband), ItemInfoProvider.Get(EInventoryEquipmentType.NelisteEarring), ItemInfoProvider.Get(EInventoryEquipmentType.FamiliarEgg), ItemInfoProvider.Get(EInventoryEquipmentType.LuckyCoin), ItemInfoProvider.Get(EInventoryRelicType.EternalBrooch), ItemInfoProvider.Get(EInventoryRelicType.FamiliarAltMeyef), ItemInfoProvider.Get(EInventoryRelicType.FamiliarAltCrow), }; genericItems = new[] { ItemInfoProvider.Get(EInventoryUseItemType.Potion), ItemInfoProvider.Get(EInventoryUseItemType.HiPotion), ItemInfoProvider.Get(EInventoryUseItemType.FuturePotion), ItemInfoProvider.Get(EInventoryUseItemType.FutureHiPotion), ItemInfoProvider.Get(EInventoryUseItemType.Ether), ItemInfoProvider.Get(EInventoryUseItemType.HiEther), ItemInfoProvider.Get(EInventoryUseItemType.FutureEther), ItemInfoProvider.Get(EInventoryUseItemType.FutureHiEther), ItemInfoProvider.Get(EInventoryUseItemType.ChaosHeal), ItemInfoProvider.Get(EInventoryUseItemType.Antidote), ItemInfoProvider.Get(EInventoryUseItemType.SandBottle), ItemInfoProvider.Get(EInventoryUseItemType.HiSandBottle), }; }