mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-03 17:29:13 +00:00
Minor tweaks
Enc static 4 should check met location, since locations are flexible for roamers Simplify expressions Disallow 0 moves in "needed moves" list.
This commit is contained in:
parent
9d8b528437
commit
ce17fd4050
8 changed files with 42 additions and 24 deletions
|
@ -129,6 +129,7 @@ namespace PKHeX.Core
|
|||
if (Gen5.Contains(game)) return 5;
|
||||
if (Gen6.Contains(game)) return 6;
|
||||
if (Gen7.Contains(game)) return 7;
|
||||
if (Gen7b.Contains(game)) return 7;
|
||||
if (Gen8.Contains(game)) return 8;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -91,7 +91,8 @@ namespace PKHeX.Core
|
|||
if (pkm.TSV == 0) // HOME doesn't assign TSV=0 to accounts.
|
||||
yield break;
|
||||
|
||||
var sf = chain.FirstOrDefault(z => z.Species == Species && z.Form == Form);
|
||||
var sf = chain.FirstOrDefault(z => z.Species == Species
|
||||
&& (z.Form == Form || AltFormInfo.IsFormChangeable(Species, Form, z.Form, pkm.Format)));
|
||||
if (sf == null)
|
||||
yield break;
|
||||
|
||||
|
|
|
@ -22,5 +22,12 @@ namespace PKHeX.Core
|
|||
pb.HeightScalar = PokeSizeUtil.GetRandomScalar();
|
||||
pb.WeightScalar = PokeSizeUtil.GetRandomScalar();
|
||||
}
|
||||
|
||||
protected override void SetEncounterMoves(PKM pk, GameVersion version, int level)
|
||||
{
|
||||
var moves = MoveLevelUp.GetEncounterMoves(pk, level, GameVersion.GG);
|
||||
pk.SetMoves(moves);
|
||||
pk.SetMaximumPPCurrent(moves);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,5 +35,12 @@ namespace PKHeX.Core
|
|||
pk8.HeightScalar = PokeSizeUtil.GetRandomScalar();
|
||||
pk8.WeightScalar = PokeSizeUtil.GetRandomScalar();
|
||||
}
|
||||
|
||||
protected override void SetEncounterMoves(PKM pk, GameVersion version, int level)
|
||||
{
|
||||
var moves = MoveLevelUp.GetEncounterMoves(pk, level, OriginGroup);
|
||||
pk.SetMoves(moves);
|
||||
pk.SetMaximumPPCurrent(moves);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,9 +79,12 @@ namespace PKHeX.Core
|
|||
if (Start == 0)
|
||||
return End == 0 ? DateTime.Now : GetDate(End);
|
||||
|
||||
var end = Math.Max(Start, End);
|
||||
var delta = end - Start;
|
||||
var bias = Util.Rand.Next(0, delta + 1);
|
||||
var start = GetDate(Start);
|
||||
if (End == 0)
|
||||
return start;
|
||||
var end = GetDate(End);
|
||||
var delta = end - start;
|
||||
var bias = Util.Rand.Next(0, delta.Days + 1);
|
||||
return GetDate(Start).AddDays(bias);
|
||||
}
|
||||
|
||||
|
|
|
@ -152,9 +152,14 @@ namespace PKHeX.Core
|
|||
if (pk.Species == (int)Species.Smeargle)
|
||||
return moves.Intersect(Legal.InvalidSketch).ToArray(); // Can learn anything
|
||||
|
||||
var gens = VerifyCurrentMoves.GetGenMovesCheckOrder(pk);
|
||||
// Roughly determine the generation the PKM is originating from
|
||||
int origin = pk.GenNumber;
|
||||
if (origin < 0)
|
||||
origin = ((GameVersion)pk.Version).GetGeneration();
|
||||
|
||||
var gens = VerifyCurrentMoves.GetGenMovesCheckOrder(pk, origin);
|
||||
var canlearn = gens.SelectMany(z => GetMovesForGeneration(pk, chain, z));
|
||||
return moves.Except(canlearn).ToArray();
|
||||
return moves.Except(canlearn).Where(z => z != 0).ToArray();
|
||||
}
|
||||
|
||||
private static IEnumerable<int> GetMovesForGeneration(PKM pk, IReadOnlyList<EvoCriteria> chain, int generation)
|
||||
|
@ -367,21 +372,16 @@ namespace PKHeX.Core
|
|||
{
|
||||
switch (enc.Generation)
|
||||
{
|
||||
case 4 when enc is EncounterStaticTyped t && enc.Location == 193:
|
||||
if (t.TypeEncounter == EncounterType.Surfing_Fishing) // Johto Route 45 surfing encounter. Unreachable Water tiles.
|
||||
return true; // only hits for Roamer Raikou
|
||||
break;
|
||||
case 4 when enc is EncounterStaticTyped t && pk.Met_Location == 193: // Johto Route 45 surfing encounter. Unreachable Water tiles.
|
||||
return t.TypeEncounter == EncounterType.Surfing_Fishing; // Roamer Raikou
|
||||
case 4:
|
||||
switch (pk.Species)
|
||||
return enc.Species switch
|
||||
{
|
||||
case (int)Species.Darkrai when enc.Location == 079 && !pk.Pt: // DP Darkrai
|
||||
return true;
|
||||
case (int)Species.Shaymin when enc.Location == 063 && !pk.Pt: // DP Shaymin
|
||||
return true;
|
||||
case (int)Species.Arceus when enc.Location == 086: // Azure Flute Arceus
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
(int)Species.Darkrai when enc.Location == 079 && enc.Version != GameVersion.Pt => true, // DP Darkrai
|
||||
(int)Species.Shaymin when enc.Location == 063 && enc.Version != GameVersion.Pt => true, // DP Shaymin
|
||||
(int)Species.Arceus when enc.Location == 086 => true, // Azure Flute Arceus
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -282,7 +282,7 @@ namespace PKHeX.Core
|
|||
case (int)Species.Arceus when s.Location == 086: // Azure Flute Arceus
|
||||
return new CheckResult(Severity.Invalid, LEncUnreleasedHoOArceus, CheckIdentifier.Encounter);
|
||||
}
|
||||
if (s.Location == 193 && s is EncounterStaticTyped t && t.TypeEncounter == EncounterType.Surfing_Fishing) // Roaming pokemon surfing in Johto Route 45
|
||||
if (pkm.Met_Location == 193 && s is EncounterStaticTyped t && t.TypeEncounter == EncounterType.Surfing_Fishing) // Roaming pokemon surfing in Johto Route 45
|
||||
return new CheckResult(Severity.Invalid, LG4InvalidTileR45Surf, CheckIdentifier.Encounter);
|
||||
break;
|
||||
case 7:
|
||||
|
|
|
@ -268,7 +268,7 @@ namespace PKHeX.Core
|
|||
// Encapsulate arguments to simplify method calls
|
||||
var moveInfo = new LearnInfo(pkm, source);
|
||||
// Check moves going backwards, marking the move valid in the most current generation when it can be learned
|
||||
int[] generations = GetGenMovesCheckOrder(pkm);
|
||||
int[] generations = GetGenMovesCheckOrder(pkm, info.EncounterOriginal.Generation);
|
||||
if (pkm.Format <= 2)
|
||||
generations = generations.Where(z => z < info.EncounterMoves.LevelUpMoves.Length).ToArray();
|
||||
if (reset != 0)
|
||||
|
@ -887,14 +887,13 @@ namespace PKHeX.Core
|
|||
/// <summary>
|
||||
/// Gets the generation numbers in descending order for iterating over.
|
||||
/// </summary>
|
||||
public static int[] GetGenMovesCheckOrder(PKM pkm)
|
||||
public static int[] GetGenMovesCheckOrder(PKM pkm, int origin)
|
||||
{
|
||||
if (pkm.Format < 3)
|
||||
return GetGenMovesCheckOrderGB(pkm, pkm.Format);
|
||||
if (pkm.VC)
|
||||
return GetGenMovesOrderVC(pkm);
|
||||
|
||||
return GetGenMovesOrder(pkm.Format, pkm.GenNumber);
|
||||
return GetGenMovesOrder(pkm.Format, origin);
|
||||
}
|
||||
|
||||
private static int[] GetGenMovesOrderVC(PKM pkm)
|
||||
|
|
Loading…
Reference in a new issue