mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-09 04:24:36 -05:00
Add ability to replace IV marking method
set the MarkingMethod to a desired func provider (out int markval, int IVvalue, int IVindex) #1862
This commit is contained in:
parent
1cdbe6f4f8
commit
46e1d8a4eb
|
|
@ -319,12 +319,18 @@ public static void SetMarkings(this PKM pk, int[] IVs = null)
|
|||
|
||||
if (IVs == null)
|
||||
IVs = pk.IVs;
|
||||
pk.Markings = IVs.Select(MarkingMethod(pk)).ToArray();
|
||||
}
|
||||
|
||||
var remapper = pk.Format < 7 ? (Func<int, int>)GetSimpleMarking : GetComplexMarking;
|
||||
pk.Markings = IVs.Select(remapper).ToArray();
|
||||
public static Func<PKM, Func<int, int, int>> MarkingMethod { get; set; } = FlagHighLow;
|
||||
private static Func<int, int, int> FlagHighLow(PKM pk)
|
||||
{
|
||||
if (pk.Format < 7)
|
||||
return GetSimpleMarking;
|
||||
return GetComplexMarking;
|
||||
|
||||
int GetSimpleMarking(int val) => val == 31 ? 1 : 0;
|
||||
int GetComplexMarking(int val)
|
||||
int GetSimpleMarking(int val, int index) => val == 31 ? 1 : 0;
|
||||
int GetComplexMarking(int val, int index)
|
||||
{
|
||||
if (val == 31 || val == 1)
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user