Add stubs for raid correlation verifiers/generators

Not going to implement this within the base repo as z3 is too large of a
dependency and is platform specific.

If anyone wants to implement as a plugin project, just inject your new
methods via the setters on the static func/action at the top of the 3
classes.

Since z3's searches aren't instant, I'd recommend caching recent results
in a dictionary, as re-parses are common. Something like the Wordfilter
is what you'd be aiming for :)

Closes #2617
This commit is contained in:
Kurt 2020-01-03 20:03:04 -08:00
parent 90dabf5b87
commit 15779513f5
3 changed files with 48 additions and 3 deletions

View file

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using static PKHeX.Core.Encounters8Nest;
@ -9,6 +10,9 @@ namespace PKHeX.Core
/// </summary>
public sealed class EncounterStatic8N : EncounterStatic, IGigantamax, IDynamaxLevel
{
public static Func<PKM, EncounterStatic8N, bool>? VerifyCorrelation { private get; set; }
public static Action<PKM, EncounterStatic8N, EncounterCriteria>? GenerateData { private get; set; }
public bool CanGigantamax { get; set; }
public byte DynamaxLevel { get; set; }
@ -83,6 +87,9 @@ namespace PKHeX.Core
if (Version != GameVersion.SWSH && pkm.Version != (int) Version && pkm.Met_Location != SharedNest)
return false;
if (VerifyCorrelation != null && !VerifyCorrelation(pkm, this))
return false;
return base.IsMatch(pkm, lvl);
}
@ -97,5 +104,13 @@ namespace PKHeX.Core
return false;
}
protected override void SetPINGA(PKM pk, EncounterCriteria criteria)
{
if (GenerateData != null)
GenerateData(pk, this, criteria);
else
base.SetPINGA(pk, criteria);
}
}
}

View file

@ -1,4 +1,5 @@
using static PKHeX.Core.Encounters8Nest;
using System;
using static PKHeX.Core.Encounters8Nest;
namespace PKHeX.Core
{
@ -7,6 +8,9 @@ namespace PKHeX.Core
/// </summary>
public sealed class EncounterStatic8NC : EncounterStatic, IGigantamax, IDynamaxLevel
{
public static Func<PKM, EncounterStatic8NC, bool>? VerifyCorrelation { private get; set; }
public static Action<PKM, EncounterStatic8NC, EncounterCriteria>? GenerateData { private get; set; }
public bool CanGigantamax { get; set; }
public byte DynamaxLevel { get; set; }
public override int Location { get => SharedNest; set { } }
@ -25,6 +29,9 @@ namespace PKHeX.Core
if (Version != GameVersion.SWSH && pkm.Version != (int)Version && pkm.Met_Location != SharedNest)
return false;
if (VerifyCorrelation != null && !VerifyCorrelation(pkm, this))
return false;
return base.IsMatch(pkm, lvl);
}
@ -39,5 +46,13 @@ namespace PKHeX.Core
return false;
}
protected override void SetPINGA(PKM pk, EncounterCriteria criteria)
{
if (GenerateData != null)
GenerateData(pk, this, criteria);
else
base.SetPINGA(pk, criteria);
}
}
}

View file

@ -1,4 +1,5 @@
using static PKHeX.Core.Encounters8Nest;
using System;
using static PKHeX.Core.Encounters8Nest;
namespace PKHeX.Core
{
@ -7,6 +8,9 @@ namespace PKHeX.Core
/// </summary>
public sealed class EncounterStatic8ND : EncounterStatic, IGigantamax, IDynamaxLevel
{
public static Func<PKM, EncounterStatic8ND, bool>? VerifyCorrelation { private get; set; }
public static Action<PKM, EncounterStatic8ND, EncounterCriteria>? GenerateData { private get; set; }
public bool CanGigantamax { get; set; }
public byte DynamaxLevel { get; set; }
public override int Location { get => SharedNest; set { } }
@ -35,6 +39,9 @@ namespace PKHeX.Core
if (Version != GameVersion.SWSH && pkm.Version != (int)Version && pkm.Met_Location != SharedNest)
return false;
if (VerifyCorrelation != null && !VerifyCorrelation(pkm, this))
return false;
return base.IsMatch(pkm, lvl);
}
@ -49,5 +56,13 @@ namespace PKHeX.Core
return false;
}
protected override void SetPINGA(PKM pk, EncounterCriteria criteria)
{
if (GenerateData != null)
GenerateData(pk, this, criteria);
else
base.SetPINGA(pk, criteria);
}
}
}