mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-16 23:43:11 +00:00
734aa33898
Now logic is reasonably split, and each format of area has its own way of yielding slots Too much junk with checking flute boosts or catch combo applicability; just let the area dictate how slots match.
43 lines
No EOL
1.4 KiB
C#
43 lines
No EOL
1.4 KiB
C#
using System;
|
|
|
|
namespace PKHeX.Core
|
|
{
|
|
/// <inheritdoc />
|
|
/// <summary>
|
|
/// Base encounter class for manually repacked areas
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Encounter Data is stored in the following format: (u16 Location, n*[u16 Species/Form, u8 Min, u8 Max]), hence the 32bit name
|
|
/// </remarks>
|
|
public abstract class EncounterArea32 : EncounterArea
|
|
{
|
|
protected internal void LoadSlots(byte[] areaData)
|
|
{
|
|
var count = (areaData.Length - 2) / 4;
|
|
Location = BitConverter.ToUInt16(areaData, 0);
|
|
Slots = new EncounterSlot[count];
|
|
for (int i = 0; i < Slots.Length; i++)
|
|
{
|
|
int ofs = 2 + (i * 4);
|
|
ushort SpecForm = BitConverter.ToUInt16(areaData, ofs);
|
|
Slots[i] = new EncounterSlot
|
|
{
|
|
Species = SpecForm & 0x7FF,
|
|
Form = SpecForm >> 11,
|
|
LevelMin = areaData[ofs + 2],
|
|
LevelMax = areaData[ofs + 3],
|
|
};
|
|
}
|
|
foreach (var slot in Slots)
|
|
slot.Area = this;
|
|
}
|
|
|
|
protected static EncounterSlot GetPressureSlot(EncounterSlot s, PKM pkm)
|
|
{
|
|
var max = s.Clone();
|
|
max.Permissions.Pressure = true;
|
|
max.Form = pkm.AltForm;
|
|
return max;
|
|
}
|
|
}
|
|
} |