Fix wild slot spawn uniqueness filter

Cramming in Weather when the hash used 64bits already was my mistake; code wasn't obvious lol.
Upgrade to u128; not any noticeable perf drop.
Pull out LevelAdjust to not fetch every pokemon attempted (negligible speed boost)
This commit is contained in:
Kurt
2025-07-04 22:43:52 -05:00
parent de3aa6ea5d
commit de84dcd3ba
2 changed files with 5 additions and 5 deletions

View File

@@ -54,7 +54,7 @@ private string GetString(string species)
{
var form = Form == 0 ? "" : $"-{Form}";
var sex = Sex == 0 ? "" : $" (sex={Sex})";
return $"{species}{form}{sex} Lv. {MinLevel}-{MaxLevel}";
return $"{species}{form}{sex} Lv. {MinLevel}-{MaxLevel} {Weather}";
}
public bool Absorb(PaldeaEncounter other)
@@ -112,9 +112,9 @@ public int CompareTo(PaldeaEncounter? other)
return CrossFromLocation.CompareTo(other.CrossFromLocation);
}
public ulong GetHash()
public UInt128 GetHash()
{
ulong result = Species;
UInt128 result = Species;
result = (result << 16) | CrossFromLocation;
result = (result << 8) | Form;

View File

@@ -10,7 +10,7 @@ public class LocationStorage(int loc, PaldeaFieldIndex fieldIndex, string areaNa
public readonly AreaInfo AreaInfo = info;
public readonly string AreaName = areaName;
public readonly HashSet<ulong> Added = [];
public readonly HashSet<UInt128> Added = [];
public readonly List<PaldeaEncounter> Slots = [];
public readonly Dictionary<int, LocationStorage> SlotsCrossover = [];
public readonly List<LocationPointDetail> Local = [];
@@ -143,6 +143,7 @@ public void GetEncounters(EncountPokeDataArray pokeData, PaldeaSceneModel scene)
{
foreach (var spawner in Local)
{
var boost = spawner.LevelAdjust;
foreach (var pd in pokeData.Table)
{
if (!IsAbleToSpawnAt(pd, spawner, AreaName, scene, fieldIndex))
@@ -154,7 +155,6 @@ public void GetEncounters(EncountPokeDataArray pokeData, PaldeaSceneModel scene)
if (pd.BandPoke != 0) // Add band encount
spawner.Add(PaldeaEncounter.GetBand(pd, point));
var boost = spawner.LevelAdjust;
if (boost == 0)
continue;