Fix gen4 set all TMHM bits

oops
make other personalinfo consistent
show legality triangles if previous parse failed (oops)
This commit is contained in:
Kurt
2023-01-22 14:55:35 -08:00
parent f96de7d38c
commit 71eeb7072b
9 changed files with 49 additions and 48 deletions

View File

@@ -154,7 +154,7 @@ public void GetAllMoves(Span<bool> result, PKM pk, EvoCriteria evo, MoveSourceTy
result[moves[i]] = true;
}
}
if (types.HasFlag(MoveSourceType.SpecialTutor))
pi.SetAllLearnTutorType(result, Tutors_4);

View File

@@ -96,10 +96,10 @@ public void SetIsLearnTM(int index, bool value)
public void SetAllLearnTM(Span<bool> result, ReadOnlySpan<ushort> moves)
{
var span = Data.AsSpan(TMHM, ByteCountTM);
for (int i = CountTM - 1; i >= 0; i--)
for (int index = CountTM - 1; index >= 0; index--)
{
if ((span[i >> 3] & (i & 7)) != 0)
result[moves[i]] = true;
if ((span[index >> 3] & (1 << (index & 7))) != 0)
result[moves[index]] = true;
}
}
@@ -119,10 +119,10 @@ public void SetIsLearnTutorType(int index, bool value)
public void SetAllLearnTutorType(Span<bool> result, ReadOnlySpan<ushort> moves)
{
for (int i = CountTutor - 1; i >= 0; i--)
for (int index = CountTutor - 1; index >= 0; index--)
{
if (TypeTutors[i])
result[moves[i]] = true;
if (TypeTutors[index])
result[moves[index]] = true;
}
}
@@ -137,10 +137,10 @@ public bool GetIsLearnHM(int index)
public void SetAllLearnHM(Span<bool> result, ReadOnlySpan<ushort> moves)
{
var span = Data.AsSpan(TMHM, ByteCountTM);
for (int i = CountTM + CountHM - 1; i >= CountTM; i--)
for (int index = CountTM + CountHM - 1; index >= CountTM; index--)
{
if ((span[i >> 3] & (i & 7)) != 0)
result[moves[i - CountTM]] = true;
if ((span[index >> 3] & (1 << (index & 7))) != 0)
result[moves[index - CountTM]] = true;
}
}
}

View File

@@ -95,10 +95,10 @@ public void SetIsLearnTM(int index, bool value)
public void SetAllLearnTM(Span<bool> result, ReadOnlySpan<ushort> moves)
{
var span = Data.AsSpan(TMHM, ByteCountTM);
for (int i = CountTMHM - 1; i >= 0; i--)
for (int index = CountTMHM - 1; index >= 0; index--)
{
if ((span[i >> 3] & (1 << (i & 7))) != 0)
result[moves[i]] = true;
if ((span[index >> 3] & (1 << (index & 7))) != 0)
result[moves[index]] = true;
}
}
@@ -122,10 +122,10 @@ public void SetIsLearnTutorType(int index, bool value)
public void SetAllLearnTutorType(Span<bool> result, ReadOnlySpan<ushort> moves)
{
var tutor = Data[TypeTutor];
for (int i = TypeTutorCount - 1; i >= 0; i--)
for (int index = TypeTutorCount - 1; index >= 0; index--)
{
if ((tutor & (1 << (i & 7))) != 0)
result[moves[i]] = true;
if ((tutor & (1 << (index & 7))) != 0)
result[moves[index]] = true;
}
}

View File

@@ -95,10 +95,10 @@ public void SetIsLearnTM(int index, bool value)
public void SetAllLearnTM(Span<bool> result, ReadOnlySpan<ushort> moves)
{
var span = Data.AsSpan(TMHM, ByteCountTM);
for (int i = CountTMHM - 1; i >= 0; i--)
for (int index = CountTMHM - 1; index >= 0; index--)
{
if ((span[i >> 3] & (1 << (i & 7))) != 0)
result[moves[i]] = true;
if ((span[index >> 3] & (1 << (index & 7))) != 0)
result[moves[index]] = true;
}
}
@@ -122,10 +122,10 @@ public void SetIsLearnTutorType(int index, bool value)
public void SetAllLearnTutorType(Span<bool> result, ReadOnlySpan<ushort> moves)
{
var tutor = Data[TypeTutor];
for (int i = TypeTutorCount - 1; i >= 0; i--)
for (int index = TypeTutorCount - 1; index >= 0; index--)
{
if ((tutor & (1 << (i & 7))) != 0)
result[moves[i]] = true;
if ((tutor & (1 << (index & 7))) != 0)
result[moves[index]] = true;
}
}
}

View File

@@ -100,10 +100,10 @@ public void SetIsLearnTM(int index, bool value)
public void SetAllLearnTM(Span<bool> result, ReadOnlySpan<ushort> moves)
{
var span = Data.AsSpan(TMHM, ByteCountTM);
for (int i = CountTMHM - 1; i >= 0; i--)
for (int index = CountTMHM - 1; index >= 0; index--)
{
if ((span[i >> 3] & (1 << (i & 7))) != 0)
result[moves[i]] = true;
if ((span[index >> 3] & (1 << (index & 7))) != 0)
result[moves[index]] = true;
}
}
@@ -127,10 +127,10 @@ public void SetIsLearnTutorType(int index, bool value)
public void SetAllLearnTutorType(Span<bool> result, ReadOnlySpan<ushort> moves)
{
var tutor = Data[TypeTutor];
for (int i = TypeTutorCount - 1; i >= 0; i--)
for (int index = TypeTutorCount - 1; index >= 0; index--)
{
if ((tutor & (1 << (i & 7))) != 0)
result[moves[i]] = true;
if ((tutor & (1 << (index & 7))) != 0)
result[moves[index]] = true;
}
}
@@ -157,10 +157,10 @@ public void SetAllLearnTutorSpecial(Span<bool> result)
{
var moves = Tutors_USUM;
var span = Data.AsSpan(Tutor1, ByteCountTutor1);
for (int i = 0; i < moves.Length; i++)
for (int index = 0; index < moves.Length; index++)
{
if ((span[i >> 3] & (1 << (i & 7))) != 0)
result[moves[i]] = true;
if ((span[index >> 3] & (1 << (index & 7))) != 0)
result[moves[index]] = true;
}
}

View File

@@ -193,10 +193,10 @@ public void SetAllLearnMoveShop(Span<bool> result)
{
var moves = MoveShopMoves;
var bits = MoveShopBits;
for (int i = 0 ; i < MoveShopCount; i++)
for (int index = 0 ; index < MoveShopCount; index++)
{
if ((bits & 1) == 1)
result[moves[i]] = true;
result[moves[index]] = true;
bits >>= 1;
}
}

View File

@@ -116,10 +116,10 @@ public void SetAllLearnTM(Span<bool> result)
{
var moves = TM_SWSH;
var span = Data.AsSpan(TM, ByteCountTM);
for (int i = moves.Length - 1; i >= 0; i--)
for (int index = moves.Length - 1; index >= 0; index--)
{
if ((span[i >> 3] & (1 << (i & 7))) != 0)
result[moves[i]] = true;
if ((span[index >> 3] & (1 << (index & 7))) != 0)
result[moves[index]] = true;
}
}
@@ -161,10 +161,10 @@ public void SetAllLearnTutorType(Span<bool> result)
{
var moves = TypeTutor8;
var tutor = Data[TutorType];
for (int i = moves.Length - 1; i >= 0; i--)
for (int index = moves.Length - 1; index >= 0; index--)
{
if ((tutor & (1 << (i & 7))) != 0)
result[moves[i]] = true;
if ((tutor & (1 << (index & 7))) != 0)
result[moves[index]] = true;
}
}
@@ -189,10 +189,10 @@ public void SetAllLearnTutorSpecial(Span<bool> result)
{
var moves = Tutors_SWSH;
var span = Data.AsSpan(TutorArmor, 3);
for (int i = moves.Length - 1; i >= 0; i--)
for (int index = moves.Length - 1; index >= 0; index--)
{
if ((span[i >> 3] & (1 << (i & 7))) != 0)
result[moves[i]] = true;
if ((span[index >> 3] & (1 << (index & 7))) != 0)
result[moves[index]] = true;
}
}
@@ -200,10 +200,10 @@ public void SetAllLearnTR(Span<bool> result)
{
var moves = TR_SWSH;
var span = Data.AsSpan(TR, ByteCountTM);
for (int i = moves.Length - 1; i >= 0; i--)
for (int index = moves.Length - 1; index >= 0; index--)
{
if ((span[i >> 3] & (1 << (i & 7))) != 0)
result[moves[i]] = true;
if ((span[index >> 3] & (1 << (index & 7))) != 0)
result[moves[index]] = true;
}
}

View File

@@ -102,10 +102,10 @@ public void SetAllLearnTM(Span<bool> result)
{
var moves = TM_SV;
var span = Data.AsSpan(TM, ByteCountTM);
for (int i = CountTM - 1; i >= 0; i--)
for (int index = CountTM - 1; index >= 0; index--)
{
if ((span[i >> 3] & (1 << (i & 7))) != 0)
result[moves[i]] = true;
if ((span[index >> 3] & (1 << (index & 7))) != 0)
result[moves[index]] = true;
}
}

View File

@@ -341,6 +341,7 @@ public void UpdateLegality(LegalityAnalysis? la = null, UpdateLegalityArgs args
LegalityChanged?.Invoke(Legality.Valid, EventArgs.Empty);
return;
}
MC_Move1.HideLegality = MC_Move2.HideLegality = MC_Move3.HideLegality = MC_Move4.HideLegality = false;
// Refresh Move Legality
var info = Legality.Info;