mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-16 21:38:40 +00:00
Add totem forms selection/spritemod and req changes
This commit is contained in:
parent
23d57f8807
commit
b3436cb791
5 changed files with 91 additions and 13 deletions
|
@ -418,6 +418,39 @@ namespace PKHeX.Core
|
|||
687, // Core Enforcer
|
||||
};
|
||||
|
||||
internal static readonly HashSet<int> Totem_Alolan = new HashSet<int>
|
||||
{
|
||||
020, // Raticate (Normal, Alolan, Totem)
|
||||
105, // Marowak (Normal, Alolan, Totem)
|
||||
778, // Mimikyu (Normal, Busted, Totem, Totem_Busted)
|
||||
};
|
||||
internal static readonly HashSet<int> Totem_SM = new HashSet<int>
|
||||
{
|
||||
020, // Raticate
|
||||
735, // Gumshoos
|
||||
746, // Wishiwashi
|
||||
758, // Salazzle
|
||||
754, // Lurantis
|
||||
738, // Vikavolt
|
||||
778, // Mimikyu
|
||||
784, // Kommo-o
|
||||
};
|
||||
internal static readonly HashSet<int> Totem_USUM = new HashSet<int>
|
||||
{
|
||||
020, // Raticate
|
||||
735, // Gumshoos
|
||||
746, // Wishiwashi
|
||||
758, // Salazzle
|
||||
754, // Lurantis
|
||||
738, // Vikavolt
|
||||
778, // Mimikyu
|
||||
784, // Kommo-o
|
||||
105, // Marowak
|
||||
752, // Araquanid
|
||||
777, // Togedemaru
|
||||
743, // Ribombee
|
||||
};
|
||||
|
||||
internal static readonly int[] EggLocations7 = {60002, 30002};
|
||||
internal static readonly HashSet<int> ValidMet_SM = new HashSet<int>
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
internal static class FormConverter
|
||||
public static class FormConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a list of formes that the species can have.
|
||||
|
@ -22,6 +22,8 @@ namespace PKHeX.Core
|
|||
types[000], // Normal
|
||||
forms[804], // Mega
|
||||
};
|
||||
if (generation == 7 && Legal.Totem_USUM.Contains(species))
|
||||
return GetFormsTotem(species, types, forms);
|
||||
|
||||
if (species <= Legal.MaxSpeciesID_1)
|
||||
return GetFormsGen1(species, types, forms, generation);
|
||||
|
@ -39,6 +41,27 @@ namespace PKHeX.Core
|
|||
return GetFormsGen7(species, types, forms);
|
||||
}
|
||||
|
||||
public static bool IsTotemForm(int species, int form, int generation = 7)
|
||||
{
|
||||
if (generation != 7)
|
||||
return false;
|
||||
if (form == 0)
|
||||
return false;
|
||||
if (!Legal.Totem_USUM.Contains(species))
|
||||
return false;
|
||||
if (species == 778) // Mimikyu
|
||||
return form == 2 || form == 3;
|
||||
if (Legal.Totem_Alolan.Contains(species))
|
||||
return form == 2;
|
||||
return form == 1;
|
||||
}
|
||||
public static int GetTotemBaseForm(int species, int form)
|
||||
{
|
||||
if (species == 778) // Mimikyu
|
||||
return form -2;
|
||||
return form - 1;
|
||||
}
|
||||
|
||||
private static string[] GetFormsGen1(int species, IReadOnlyList<string> types, IReadOnlyList<string> forms, int generation)
|
||||
{
|
||||
switch (species)
|
||||
|
@ -419,13 +442,6 @@ namespace PKHeX.Core
|
|||
forms[1057], // "V-Core", // Core Violet
|
||||
};
|
||||
|
||||
case 778: // Mimikyu
|
||||
return new[]
|
||||
{
|
||||
forms[778], // Disguised
|
||||
forms[1058], // Busted
|
||||
};
|
||||
|
||||
case 800:
|
||||
return new[]
|
||||
{
|
||||
|
@ -444,7 +460,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
}
|
||||
|
||||
private static string[] GetFormsAlolan(int generation, IReadOnlyList<string> types, IReadOnlyList<string> forms, int species)
|
||||
private static string[] GetFormsAlolan (int generation, IReadOnlyList<string> types, IReadOnlyList<string> forms, int species)
|
||||
{
|
||||
if (generation < 7)
|
||||
return new[] { "" };
|
||||
|
@ -455,7 +471,6 @@ namespace PKHeX.Core
|
|||
return new[] { "" };
|
||||
|
||||
case 19: // Rattata
|
||||
case 20: // Raticate
|
||||
case 26: // Raichu
|
||||
case 27: // Sandshrew
|
||||
case 28: // Sandslash
|
||||
|
@ -470,7 +485,6 @@ namespace PKHeX.Core
|
|||
case 76: // Golem
|
||||
case 88: // Grimer
|
||||
case 89: // Muk
|
||||
case 105: // Marowak
|
||||
case 103: // Exeggutor
|
||||
return new[]
|
||||
{
|
||||
|
@ -592,6 +606,29 @@ namespace PKHeX.Core
|
|||
};
|
||||
}
|
||||
}
|
||||
private static string[] GetFormsTotem (int species, IReadOnlyList<string> types, IReadOnlyList<string> forms)
|
||||
{
|
||||
if (species == 778) // Mimikyu
|
||||
return new[]
|
||||
{
|
||||
forms[778], // Disguised
|
||||
forms[1058], // Busted
|
||||
forms[1007], // Large
|
||||
"*" + forms[1058], // Busted
|
||||
};
|
||||
if (Legal.Totem_Alolan.Contains(species))
|
||||
return new[]
|
||||
{
|
||||
types[0], // Normal
|
||||
forms[810], // Alolan
|
||||
forms[1007], // Large
|
||||
};
|
||||
return new[]
|
||||
{
|
||||
types[0], // Normal
|
||||
forms[1007], // Large
|
||||
};
|
||||
}
|
||||
private static string[] GetFormsUnown(int generation)
|
||||
{
|
||||
switch (generation)
|
||||
|
|
|
@ -343,7 +343,8 @@ namespace PKHeX.WinForms.Controls
|
|||
if (!hasForms)
|
||||
return;
|
||||
|
||||
var ds = PKX.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, gendersymbols, pkm.Format).ToList();
|
||||
var ds = PKX.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, gendersymbols, pkm.Format)
|
||||
.Take(RequestSaveFile?.Personal[species]?.FormeCount ?? 0).ToList();
|
||||
if (ds.Count == 1 && string.IsNullOrEmpty(ds[0])) // empty (Alolan Totems)
|
||||
CB_Form.Enabled = CB_Form.Visible = Label_Form.Visible = false;
|
||||
else CB_Form.DataSource = ds;
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace PKHeX.WinForms
|
|||
bool hasForms = SAV.Personal[bspecies].HasFormes || new[] { 201, 664, 665, 414 }.Contains(bspecies);
|
||||
LB_Forms.Enabled = hasForms;
|
||||
if (!hasForms) return false;
|
||||
var ds = PKX.GetFormList(bspecies, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation).ToList();
|
||||
var ds = PKX.GetFormList(bspecies, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation).Take(SAV.Personal[bspecies].FormeCount).ToList();
|
||||
if (ds.Count == 1 && string.IsNullOrEmpty(ds[0]))
|
||||
{
|
||||
// empty (Alolan Totems)
|
||||
|
|
|
@ -49,6 +49,13 @@ namespace PKHeX.WinForms
|
|||
|
||||
// Redrawing logic
|
||||
Image baseImage = (Image)Resources.ResourceManager.GetObject(file);
|
||||
if (baseImage == null && FormConverter.IsTotemForm(species, form))
|
||||
{
|
||||
form = FormConverter.GetTotemBaseForm(species, form);
|
||||
file = PKX.GetResourceStringSprite(species, form, gender, generation);
|
||||
baseImage = (Image)Resources.ResourceManager.GetObject(file);
|
||||
baseImage = ImageUtil.ToGrayscale(baseImage);
|
||||
}
|
||||
if (baseImage == null)
|
||||
{
|
||||
baseImage = (Image) Resources.ResourceManager.GetObject($"_{species}");
|
||||
|
|
Loading…
Add table
Reference in a new issue