mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-04-26 02:29:59 -05:00
Updates from net46->net7, dropping support for mono in favor of using the latest runtime (along with the performance/API improvements). Releases will be posted as 64bit only for now. Refactors a good amount of internal API methods to be more performant and more customizable for future updates & fixes. Adds functionality for Batch Editor commands to `>`, `<` and <=/>= TID/SID properties renamed to TID16/SID16 for clarity; other properties exposed for Gen7 / display variants. Main window has a new layout to account for DPI scaling (8 point grid) Fixed: Tatsugiri and Paldean Tauros now output Showdown form names as Showdown expects Changed: Gen9 species now interact based on the confirmed National Dex IDs (closes #3724) Fixed: Pokedex set all no longer clears species with unavailable non-base forms (closes #3720) Changed: Hyper Training suggestions now apply for level 50 in SV. (closes #3714) Fixed: B2/W2 hatched egg met locations exclusive to specific versions are now explicitly checked (closes #3691) Added: Properties for ribbon/mark count (closes #3659) Fixed: Traded SV eggs are now checked correctly (closes #3692)
65 lines
2.0 KiB
C#
65 lines
2.0 KiB
C#
using System;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
/// <summary>
|
|
/// Intermediary Representation of Dream World Data
|
|
/// </summary>
|
|
public readonly record struct 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;
|
|
|
|
private void AddTo(GameVersion game, EncounterStatic5[] result, ref int ctr)
|
|
{
|
|
var p = PersonalTable.B2W2[Species];
|
|
var a = p.HasHiddenAbility ? AbilityPermission.OnlyHidden : AbilityPermission.OnlyFirst;
|
|
if (Move1 == 0)
|
|
{
|
|
result[ctr++] = new EncounterStatic5(game)
|
|
{
|
|
Species = Species,
|
|
Form = Form,
|
|
Gender = Gender,
|
|
Level = Level,
|
|
Ability = a,
|
|
Location = 075,
|
|
Shiny = Shiny.Never,
|
|
};
|
|
return;
|
|
}
|
|
result[ctr++] = Create(game, a, Move1);
|
|
if (Move2 == 0)
|
|
return;
|
|
result[ctr++] = Create(game, a, Move2);
|
|
if (Move3 == 0)
|
|
return;
|
|
result[ctr++] = Create(game, a, Move3);
|
|
}
|
|
|
|
private EncounterStatic5 Create(GameVersion game, AbilityPermission ability, ushort move) => new(game)
|
|
{
|
|
Species = Species,
|
|
Form = Form,
|
|
Gender = Gender,
|
|
Level = Level,
|
|
Ability = ability,
|
|
Location = 075,
|
|
Shiny = Shiny.Never,
|
|
Moves = new(move),
|
|
};
|
|
|
|
public static EncounterStatic5[] GetArray(GameVersion game, ReadOnlySpan<DreamWorldEntry> t)
|
|
{
|
|
// Split encounters with multiple permitted special moves -- a pk can only be obtained with 1 of the special moves!
|
|
int count = 0;
|
|
foreach (var e in t)
|
|
count += e.EntryCount;
|
|
var result = new EncounterStatic5[count];
|
|
|
|
int ctr = 0;
|
|
foreach (var s in t)
|
|
s.AddTo(game, result, ref ctr);
|
|
return result;
|
|
}
|
|
}
|