mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-19 17:40:09 -05:00
Allow seed of mastery toggling mastered flag
oops
This commit is contained in:
@@ -157,7 +157,7 @@ public bool IsForcedMasteryCorrect(PKM pkm)
|
||||
learn.SetEncounterMoves(level, moves);
|
||||
}
|
||||
|
||||
return p.IsValidMasteredEncounter(moves, mastery, level, alpha);
|
||||
return p.IsValidMasteredEncounter(moves, learn, mastery, level, alpha);
|
||||
}
|
||||
|
||||
private OverworldParam8a GetParams()
|
||||
|
||||
@@ -122,16 +122,17 @@ public bool IsForcedMasteryCorrect(PKM pkm)
|
||||
if (pkm is not IMoveShop8Mastery p)
|
||||
return true;
|
||||
|
||||
Span<int> m = stackalloc int[4];
|
||||
Span<int> moves = stackalloc int[4];
|
||||
var level = pkm.Met_Level;
|
||||
var index = PersonalTable.LA.GetFormIndex(Species, Form);
|
||||
var learn = Legal.LevelUpLA[index];
|
||||
var mastery = Legal.MasteryLA[index];
|
||||
if (Moves.Count != 0)
|
||||
m = (int[])Moves;
|
||||
moves = (int[])Moves;
|
||||
else
|
||||
Legal.LevelUpLA[index].SetEncounterMoves(level, m);
|
||||
learn.SetEncounterMoves(level, moves);
|
||||
|
||||
return p.IsValidMasteredEncounter(m, mastery, level, alpha);
|
||||
return p.IsValidMasteredEncounter(moves, learn, mastery, level, alpha);
|
||||
}
|
||||
|
||||
protected override void SetEncounterMoves(PKM pk, GameVersion version, int level)
|
||||
|
||||
@@ -21,7 +21,7 @@ public interface IMoveShop8Mastery : IMoveShop8
|
||||
|
||||
public static class MoveShop8MasteryExtensions
|
||||
{
|
||||
public static bool IsValidMasteredEncounter(this IMoveShop8Mastery shop, Span<int> moves, Learnset mastery, int level, ushort alpha)
|
||||
public static bool IsValidMasteredEncounter(this IMoveShop8Mastery shop, Span<int> moves, Learnset learn, Learnset mastery, int level, ushort alpha)
|
||||
{
|
||||
foreach (var move in moves)
|
||||
{
|
||||
@@ -38,7 +38,11 @@ public static bool IsValidMasteredEncounter(this IMoveShop8Mastery shop, Span<in
|
||||
if (masteryLevel > level && move != alpha) // no master flag set
|
||||
{
|
||||
if (!p && m)
|
||||
return false;
|
||||
{
|
||||
// Check for seed of mastery usage
|
||||
if (learn.GetMoveLevel(move) > level)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -49,21 +53,4 @@ public static bool IsValidMasteredEncounter(this IMoveShop8Mastery shop, Span<in
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool IsPurchasedEncounterMove(IMoveShop8 p, Span<int> moves)
|
||||
{
|
||||
foreach (var move in moves)
|
||||
{
|
||||
if (move == 0)
|
||||
continue;
|
||||
var index = p.MoveShopPermitIndexes.IndexOf((ushort)move);
|
||||
if (index == -1)
|
||||
continue; // manually mastered for encounter, not a tutor
|
||||
|
||||
if (p.GetPurchasedRecordFlag(index))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user