Add downleveled regular raid movepool verification

#2416
Not having enough badges pulls the level of the captured mon down

need more info if the other raid types behave similarly
This commit is contained in:
Kurt 2019-11-25 08:52:03 -08:00
parent 5dec94d456
commit b37a0c5bfe
3 changed files with 20 additions and 4 deletions

View File

@ -29,7 +29,7 @@ public EncounterStatic8N(byte nestID, uint minRank, uint maxRank, byte val)
FlawlessIVCount = val;
}
private readonly int[] LevelCaps =
private static readonly int[] LevelCaps =
{
15, 20, // 0
25, 30, // 1
@ -38,6 +38,8 @@ public EncounterStatic8N(byte nestID, uint minRank, uint maxRank, byte val)
55, 60, // 4
};
public static bool IsHighestLevelTier(int lvl) => ArrayUtil.WithinRange(lvl, 55, 60);
protected override int GetMinimalLevel() => LevelCaps[MinRank * 2];
protected override bool IsMatchLevel(PKM pkm, int lvl)

View File

@ -17,13 +17,27 @@ public sealed class ValidEncounterMoves
private const int EmptyCount = PKX.Generation + 1; // one for each generation index (and 0th)
private static readonly List<int>[] Empty = new int[EmptyCount].Select(_ => new List<int>()).ToArray();
public ValidEncounterMoves(PKM pkm, LevelUpRestriction restrict)
public ValidEncounterMoves(PKM pkm, LevelUpRestriction restrict, IEncounterable encounter)
{
LevelUpMoves = Legal.GetValidMovesAllGens(pkm, restrict.EvolutionChains, minLvLG1: restrict.MinimumLevelGen1, minLvLG2: restrict.MinimumLevelGen2, Tutor: false, Machine: false, RemoveTransferHM: false);
var originalGeneration = encounter is IGeneration g ? g.Generation : pkm.GenNumber;
var level = Legal.GetValidMovesAllGens(pkm, restrict.EvolutionChains, minLvLG1: restrict.MinimumLevelGen1, minLvLG2: restrict.MinimumLevelGen2, Tutor: false, Machine: false, RemoveTransferHM: false);
AddEdgeCaseMoves(level[originalGeneration], encounter, pkm);
LevelUpMoves = level;
TMHMMoves = Legal.GetValidMovesAllGens(pkm, restrict.EvolutionChains, LVL: false, Tutor: false, MoveReminder: false, RemoveTransferHM: false);
TutorMoves = Legal.GetValidMovesAllGens(pkm, restrict.EvolutionChains, LVL: false, Machine: false, MoveReminder: false, RemoveTransferHM: false);
}
private static void AddEdgeCaseMoves(List<int> moves, IEncounterable encounter, PKM pkm)
{
switch (encounter)
{
case EncounterStatic8N r when pkm.Met_Location == Encounters8Nest.SharedNest && !EncounterStatic8N.IsHighestLevelTier(pkm.Met_Level):
moves.AddRange(MoveLevelUp.GetMovesLevelUp(pkm, r.Species, -1, -1, 60, r.Form, GameVersion.SW, false, 8));
break;
}
}
public ValidEncounterMoves(IReadOnlyList<int>[] levelup)
{
LevelUpMoves = levelup;

View File

@ -41,7 +41,7 @@ private static CheckMoveResult[] ParseMovesForEncounters(PKM pkm, LegalInfo info
// gather valid moves for encounter species
var restrict = new LevelUpRestriction(pkm, info);
info.EncounterMoves = new ValidEncounterMoves(pkm, restrict);
info.EncounterMoves = new ValidEncounterMoves(pkm, restrict, info.EncounterMatch);
IReadOnlyList<int> defaultG1LevelMoves = Array.Empty<int>();
IReadOnlyList<int> defaultG2LevelMoves = Array.Empty<int>();