Fix initial move application of low leveled mons

Relearn moves shouldn't really be applied by default (fixes honedge expecting Sacred Sword)
Add edge case for modified learnset (Espurr) pre-dlc as an untouched level 7-8 capture. Only need 3 moves.

ty abby on discord
This commit is contained in:
Kurt
2025-12-16 01:18:13 -06:00
parent c8eb4f548f
commit e95dddd86d
2 changed files with 19 additions and 4 deletions

View File

@@ -134,7 +134,7 @@ public void SetEncounterMovesBackwards(byte level, Span<ushort> moves, int ctr =
if (sameDescend)
{
while(start != 0 && Levels[start] == Levels[start - 1])
while (start != 0 && Levels[start] == Levels[start - 1])
start--;
}
@@ -144,6 +144,9 @@ public void SetEncounterMovesBackwards(byte level, Span<ushort> moves, int ctr =
if (moves.Contains(move))
continue;
if (Levels[i] == 0)
break; // not a Level Up move
moves[ctr++] = move;
if (ctr == 4)
return;

View File

@@ -56,8 +56,20 @@ private void CheckLearnset(LegalityAnalysis data, PA9 pa)
for (int i = 0; i < expect.Length; i++)
{
var move = expect[i];
if (pa.GetMove(i) != move)
moves[i] = MoveResult.Unobtainable(move);
if (pa.GetMove(i) == move)
continue;
// Espurr (among others) had new moves added to their learnset at low levels.
// Only for Espurr does it actually happen (Absol/Meowstic is never found at a low enough level).
// - Espurr @ Level 9 will gain Confusion to be 4 moves total (Pre-DLC).
// - Otherwise, the DLC learnset would require 4 at level 6 (lowest encounter is 7-8).
if (e9a.Species is (int)Espurr && move is (int)Teleport && pa.CurrentLevel < 9) // DLC
{
// do the more expensive check after; check species first
if (WasPossiblyObtainedBeforeDLC(pa, e9a))
continue;
}
moves[i] = MoveResult.Unobtainable(move);
}
}
@@ -310,7 +322,6 @@ private static bool WasPossiblyObtainedBeforeDLC(PKM pk, IEncounterTemplate enc)
Roserade or Whirlipede or Scolipede when move is MortalSpin => true,
Abomasnow when move is IceHammer => true,
Gallade when move is SacredSword => true,
Espurr or Meowstic when move is Teleport => true,
Meowstic when move is Moonblast => true,
Honedge or Doublade or Aegislash when move is SacredSword => true,
Malamar when move is Octolock => true,
@@ -318,6 +329,7 @@ private static bool WasPossiblyObtainedBeforeDLC(PKM pk, IEncounterTemplate enc)
Aurorus when move is IceHammer => true,
// Level-up moves added in DLC:
Espurr or Meowstic when move is Teleport => true,
Absol when move is ConfuseRay or ShadowSneak => true,
_ => false,