mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 06:20:25 +00:00
768047cd80
* Rewrite ribbon verification * Explicitly verifies all ribbons instead of chained iterators. * Verifies using only the stack, using `struct` and `Span<T>`. No allocation on heap, or `IEnumerable` iterators. * Verifies all egg ribbons using a separate method, explicitly implemented. No reflection overhead. * Separates each ribbon interface to separate `static` classes. Easier to identify code needing change on new game update. * Extracted logic for specific ribbons. Can easily revise complicated ribbon's acquisition rules. * Simplifies GiveAll/RemoveAll legal ribbon mutations. No reflection overhead, and no allocation. * Can be expanded in the future if we need to track conditions for ribbon acquisition (was Sinnoh Champ received in BDSP or Gen4?) End result is a more performant implementation and easier to maintain & reuse logic.
25 lines
911 B
C#
25 lines
911 B
C#
namespace PKHeX.Core;
|
|
|
|
/// <summary> Ribbons introduced in Generation 3 for Special Events </summary>
|
|
public interface IRibbonSetEvent3
|
|
{
|
|
bool RibbonEarth { get; set; }
|
|
bool RibbonNational { get; set; }
|
|
bool RibbonCountry { get; set; }
|
|
bool RibbonChampionBattle { get; set; }
|
|
bool RibbonChampionRegional { get; set; }
|
|
bool RibbonChampionNational { get; set; }
|
|
}
|
|
|
|
internal static partial class RibbonExtensions
|
|
{
|
|
internal static void CopyRibbonSetEvent3(this IRibbonSetEvent3 set, IRibbonSetEvent3 dest)
|
|
{
|
|
dest.RibbonEarth = set.RibbonEarth;
|
|
dest.RibbonNational = set.RibbonNational;
|
|
dest.RibbonCountry = set.RibbonCountry;
|
|
dest.RibbonChampionBattle = set.RibbonChampionBattle;
|
|
dest.RibbonChampionRegional = set.RibbonChampionRegional;
|
|
dest.RibbonChampionNational = set.RibbonChampionNational;
|
|
}
|
|
}
|