Add Big Shiny Sprites (#62)

* Add Big Shiny Sprites
Also addresses Trainer Meltan failing to evolve if requirements are met.
Fix Personal Held Item randomization.

* Fix silly typo
Copy/paste is a curse.

* Add Double Battle Classes to blacklist
Don't allow them to be set to any Trainers for crashes.
This commit is contained in:
Matt
2020-04-24 10:52:01 -04:00
committed by GitHub
parent 64909ee7ac
commit 7fc8f967dd
2689 changed files with 32174 additions and 310 deletions

View File

@@ -27,3 +27,7 @@ pkNX also provides some utility to extract from supported container types, e.g.
pkNX is a Windows Forms application which requires [.NET Framework v4.6](https://www.microsoft.com/en-us/download/details.aspx?id=48137).
The executable can be built with any compiler that supports C# 8.
## Dependencies
pkNX's shiny sprite collection is taken from [pokesprite](https://github.com/msikma/pokesprite), which is licensed under [the MIT license](https://github.com/msikma/pokesprite/blob/master/LICENSE).

View File

@@ -16,7 +16,6 @@ public class TrainerRandomizer : Randomizer
private readonly Dictionary<int, int> IndexFixedCount;
private readonly IList<int> SpecialClasses;
private readonly IList<int> CrashClasses;
private readonly IList<int> DoubleClasses;
public GenericRandomizer<int> Class { get; set; }
public LearnsetRandomizer Learn { get; set; }
@@ -41,7 +40,6 @@ public TrainerRandomizer(GameInfo info, PersonalTable t, VsTrainer[] trainers, E
IndexFixedCount = GetFixedCountIndexes(Info.Game);
SpecialClasses = GetSpecialClasses(Info.Game);
CrashClasses = GetCrashClasses(Info.Game);
DoubleClasses = GetDoubleClasses(Info.Game);
}
public void Initialize(TrainerRandSettings settings)
@@ -51,7 +49,6 @@ public void Initialize(TrainerRandSettings settings)
IEnumerable<int> classes = Enumerable.Range(0, ClassCount).Except(CrashClasses);
if (Settings.SkipSpecialClasses)
classes = classes.Except(SpecialClasses);
classes = classes.Except(DoubleClasses);
Class = new GenericRandomizer<int>(classes.ToArray());
}
@@ -124,7 +121,7 @@ private void SetRandomClass(VsTrainer tr)
if (Settings.SkipSpecialClasses && SpecialClasses.Contains(tr.Self.Class))
return;
if (CrashClasses.Contains(tr.Self.Class) || DoubleClasses.Contains(tr.Self.Class))
if (CrashClasses.Contains(tr.Self.Class))
return; // keep as is
tr.Self.Class = Class.Next();
@@ -208,12 +205,18 @@ private int TryForceEvolve(IReadOnlyList<EvolutionSet> evos, ref int species, re
var index = Personal.GetFormeIndex(species, form);
var eSet = evos[index].PossibleEvolutions;
int evoCount = eSet.Count(z => z.HasData);
if (evoCount == 0)
if (evoCount == 0 && species != 808)
break;
++timesEvolved;
var next = Util.Random.Next(evoCount);
var nextEvo = eSet[next];
species = nextEvo.Species;
// Meltan only evolves in GO, so force evolve if no custom evo method has been added
if (evoCount == 0 && species == 808)
species = 809;
else
species = nextEvo.Species;
form = nextEvo.Form >= 0 ? nextEvo.Form : form;
}
while (timesEvolved < 3); // prevent randomized evos from looping excessively
@@ -241,7 +244,7 @@ private void UpdatePKMFromSettings(TrainerPoke pk)
if (Settings.GigantamaxSwap && c.CanGigantamax)
{
c.Species = GigantamaxForms[Util.Random.Next(GigantamaxForms.Length)];
c.Form = 0; // only Kanto Meowth can Gigantamax
c.Form = c.Species == 025 || c.Species == 052 ? 0 : Legal.GetRandomForme(c.Species, false, false, false, Personal); // Pikachu & Meowth altforms can't gmax
}
if (Settings.MaxDynamaxLevel && c.CanDynamax)
c.DynamaxLevel = 10;
@@ -358,7 +361,6 @@ private static int[] GetRandomMega(Dictionary<int, int[]> megas, out int species
private static readonly int[] CrashClasses_GG = Enumerable.Range(072, 382 - 072 + 1).ToArray(); // Master Trainer titles, not really trclasses
private static readonly int[] CrashClasses_SWSH = Legal.BlacklistedClasses_SWSH;
private static readonly int[] DoubleClasses_SWSH = Legal.DoubleBattleClasses_SWSH;
private static int[] GetSpecialClasses(GameVersion game)
{
@@ -385,12 +387,5 @@ private static int[] GetCrashClasses(GameVersion game)
return CrashClasses_GG;
return Array.Empty<int>();
}
private static int[] GetDoubleClasses(GameVersion game)
{
if (GameVersion.SWSH.Contains(game))
return DoubleClasses_SWSH;
return Array.Empty<int>();
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -22,6 +22,7 @@ public abstract class SpriteBuilder
public abstract Bitmap Delete { get; }
public abstract Bitmap Transparent { get; }
public abstract Bitmap Drag { get; }
public abstract Bitmap UnknownItem { get; }
private const double UnknownFormTransparency = 0.5;
private const double ShinyTransparency = 0.7;
@@ -94,10 +95,10 @@ private Image GetBaseImageFallback(int species, int form, int gender, bool shiny
private Image LayerOverImageItem(Image baseImage, int item, int generation)
{
Image itemimg = (Image)Resources.ResourceManager.GetObject(GetItemResourceName(item)) ?? Resources.helditem;
if (2 <= generation && generation <= 4 && 328 <= item && item <= 419) // gen2/3/4 TM
itemimg = Resources.item_tm;
else if (generation >= 8 && (1130 <= item && item <= 1229)) // Gen8 TR
Image itemimg = (Image)Resources.ResourceManager.GetObject(GetItemResourceName(item)) ?? Resources.bitem_unk;
if (328 <= item && item <= 419) // gen2/3/4 TM
itemimg = Resources.bitem_tm;
else if (1130 <= item && item <= 1229) // Gen8 TR
itemimg = Resources.bitem_tr;
// Redraw item in bottom right corner; since images are cropped, try to not have them at the edge
@@ -158,6 +159,7 @@ public class SpriteBuilder3040 : SpriteBuilder
public override Bitmap Delete => Resources.slotDel;
public override Bitmap Transparent => Resources.slotTrans;
public override Bitmap Drag => Resources.slotDrag;
public override Bitmap UnknownItem => Resources.helditem;
}
/// <summary>
@@ -186,5 +188,6 @@ protected override Image GetEggSprite(int species) => Resources.egg; // no manap
public override Bitmap Delete => Resources.slotDel68;
public override Bitmap Transparent => Resources.slotTrans68;
public override Bitmap Drag => Resources.slotDrag68;
public override Bitmap UnknownItem => Resources.bitem_unk;
}
}

View File

@@ -5,7 +5,7 @@ namespace pkNX.Sprites
{
public static class SpriteName
{
public static bool AllowShinySprite { get; set; }
public static bool AllowShinySprite { get; set; } = true;
private const string Separator = "_";
private const string Cosplay = "c";
@@ -42,7 +42,7 @@ public static string GetResourceStringSprite(int species, int form, int gender,
sb.Append(GGStarter);
}
}
else if (gender == 1 && SpeciesGenderedSprite.Contains(species))
else if (gender == 2 && SpeciesGenderedSprite.Contains(species))
{
sb.Append('f');
}
@@ -61,8 +61,9 @@ public static string GetResourceStringSprite(int species, int form, int gender,
493, // Arceus
664, // Scatterbug
665, // Spewpa
773, // Silvally
778, // Mimikyu
854, // Sinistea
855, // Polteageist
};
/// <summary>
@@ -70,6 +71,8 @@ public static string GetResourceStringSprite(int species, int form, int gender,
/// </summary>
public static readonly HashSet<int> SpeciesGenderedSprite = new HashSet<int>
{
449, // Hippopotas
450, // Hippowdon
521, // Unfezant
592, // Frillish
593, // Jellicent

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 999 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 894 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 945 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 679 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 689 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 724 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 868 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 805 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 977 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1003 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 978 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 986 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 961 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 943 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 971 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 971 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 955 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 949 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 934 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 938 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 871 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 925 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 928 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 706 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 932 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 898 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 915 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

Some files were not shown because too many files have changed in this diff Show More