mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-30 07:50:32 +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.
41 lines
1.5 KiB
C#
41 lines
1.5 KiB
C#
namespace PKHeX.Core;
|
|
|
|
/// <summary> Common Ribbons introduced in Generation 4 </summary>
|
|
public interface IRibbonSetCommon4
|
|
{
|
|
bool RibbonChampionSinnoh { get; set; }
|
|
bool RibbonAlert { get; set; }
|
|
bool RibbonShock { get; set; }
|
|
bool RibbonDowncast { get; set; }
|
|
bool RibbonCareless { get; set; }
|
|
bool RibbonRelax { get; set; }
|
|
bool RibbonSnooze { get; set; }
|
|
bool RibbonSmile { get; set; }
|
|
bool RibbonGorgeous { get; set; }
|
|
bool RibbonRoyal { get; set; }
|
|
bool RibbonGorgeousRoyal { get; set; }
|
|
bool RibbonFootprint { get; set; }
|
|
bool RibbonRecord { get; set; }
|
|
bool RibbonLegend { get; set; }
|
|
}
|
|
|
|
internal static partial class RibbonExtensions
|
|
{
|
|
internal static void CopyRibbonSetCommon4(this IRibbonSetCommon4 set, IRibbonSetCommon4 dest)
|
|
{
|
|
dest.RibbonChampionSinnoh = set.RibbonChampionSinnoh;
|
|
dest.RibbonAlert = set.RibbonAlert;
|
|
dest.RibbonShock = set.RibbonShock;
|
|
dest.RibbonDowncast = set.RibbonDowncast;
|
|
dest.RibbonCareless = set.RibbonCareless;
|
|
dest.RibbonRelax = set.RibbonRelax;
|
|
dest.RibbonSnooze = set.RibbonSnooze;
|
|
dest.RibbonSmile = set.RibbonSmile;
|
|
dest.RibbonGorgeous = set.RibbonGorgeous;
|
|
dest.RibbonRoyal = set.RibbonRoyal;
|
|
dest.RibbonGorgeousRoyal = set.RibbonGorgeousRoyal;
|
|
dest.RibbonFootprint = set.RibbonFootprint;
|
|
dest.RibbonRecord = set.RibbonRecord;
|
|
dest.RibbonLegend = set.RibbonLegend;
|
|
}
|
|
}
|