Skip to content

Commit

Permalink
Merge pull request #589 from TheTrackerCouncil/fix-lumberjack-ledge
Browse files Browse the repository at this point in the history
Fix bug preventing progression on Aga ledge
  • Loading branch information
MattEqualsCoder authored Oct 17, 2024
2 parents 44248d2 + 5cacbcf commit c345200
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/TrackerCouncil.Smz3.Data/RandomizerVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/TrackerCouncil.Smz3.Data/WorldData/Reward.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public static ICollection<Reward> CreatePool(World world)
CreatePlayerReward(RewardType.CrystalBlue, world, regions),
CreatePlayerReward(RewardType.CrystalRed, world, regions),
CreatePlayerReward(RewardType.CrystalRed, world, regions),
CreatePlayerReward(RewardType.Agahnim, world, regions),
};
}

Expand Down
36 changes: 35 additions & 1 deletion src/TrackerCouncil.Smz3.Tools/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,25 @@ 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<StatsDetails>();

var pedProgression = 0;
var pedNice = 0;
var pedJunk = 0;
var pedItems = new ConcurrentBag<ItemType>();

var treeProgression = 0;
var treeNice = 0;
var treeJunk = 0;
var treeItems = new ConcurrentBag<ItemType>();

var sahaProgression = 0;
var sahaNice = 0;
var sahaJunk = 0;
var sahaItems = new ConcurrentBag<ItemType>();

var hintService = s_services.GetRequiredService<IGameHintService>();
var playthroughService = s_services.GetRequiredService<PlaythroughService>();
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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)
{
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<StandardFiller>());
Expand Down

0 comments on commit c345200

Please sign in to comment.