From f156019c3701456b9583e766ae5e1c01a1846a40 Mon Sep 17 00:00:00 2001 From: MattEqualsCoder Date: Wed, 16 Oct 2024 22:53:17 -0400 Subject: [PATCH 1/2] Fix bug preventing progression on Aga ledge --- .../Zelda/LightWorld/LightWorldNorthWest.cs | 4 +-- .../WorldData/Reward.cs | 1 + src/TrackerCouncil.Smz3.Tools/Program.cs | 36 ++++++++++++++++++- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/TrackerCouncil.Smz3.Data/WorldData/Regions/Zelda/LightWorld/LightWorldNorthWest.cs b/src/TrackerCouncil.Smz3.Data/WorldData/Regions/Zelda/LightWorld/LightWorldNorthWest.cs index 67ee39eb2..150966191 100644 --- a/src/TrackerCouncil.Smz3.Data/WorldData/Regions/Zelda/LightWorld/LightWorldNorthWest.cs +++ b/src/TrackerCouncil.Smz3.Data/WorldData/Regions/Zelda/LightWorld/LightWorldNorthWest.cs @@ -24,7 +24,7 @@ public LightWorldNorthWest(World world, Config config, IMetadataService? metadat memoryType: LocationMemoryType.ZeldaMisc, metadata: metadata, trackerState: trackerState) - .Weighted(6); + .Weighted(4); Mushroom = new Location(this, LocationId.Mushroom, 0x308013, LocationType.Regular, name: "Mushroom", @@ -54,7 +54,7 @@ public LightWorldNorthWest(World world, Config config, IMetadataService? metadat memoryFlag: 0x9, metadata: metadata, trackerState: trackerState) - .Weighted(100); + .Weighted(4); PegasusRocks = new Location(this, LocationId.PegasusRocks, 0x1EB3F, LocationType.Regular, name: "Pegasus Rocks", diff --git a/src/TrackerCouncil.Smz3.Data/WorldData/Reward.cs b/src/TrackerCouncil.Smz3.Data/WorldData/Reward.cs index 643b408d3..6b0d0f4e6 100644 --- a/src/TrackerCouncil.Smz3.Data/WorldData/Reward.cs +++ b/src/TrackerCouncil.Smz3.Data/WorldData/Reward.cs @@ -49,6 +49,7 @@ public static ICollection CreatePool(World world) CreatePlayerReward(RewardType.CrystalBlue, world, regions), CreatePlayerReward(RewardType.CrystalRed, world, regions), CreatePlayerReward(RewardType.CrystalRed, world, regions), + CreatePlayerReward(RewardType.Agahnim, world, regions), }; } diff --git a/src/TrackerCouncil.Smz3.Tools/Program.cs b/src/TrackerCouncil.Smz3.Tools/Program.cs index c8795798e..0733c8126 100644 --- a/src/TrackerCouncil.Smz3.Tools/Program.cs +++ b/src/TrackerCouncil.Smz3.Tools/Program.cs @@ -68,7 +68,7 @@ public static void Main(string[] args) })); } - private static string GenerateStats(Config config, int count = 10000) + private static string GenerateStats(Config config, int count = 1000) { var start = DateTime.Now; var stats = new ConcurrentBag(); @@ -76,10 +76,17 @@ private static string GenerateStats(Config config, int count = 10000) var pedProgression = 0; var pedNice = 0; var pedJunk = 0; + var pedItems = new ConcurrentBag(); var treeProgression = 0; var treeNice = 0; var treeJunk = 0; + var treeItems = new ConcurrentBag(); + + var sahaProgression = 0; + var sahaNice = 0; + var sahaJunk = 0; + var sahaItems = new ConcurrentBag(); var hintService = s_services.GetRequiredService(); var playthroughService = s_services.GetRequiredService(); @@ -104,6 +111,7 @@ private static string GenerateStats(Config config, int count = 10000) { case LocationUsefulness.Mandatory: pedProgression++; + pedItems.Add(location.Item.Type); break; case LocationUsefulness.NiceToHave: case LocationUsefulness.Sword: @@ -122,6 +130,7 @@ private static string GenerateStats(Config config, int count = 10000) { case LocationUsefulness.Mandatory: treeProgression++; + treeItems.Add(location.Item.Type); break; case LocationUsefulness.NiceToHave: case LocationUsefulness.Sword: @@ -131,6 +140,25 @@ private static string GenerateStats(Config config, int count = 10000) treeJunk++; break; } + + location = + seed.WorldGenerationData.LocalWorld.World.FindLocation(LocationId.Sahasrahla); + usefulness = hintService.GetLocationUsefulness(location, + seed.WorldGenerationData.Worlds.ToList(), playthrough); + switch (usefulness) + { + case LocationUsefulness.Mandatory: + sahaProgression++; + sahaItems.Add(location.Item.Type); + break; + case LocationUsefulness.NiceToHave: + case LocationUsefulness.Sword: + sahaNice++; + break; + default: + sahaJunk++; + break; + } } catch (Exception e) { @@ -194,9 +222,15 @@ private static string GenerateStats(Config config, int count = 10000) sb.AppendLine($"Ped Progression: {pedProgression * 1f / stats.Count * 100f}%"); sb.AppendLine($"Ped Nice: {pedNice * 1f / stats.Count * 100f}%"); sb.AppendLine($"Ped Junk: {pedJunk * 1f / stats.Count * 100f}%"); + sb.AppendLine($"Ped items: {string.Join(',', pedItems.Distinct())}"); sb.AppendLine($"Tree Progression: {treeProgression * 1f / stats.Count * 100f}%"); sb.AppendLine($"Tree Nice: {treeNice * 1f / stats.Count * 100f}%"); sb.AppendLine($"Tree Junk: {treeJunk * 1f / stats.Count * 100f}%"); + sb.AppendLine($"Tree items: {string.Join(',', treeItems.Distinct())}"); + sb.AppendLine($"Saha Progression: {sahaProgression * 1f / stats.Count * 100f}%"); + sb.AppendLine($"Saha Nice: {sahaNice * 1f / stats.Count * 100f}%"); + sb.AppendLine($"Saha Junk: {sahaJunk * 1f / stats.Count * 100f}%"); + sb.AppendLine($"Saha items: {string.Join(',', sahaItems.Distinct())}"); sb.AppendLine("Run time: " + ts.TotalSeconds + "s"); sb.AppendLine(); return sb.ToString(); From 5cacbcf8f510f06483d0efdbbe11b2b532f00b6d Mon Sep 17 00:00:00 2001 From: MattEqualsCoder Date: Wed, 16 Oct 2024 22:55:30 -0400 Subject: [PATCH 2/2] Fix unit test --- src/TrackerCouncil.Smz3.Data/RandomizerVersion.cs | 2 +- tests/TrackerCouncil.Smz3.Tests/LogicTests/RandomizerTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TrackerCouncil.Smz3.Data/RandomizerVersion.cs b/src/TrackerCouncil.Smz3.Data/RandomizerVersion.cs index 512dda57d..b92af6715 100644 --- a/src/TrackerCouncil.Smz3.Data/RandomizerVersion.cs +++ b/src/TrackerCouncil.Smz3.Data/RandomizerVersion.cs @@ -6,7 +6,7 @@ public class RandomizerVersion { // Update this whenever we have breaking logic changes which might affect // old seeds. Only use the major version number. - public static Version Version => new(6, 0); + public static Version Version => new(7, 0); public static string VersionString => Version.ToString(); diff --git a/tests/TrackerCouncil.Smz3.Tests/LogicTests/RandomizerTests.cs b/tests/TrackerCouncil.Smz3.Tests/LogicTests/RandomizerTests.cs index cddc20342..fbef15c1d 100644 --- a/tests/TrackerCouncil.Smz3.Tests/LogicTests/RandomizerTests.cs +++ b/tests/TrackerCouncil.Smz3.Tests/LogicTests/RandomizerTests.cs @@ -24,7 +24,7 @@ public class RandomizerTests { // If this test breaks, update Smz3Randomizer.Version [Theory] - [InlineData("test", -1617061639)] // Smz3Randomizer v6 + [InlineData("test", -1216945357)] // Smz3Randomizer v7 public void StandardFillerWithSameSeedGeneratesSameWorld(string seed, int expectedHash) { var filler = new StandardFiller(GetLogger());