mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-20 20:58:30 -05:00
-8 bytes from each encounter template
saves about ~1MB RAM savings (>=179,142 objects)
This commit is contained in:
parent
462ef70ffb
commit
4e1276a954
|
|
@ -7,8 +7,8 @@ public sealed class QRPK7 : IEncounterInfo
|
|||
{
|
||||
public GameVersion Version => (GameVersion)CassetteVersion;
|
||||
public bool EggEncounter => false;
|
||||
public int LevelMin => Level;
|
||||
public int LevelMax => Level;
|
||||
public byte LevelMin => Level;
|
||||
public byte LevelMax => Level;
|
||||
public int Generation => Version.GetGeneration();
|
||||
public bool IsShiny => false;
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ public sealed class QRPK7 : IEncounterInfo
|
|||
public int Unk_2A => Data[0x2A];
|
||||
public int Friendship => Data[0x2B];
|
||||
public int Ball => Data[0x2C];
|
||||
public int Level => Data[0x2D];
|
||||
public byte Level => Data[0x2D];
|
||||
public int CassetteVersion => Data[0x2E];
|
||||
public int Language => Data[0x2F];
|
||||
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@ private EncounterArea1(ReadOnlySpan<byte> data, GameVersion game) : base(game)
|
|||
{
|
||||
const int size = 4;
|
||||
var entry = data.Slice(i * size, size);
|
||||
int max = entry[3];
|
||||
int min = entry[2];
|
||||
byte max = entry[3];
|
||||
byte min = entry[2];
|
||||
byte slotNum = entry[1];
|
||||
int species = entry[0];
|
||||
byte species = entry[0];
|
||||
slots[i] = new EncounterSlot1(this, species, min, max, slotNum);
|
||||
}
|
||||
Slots = slots;
|
||||
|
|
|
|||
|
|
@ -64,10 +64,10 @@ private EncounterSlot2[] ReadSlots(ReadOnlySpan<byte> data, int count)
|
|||
for (int i = 0; i < slots.Length; i++)
|
||||
{
|
||||
var entry = data.Slice(i * size, size);
|
||||
int max = entry[3];
|
||||
int min = entry[2];
|
||||
byte max = entry[3];
|
||||
byte min = entry[2];
|
||||
byte slotNum = entry[1];
|
||||
int species = entry[0];
|
||||
byte species = entry[0];
|
||||
slots[i] = new EncounterSlot2(this, species, min, max, slotNum);
|
||||
}
|
||||
return slots;
|
||||
|
|
|
|||
|
|
@ -66,11 +66,11 @@ private EncounterSlot3[] ReadRegularSlots(ReadOnlySpan<byte> data)
|
|||
|
||||
private EncounterSlot3 ReadRegularSlot(ReadOnlySpan<byte> entry)
|
||||
{
|
||||
int species = ReadUInt16LittleEndian(entry);
|
||||
int form = entry[2];
|
||||
ushort species = ReadUInt16LittleEndian(entry);
|
||||
byte form = entry[2];
|
||||
byte slotNum = entry[3];
|
||||
int min = entry[4];
|
||||
int max = entry[5];
|
||||
byte min = entry[4];
|
||||
byte max = entry[5];
|
||||
|
||||
byte mpi = entry[6];
|
||||
byte mpc = entry[7];
|
||||
|
|
@ -96,11 +96,11 @@ private EncounterSlot3[] ReadSwarmSlots(ReadOnlySpan<byte> data)
|
|||
|
||||
private EncounterSlot3Swarm ReadSwarmSlot(ReadOnlySpan<byte> entry)
|
||||
{
|
||||
int species = ReadUInt16LittleEndian(entry);
|
||||
ushort species = ReadUInt16LittleEndian(entry);
|
||||
// form always 0
|
||||
byte slotNum = entry[3];
|
||||
int min = entry[4];
|
||||
int max = entry[5];
|
||||
byte min = entry[4];
|
||||
byte max = entry[5];
|
||||
|
||||
int[] moves =
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public sealed record EncounterArea3XD : EncounterArea
|
|||
|
||||
protected override IReadOnlyList<EncounterSlot> Raw => Slots;
|
||||
|
||||
public EncounterArea3XD(int loc, int s0, int l0, int s1, int l1, int s2, int l2) : base(GameVersion.XD)
|
||||
public EncounterArea3XD(int loc, ushort s0, byte l0, ushort s1, byte l1, ushort s2, byte l2) : base(GameVersion.XD)
|
||||
{
|
||||
Location = loc;
|
||||
Type = SlotType.Grass;
|
||||
|
|
|
|||
|
|
@ -52,11 +52,11 @@ private EncounterSlot4[] ReadRegularSlots(ReadOnlySpan<byte> data)
|
|||
|
||||
private EncounterSlot4 ReadRegularSlot(ReadOnlySpan<byte> entry)
|
||||
{
|
||||
int species = ReadUInt16LittleEndian(entry);
|
||||
int form = entry[2];
|
||||
ushort species = ReadUInt16LittleEndian(entry);
|
||||
byte form = entry[2];
|
||||
byte slotNum = entry[3];
|
||||
int min = entry[4];
|
||||
int max = entry[5];
|
||||
byte min = entry[4];
|
||||
byte max = entry[5];
|
||||
byte mpi = entry[6];
|
||||
byte mpc = entry[7];
|
||||
byte sti = entry[8];
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@ private EncounterSlot5[] ReadSlots(ReadOnlySpan<byte> data)
|
|||
|
||||
private EncounterSlot5 ReadSlot(ReadOnlySpan<byte> entry)
|
||||
{
|
||||
ushort SpecForm = ReadUInt16LittleEndian(entry);
|
||||
int species = SpecForm & 0x3FF;
|
||||
int form = SpecForm >> 11;
|
||||
int min = entry[2];
|
||||
int max = entry[3];
|
||||
ushort species = ReadUInt16LittleEndian(entry);
|
||||
byte form = (byte)(species >> 11);
|
||||
species &= 0x3FF;
|
||||
byte min = entry[2];
|
||||
byte max = entry[3];
|
||||
return new EncounterSlot5(this, species, form, min, max);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@ private EncounterSlot6AO[] ReadSlots(ReadOnlySpan<byte> data)
|
|||
|
||||
private EncounterSlot6AO ReadSlot(ReadOnlySpan<byte> entry)
|
||||
{
|
||||
ushort SpecForm = ReadUInt16LittleEndian(entry);
|
||||
int species = SpecForm & 0x3FF;
|
||||
int form = SpecForm >> 11;
|
||||
int min = entry[2];
|
||||
int max = entry[3];
|
||||
ushort species = ReadUInt16LittleEndian(entry);
|
||||
byte form = (byte)(species >> 11);
|
||||
species &= 0x3FF;
|
||||
byte min = entry[2];
|
||||
byte max = entry[3];
|
||||
return new EncounterSlot6AO(this, species, form, min, max);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ private EncounterSlot6XY[] LoadSafariSlots()
|
|||
const int SpeciesFormSlots = 4;
|
||||
|
||||
// Single form species
|
||||
ushort[] species =
|
||||
Span<ushort> species = stackalloc ushort[]
|
||||
{
|
||||
002, 005, 008, 012, 014, 016, 021, 025, 027, 035,
|
||||
038, 039, 043, 044, 046, 049, 049, 051, 056, 058,
|
||||
|
|
@ -93,11 +93,11 @@ private EncounterSlot6XY[] ReadSlots(ReadOnlySpan<byte> data)
|
|||
{
|
||||
int offset = 4 + (size * i);
|
||||
var entry = data.Slice(offset, size);
|
||||
ushort SpecForm = ReadUInt16LittleEndian(entry);
|
||||
int species = SpecForm & 0x3FF;
|
||||
int form = SpecForm >> 11;
|
||||
int min = entry[2];
|
||||
int max = entry[3];
|
||||
ushort species = ReadUInt16LittleEndian(entry);
|
||||
byte form = (byte)(species >> 11);
|
||||
species &= 0x3FF;
|
||||
byte min = entry[2];
|
||||
byte max = entry[3];
|
||||
slots[i] = new EncounterSlot6XY(this, species, form, min, max);
|
||||
}
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ public override IEnumerable<EncounterSlot> GetMatchingSlots(PKM pkm, IReadOnlyLi
|
|||
}
|
||||
}
|
||||
|
||||
private bool ExistsPressureSlot(DexLevel evo, ref int level)
|
||||
private bool ExistsPressureSlot(DexLevel evo, ref byte level)
|
||||
{
|
||||
bool existsForm = false;
|
||||
foreach (var z in Slots)
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@ private EncounterSlot7[] ReadSlots(ReadOnlySpan<byte> data)
|
|||
|
||||
private EncounterSlot7 ReadSlot(ReadOnlySpan<byte> entry)
|
||||
{
|
||||
ushort SpecForm = ReadUInt16LittleEndian(entry);
|
||||
int species = SpecForm & 0x3FF;
|
||||
int form = SpecForm >> 11;
|
||||
int min = entry[2];
|
||||
int max = entry[3];
|
||||
ushort species = ReadUInt16LittleEndian(entry);
|
||||
byte form = (byte)(species >> 11);
|
||||
species &= 0x3FF;
|
||||
byte min = entry[2];
|
||||
byte max = entry[3];
|
||||
return new EncounterSlot7(this, species, form, min, max);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ private EncounterSlot7b ReadSlot(ReadOnlySpan<byte> entry)
|
|||
{
|
||||
int species = entry[0]; // always < 255; only original 151
|
||||
// form is always 0
|
||||
int min = entry[2];
|
||||
int max = entry[3];
|
||||
byte min = entry[2];
|
||||
byte max = entry[3];
|
||||
return new EncounterSlot7b(this, species, min, max);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public sealed record EncounterArea7g : EncounterArea, ISpeciesForm
|
|||
|
||||
protected override IReadOnlyList<EncounterSlot> Raw => Slots;
|
||||
|
||||
private EncounterArea7g(int species, int form, EncounterSlot7GO[] slots) : base(GameVersion.GO)
|
||||
private EncounterArea7g(ushort species, byte form, EncounterSlot7GO[] slots) : base(GameVersion.GO)
|
||||
{
|
||||
Species = species;
|
||||
Form = form;
|
||||
|
|
@ -40,9 +40,9 @@ internal static EncounterArea7g[] GetArea(BinLinkerAccessor data)
|
|||
|
||||
private static EncounterArea7g GetArea(ReadOnlySpan<byte> data)
|
||||
{
|
||||
var sf = ReadUInt16LittleEndian(data);
|
||||
int species = sf & 0x7FF;
|
||||
int form = sf >> 11;
|
||||
var species = ReadUInt16LittleEndian(data);
|
||||
byte form = (byte)(species >> 11);
|
||||
species &= 0x3FF;
|
||||
|
||||
var result = new EncounterSlot7GO[(data.Length - 2) / entrySize];
|
||||
var area = new EncounterArea7g(species, form, result);
|
||||
|
|
@ -56,7 +56,7 @@ private static EncounterArea7g GetArea(ReadOnlySpan<byte> data)
|
|||
return area;
|
||||
}
|
||||
|
||||
private static EncounterSlot7GO ReadSlot(ReadOnlySpan<byte> entry, EncounterArea7g area, int species, int form)
|
||||
private static EncounterSlot7GO ReadSlot(ReadOnlySpan<byte> entry, EncounterArea7g area, ushort species, byte form)
|
||||
{
|
||||
int start = ReadInt32LittleEndian(entry);
|
||||
int end = ReadInt32LittleEndian(entry[4..]);
|
||||
|
|
|
|||
|
|
@ -392,9 +392,9 @@ private EncounterSlot8[] ReadSlots(ReadOnlySpan<byte> areaData, byte slotCount)
|
|||
for (int i = 0; i < count; i++, ctr++, ofs += bpe)
|
||||
{
|
||||
var entry = areaData.Slice(ofs, bpe);
|
||||
var specForm = ReadUInt16LittleEndian(entry);
|
||||
var species = specForm & 0x7FF;
|
||||
var form = specForm >> 11;
|
||||
var species = ReadUInt16LittleEndian(entry);
|
||||
byte form = (byte)(species >> 11);
|
||||
species &= 0x3FF;
|
||||
slots[ctr] = new EncounterSlot8(this, species, form, min, max, flags, slotType);
|
||||
}
|
||||
} while (ctr != slots.Length);
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ private EncounterSlot8a[] ReadSlots(ReadOnlySpan<byte> areaData, byte slotCount)
|
|||
var entry = areaData.Slice(ofs, bpe);
|
||||
byte flawless = entry[7];
|
||||
var gender = (Gender)entry[6];
|
||||
int max = entry[5];
|
||||
int min = entry[4];
|
||||
byte max = entry[5];
|
||||
byte min = entry[4];
|
||||
var alpha = entry[3];
|
||||
var form = entry[2];
|
||||
var species = ReadUInt16LittleEndian(entry);
|
||||
|
|
|
|||
|
|
@ -46,11 +46,11 @@ private EncounterSlot8b[] ReadSlots(ReadOnlySpan<byte> data)
|
|||
|
||||
private EncounterSlot8b ReadSlot(ReadOnlySpan<byte> data)
|
||||
{
|
||||
ushort SpecForm = ReadUInt16LittleEndian(data);
|
||||
int species = SpecForm & 0x3FF;
|
||||
int form = SpecForm >> 11;
|
||||
int min = data[2];
|
||||
int max = data[3];
|
||||
ushort species = ReadUInt16LittleEndian(data);
|
||||
byte form = (byte)(species >> 11);
|
||||
species &= 0x3FF;
|
||||
byte min = data[2];
|
||||
byte max = data[3];
|
||||
return new EncounterSlot8b(this, species, form, min, max);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public sealed record EncounterArea8g : EncounterArea, ISpeciesForm
|
|||
|
||||
protected override IReadOnlyList<EncounterSlot> Raw => Slots;
|
||||
|
||||
private EncounterArea8g(int species, int form, EncounterSlot8GO[] slots) : base(GameVersion.GO)
|
||||
private EncounterArea8g(ushort species, byte form, EncounterSlot8GO[] slots) : base(GameVersion.GO)
|
||||
{
|
||||
Species = species;
|
||||
Form = form;
|
||||
|
|
@ -40,9 +40,9 @@ internal static EncounterArea8g[] GetArea(BinLinkerAccessor data)
|
|||
|
||||
private static EncounterArea8g GetArea(ReadOnlySpan<byte> data)
|
||||
{
|
||||
var sf = ReadUInt16LittleEndian(data);
|
||||
int species = sf & 0x7FF;
|
||||
int form = sf >> 11;
|
||||
var species = ReadUInt16LittleEndian(data);
|
||||
byte form = (byte)(species >> 11);
|
||||
species &= 0x3FF;
|
||||
|
||||
var group = GetGroup(species, form);
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ private static EncounterArea8g GetArea(ReadOnlySpan<byte> data)
|
|||
return area;
|
||||
}
|
||||
|
||||
private static EncounterSlot8GO ReadSlot(ReadOnlySpan<byte> entry, EncounterArea8g area, int species, int form, GameVersion group)
|
||||
private static EncounterSlot8GO ReadSlot(ReadOnlySpan<byte> entry, EncounterArea8g area, ushort species, byte form, GameVersion group)
|
||||
{
|
||||
int start = ReadInt32LittleEndian(entry);
|
||||
int end = ReadInt32LittleEndian(entry[4..]);
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@ namespace PKHeX.Core
|
|||
/// <summary>
|
||||
/// Egg Encounter Data
|
||||
/// </summary>
|
||||
public sealed record EncounterEgg(int Species, int Form, int Level, int Generation, GameVersion Version) : IEncounterable
|
||||
public sealed record EncounterEgg(int Species, int Form, byte Level, int Generation, GameVersion Version) : IEncounterable
|
||||
{
|
||||
public string Name => "Egg";
|
||||
public string LongName => "Egg";
|
||||
|
||||
public bool EggEncounter => true;
|
||||
public int LevelMin => Level;
|
||||
public int LevelMax => Level;
|
||||
public byte LevelMin => Level;
|
||||
public byte LevelMax => Level;
|
||||
public bool IsShiny => false;
|
||||
public int Location => 0;
|
||||
public int EggLocation => Locations.GetDaycareLocation(Generation, Version);
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ public sealed record EncounterInvalid : IEncounterable
|
|||
|
||||
public int Species { get; }
|
||||
public int Form { get; }
|
||||
public int LevelMin { get; }
|
||||
public int LevelMax { get; }
|
||||
public byte LevelMin { get; }
|
||||
public byte LevelMax { get; }
|
||||
public bool EggEncounter { get; }
|
||||
public int Generation { get; }
|
||||
public GameVersion Version { get; }
|
||||
|
|
@ -32,8 +32,8 @@ public EncounterInvalid(PKM pkm)
|
|||
{
|
||||
Species = pkm.Species;
|
||||
Form = pkm.Form;
|
||||
LevelMin = pkm.Met_Level;
|
||||
LevelMax = pkm.CurrentLevel;
|
||||
LevelMin = (byte)pkm.Met_Level;
|
||||
LevelMax = (byte)pkm.CurrentLevel;
|
||||
EggEncounter = pkm.WasEgg;
|
||||
Generation = pkm.Generation;
|
||||
Version = (GameVersion)pkm.Version;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace PKHeX.Core
|
|||
/// Wild Encounter Slot data
|
||||
/// </summary>
|
||||
/// <remarks>Wild encounter slots are found as random encounters in-game.</remarks>
|
||||
public abstract record EncounterSlot(EncounterArea Area, int Species, int Form, int LevelMin, int LevelMax) : IEncounterable, IEncounterMatch
|
||||
public abstract record EncounterSlot(EncounterArea Area, int Species, int Form, byte LevelMin, byte LevelMax) : IEncounterable, IEncounterMatch
|
||||
{
|
||||
public abstract int Generation { get; }
|
||||
public bool EggEncounter => false;
|
||||
|
|
@ -39,7 +39,7 @@ public abstract record EncounterSlot(EncounterArea Area, int Species, int Form,
|
|||
/// <param name="min">Highest value the low end of levels can be</param>
|
||||
/// <param name="max">Lowest value the high end of levels can be</param>
|
||||
/// <returns>True if within slot's range, false if impossible.</returns>
|
||||
public bool IsLevelWithinRange(int min, int max) => LevelMin <= max && min <= LevelMax;
|
||||
public bool IsLevelWithinRange(byte min, byte max) => LevelMin <= max && min <= LevelMax;
|
||||
|
||||
/// <summary>
|
||||
/// Gets if the specified level inputs are within range of the <see cref="LevelMin"/> and <see cref="LevelMax"/>
|
||||
|
|
@ -58,7 +58,7 @@ public abstract record EncounterSlot(EncounterArea Area, int Species, int Form,
|
|||
/// <param name="minDecrease">Highest value the low end of levels can be</param>
|
||||
/// <param name="maxIncrease">Lowest value the high end of levels can be</param>
|
||||
/// <returns>True if within slot's range, false if impossible.</returns>
|
||||
public bool IsLevelWithinRange(int min, int max, int minDecrease, int maxIncrease) => LevelMin - minDecrease <= max && min <= LevelMax + maxIncrease;
|
||||
public bool IsLevelWithinRange(byte min, byte max, int minDecrease, int maxIncrease) => LevelMin - minDecrease <= max && min <= LevelMax + maxIncrease;
|
||||
|
||||
public virtual string LongName
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public sealed record EncounterSlot1 : EncounterSlot, INumberedSlot
|
|||
public byte SlotNumber { get; }
|
||||
public override Ball FixedBall => Ball.Poke;
|
||||
|
||||
public EncounterSlot1(EncounterArea1 area, int species, int min, int max, byte slot) : base(area, species, 0, min, max)
|
||||
public EncounterSlot1(EncounterArea1 area, byte species, byte min, byte max, byte slot) : base(area, species, 0, min, max)
|
||||
{
|
||||
SlotNumber = slot;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public sealed record EncounterSlot2 : EncounterSlot, INumberedSlot
|
|||
public byte SlotNumber { get; }
|
||||
public override Ball FixedBall => Ball.Poke;
|
||||
|
||||
public EncounterSlot2(EncounterArea2 area, int species, int min, int max, byte slot) : base(area, species, species == 201 ? FormRandom : 0, min, max)
|
||||
public EncounterSlot2(EncounterArea2 area, byte species, byte min, byte max, byte slot) : base(area, species, species == 201 ? FormRandom : 0, min, max)
|
||||
{
|
||||
SlotNumber = slot;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public record EncounterSlot3 : EncounterSlot, IMagnetStatic, INumberedSlot, ISlo
|
|||
public byte SlotNumber { get; }
|
||||
public override Ball FixedBall => Locations.IsSafariZoneLocation3(Location) ? Ball.Safari : Ball.None;
|
||||
|
||||
public EncounterSlot3(EncounterArea3 area, int species, int form, int min, int max, byte slot, byte mpi, byte mpc, byte sti, byte stc) : base(area, species, form, min, max)
|
||||
public EncounterSlot3(EncounterArea3 area, ushort species, byte form, byte min, byte max, byte slot, byte mpi, byte mpc, byte sti, byte stc) : base(area, species, form, min, max)
|
||||
{
|
||||
SlotNumber = slot;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public sealed record EncounterSlot3PokeSpot : EncounterSlot, INumberedSlot
|
|||
|
||||
public byte SlotNumber { get; }
|
||||
|
||||
public EncounterSlot3PokeSpot(EncounterArea3XD area, int species, int min, int max, byte slot) : base(area, species, 0, min, max)
|
||||
public EncounterSlot3PokeSpot(EncounterArea3XD area, int species, byte min, byte max, byte slot) : base(area, species, 0, min, max)
|
||||
{
|
||||
SlotNumber = slot;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ internal sealed record EncounterSlot3Swarm : EncounterSlot3, IMoveset
|
|||
{
|
||||
public IReadOnlyList<int> Moves { get; }
|
||||
|
||||
public EncounterSlot3Swarm(EncounterArea3 area, int species, int min, int max, byte slot,
|
||||
public EncounterSlot3Swarm(EncounterArea3 area, ushort species, byte min, byte max, byte slot,
|
||||
IReadOnlyList<int> moves) : base(area, species, 0, min, max, slot, 0, 0, 0, 0) => Moves = moves;
|
||||
|
||||
protected override void SetEncounterMoves(PKM pk, GameVersion version, int level)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public sealed record EncounterSlot4 : EncounterSlot, IMagnetStatic, INumberedSlo
|
|||
public override Ball FixedBall => GetRequiredBallValue();
|
||||
public bool CanUseRadar => !GameVersion.HGSS.Contains(Version) && GroundTile.HasFlag(GroundTilePermission.Grass);
|
||||
|
||||
public EncounterSlot4(EncounterArea4 area, int species, int form, int min, int max, byte slot, byte mpi, byte mpc, byte sti, byte stc) : base(area, species, form, min, max)
|
||||
public EncounterSlot4(EncounterArea4 area, ushort species, byte form, byte min, byte max, byte slot, byte mpi, byte mpc, byte sti, byte stc) : base(area, species, form, min, max)
|
||||
{
|
||||
SlotNumber = slot;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public sealed record EncounterSlot5 : EncounterSlot
|
|||
{
|
||||
public override int Generation => 5;
|
||||
|
||||
public EncounterSlot5(EncounterArea5 area, int species, int form, int min, int max) : base(area, species, form, min, max)
|
||||
public EncounterSlot5(EncounterArea5 area, ushort species, byte form, byte min, byte max) : base(area, species, form, min, max)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public sealed record EncounterSlot6AO : EncounterSlot
|
|||
public bool WhiteFlute { get; init; }
|
||||
public bool BlackFlute { get; init; }
|
||||
|
||||
public EncounterSlot6AO(EncounterArea6AO area, int species, int form, int min, int max) : base(area, species, form, min, max)
|
||||
public EncounterSlot6AO(EncounterArea6AO area, ushort species, byte form, byte min, byte max) : base(area, species, form, min, max)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ public sealed record EncounterSlot6XY : EncounterSlot
|
|||
public bool IsFriendSafari => Area.Type == SlotType.FriendSafari;
|
||||
public bool IsHorde => Area.Type == SlotType.Horde;
|
||||
|
||||
public EncounterSlot6XY(EncounterArea6XY area, int species, int form, int min, int max) : base(area, species, form, min, max)
|
||||
public EncounterSlot6XY(EncounterArea6XY area, int species, int form, byte min, byte max) : base(area, species, form, min, max)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public sealed record EncounterSlot7 : EncounterSlot
|
|||
public override int Generation => 7;
|
||||
public bool IsSOS => Area.Type == SlotType.SOS;
|
||||
|
||||
public EncounterSlot7(EncounterArea7 area, int species, int form, int min, int max) : base(area, species, form, min, max)
|
||||
public EncounterSlot7(EncounterArea7 area, ushort species, byte form, byte min, byte max) : base(area, species, form, min, max)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public sealed record EncounterSlot7b : EncounterSlot
|
|||
{
|
||||
public override int Generation => 7;
|
||||
|
||||
public EncounterSlot7b(EncounterArea7b area, int species, int min, int max) : base(area, species, 0, min, max)
|
||||
public EncounterSlot7b(EncounterArea7b area, int species, byte min, byte max) : base(area, species, 0, min, max)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public sealed record EncounterSlot8 : EncounterSlot, IOverworldCorrelation8
|
|||
public override string LongName => $"{wild} [{SlotType}] - {Weather.ToString().Replace("_", string.Empty)}";
|
||||
public override int Generation => 8;
|
||||
|
||||
public EncounterSlot8(EncounterArea8 area, int species, int form, int min, int max, AreaWeather8 weather, AreaSlotType8 slotType) : base(area, species, form, min, max)
|
||||
public EncounterSlot8(EncounterArea8 area, ushort species, byte form, byte min, byte max, AreaWeather8 weather, AreaSlotType8 slotType) : base(area, species, form, min, max)
|
||||
{
|
||||
Weather = weather;
|
||||
SlotType = slotType;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public sealed record EncounterSlot8a : EncounterSlot, IAlpha
|
|||
public Gender Gender { get; }
|
||||
public byte AlphaType { get; } // 0=Never, 1=Random, 2=Guaranteed
|
||||
|
||||
public EncounterSlot8a(EncounterArea8a area, int species, int form, int min, int max, byte alphaType, byte flawlessIVs, Gender gender) : base(area, species, form, min, max)
|
||||
public EncounterSlot8a(EncounterArea8a area, ushort species, byte form, byte min, byte max, byte alphaType, byte flawlessIVs, Gender gender) : base(area, species, form, min, max)
|
||||
{
|
||||
AlphaType = alphaType;
|
||||
FlawlessIVCount = flawlessIVs;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public sealed record EncounterSlot8b : EncounterSlot
|
|||
public readonly bool IsBCAT;
|
||||
public override Ball FixedBall => IsMarsh ? Ball.Safari : Ball.None;
|
||||
|
||||
public EncounterSlot8b(EncounterArea area, int species, int form, int min, int max, bool isBCAT = false) : base(area, species, form, min, max)
|
||||
public EncounterSlot8b(EncounterArea area, ushort species, byte form, byte min, byte max, bool isBCAT = false) : base(area, species, form, min, max)
|
||||
{
|
||||
IsBCAT = isBCAT;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public static class PogoTypeExtensions
|
|||
/// Gets the minimum level (relative to GO's 1-<see cref="EncountersGO.MAX_LEVEL"/>) the <see cref="encounterType"/> must have.
|
||||
/// </summary>
|
||||
/// <param name="encounterType">Descriptor indicating how the Pokémon was encountered in GO.</param>
|
||||
public static int GetMinLevel(this PogoType encounterType) => encounterType switch
|
||||
public static byte GetMinLevel(this PogoType encounterType) => encounterType switch
|
||||
{
|
||||
PogoType.EggS => 8,
|
||||
PogoType.Raid => 20,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace PKHeX.Core
|
|||
/// <summary>
|
||||
/// Intermediary Representation of Dream World Data
|
||||
/// </summary>
|
||||
internal record DreamWorldEntry(int Species, int Level, ushort Move1 = 0, ushort Move2 = 0, ushort Move3 = 0, byte Form = 0, sbyte Gender = -1)
|
||||
internal record DreamWorldEntry(ushort Species, byte Level, ushort Move1 = 0, ushort Move2 = 0, ushort Move3 = 0, byte Form = 0, sbyte Gender = -1)
|
||||
{
|
||||
private int EntryCount => Move1 == 0 ? 1 : Move2 == 0 ? 1 : Move3 == 0 ? 2 : 3;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ public abstract record EncounterStatic(GameVersion Version) : IEncounterable, IM
|
|||
{
|
||||
public int Species { get; init; }
|
||||
public int Form { get; init; }
|
||||
public virtual int Level { get; init; }
|
||||
public virtual int LevelMin => Level;
|
||||
public virtual int LevelMax => Level;
|
||||
public virtual byte Level { get; init; }
|
||||
public virtual byte LevelMin => Level;
|
||||
public virtual byte LevelMax => Level;
|
||||
public abstract int Generation { get; }
|
||||
|
||||
public virtual int Location { get; init; }
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
public record EncounterStatic1 : EncounterStatic
|
||||
{
|
||||
public override int Generation => 1;
|
||||
public sealed override int Level { get; init; }
|
||||
public sealed override byte Level { get; init; }
|
||||
|
||||
private const int LightBallPikachuCatchRate = 0xA3; // 163
|
||||
|
||||
public EncounterStatic1(int species, int level, GameVersion game) : base(game)
|
||||
public EncounterStatic1(byte species, byte level, GameVersion game) : base(game)
|
||||
{
|
||||
Species = species;
|
||||
Level = level;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public sealed record EncounterStatic1E : EncounterStatic1, IFixedGBLanguage
|
|||
/// <summary> Trainer ID for the event. </summary>
|
||||
public int TID { get; init; } = -1;
|
||||
|
||||
public EncounterStatic1E(int species, int level, GameVersion game) : base(species, level, game)
|
||||
public EncounterStatic1E(byte species, byte level, GameVersion game) : base(species, level, game)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ namespace PKHeX.Core
|
|||
public record EncounterStatic2 : EncounterStatic
|
||||
{
|
||||
public sealed override int Generation => 2;
|
||||
public sealed override int Level { get; init; }
|
||||
public sealed override byte Level { get; init; }
|
||||
|
||||
public EncounterStatic2(int species, int level, GameVersion game) : base(game)
|
||||
public EncounterStatic2(byte species, byte level, GameVersion game) : base(game)
|
||||
{
|
||||
Species = species;
|
||||
Level = level;
|
||||
|
|
@ -98,7 +98,7 @@ protected override void SetMetData(PKM pk, int level, DateTime today)
|
|||
|
||||
public sealed record EncounterStatic2Odd : EncounterStatic2
|
||||
{
|
||||
public EncounterStatic2Odd(int species) : base(species, 5, GameVersion.C)
|
||||
public EncounterStatic2Odd(byte species) : base(species, 5, GameVersion.C)
|
||||
{
|
||||
EggLocation = 256;
|
||||
EggCycles = 20;
|
||||
|
|
@ -125,7 +125,7 @@ public sealed record EncounterStatic2Roam : EncounterStatic2
|
|||
private const ulong RoamLocations = 0b10_1000_1010_0100_0000_0110_0011_0100_1000_1001_0011_0100;
|
||||
public override int Location => 2;
|
||||
|
||||
public EncounterStatic2Roam(int species, int level, GameVersion ver) : base(species, level, ver) { }
|
||||
public EncounterStatic2Roam(byte species, byte level, GameVersion ver) : base(species, level, ver) { }
|
||||
|
||||
protected override bool IsMatchLocation(PKM pkm)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public sealed record EncounterStatic2E : EncounterStatic2, IFixedGBLanguage
|
|||
|
||||
public int CurrentLevel { get; init; } = -1;
|
||||
|
||||
public EncounterStatic2E(int species, int level, GameVersion ver) : base(species, level, ver)
|
||||
public EncounterStatic2E(byte species, byte level, GameVersion ver) : base(species, level, ver)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public sealed record EncounterStatic3 : EncounterStatic
|
|||
public override int Generation => 3;
|
||||
public bool Roaming { get; init; }
|
||||
|
||||
public EncounterStatic3(int species, int level, GameVersion game) : base(game)
|
||||
public EncounterStatic3(ushort species, byte level, GameVersion game) : base(game)
|
||||
{
|
||||
Species = species;
|
||||
Level = level;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public sealed record EncounterStatic4Pokewalker : EncounterStatic
|
|||
{
|
||||
public override int Generation => 4;
|
||||
|
||||
public EncounterStatic4Pokewalker(int species, sbyte gender, int level) : base(GameVersion.HGSS)
|
||||
public EncounterStatic4Pokewalker(ushort species, sbyte gender, byte level) : base(GameVersion.HGSS)
|
||||
{
|
||||
Species = species;
|
||||
Gender = gender;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteri
|
|||
pk.SetRandomEC();
|
||||
}
|
||||
|
||||
internal static EncounterStatic7 GetVC1(int species, int metLevel)
|
||||
internal static EncounterStatic7 GetVC1(int species, byte metLevel)
|
||||
{
|
||||
bool mew = species == (int)Core.Species.Mew;
|
||||
return new EncounterStatic7(GameVersion.RBY)
|
||||
|
|
@ -74,7 +74,7 @@ internal static EncounterStatic7 GetVC1(int species, int metLevel)
|
|||
};
|
||||
}
|
||||
|
||||
internal static EncounterStatic7 GetVC2(int species, int metLevel)
|
||||
internal static EncounterStatic7 GetVC2(int species, byte metLevel)
|
||||
{
|
||||
bool mew = species == (int)Core.Species.Mew;
|
||||
bool fateful = mew || species == (int)Core.Species.Celebi;
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ public sealed record EncounterStatic8N : EncounterStatic8Nest<EncounterStatic8N>
|
|||
|
||||
private IReadOnlyList<byte> NestLocations => Encounters8Nest.NestLocations[NestID];
|
||||
|
||||
public override int Level { get => LevelMin; init { } }
|
||||
public override int LevelMin => LevelCaps[MinRank * 2];
|
||||
public override int LevelMax => LevelCaps[(MaxRank * 2) + 1];
|
||||
public override byte Level { get => LevelMin; init { } }
|
||||
public override byte LevelMin => LevelCaps[MinRank * 2];
|
||||
public override byte LevelMax => LevelCaps[(MaxRank * 2) + 1];
|
||||
|
||||
public EncounterStatic8N(byte nestID, uint minRank, uint maxRank, byte val, GameVersion game) : base(game)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public sealed record EncounterStatic8U : EncounterStatic8Nest<EncounterStatic8U>
|
|||
{
|
||||
public override int Location { get => MaxLair; init { } }
|
||||
|
||||
public EncounterStatic8U(int species, int form, int level) : base(GameVersion.SWSH) // no difference in met location for hosted raids
|
||||
public EncounterStatic8U(ushort species, byte form, byte level) : base(GameVersion.SWSH) // no difference in met location for hosted raids
|
||||
{
|
||||
Species = species;
|
||||
Form = form;
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ public abstract record EncounterTrade(GameVersion Version) : IEncounterable, IMo
|
|||
{
|
||||
public int Species { get; init; }
|
||||
public int Form { get; init; }
|
||||
public int Level { get; init; }
|
||||
public virtual int LevelMin => Level;
|
||||
public int LevelMax => 100;
|
||||
public byte Level { get; init; }
|
||||
public virtual byte LevelMin => Level;
|
||||
public byte LevelMax => 100;
|
||||
public abstract int Generation { get; }
|
||||
|
||||
public int CurrentLevel { get; init; } = -1;
|
||||
|
|
@ -81,7 +81,7 @@ protected virtual void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria
|
|||
int lang = (int)Language.GetSafeLanguage(Generation, (LanguageID)sav.Language, version);
|
||||
int level = CurrentLevel > 0 ? CurrentLevel : LevelMin;
|
||||
if (level == 0)
|
||||
level = Math.Max(1, LevelMin);
|
||||
level = Math.Max((byte)1, LevelMin);
|
||||
|
||||
int species = Species;
|
||||
if (EvolveOnTrade)
|
||||
|
|
|
|||
|
|
@ -12,14 +12,14 @@ namespace PKHeX.Core
|
|||
public sealed record EncounterTrade1 : EncounterTradeGB
|
||||
{
|
||||
public override int Generation => 1;
|
||||
public override int LevelMin => CanObtainMinGSC() ? LevelMinGSC : LevelMinRBY;
|
||||
public override byte LevelMin => CanObtainMinGSC() ? LevelMinGSC : LevelMinRBY;
|
||||
|
||||
private readonly int LevelMinRBY;
|
||||
private readonly int LevelMinGSC;
|
||||
private readonly byte LevelMinRBY;
|
||||
private readonly byte LevelMinGSC;
|
||||
public override int Location => 0;
|
||||
public override Shiny Shiny => Shiny.Random;
|
||||
|
||||
public EncounterTrade1(int species, GameVersion game, int rby, int gsc) : base(species, gsc, game)
|
||||
public EncounterTrade1(int species, GameVersion game, byte rby, byte gsc) : base(species, gsc, game)
|
||||
{
|
||||
TrainerNames = StringConverter12.G1TradeOTName;
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ public EncounterTrade1(int species, GameVersion game, int rby, int gsc) : base(s
|
|||
LevelMinGSC = gsc;
|
||||
}
|
||||
|
||||
public EncounterTrade1(int species, GameVersion game, int rby) : this(species, game, rby, rby) { }
|
||||
public EncounterTrade1(int species, GameVersion game, byte rby) : this(species, game, rby, rby) { }
|
||||
|
||||
public byte GetInitialCatchRate()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ public sealed record EncounterTrade2 : EncounterTradeGB
|
|||
public override int Generation => 2;
|
||||
public override int Location => Locations.LinkTrade2NPC;
|
||||
|
||||
public EncounterTrade2(int species, int level, ushort tid) : base(species, level, GameVersion.GSC)
|
||||
public EncounterTrade2(ushort species, byte level, ushort tid) : base(species, level, GameVersion.GSC)
|
||||
{
|
||||
TID = tid;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public IReadOnlyList<byte> Contest
|
|||
}
|
||||
}
|
||||
|
||||
public EncounterTrade3(GameVersion game, uint pid, int species, int level) : base(game)
|
||||
public EncounterTrade3(GameVersion game, uint pid, ushort species, byte level) : base(game)
|
||||
{
|
||||
PID = pid;
|
||||
Species = species;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public sealed record EncounterTrade4PID : EncounterTrade4, IContestStats
|
|||
|
||||
public override Shiny Shiny => Shiny.FixedValue;
|
||||
|
||||
public EncounterTrade4PID(GameVersion game, uint pid, int species, int level) : base(game)
|
||||
public EncounterTrade4PID(GameVersion game, uint pid, ushort species, byte level) : base(game)
|
||||
{
|
||||
PID = pid;
|
||||
Species = species;
|
||||
|
|
@ -119,7 +119,7 @@ public sealed record EncounterTrade4RanchGift : EncounterTrade4
|
|||
public override int Location => MetLocation;
|
||||
public override Shiny Shiny => Shiny.FixedValue;
|
||||
|
||||
public EncounterTrade4RanchGift(uint pid, int species, int level) : base(GameVersion.D)
|
||||
public EncounterTrade4RanchGift(uint pid, ushort species, byte level) : base(GameVersion.D)
|
||||
{
|
||||
PID = pid;
|
||||
Species = species;
|
||||
|
|
@ -150,7 +150,7 @@ public sealed record EncounterTrade4RanchSpecial : EncounterTrade4
|
|||
{
|
||||
public override int Location => 3000;
|
||||
|
||||
public EncounterTrade4RanchSpecial(int species, int level) : base(GameVersion.D)
|
||||
public EncounterTrade4RanchSpecial(ushort species, byte level) : base(GameVersion.D)
|
||||
{
|
||||
Species = species;
|
||||
Level = level;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public sealed record EncounterTrade8 : EncounterTrade, IDynamaxLevel, IRelearn,
|
|||
public byte FlawlessIVCount { get; init; }
|
||||
public override Shiny Shiny { get; }
|
||||
|
||||
public EncounterTrade8(GameVersion game, int species, int level, byte memory, ushort arg, byte feel, byte intensity, Shiny shiny = Shiny.Never) : base(game)
|
||||
public EncounterTrade8(GameVersion game, int species, byte level, byte memory, ushort arg, byte feel, byte intensity, Shiny shiny = Shiny.Never) : base(game)
|
||||
{
|
||||
Species = species;
|
||||
Level = level;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
/// <inheritdoc cref="EncounterTrade"/>
|
||||
public abstract record EncounterTradeGB : EncounterTrade
|
||||
{
|
||||
protected EncounterTradeGB(int species, int level, GameVersion game) : base(game)
|
||||
protected EncounterTradeGB(int species, byte level, GameVersion game) : base(game)
|
||||
{
|
||||
Species = species;
|
||||
Level = level;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public static IEnumerable<EncounterEgg> GenerateEggs(PKM pkm, IReadOnlyList<EvoC
|
|||
if (!Breeding.CanGameGenerateEggs(ver))
|
||||
yield break;
|
||||
|
||||
int lvl = EggStateLegality.GetEggLevel(generation);
|
||||
var lvl = EggStateLegality.GetEggLevel(generation);
|
||||
int max = GetMaxSpeciesOrigin(generation);
|
||||
|
||||
var (species, form) = GetBaseSpecies(chain, 0);
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ private static IEnumerable<EncounterStatic> GetMatchingStaticEncounters(PKM pkm,
|
|||
internal static EncounterStatic7 GetVCStaticTransferEncounter(PKM pkm, IEncounterTemplate enc, IReadOnlyList<EvoCriteria> chain)
|
||||
{
|
||||
// Obtain the lowest evolution species with matching OT friendship. Not all species chains have the same base friendship.
|
||||
var met = pkm.Met_Level;
|
||||
var met = (byte)pkm.Met_Level;
|
||||
if (pkm.VC1)
|
||||
{
|
||||
// Only yield a VC1 template if it could originate in VC1.
|
||||
|
|
@ -123,9 +123,9 @@ internal static EncounterStatic7 GetVCStaticTransferEncounter(PKM pkm, IEncounte
|
|||
switch (pkm.Generation)
|
||||
{
|
||||
case 1:
|
||||
return EncounterStatic7.GetVC1(MaxSpeciesID_1, pkm.Met_Level);
|
||||
return EncounterStatic7.GetVC1(MaxSpeciesID_1, (byte)pkm.Met_Level);
|
||||
case 2:
|
||||
return EncounterStatic7.GetVC2(MaxSpeciesID_2, pkm.Met_Level);
|
||||
return EncounterStatic7.GetVC2(MaxSpeciesID_2, (byte)pkm.Met_Level);
|
||||
default:
|
||||
return GetPossible(pkm, chain)
|
||||
.OrderBy(z => !chain.Any(s => s.Species == z.Species && s.Form == z.Form))
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ public interface IEncounterTemplate : ISpeciesForm, IVersion, IGeneration, IShin
|
|||
/// <summary>
|
||||
/// Minimum level for the encounter.
|
||||
/// </summary>
|
||||
int LevelMin { get; }
|
||||
int LevelMax { get; }
|
||||
byte LevelMin { get; }
|
||||
byte LevelMax { get; }
|
||||
}
|
||||
|
||||
public static partial class Extensions
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ internal static int GetEvoChainSpeciesIndex(IReadOnlyList<EvoCriteria> chain, in
|
|||
|
||||
private static List<EvoCriteria> GetEvolutionChain(PKM pkm, IEncounterTemplate enc, int mostEvolvedSpecies, int maxlevel)
|
||||
{
|
||||
var min = enc.LevelMin;
|
||||
int min = enc.LevelMin;
|
||||
if (pkm.HasOriginalMetLocation && pkm.Met_Level != 0)
|
||||
min = pkm.Met_Level;
|
||||
var chain = GetValidPreEvolutions(pkm, minLevel: min);
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public static int GetMaximumEggHatchCycles(PKM pk, IEncounterTemplate enc)
|
|||
/// Level which eggs are given to the player.
|
||||
/// </summary>
|
||||
/// <param name="generation">Generation the egg is given in</param>
|
||||
public static int GetEggLevel(int generation) => generation >= 4 ? 1 : 5;
|
||||
public static byte GetEggLevel(int generation) => generation >= 4 ? (byte)1 : (byte)5;
|
||||
|
||||
/// <summary>
|
||||
/// Met Level which eggs are given to the player. May change if transferred to future games.
|
||||
|
|
|
|||
|
|
@ -152,9 +152,9 @@ public virtual Shiny Shiny
|
|||
public abstract string OT_Name { get; set; }
|
||||
public abstract int Location { get; set; }
|
||||
|
||||
public abstract int Level { get; set; }
|
||||
public int LevelMin => Level;
|
||||
public int LevelMax => Level;
|
||||
public abstract byte Level { get; set; }
|
||||
public byte LevelMin => Level;
|
||||
public byte LevelMax => Level;
|
||||
public abstract int Ball { get; set; }
|
||||
public virtual bool EggEncounter => IsEgg;
|
||||
public abstract int EggLocation { get; set; }
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public sealed class PCD : DataMysteryGift, IRibbonSetEvent3, IRibbonSetEvent4
|
|||
public const int Size = 0x358; // 856
|
||||
public override int Generation => 4;
|
||||
|
||||
public override int Level
|
||||
public override byte Level
|
||||
{
|
||||
get => Gift.Level;
|
||||
set => Gift.Level = value;
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public override string OT_Name
|
|||
}
|
||||
|
||||
public int OTGender { get => Data[0x5A]; set => Data[0x5A] = (byte)value; }
|
||||
public override int Level { get => Data[0x5B]; set => Data[0x5C] = (byte)value; }
|
||||
public override byte Level { get => Data[0x5B]; set => Data[0x5C] = value; }
|
||||
public override bool IsEgg { get => Data[0x5C] == 1; set => Data[0x5C] = value ? (byte)1 : (byte)0; }
|
||||
// Unused 0x5D 0x5E 0x5F
|
||||
public override string CardTitle
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ public sealed class PGT : DataMysteryGift, IRibbonSetEvent3, IRibbonSetEvent4
|
|||
public const int Size = 0x104; // 260
|
||||
public override int Generation => 4;
|
||||
|
||||
public override int Level
|
||||
public override byte Level
|
||||
{
|
||||
get => IsManaphyEgg ? 1 : IsPokémon ? PK.Met_Level : 0;
|
||||
get => IsManaphyEgg ? (byte)1 : IsPokémon ? (byte)PK.Met_Level : (byte)0;
|
||||
set { if (IsPokémon) PK.Met_Level = value; }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ public string Nickname
|
|||
public int PIDType { get => Data[0x3B]; set => Data[0x3B] = (byte)value; }
|
||||
public int EggLocation { get => ReadUInt16LittleEndian(Data.AsSpan(0x3C)); set => WriteUInt16LittleEndian(Data.AsSpan(0x3C), (ushort)value); }
|
||||
public int MetLocation { get => ReadUInt16LittleEndian(Data.AsSpan(0x3E)); set => WriteUInt16LittleEndian(Data.AsSpan(0x3E), (ushort)value); }
|
||||
public int MetLevel { get => Data[0x40]; set => Data[0x40] = (byte)value; }
|
||||
public byte MetLevel { get => Data[0x40]; set => Data[0x40] = value; }
|
||||
|
||||
public int CNT_Cool { get => Data[0x41]; set => Data[0x41] = (byte)value; }
|
||||
public int CNT_Beauty { get => Data[0x42]; set => Data[0x42] = (byte)value; }
|
||||
|
|
@ -169,8 +169,8 @@ public string OT
|
|||
public bool RibbonPremier { get => (RIB1 & (1 << 6)) == 1 << 6; set => RIB1 = (byte)((RIB1 & ~(1 << 6)) | (value ? 1 << 6 : 0)); }
|
||||
public bool RIB1_7 { get => (RIB1 & (1 << 7)) == 1 << 7; set => RIB1 = (byte)((RIB1 & ~(1 << 7)) | (value ? 1 << 7 : 0)); }
|
||||
|
||||
public int LevelMin => MetLevel;
|
||||
public int LevelMax => MetLevel;
|
||||
public byte LevelMin => MetLevel;
|
||||
public byte LevelMax => MetLevel;
|
||||
|
||||
public IReadOnlyList<int> Moves
|
||||
{
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ public override int HeldItem
|
|||
public override int Species { get => ReadUInt16LittleEndian(Data.AsSpan(0x238)); set => WriteUInt16LittleEndian(Data.AsSpan(0x238), (ushort)value); }
|
||||
public override int Form { get => Data[0x23A]; set => Data[0x23A] = (byte)value; }
|
||||
public override int Gender { get => Data[0x23B]; set => Data[0x23B] = (byte)value; }
|
||||
public override int Level { get => Data[0x23C]; set => Data[0x23C] = (byte)value; }
|
||||
public override byte Level { get => Data[0x23C]; set => Data[0x23C] = value; }
|
||||
public override bool IsEgg { get => Data[0x23D] == 1; set => Data[0x23D] = value ? (byte)1 : (byte)0; }
|
||||
public int Nature { get => (sbyte)Data[0x23E]; set => Data[0x23E] = (byte)value; }
|
||||
public override int AbilityType { get => Data[0x23F]; set => Data[0x23F] = (byte)value; }
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ public override int Ball
|
|||
// set => Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, CardStart + 0xB6);
|
||||
// }
|
||||
|
||||
public override int Level { get => Data[CardStart + 0xD0]; set => Data[CardStart + 0xD0] = (byte)value; }
|
||||
public override byte Level { get => Data[CardStart + 0xD0]; set => Data[CardStart + 0xD0] = value; }
|
||||
public override bool IsEgg { get => Data[CardStart + 0xD1] == 1; set => Data[CardStart + 0xD1] = value ? (byte)1 : (byte)0; }
|
||||
public ushort AdditionalItem { get => ReadUInt16LittleEndian(Data.AsSpan(CardStart + 0xD2)); set => WriteUInt16LittleEndian(Data.AsSpan(CardStart + 0xD2), value); }
|
||||
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ public override int HeldItem
|
|||
public override int Species { get => ReadUInt16LittleEndian(Data.AsSpan(CardStart + 0x288)); set => WriteUInt16LittleEndian(Data.AsSpan(CardStart + 0x288), (ushort)value); }
|
||||
public override int Form { get => Data[CardStart + 0x28A]; set => Data[CardStart + 0x28A] = (byte)value; }
|
||||
public override int Gender { get => Data[CardStart + 0x28B]; set => Data[CardStart + 0x28B] = (byte)value; }
|
||||
public override int Level { get => Data[CardStart + 0x28C]; set => Data[CardStart + 0x28C] = (byte)value; }
|
||||
public override byte Level { get => Data[CardStart + 0x28C]; set => Data[CardStart + 0x28C] = value; }
|
||||
public override bool IsEgg { get => Data[CardStart + 0x28D] == 1; set => Data[CardStart + 0x28D] = value ? (byte)1 : (byte)0; }
|
||||
public int Nature { get => (sbyte)Data[CardStart + 0x28E]; set => Data[CardStart + 0x28E] = (byte)value; }
|
||||
public override int AbilityType { get => Data[CardStart + 0x28F]; set => Data[CardStart + 0x28F] = (byte)value; }
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public sealed class WC3 : MysteryGift, IRibbonSetEvent3, ILangNicknamedTemplate
|
|||
|
||||
// Mystery Gift Properties
|
||||
public override int Generation => 3;
|
||||
public override int Level { get; set; }
|
||||
public override byte Level { get; set; }
|
||||
public override int Ball { get; set; } = 4;
|
||||
public override bool IsShiny => Shiny == Shiny.Always;
|
||||
public bool RibbonEarth { get; set; }
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ public override string OT_Name
|
|||
set => StringConverter6.SetString(Data.AsSpan(0xB6, 0x1A), value.AsSpan(), 12, StringConverterOption.ClearZero);
|
||||
}
|
||||
|
||||
public override int Level { get => Data[0xD0]; set => Data[0xD0] = (byte)value; }
|
||||
public override byte Level { get => Data[0xD0]; set => Data[0xD0] = value; }
|
||||
public override bool IsEgg { get => Data[0xD1] == 1; set => Data[0xD1] = value ? (byte)1 : (byte)0; }
|
||||
public uint PID { get => ReadUInt32LittleEndian(Data.AsSpan(0xD4)); set => WriteUInt32LittleEndian(Data.AsSpan(0xD4), value); }
|
||||
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ public override string OT_Name
|
|||
set => StringConverter7.SetString(Data.AsSpan(0xB6, 0x1A), value.AsSpan(), 12, Language, StringConverterOption.ClearZero);
|
||||
}
|
||||
|
||||
public override int Level { get => Data[0xD0]; set => Data[0xD0] = (byte)value; }
|
||||
public override byte Level { get => Data[0xD0]; set => Data[0xD0] = value; }
|
||||
public override bool IsEgg { get => Data[0xD1] == 1; set => Data[0xD1] = value ? (byte)1 : (byte)0; }
|
||||
public ushort AdditionalItem { get => ReadUInt16LittleEndian(Data.AsSpan(0xD2)); set => WriteUInt16LittleEndian(Data.AsSpan(0xD2), value); }
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ public override int HeldItem
|
|||
public override int Species { get => ReadUInt16LittleEndian(Data.AsSpan(CardStart + 0x240)); set => WriteUInt16LittleEndian(Data.AsSpan(CardStart + 0x240), (ushort)value); }
|
||||
public override int Form { get => Data[CardStart + 0x242]; set => Data[CardStart + 0x242] = (byte)value; }
|
||||
public override int Gender { get => Data[CardStart + 0x243]; set => Data[CardStart + 0x243] = (byte)value; }
|
||||
public override int Level { get => Data[CardStart + 0x244]; set => Data[CardStart + 0x244] = (byte)value; }
|
||||
public override byte Level { get => Data[CardStart + 0x244]; set => Data[CardStart + 0x244] = value; }
|
||||
public override bool IsEgg { get => Data[CardStart + 0x245] == 1; set => Data[CardStart + 0x245] = value ? (byte)1 : (byte)0; }
|
||||
public int Nature { get => (sbyte)Data[CardStart + 0x246]; set => Data[CardStart + 0x246] = (byte)value; }
|
||||
public override int AbilityType { get => Data[CardStart + 0x247]; set => Data[CardStart + 0x247] = (byte)value; }
|
||||
|
|
|
|||
|
|
@ -64,10 +64,10 @@ public override int Species
|
|||
|
||||
public override bool GiftUsed { get; set; }
|
||||
|
||||
public override int Level // are moves stored? mew has '1' but this could be move
|
||||
public override byte Level // are moves stored? mew has '1' but this could be move
|
||||
{
|
||||
get => ReadUInt16LittleEndian(Data.AsSpan(0x10E));
|
||||
set => WriteUInt16LittleEndian(Data.AsSpan(0x10E), (ushort)value);
|
||||
get => Data[0x10E];
|
||||
set => Data[0x10E] = value;
|
||||
}
|
||||
|
||||
public override int ItemID { get => ReadUInt16LittleEndian(Data.AsSpan(0x110)); set => WriteUInt16LittleEndian(Data.AsSpan(0x110), (ushort)value); }
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ public sealed class GP1 : IEncounterInfo, IFixedAbilityNumber
|
|||
|
||||
public GameVersion Version => GameVersion.GO;
|
||||
public bool EggEncounter => false;
|
||||
public int LevelMin => Level;
|
||||
public int LevelMax => Level;
|
||||
public byte LevelMin => Level;
|
||||
public byte LevelMax => Level;
|
||||
public int Generation => 7;
|
||||
public AbilityPermission Ability => AbilityPermission.Any12;
|
||||
public PKM ConvertToPKM(ITrainerInfo sav) => ConvertToPB7(sav);
|
||||
|
|
@ -65,7 +65,7 @@ public static byte[] GetBlank()
|
|||
public int Species => ReadInt32LittleEndian(Data.AsSpan(0x28));
|
||||
public int CP => ReadInt32LittleEndian(Data.AsSpan(0x2C));
|
||||
public float LevelF => ReadSingleLittleEndian(Data.AsSpan(0x30));
|
||||
public int Level => Math.Max(1, (int)Math.Round(LevelF));
|
||||
public byte Level => Math.Max((byte)1, (byte)Math.Round(LevelF));
|
||||
public int Stat_HP => ReadInt32LittleEndian(Data.AsSpan(0x34));
|
||||
// geolocation data 0x38-0x47?
|
||||
public float HeightF => ReadSingleLittleEndian(Data.AsSpan(0x48));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user