Minior form rand, pickle bb fixed spawns

This commit is contained in:
Kurt 2023-12-18 23:41:25 -08:00
parent 6cb4d9ffa7
commit 1de3303048
2 changed files with 34 additions and 22 deletions

View File

@ -4,7 +4,6 @@
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
// ReSharper disable UnusedType.Global
#nullable disable
namespace pkNX.Structures.FlatBuffers.SV;
@ -24,8 +23,16 @@ public void SerializePKHeX(BinaryWriter bw, sbyte captureLv, RaidSerializationFo
if (BallId != BallType.NONE)
throw new ArgumentOutOfRangeException(nameof(BallId), BallId, $"No {nameof(BallId)} allowed!");
bw.Write(SpeciesConverterSV.GetNational9((ushort)DevId));
bw.Write((byte)FormId);
ushort species = SpeciesConverterSV.GetNational9((ushort)DevId);
byte form = species switch
{
//(ushort)Species.Vivillon or (ushort)Species.Spewpa or (ushort)Species.Scatterbug => 30,
(ushort)Species.Minior when FormId == 0 => 31,
_ => (byte)FormId,
};
bw.Write(species);
bw.Write(form);
bw.Write((byte)Sex);
bw.Write((byte)Tokusei);
@ -42,7 +49,7 @@ public void SerializePKHeX(BinaryWriter bw, sbyte captureLv, RaidSerializationFo
// ROM raids with 5 stars have a few entries that are defined as DEFAULT
// If the type is not {specified}, the game will assume it is RANDOM.
// Thus, DEFAULT behaves like RANDOM.
// Let's clean up this mistake and make it explicit so we don't have to program this workaround in other tools.
// Let's clean up this mistake and make it explicit, so we don't have to program this workaround in other tools.
var gem = GemType is GemType.DEFAULT ? GemType.RANDOM : GemType;
bw.Write((byte)gem);
}
@ -51,8 +58,7 @@ private void AssertRegularFormat()
{
if (TalentType != TalentType.V_NUM)
throw new ArgumentOutOfRangeException(nameof(TalentType), TalentType, "No min flawless IVs?");
if (TalentVnum == 0 && DevId != DevID.DEV_PATIRISU &&
Level != 35) // nice mistake gamefreak -- 3star Pachirisu is 0 IVs.
if (TalentVnum == 0 && DevId != DevID.DEV_PATIRISU && Level != 35) // nice mistake gamefreak -- 3star Pachirisu is 0 IVs.
throw new ArgumentOutOfRangeException(nameof(TalentVnum), TalentVnum, "No min flawless IVs?");
if (Seikaku != SeikakuType.DEFAULT)
@ -73,7 +79,7 @@ public enum RaidSerializationFormat
Distribution,
/// <summary>
/// 7 Star Distribution Raids
/// 7-Star Distribution Raids
/// </summary>
Might,
}

View File

@ -100,11 +100,11 @@ public class EncounterDumperSV
var atlantis = scene.IsAtlantis[(int)fieldIndex];
var allPoints = gamePoints[(int)fieldIndex];
if (fieldIndex == PaldeaFieldIndex.Kitakami || fieldIndex == PaldeaFieldIndex.Terarium)
if (fieldIndex is PaldeaFieldIndex.Kitakami)
{
areas = areas.Where(z => z.Value.AdjustEncLv != 0)
.ToDictionary(z => z.Key, z => z.Value);
areaNames = areas.Keys.ToList();
areaNames = [.. areas.Keys];
}
for (var i = 0; i < fsymData.Table.Count; i++)
@ -141,11 +141,11 @@ bool FindArea(AreaType type)
var pt = point.Position;
if (!collider.ContainsPoint(pt.X, pt.Y, pt.Z))
continue;
if (!TryGetPlaceName(ref areaName, areaInfo, pt, placeNameMap, areas, scene, fieldIndex, out var placeName))
var tmp = areaName;
if (!TryGetPlaceName(ref tmp, areaInfo, pt, placeNameMap, areas, scene, fieldIndex, out var placeName))
continue;
areaName = areaNames[x];
if (!appearAreas.Exists(z => z.Point == pt && z.AreaName == areaName))
appearAreas.Add(new(placeName, areaName, areaInfo.AdjustEncLv, pt));
if (!appearAreas.Exists(z => z.Point == pt && z.AreaName == tmp))
appearAreas.Add(new(placeName, tmp, areaInfo.AdjustEncLv, pt));
points.RemoveAt(p);
p--;
}
@ -371,11 +371,6 @@ void ProcessAreas(PaldeaFieldIndex fieldIndex)
// 4 - Consolidate the encounters from both point lists.
// Just compute everything (big memory!) then crunch it all down.
if (fieldIndex == PaldeaFieldIndex.Terarium)
{
var z = -1;
}
// Fill the point lists for each area, then spawn everything into those points.
var areaNames = scene.AreaNames[(int)fieldIndex];
var areas = scene.AreaInfos[(int)fieldIndex];
@ -640,8 +635,13 @@ private static void WriteFixedSymbol(ICollection<byte[]> exist, FixedSymbolTable
using var ms = new MemoryStream();
using var bw = new BinaryWriter(ms);
bw.Write(SpeciesConverterSV.GetNational9((ushort)enc.DevId));
bw.Write((byte)enc.FormId);
ushort species = SpeciesConverterSV.GetNational9((ushort)enc.DevId);
byte form = (byte)enc.FormId;
if (species == (int)Species.Minior)
form = 31; // Form Random
bw.Write(species);
bw.Write(form);
bw.Write((byte)(enc.Level + adjustLevel));
bw.Write((byte)enc.TalentVNum);
@ -691,10 +691,16 @@ private static byte[] SerializeLocationSet(ushort loc, ushort crossover, IReadOn
bw.Write(crossover);
foreach (var slot in slots)
{
byte form = slot.Species is (ushort)Species.Vivillon or (ushort)Species.Spewpa or (ushort)Species.Scatterbug ? (byte)30 : slot.Form;
ushort species = slot.Species;
byte form = slot.Species switch
{
(ushort)Species.Vivillon or (ushort)Species.Spewpa or (ushort)Species.Scatterbug => 30,
(ushort)Species.Minior => 31,
_ => slot.Form,
};
// ReSharper disable RedundantCast
bw.Write((ushort)slot.Species);
bw.Write(species);
bw.Write(form);
bw.Write((byte)slot.Gender);