Add move/enc/loc references

This commit is contained in:
Kurt 2018-11-11 22:49:17 -08:00
parent ac314fe0d7
commit 6495dc41af
5 changed files with 81 additions and 4 deletions

View file

@ -45,6 +45,8 @@ namespace PKHeX.Core
{ GameVersion.MN, Legal.LevelUpSM },
{ GameVersion.US, Legal.LevelUpUSUM },
{ GameVersion.UM, Legal.LevelUpUSUM },
{ GameVersion.GP, Legal.LevelUpGG },
{ GameVersion.GE, Legal.LevelUpGG },
{ GameVersion.RB, Legal.LevelUpRB },
{ GameVersion.RBY, Legal.LevelUpY },
@ -64,6 +66,8 @@ namespace PKHeX.Core
{ GameVersion.SM, Legal.LevelUpSM },
{ GameVersion.USUM, Legal.LevelUpUSUM },
{ GameVersion.GG, Legal.LevelUpGG },
{ GameVersion.Gen1, Legal.LevelUpY },
{ GameVersion.Gen2, Legal.LevelUpC },
{ GameVersion.Gen3, Legal.LevelUpE },
@ -112,6 +116,8 @@ namespace PKHeX.Core
{ GameVersion.MN, PersonalTable.SM },
{ GameVersion.US, PersonalTable.USUM },
{ GameVersion.UM, PersonalTable.USUM },
{ GameVersion.GP, PersonalTable.GG },
{ GameVersion.GE, PersonalTable.GG },
{ GameVersion.RB, PersonalTable.RB },
{ GameVersion.RBY, PersonalTable.Y },
@ -131,6 +137,8 @@ namespace PKHeX.Core
{ GameVersion.SM, PersonalTable.SM },
{ GameVersion.USUM, PersonalTable.USUM },
{ GameVersion.GG, PersonalTable.GG },
{ GameVersion.Gen1, PersonalTable.Y },
{ GameVersion.Gen2, PersonalTable.C },
{ GameVersion.Gen3, PersonalTable.E },

View file

@ -19,6 +19,7 @@ namespace PKHeX.Core
public readonly string[] metBW2_00000, metBW2_30000, metBW2_40000, metBW2_60000;
public readonly string[] metXY_00000, metXY_30000, metXY_40000, metXY_60000;
public readonly string[] metSM_00000, metSM_30000, metSM_40000, metSM_60000;
public readonly string[] metGG_00000, metGG_30000, metGG_40000, metGG_60000;
// Misc
public readonly string[] wallpapernames, puffs;
@ -116,6 +117,11 @@ namespace PKHeX.Core
metSM_40000 = Get("sm_40000");
metSM_60000 = Get("sm_60000");
metGG_00000 = Get("gg_00000");
metGG_30000 = metSM_30000;
metGG_40000 = Get("gg_40000");
metGG_60000 = metSM_60000;
Sanitize();
g4items = (string[])itemlist.Clone();
@ -177,6 +183,8 @@ namespace PKHeX.Core
itemlist[842] += " (SM)"; // Fishing Rod
itemlist[945] += " (2)"; // Used Solarizer
itemlist[946] += " (2)"; // Used Lunarizer
itemlist[894] += " (P)"; // Leaf Letter
itemlist[895] += " (E)"; // Leaf Letter
// Append Z-Crystal flagging
foreach (var i in Legal.Pouch_ZCrystal_USUM)
@ -304,6 +312,7 @@ namespace PKHeX.Core
private IReadOnlyList<ComboItem> MetGen5 { get; set; }
private IReadOnlyList<ComboItem> MetGen6 { get; set; }
private IReadOnlyList<ComboItem> MetGen7 { get; set; }
private IReadOnlyList<ComboItem> MetGen7GG { get; set; }
public MemoryStrings Memories { get; private set; }
@ -327,6 +336,7 @@ namespace PKHeX.Core
private IReadOnlyList<ComboItem> GetVersionList()
{
var ver = Util.GetCBList(gamelist,
Legal.Games_7gg,
Legal.Games_7usum, Legal.Games_7sm,
Legal.Games_6oras, Legal.Games_6xy,
Legal.Games_5, Legal.Games_4, Legal.Games_4e, Legal.Games_4r,
@ -397,6 +407,17 @@ namespace PKHeX.Core
met_list = Util.GetOffsetCBList(met_list, metSM_60000, 60001, Legal.Met_SM_6);
MetGen7 = met_list;
}
// Gen 7 GG
{
var met_list = Util.GetCBList(metGG_00000, new[] { 0 });
met_list = Util.GetOffsetCBList(met_list, metGG_60000, 60001, new[] { 60002 });
met_list = Util.GetOffsetCBList(met_list, metGG_30000, 30001, new[] { 30002 });
met_list = Util.GetOffsetCBList(met_list, metGG_00000, 00000, Legal.Met_GG_0);
met_list = Util.GetOffsetCBList(met_list, metGG_30000, 30001, Legal.Met_GG_3);
met_list = Util.GetOffsetCBList(met_list, metGG_40000, 40001, Legal.Met_GG_4);
met_list = Util.GetOffsetCBList(met_list, metGG_60000, 60001, Legal.Met_GG_6);
MetGen7GG = met_list;
}
}
public void SetItemDataSource(GameVersion game, int generation, int MaxItemID, IEnumerable<ushort> allowed = null, bool HaX = false)
@ -485,6 +506,10 @@ namespace PKHeX.Core
case GameVersion.SV:
case GameVersion.C:
return MetGen7.Take(3).Concat(MetGen7.Skip(3).OrderByDescending(loc => loc.Value < 234)).ToList(); // Dividing Peak Tunnel
case GameVersion.GP:
case GameVersion.GE:
return MetGen7GG.Take(3).Concat(MetGen7GG.Skip(3).OrderByDescending(loc => loc.Value <= 54)).ToList(); // Pokémon League
}
// Currently on a future game, return corresponding list for generation

View file

@ -8,7 +8,8 @@ namespace PKHeX.Core
{
internal static class MoveLevelUp
{
private static readonly LearnLookup LearnSM, LearnUSUM,
private static readonly LearnLookup
LearnSM, LearnUSUM, LearnGG,
LearnXY, LearnAO,
LearnBW, LearnB2W2,
LearnDP, LearnPt, LearnHGSS,
@ -20,6 +21,7 @@ namespace PKHeX.Core
{
LearnSM = new LearnLookup(PersonalTable.SM, LevelUpSM, SM);
LearnUSUM = new LearnLookup(PersonalTable.USUM, LevelUpUSUM, USUM);
LearnGG = new LearnLookup(PersonalTable.GG, LevelUpGG, GG);
LearnXY = new LearnLookup(PersonalTable.XY, LevelUpXY, XY);
LearnAO = new LearnLookup(PersonalTable.AO, LevelUpAO, ORAS);
LearnBW = new LearnLookup(PersonalTable.BW, LevelUpBW, BW);
@ -39,6 +41,7 @@ namespace PKHeX.Core
{
if (pkm.IsMovesetRestricted())
version = (GameVersion)pkm.Version;
switch (generation)
{
case 1: return GetIsLevelUp1(species, move, lvl, form, minlvlG1, version);
@ -183,6 +186,9 @@ namespace PKHeX.Core
{
switch (ver)
{
case GP: case GE: case GG:
return LearnGG.GetIsLevelUp(species, form, move);
case Any:
if (species > MaxSpeciesID_7)
return LearnNONE;
@ -426,6 +432,9 @@ namespace PKHeX.Core
max = 100; // Move reminder can teach any level in movepool now!
switch (ver)
{
case GP: case GE: case GG:
return LearnGG.AddMoves(moves, species, form, max);
case Any:
if (species > MaxSpeciesID_7_USUM)
return moves;

View file

@ -7,6 +7,8 @@ namespace PKHeX.Core
{
internal static GameVersion GetIsMachineMove(PKM pkm, int species, int form, int generation, int move, GameVersion ver = GameVersion.Any, bool RemoveTransfer = false)
{
if (pkm.IsMovesetRestricted())
ver = (GameVersion) pkm.Version;
switch (generation)
{
case 1: return GetIsMachine1(species, move);
@ -177,11 +179,23 @@ namespace PKHeX.Core
private static GameVersion GetIsMachine7(int species, int move, int form, GameVersion ver)
{
if (GameVersion.GG.Contains(ver))
{
for (int i = 0; i < Legal.TMHM_GG.Length; i++)
{
if (Legal.TMHM_GG[i] != move)
continue;
if (PersonalTable.GG.GetFormeEntry(species, form).TMHM[i])
return GameVersion.GG;
break;
}
}
if (GameVersion.SM.Contains(ver) && species <= Legal.MaxSpeciesID_7)
{
for (int i = 0; i < Legal.TMHM_XY.Length; i++)
for (int i = 0; i < Legal.TMHM_SM.Length; i++)
{
if (Legal.TMHM_XY[i] != move)
if (Legal.TMHM_SM[i] != move)
continue;
if (PersonalTable.SM.GetFormeEntry(species, form).TMHM[i])
return GameVersion.SM;
@ -189,7 +203,7 @@ namespace PKHeX.Core
}
}
if (GameVersion.ORAS.Contains(ver) && species <= Legal.MaxSpeciesID_7_USUM)
if (GameVersion.USUM.Contains(ver) && species <= Legal.MaxSpeciesID_7_USUM)
{
for (int i = 0; i < Legal.TMHM_SM.Length; i++)
{
@ -207,6 +221,8 @@ namespace PKHeX.Core
internal static IEnumerable<int> GetTMHM(PKM pkm, int species, int form, int generation, GameVersion ver = GameVersion.Any, bool RemoveTransfer = true)
{
var r = new List<int>();
if (pkm.IsMovesetRestricted())
ver = (GameVersion)pkm.Version;
switch (generation)
{
@ -310,6 +326,11 @@ namespace PKHeX.Core
{
switch (ver)
{
case GameVersion.GP:
case GameVersion.GE:
case GameVersion.GG:
AddMachineGG(r, species, form);
return;
case GameVersion.SN:
case GameVersion.MN:
case GameVersion.SM:
@ -352,5 +373,13 @@ namespace PKHeX.Core
var pi = PersonalTable.USUM.GetFormeEntry(species, form);
r.AddRange(Legal.TMHM_SM.Where((_, m) => pi.TMHM[m]));
}
private static void AddMachineGG(List<int> r, int species, int form)
{
if (species > Legal.MaxSpeciesID_7b)
return;
var pi = PersonalTable.GG.GetFormeEntry(species, form);
r.AddRange(Legal.TMHM_GG.Where((_, m) => pi.TMHM[m]));
}
}
}

View file

@ -29,6 +29,12 @@
return loc >= locs.Length ? null : locs[loc];
}
if (GameVersion.GG.Contains(version) && Encounter.Location < 100)
{
var locs = GameInfo.Strings.metGG_00000;
return loc >= locs.Length ? null : locs[loc];
}
return GameInfo.GetLocationName(loc != Encounter.Location, loc, gen, gen);
}
}