mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-10 06:35:49 -05:00
Misc move/memory tweaks
Disallow max moves from Sketch Hide dmax moves from legal dropdown lists Pass ushort for moves for validating memories Internal class for move pp (hide empty class from dll users)
This commit is contained in:
@@ -42,15 +42,19 @@ public GameDataSource(GameStrings s)
|
||||
|
||||
var moves = Util.GetCBList(s.movelist);
|
||||
HaXMoveDataSource = moves;
|
||||
var legal = new List<ComboItem>(moves);
|
||||
legal.RemoveAll(m => MoveInfo.Z_Moves.Contains(m.Value));
|
||||
var legal = new List<ComboItem>(moves.Count);
|
||||
foreach (var m in moves)
|
||||
{
|
||||
if (MoveInfo.IsMoveKnowable((ushort)m.Value))
|
||||
legal.Add(m);
|
||||
}
|
||||
LegalMoveDataSource = legal;
|
||||
|
||||
VersionDataSource = GetVersionList(s);
|
||||
|
||||
Met = new MetDataSource(s);
|
||||
|
||||
Empty = new ComboItem(s.Species[0], 0);
|
||||
Empty = new ComboItem(s.itemlist[0], 0);
|
||||
}
|
||||
|
||||
/// <summary> Strings that this object's lists were generated with. </summary>
|
||||
|
||||
@@ -43,6 +43,7 @@ public sealed class GameStrings : IBasicStrings
|
||||
|
||||
private string[] Get(string ident) => GameLanguage.GetStrings(ident, lang);
|
||||
private const string NPC = "NPC";
|
||||
private const string EmptyIndex = "---";
|
||||
|
||||
/// <summary>
|
||||
/// Item IDs that correspond to the <see cref="Ball"/> value.
|
||||
@@ -81,9 +82,14 @@ public GameStrings(string l)
|
||||
abilitylist = Get("abilities");
|
||||
|
||||
movelist = Get("moves");
|
||||
string[] ps = { "P", "S" }; // Distinguish Physical/Special
|
||||
// Differentiate Physical/Special Z-Moves
|
||||
for (int i = 622; i < 658; i++)
|
||||
movelist[i] += $" ({ps[i % 2]})";
|
||||
{
|
||||
const string p = " (P)";
|
||||
const string s = " (S)";
|
||||
bool isPhysicalZMove = (i & 1) == 0;
|
||||
movelist[i] += isPhysicalZMove ? p : s;
|
||||
}
|
||||
|
||||
itemlist = Get("items");
|
||||
characteristics = Get("character");
|
||||
@@ -159,6 +165,8 @@ public GameStrings(string l)
|
||||
|
||||
private string[] GetG3CXD(string[] arr, string fileName)
|
||||
{
|
||||
// Concatenate the Gen3 Item list with the CXD item array; CXD items starting at index 500.
|
||||
// Empty slots between the two lists are marked as unused.
|
||||
string[] item500 = Get(fileName);
|
||||
var result = new string[500 + item500.Length];
|
||||
for (int i = arr.Length; i < result.Length; i++)
|
||||
@@ -190,7 +198,7 @@ private void Sanitize()
|
||||
abilitylist[(int)Core.Ability.AsOneG] += $" ({specieslist[(int)Core.Species.Spectrier]})";
|
||||
|
||||
// Replace the Egg Name with ---; egg name already stored to eggname
|
||||
specieslist[0] = "---";
|
||||
specieslist[0] = EmptyIndex;
|
||||
// Fix (None) tags
|
||||
var none = $"({itemlist[0]})";
|
||||
abilitylist[0] = itemlist[0] = movelist[0] = metXY_00000[0] = metBW2_00000[0] = metHGSS_00000[0] = metCXD_00000[0] = puffs[0] = none;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -20,16 +20,16 @@ public MemoryStrings(GameStrings strings)
|
||||
memories = new Lazy<List<ComboItem>>(GetMemories);
|
||||
none = new Lazy<List<ComboItem>>(() => Util.GetCBList(new[] {string.Empty}));
|
||||
species = new Lazy<List<ComboItem>>(() => Util.GetCBList(s.specieslist));
|
||||
item6 = new Lazy<List<ComboItem>>(() => GetItems(6));
|
||||
item8 = new Lazy<List<ComboItem>>(() => GetItems(8));
|
||||
item6 = new Lazy<List<ComboItem>>(() => GetItems(EntityContext.Gen6));
|
||||
item8 = new Lazy<List<ComboItem>>(() => GetItems(EntityContext.Gen8));
|
||||
genloc = new Lazy<List<ComboItem>>(() => Util.GetCBList(s.genloc));
|
||||
moves = new Lazy<List<ComboItem>>(() => Util.GetCBList(s.movelist));
|
||||
specific = new Lazy<List<ComboItem>>(() => Util.GetCBList(s.metXY_00000, Locations6.Met0));
|
||||
}
|
||||
|
||||
private List<ComboItem> GetItems(int memoryGen)
|
||||
private List<ComboItem> GetItems(EntityContext context)
|
||||
{
|
||||
var permit = Memories.GetMemoryItemParams(memoryGen);
|
||||
var permit = Memories.GetMemoryItemParams(context);
|
||||
var asInt = permit.ToArray();
|
||||
return Util.GetCBList(s.itemlist, asInt);
|
||||
}
|
||||
|
||||
@@ -140,19 +140,6 @@ internal static int GetMaxSpeciesOrigin(PKM pk)
|
||||
_ => -1,
|
||||
};
|
||||
|
||||
internal static int GetMaxMoveID(int generation) => generation switch
|
||||
{
|
||||
1 => MaxMoveID_1,
|
||||
2 => MaxMoveID_2,
|
||||
3 => MaxMoveID_3,
|
||||
4 => MaxMoveID_4,
|
||||
5 => MaxMoveID_5,
|
||||
6 => MaxMoveID_6_AO,
|
||||
7 => MaxMoveID_7b,
|
||||
8 => MaxMoveID_8a,
|
||||
_ => -1,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the relearn moves should be wiped.
|
||||
/// </summary>
|
||||
|
||||
@@ -117,13 +117,13 @@ private static bool VerifySecondaryChecks(PKM pk, LegalInfo info, PeekEnumerator
|
||||
if (m is IMemoryOT o && MemoryPermissions.IsMemoryOfKnownMove(o.OT_Memory))
|
||||
{
|
||||
var mem = MemoryVariableSet.Read(m, 0);
|
||||
if (!MemoryPermissions.CanKnowMove(pk, mem, info.EncounterMatch.Generation, info))
|
||||
if (!MemoryPermissions.CanKnowMove(pk, mem, info.EncounterMatch.Context, info))
|
||||
return false;
|
||||
}
|
||||
if (m is IMemoryHT h && MemoryPermissions.IsMemoryOfKnownMove(h.HT_Memory) && !pk.HasMove(h.HT_TextVar))
|
||||
{
|
||||
var mem = MemoryVariableSet.Read(m, 1);
|
||||
if (!MemoryPermissions.CanKnowMove(pk, mem, pk.Format, info))
|
||||
if (!MemoryPermissions.CanKnowMove(pk, mem, pk.Context, info))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ private static bool IsPlausibleSmeargleMoveset(PKM pk, ReadOnlySpan<int> moves)
|
||||
{
|
||||
foreach (var move in moves)
|
||||
{
|
||||
if (!Legal.IsValidSketch(move, pk.Format))
|
||||
if (!MoveInfo.IsValidSketch((ushort)move, pk.Context))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -119,7 +119,7 @@ private static void VerifySmeargle(Span<MoveResult> result, ReadOnlySpan<int> cu
|
||||
var move = current[i];
|
||||
if (move == 0)
|
||||
result[i] = MoveResult.Empty;
|
||||
else if (Legal.IsValidSketch(move, pk.Format))
|
||||
else if (MoveInfo.IsValidSketch((ushort)move, pk.Context))
|
||||
result[i] = MoveResult.Sketch;
|
||||
else
|
||||
result[i] = MoveResult.Unobtainable();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
||||
@@ -33,11 +33,11 @@ public static MemoryArgType GetMemoryArgType(int memory, int memoryGen)
|
||||
return MemoryArgType.None;
|
||||
}
|
||||
|
||||
public static MemoryContext GetContext(int memoryGen) => memoryGen switch
|
||||
public static MemoryContext GetContext(EntityContext context) => context.Generation() switch
|
||||
{
|
||||
<=7 => Memory6,
|
||||
_ => Memory8,
|
||||
};
|
||||
|
||||
public static IEnumerable<ushort> GetMemoryItemParams(int memoryGen) => GetContext(memoryGen).GetMemoryItemParams();
|
||||
public static IEnumerable<ushort> GetMemoryItemParams(EntityContext context) => GetContext(context).GetMemoryItemParams();
|
||||
}
|
||||
|
||||
@@ -16,58 +16,58 @@ public static class MemoryPermissions
|
||||
{
|
||||
public static bool IsMemoryOfKnownMove(int memory) => memory is 48 or 80 or 81;
|
||||
|
||||
public static bool CanWinLotoID(int generation, int item)
|
||||
public static bool CanWinLotoID(EntityContext context, int item)
|
||||
{
|
||||
var context = Memories.GetContext(generation);
|
||||
return context.CanWinLotoID(item);
|
||||
var mem = Memories.GetContext(context);
|
||||
return mem.CanWinLotoID(item);
|
||||
}
|
||||
|
||||
public static bool CanHoldItem(int generation, int item)
|
||||
public static bool CanHoldItem(EntityContext context, int item)
|
||||
{
|
||||
var context = Memories.GetContext(generation);
|
||||
return context.CanHoldItem(item);
|
||||
var mem = Memories.GetContext(context);
|
||||
return mem.CanHoldItem(item);
|
||||
}
|
||||
|
||||
public static bool CanPlantBerry(int generation, int item)
|
||||
public static bool CanPlantBerry(EntityContext context, int item)
|
||||
{
|
||||
var context = Memories.GetContext(generation);
|
||||
return context.CanPlantBerry(item);
|
||||
var mem = Memories.GetContext(context);
|
||||
return mem.CanPlantBerry(item);
|
||||
}
|
||||
|
||||
public static bool CanUseItemGeneric(int generation, int item)
|
||||
public static bool CanUseItemGeneric(EntityContext context, int item)
|
||||
{
|
||||
var context = Memories.GetContext(generation);
|
||||
return context.CanUseItemGeneric(item);
|
||||
var mem = Memories.GetContext(context);
|
||||
return mem.CanUseItemGeneric(item);
|
||||
}
|
||||
|
||||
public static bool CanUseItem(int generation, int item, int species)
|
||||
public static bool CanUseItem(EntityContext context, int item, int species)
|
||||
{
|
||||
if (IsUsedKeyItemUnspecific(generation, item))
|
||||
if (IsUsedKeyItemUnspecific(context, item))
|
||||
return true;
|
||||
if (IsUsedKeyItemSpecific(generation, item, species))
|
||||
if (IsUsedKeyItemSpecific(context, item, species))
|
||||
return true;
|
||||
return true; // todo
|
||||
}
|
||||
|
||||
private static bool IsUsedKeyItemUnspecific(int generation, int item)
|
||||
private static bool IsUsedKeyItemUnspecific(EntityContext context, int item)
|
||||
{
|
||||
var context = Memories.GetContext(generation);
|
||||
return context.IsUsedKeyItemUnspecific(item);
|
||||
var mem = Memories.GetContext(context);
|
||||
return mem.IsUsedKeyItemUnspecific(item);
|
||||
}
|
||||
|
||||
private static bool IsUsedKeyItemSpecific(int generation, int item, int species)
|
||||
private static bool IsUsedKeyItemSpecific(EntityContext context, int item, int species)
|
||||
{
|
||||
var context = Memories.GetContext(generation);
|
||||
return context.IsUsedKeyItemSpecific(item, species);
|
||||
var mem = Memories.GetContext(context);
|
||||
return mem.IsUsedKeyItemSpecific(item, species);
|
||||
}
|
||||
|
||||
public static bool CanBuyItem(int generation, int item, GameVersion version = GameVersion.Any)
|
||||
public static bool CanBuyItem(EntityContext context, int item, GameVersion version = GameVersion.Any)
|
||||
{
|
||||
var context = Memories.GetContext(generation);
|
||||
return context.CanBuyItem(item, version);
|
||||
var mem = Memories.GetContext(context);
|
||||
return mem.CanBuyItem(item, version);
|
||||
}
|
||||
|
||||
public static bool CanKnowMove(PKM pk, MemoryVariableSet memory, int gen, LegalInfo info, bool battleOnly = false)
|
||||
public static bool CanKnowMove(PKM pk, MemoryVariableSet memory, EntityContext gen, LegalInfo info, bool battleOnly = false)
|
||||
{
|
||||
var move = memory.Variable;
|
||||
if (move == 0)
|
||||
@@ -105,7 +105,7 @@ public static bool CanKnowMove(PKM pk, MemoryVariableSet memory, int gen, LegalI
|
||||
case (int)BehemothBash when pk.Species == (int)Zamazenta:
|
||||
return true;
|
||||
}
|
||||
if (gen == 8 && MoveInfo.IsDynamaxMove(move))
|
||||
if (gen == EntityContext.Gen8 && MoveInfo.IsMoveDynamax(move))
|
||||
return true;
|
||||
if (pk.Species == (int)Ditto)
|
||||
{
|
||||
@@ -113,7 +113,7 @@ public static bool CanKnowMove(PKM pk, MemoryVariableSet memory, int gen, LegalI
|
||||
return false;
|
||||
return gen switch
|
||||
{
|
||||
8 => move <= Legal.MaxMoveID_8_R2 && !MoveInfo.IsDummiedMove(pk, move),
|
||||
EntityContext.Gen8 => move <= Legal.MaxMoveID_8_R2 && !MoveInfo.IsDummiedMove(pk, move),
|
||||
_ => move <= Legal.MaxMoveID_6_AO,
|
||||
};
|
||||
}
|
||||
@@ -129,16 +129,16 @@ private static bool IsSpecialEncounterMoveEggDeleted(PKM pk, IEncounterTemplate
|
||||
return enc is EncounterEgg { Generation: < 6 }; // egg moves that are no longer in the movepool
|
||||
}
|
||||
|
||||
public static bool GetCanRelearnMove(PKM pk, int move, int generation, EvolutionHistory history, IEncounterTemplate enc)
|
||||
public static bool GetCanRelearnMove(PKM pk, int move, EntityContext context, EvolutionHistory history, IEncounterTemplate enc)
|
||||
{
|
||||
if (generation == 6)
|
||||
if (context == EntityContext.Gen6)
|
||||
{
|
||||
Span<MoveResult> result = stackalloc MoveResult[1];
|
||||
Span<int> moves = stackalloc int[] { move };
|
||||
LearnGroup6.Instance.Check(result, moves, pk, history, enc, MoveSourceType.Reminder, LearnOption.AtAnyTime);
|
||||
return result[0].Valid;
|
||||
}
|
||||
if (generation == 8)
|
||||
if (context == EntityContext.Gen8)
|
||||
{
|
||||
Span<MoveResult> result = stackalloc MoveResult[1];
|
||||
Span<int> moves = stackalloc int[] { move };
|
||||
@@ -148,15 +148,15 @@ public static bool GetCanRelearnMove(PKM pk, int move, int generation, Evolution
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool GetCanKnowMove(PKM pk, int move, int generation, EvolutionHistory history, IEncounterTemplate enc)
|
||||
private static bool GetCanKnowMove(PKM pk, int move, EntityContext context, EvolutionHistory history, IEncounterTemplate enc)
|
||||
{
|
||||
if (pk.Species == (int)Smeargle)
|
||||
return Legal.IsValidSketch(move, generation);
|
||||
return MoveInfo.IsValidSketch((ushort)move, context);
|
||||
|
||||
ILearnGroup game;
|
||||
if (generation == 6)
|
||||
if (context == EntityContext.Gen6)
|
||||
game = LearnGroup6.Instance;
|
||||
else if (generation == 8)
|
||||
else if (context == EntityContext.Gen8)
|
||||
game = LearnGroup8.Instance;
|
||||
else
|
||||
return false;
|
||||
@@ -167,9 +167,9 @@ private static bool GetCanKnowMove(PKM pk, int move, int generation, EvolutionHi
|
||||
return result[0].Valid;
|
||||
}
|
||||
|
||||
public static bool GetCanBeCaptured(int species, int gen, GameVersion version) => gen switch
|
||||
public static bool GetCanBeCaptured(int species, EntityContext gen, GameVersion version) => gen switch
|
||||
{
|
||||
6 => version switch
|
||||
EntityContext.Gen6 => version switch
|
||||
{
|
||||
GameVersion.Any => GetCanBeCaptured(species, SlotsX, StaticX) || GetCanBeCaptured(species, SlotsY, StaticY)
|
||||
|| GetCanBeCaptured(species, SlotsA, StaticA) || GetCanBeCaptured(species, SlotsO, StaticO),
|
||||
@@ -181,7 +181,7 @@ private static bool GetCanKnowMove(PKM pk, int move, int generation, EvolutionHi
|
||||
GameVersion.OR => GetCanBeCaptured(species, SlotsO, StaticO),
|
||||
_ => false,
|
||||
},
|
||||
8 => version switch
|
||||
EntityContext.Gen8 => version switch
|
||||
{
|
||||
GameVersion.Any => GetCanBeCaptured(species, SlotsSW.Concat(SlotsSH), StaticSW.Concat(StaticSH)),
|
||||
GameVersion.SW => GetCanBeCaptured(species, SlotsSW, StaticSW),
|
||||
@@ -249,9 +249,9 @@ public static bool GetCanDynamaxTrainer(int species, int gen, GameVersion versio
|
||||
(int)Urshifu,
|
||||
};
|
||||
|
||||
public static bool GetCanFishSpecies(int species, int gen, GameVersion version) => gen switch
|
||||
public static bool GetCanFishSpecies(int species, EntityContext context, GameVersion version) => context switch
|
||||
{
|
||||
6 => version switch
|
||||
EntityContext.Gen6 => version switch
|
||||
{
|
||||
GameVersion.Any => FishingSpecies_XY.Contains(species) || FishingSpecies_AO.Contains(species)
|
||||
|| IsFishingSpeciesX(species) || IsFishingSpeciesY(species),
|
||||
@@ -262,7 +262,7 @@ public static bool GetCanDynamaxTrainer(int species, int gen, GameVersion versio
|
||||
GameVersion.OR or GameVersion.AS => FishingSpecies_AO.Contains(species),
|
||||
_ => false,
|
||||
},
|
||||
8 => version switch
|
||||
EntityContext.Gen8 => version switch
|
||||
{
|
||||
GameVersion.Any or GameVersion.SW or GameVersion.SH => FishingSpecies_SWSH.Contains(species),
|
||||
_ => false,
|
||||
|
||||
@@ -21,30 +21,6 @@ public static partial class Legal
|
||||
(int)Meltan, (int)Melmetal,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Checks if Sketch can obtain the <see cref="move"/> in the requested <see cref="generation"/>
|
||||
/// </summary>
|
||||
/// <remarks>Doesn't bounds check the <see cref="generation"/> for max move ID.</remarks>
|
||||
/// <param name="move">Move ID</param>
|
||||
/// <param name="generation">Generation to check</param>
|
||||
/// <returns>True if can be sketched, false if not available.</returns>
|
||||
public static bool IsValidSketch(int move, int generation)
|
||||
{
|
||||
if (MoveInfo.InvalidSketch.Contains(move))
|
||||
return false;
|
||||
if (generation is 6 && move is ((int)ThousandArrows or (int)ThousandWaves))
|
||||
return false;
|
||||
if (generation is 8) // can't Sketch unusable moves in BDSP, no Sketch in PLA
|
||||
{
|
||||
if (DummiedMoves_BDSP.Contains(move))
|
||||
return false;
|
||||
if (move > MaxMoveID_8)
|
||||
return false;
|
||||
}
|
||||
|
||||
return move <= GetMaxMoveID(generation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Species that are from Mythical Distributions (disallowed species for competitive rulesets)
|
||||
/// </summary>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using static PKHeX.Core.LegalityCheckStrings;
|
||||
using static PKHeX.Core.MemoryPermissions;
|
||||
using static PKHeX.Core.EntityContext;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
||||
@@ -32,7 +33,7 @@ private static bool ShouldHaveNoMemory(LegalityAnalysis data, PKM pk)
|
||||
return false;
|
||||
}
|
||||
|
||||
private CheckResult VerifyCommonMemory(PKM pk, int handler, int gen, LegalInfo info, MemoryContext context)
|
||||
private CheckResult VerifyCommonMemory(PKM pk, int handler, EntityContext context, LegalInfo info, MemoryContext mem)
|
||||
{
|
||||
var memory = MemoryVariableSet.Read((ITrainerMemories)pk, handler);
|
||||
|
||||
@@ -40,7 +41,7 @@ private CheckResult VerifyCommonMemory(PKM pk, int handler, int gen, LegalInfo i
|
||||
int hmIndex = Array.IndexOf(MemoryContext6.MoveSpecificMemoryHM, memory.MemoryID);
|
||||
if (hmIndex != -1)
|
||||
{
|
||||
if (gen != 6) // Gen8 has no HMs, so this memory can never exist.
|
||||
if (context != Gen6) // Gen8 has no HMs, so this memory can never exist.
|
||||
return GetInvalid(string.Format(LMemoryArgBadMove, memory.Handler));
|
||||
|
||||
if (pk.Species != (int)Species.Smeargle)
|
||||
@@ -54,10 +55,10 @@ private CheckResult VerifyCommonMemory(PKM pk, int handler, int gen, LegalInfo i
|
||||
}
|
||||
}
|
||||
|
||||
if (context.IsInvalidGeneralLocationMemoryValue(memory.MemoryID, memory.Variable, info.EncounterMatch, pk))
|
||||
if (mem.IsInvalidGeneralLocationMemoryValue(memory.MemoryID, memory.Variable, info.EncounterMatch, pk))
|
||||
return GetInvalid(string.Format(LMemoryArgBadLocation, memory.Handler));
|
||||
|
||||
if (context.IsInvalidMiscMemory(memory.MemoryID, memory.Variable))
|
||||
if (mem.IsInvalidMiscMemory(memory.MemoryID, memory.Variable))
|
||||
return GetInvalid(string.Format(LMemoryArgBadID, memory.Handler));
|
||||
|
||||
switch (memory.MemoryID)
|
||||
@@ -67,15 +68,15 @@ private CheckResult VerifyCommonMemory(PKM pk, int handler, int gen, LegalInfo i
|
||||
return GetInvalid(string.Format(LMemoryArgBadLocation, memory.Handler));
|
||||
|
||||
// {0} saw {2} carrying {1} on its back. {4} that {3}.
|
||||
case 21 when gen != 6 || !PersonalTable.AO.GetFormEntry(memory.Variable, 0).TMHM[101]: // Fly
|
||||
case 21 when context != Gen6 || !PersonalTable.AO.GetFormEntry(memory.Variable, 0).TMHM[101]: // Fly
|
||||
return GetInvalid(string.Format(LMemoryArgBadMove, memory.Handler));
|
||||
|
||||
// {0} used {2} at {1}’s instruction, but it had no effect. {4} that {3}.
|
||||
// The Move Deleter that {0} met through {1} made it forget {2}. {4} that {3}.
|
||||
case 16 or 48 when !CanKnowMove(pk, memory, gen, info, memory.MemoryID == 16):
|
||||
case 16 or 48 when !CanKnowMove(pk, memory, context, info, memory.MemoryID == 16):
|
||||
return GetInvalid(string.Format(LMemoryArgBadMove, memory.Handler));
|
||||
|
||||
case 49 when memory.Variable == 0 || !GetCanRelearnMove(pk, memory.Variable, gen, info.EvoChainsAllGens, info.EncounterOriginal):
|
||||
case 49 when memory.Variable == 0 || !GetCanRelearnMove(pk, memory.Variable, context, info.EvoChainsAllGens, info.EncounterOriginal):
|
||||
return GetInvalid(string.Format(LMemoryArgBadMove, memory.Handler));
|
||||
|
||||
// Dynamaxing
|
||||
@@ -88,18 +89,18 @@ private CheckResult VerifyCommonMemory(PKM pk, int handler, int gen, LegalInfo i
|
||||
// Move
|
||||
// {0} studied about how to use {2} in a Box, thinking about {1}. {4} that {3}.
|
||||
// {0} practiced its cool pose for the move {2} in a Box, wishing to be praised by {1}. {4} that {3}.
|
||||
case 80 or 81 when !CanKnowMove(pk, memory, gen, info):
|
||||
case 80 or 81 when !CanKnowMove(pk, memory, context, info):
|
||||
return Get(string.Format(LMemoryArgBadMove, memory.Handler), Severity.Invalid);
|
||||
|
||||
// Species
|
||||
// With {1}, {0} went fishing, and they caught {2}. {4} that {3}.
|
||||
case 7 when !GetCanFishSpecies(memory.Variable, gen, handler == 0 ? (GameVersion)pk.Version : GameVersion.Any):
|
||||
case 7 when !GetCanFishSpecies(memory.Variable, context, handler == 0 ? (GameVersion)pk.Version : GameVersion.Any):
|
||||
return GetInvalid(string.Format(LMemoryArgBadSpecies, memory.Handler));
|
||||
|
||||
// {0} saw {1} paying attention to {2}. {4} that {3}.
|
||||
// {0} fought hard until it had to use Struggle when it battled at {1}’s side against {2}. {4} that {3}.
|
||||
// {0} was taken to a Pokémon Nursery by {1} and left with {2}. {4} that {3}.
|
||||
case 9 or 60 or 75 when gen == 8 && !PersonalTable.SWSH.IsSpeciesInGame(memory.Variable):
|
||||
case 9 or 60 or 75 when context == Gen8 && !PersonalTable.SWSH.IsSpeciesInGame(memory.Variable):
|
||||
return GetInvalid(string.Format(LMemoryArgBadSpecies, memory.Handler));
|
||||
|
||||
// {0} had a great chat about {1} with the {2} that it was in a Box with. {4} that {3}.
|
||||
@@ -109,29 +110,29 @@ private CheckResult VerifyCommonMemory(PKM pk, int handler, int gen, LegalInfo i
|
||||
return GetInvalid(string.Format(LMemoryArgBadSpecies, memory.Handler));
|
||||
|
||||
// {0} had a very hard training session with {1}. {4} that {3}.
|
||||
case 53 when gen == 8 && pk is IHyperTrain t && !t.IsHyperTrained():
|
||||
case 53 when context == Gen8 && pk is IHyperTrain t && !t.IsHyperTrained():
|
||||
return GetInvalid(string.Format(LMemoryArgBadID, memory.Handler));
|
||||
|
||||
// Item
|
||||
// {0} went to a Pokémon Center with {1} to buy {2}. {4} that {3}.
|
||||
case 5 when !CanBuyItem(gen, memory.Variable, handler == 0 ? (GameVersion)pk.Version : GameVersion.Any):
|
||||
case 5 when !CanBuyItem(context, memory.Variable, handler == 0 ? (GameVersion)pk.Version : GameVersion.Any):
|
||||
// {1} used {2} when {0} was in trouble. {4} that {3}.
|
||||
case 15 when !CanUseItem(gen, memory.Variable, pk.Species):
|
||||
case 15 when !CanUseItem(context, memory.Variable, pk.Species):
|
||||
// {0} saw {1} using {2}. {4} that {3}.
|
||||
case 26 when !CanUseItemGeneric(gen, memory.Variable):
|
||||
case 26 when !CanUseItemGeneric(context, memory.Variable):
|
||||
// {0} planted {2} with {1} and imagined a big harvest. {4} that {3}.
|
||||
case 34 when !CanPlantBerry(gen, memory.Variable):
|
||||
case 34 when !CanPlantBerry(context, memory.Variable):
|
||||
// {1} had {0} hold items like {2} to help it along. {4} that {3}.
|
||||
case 40 when !CanHoldItem(gen, memory.Variable):
|
||||
case 40 when !CanHoldItem(context, memory.Variable):
|
||||
// {0} was excited when {1} won prizes like {2} through Loto-ID. {4} that {3}.
|
||||
case 51 when !CanWinLotoID(gen, memory.Variable):
|
||||
case 51 when !CanWinLotoID(context, memory.Variable):
|
||||
// {0} was worried if {1} was looking for the {2} that it was holding in a Box. {4} that {3}.
|
||||
// When {0} was in a Box, it thought about the reason why {1} had it hold the {2}. {4} that {3}.
|
||||
case 84 or 88 when !Legal.HeldItems_SWSH.Contains(memory.Variable) || pk.IsEgg:
|
||||
return GetInvalid(string.Format(LMemoryArgBadItem, memory.Handler));
|
||||
}
|
||||
|
||||
return VerifyCommonMemoryEtc(memory, context);
|
||||
return VerifyCommonMemoryEtc(memory, mem);
|
||||
}
|
||||
|
||||
private CheckResult VerifyCommonMemoryEtc(MemoryVariableSet memory, MemoryContext context)
|
||||
@@ -199,28 +200,28 @@ private void VerifyOTMemory(LegalityAnalysis data)
|
||||
return;
|
||||
}
|
||||
|
||||
int memoryGen = Info.Generation;
|
||||
var context = Info.EncounterOriginal.Context;
|
||||
var memory = mem.OT_Memory;
|
||||
|
||||
if (pk.IsEgg)
|
||||
{
|
||||
// Traded unhatched eggs in Gen8 have OT link trade memory applied erroneously.
|
||||
// They can also have the box-inspect memory!
|
||||
if (memoryGen != 8 || !((pk.Met_Location == Locations.LinkTrade6 && memory == 4) || memory == 85))
|
||||
if (context != Gen8 || !((pk.Met_Location == Locations.LinkTrade6 && memory == 4) || memory == 85))
|
||||
{
|
||||
VerifyOTMemoryIs(data, 0, 0, 0, 0); // empty
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!CanHaveMemoryForOT(pk, memoryGen, memory, Info.EvoChainsAllGens))
|
||||
else if (!CanHaveMemoryForOT(pk, context, memory))
|
||||
{
|
||||
VerifyOTMemoryIs(data, 0, 0, 0, 0); // empty
|
||||
return;
|
||||
}
|
||||
|
||||
// Bounds checking
|
||||
var context = Memories.GetContext(memoryGen);
|
||||
if (!context.CanObtainMemoryOT((GameVersion)pk.Version, memory))
|
||||
var mc = Memories.GetContext(context);
|
||||
if (!mc.CanObtainMemoryOT((GameVersion)pk.Version, memory))
|
||||
data.AddLine(GetInvalid(string.Format(LMemoryArgBadID, L_XOT)));
|
||||
|
||||
// Verify memory if specific to OT
|
||||
@@ -228,7 +229,7 @@ private void VerifyOTMemory(LegalityAnalysis data)
|
||||
{
|
||||
// No Memory
|
||||
case 0: // SWSH trades don't set HT memories immediately, which is hilarious.
|
||||
data.AddLine(Get(LMemoryMissingOT, memoryGen == 8 ? Severity.Fishy : Severity.Invalid));
|
||||
data.AddLine(Get(LMemoryMissingOT, context == Gen8 ? Severity.Fishy : Severity.Invalid));
|
||||
VerifyOTMemoryIs(data, 0, 0, 0, 0);
|
||||
return;
|
||||
|
||||
@@ -243,42 +244,39 @@ private void VerifyOTMemory(LegalityAnalysis data)
|
||||
return;
|
||||
|
||||
// {0} went to the Pokémon Center in {2} with {1} and had its tired body healed there. {4} that {3}.
|
||||
case 6 when !context.HasPokeCenter((GameVersion)pk.Version, mem.OT_TextVar):
|
||||
case 6 when !mc.HasPokeCenter((GameVersion)pk.Version, mem.OT_TextVar):
|
||||
data.AddLine(GetInvalid(string.Format(LMemoryArgBadLocation, L_XOT)));
|
||||
return;
|
||||
|
||||
// {0} was with {1} when {1} caught {2}. {4} that {3}.
|
||||
case 14:
|
||||
var result = GetCanBeCaptured(mem.OT_TextVar, Info.Generation, (GameVersion)pk.Version) // Any Game in the Handling Trainer's generation
|
||||
var result = GetCanBeCaptured(mem.OT_TextVar, context, (GameVersion)pk.Version) // Any Game in the Handling Trainer's generation
|
||||
? GetValid(string.Format(LMemoryArgSpecies, L_XOT))
|
||||
: GetInvalid(string.Format(LMemoryArgBadSpecies, L_XOT));
|
||||
data.AddLine(result);
|
||||
return;
|
||||
}
|
||||
|
||||
data.AddLine(VerifyCommonMemory(pk, 0, Info.Generation, Info, context));
|
||||
data.AddLine(VerifyCommonMemory(pk, 0, context, Info, mc));
|
||||
}
|
||||
|
||||
private static bool CanHaveMemoryForOT(PKM pk, int origin, int memory, EvolutionHistory evos)
|
||||
private static bool CanHaveMemoryForOT(PKM pk, EntityContext origin, int memory)
|
||||
{
|
||||
switch (origin)
|
||||
// Eggs cannot have memories
|
||||
if (pk.IsEgg)
|
||||
{
|
||||
// Bank Memories only: Gen7 does not set memories.
|
||||
case 1 or 2 or 7 when memory != 4: // VC transfers
|
||||
|
||||
// Memories don't exist
|
||||
case 7 when pk.GG: // LGPE does not set memories.
|
||||
case 8 when pk.GO_HOME: // HOME does not set memories.
|
||||
case 8 when pk.Met_Location == Locations.HOME8: // HOME does not set memories.
|
||||
case 8 when pk.BDSP && !evos.HasVisitedSWSH: // BDSP does not set memories.
|
||||
case 8 when pk.LA && !evos.HasVisitedSWSH: // LA does not set memories.
|
||||
return false;
|
||||
|
||||
// Eggs cannot have memories
|
||||
// Cannot have memories if the OT was from a generation prior to Gen6.
|
||||
default:
|
||||
return origin >= 6 && !pk.IsEgg;
|
||||
if (origin == Gen8) // Gen8 sets for traded eggs.
|
||||
return pk.IsTradedEgg;
|
||||
return false;
|
||||
}
|
||||
|
||||
return origin switch
|
||||
{
|
||||
Gen1 or Gen2 or Gen7 => memory == 4, // VC transfers can only have Bank memory.
|
||||
Gen6 => true,
|
||||
Gen8 => !(pk.GO_HOME || pk.Met_Location == Locations.HOME8), // HOME does not set memories.
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
private void VerifyHTMemory(LegalityAnalysis data)
|
||||
@@ -309,7 +307,7 @@ private void VerifyHTMemory(LegalityAnalysis data)
|
||||
return;
|
||||
}
|
||||
|
||||
var memoryGen = pk.Format >= 8 ? 8 : 6;
|
||||
var memoryGen = pk.Format >= 8 ? Gen8 : Gen6;
|
||||
|
||||
// Bounds checking
|
||||
var context = Memories.GetContext(memoryGen);
|
||||
@@ -321,7 +319,7 @@ private void VerifyHTMemory(LegalityAnalysis data)
|
||||
{
|
||||
// No Memory
|
||||
case 0: // SWSH memory application has an off-by-one error: [0,99] + 1 <= chance --> don't apply
|
||||
data.AddLine(Get(LMemoryMissingHT, memoryGen == 8 ? ParseSettings.Gen8MemoryMissingHT : Severity.Invalid));
|
||||
data.AddLine(Get(LMemoryMissingHT, memoryGen == Gen8 ? ParseSettings.Gen8MemoryMissingHT : Severity.Invalid));
|
||||
VerifyHTMemoryNone(data, mem);
|
||||
return;
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static PKHeX.Core.Move;
|
||||
using static PKHeX.Core.EntityContext;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Overall information about Moves
|
||||
/// </summary>
|
||||
public static class MoveInfo
|
||||
{
|
||||
/// <summary>
|
||||
@@ -13,7 +16,7 @@ public static class MoveInfo
|
||||
/// <param name="context">Game context</param>
|
||||
/// <param name="move">Move ID</param>
|
||||
/// <returns>Amount of PP the move has by default (no PP Ups).</returns>
|
||||
public static byte GetPP(EntityContext context, int move)
|
||||
public static byte GetPP(EntityContext context, ushort move)
|
||||
{
|
||||
var table = GetPPTable(context);
|
||||
if ((uint)move >= table.Length)
|
||||
@@ -21,8 +24,9 @@ public static byte GetPP(EntityContext context, int move)
|
||||
return table[move];
|
||||
}
|
||||
|
||||
public static ReadOnlySpan<byte> GetPPTable(PKM pk) => GetPPTable(pk.Context);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the move PP table for the <see cref="context"/>.
|
||||
/// </summary>
|
||||
public static ReadOnlySpan<byte> GetPPTable(EntityContext context) => context switch
|
||||
{
|
||||
Gen1 => MoveInfo1.MovePP_RBY,
|
||||
@@ -40,96 +44,67 @@ public static byte GetPP(EntityContext context, int move)
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(context)),
|
||||
};
|
||||
|
||||
public static ICollection<int> GetDummiedMovesHashSet(EntityContext context) => context switch
|
||||
/// <summary>
|
||||
/// Gets a collection that can be used to check if a move cannot be used in battle.
|
||||
/// </summary>
|
||||
public static ICollection<ushort> GetDummiedMovesHashSet(EntityContext context) => context switch
|
||||
{
|
||||
Gen8 => MoveInfo8.DummiedMoves_SWSH,
|
||||
Gen8a => MoveInfo8a.DummiedMoves_LA,
|
||||
Gen8b => MoveInfo8b.DummiedMoves_BDSP,
|
||||
_ => Array.Empty<int>(),
|
||||
_ => Array.Empty<ushort>(),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Generation 7 Z Moves
|
||||
/// Checks if the move is a Z-move.
|
||||
/// </summary>
|
||||
public static readonly HashSet<int> Z_Moves = new()
|
||||
public static bool IsMoveZ(ushort move) => move switch
|
||||
{
|
||||
(int)BreakneckBlitzP,
|
||||
(int)BreakneckBlitzS,
|
||||
(int)AllOutPummelingP,
|
||||
(int)AllOutPummelingS,
|
||||
(int)SupersonicSkystrikeP,
|
||||
(int)SupersonicSkystrikeS,
|
||||
(int)AcidDownpourP,
|
||||
(int)AcidDownpourS,
|
||||
(int)TectonicRageP,
|
||||
(int)TectonicRageS,
|
||||
(int)ContinentalCrushP,
|
||||
(int)ContinentalCrushS,
|
||||
(int)SavageSpinOutP,
|
||||
(int)SavageSpinOutS,
|
||||
(int)NeverEndingNightmareP,
|
||||
(int)NeverEndingNightmareS,
|
||||
(int)CorkscrewCrashP,
|
||||
(int)CorkscrewCrashS,
|
||||
(int)InfernoOverdriveP,
|
||||
(int)InfernoOverdriveS,
|
||||
(int)HydroVortexP,
|
||||
(int)HydroVortexS,
|
||||
(int)BloomDoomP,
|
||||
(int)BloomDoomS,
|
||||
(int)GigavoltHavocP,
|
||||
(int)GigavoltHavocS,
|
||||
(int)ShatteredPsycheP,
|
||||
(int)ShatteredPsycheS,
|
||||
(int)SubzeroSlammerP,
|
||||
(int)SubzeroSlammerS,
|
||||
(int)DevastatingDrakeP,
|
||||
(int)DevastatingDrakeS,
|
||||
(int)BlackHoleEclipseP,
|
||||
(int)BlackHoleEclipseS,
|
||||
(int)TwinkleTackleP,
|
||||
(int)TwinkleTackleS,
|
||||
|
||||
(int)Catastropika,
|
||||
(int)SinisterArrowRaid,
|
||||
(int)MaliciousMoonsault,
|
||||
(int)OceanicOperetta,
|
||||
(int)GuardianofAlola,
|
||||
(int)SoulStealing7StarStrike,
|
||||
(int)StokedSparksurfer,
|
||||
(int)PulverizingPancake,
|
||||
(int)ExtremeEvoboost,
|
||||
(int)GenesisSupernova,
|
||||
(int)TenMVoltThunderbolt,
|
||||
(int)LightThatBurnstheSky,
|
||||
(int)SearingSunrazeSmash,
|
||||
(int)MenacingMoonrazeMaelstrom,
|
||||
(int)LetsSnuggleForever,
|
||||
(int)SplinteredStormshards,
|
||||
(int)ClangorousSoulblaze,
|
||||
>= (int)BreakneckBlitzP and <= (int)Catastropika => true, // [622-658]
|
||||
>= (int)SinisterArrowRaid and <= (int)GenesisSupernova => true, // [695-703]
|
||||
(int)TenMVoltThunderbolt => true, // [719]
|
||||
>= (int)LightThatBurnstheSky and <= (int)ClangorousSoulblaze => true, // [723-728]
|
||||
_ => false,
|
||||
};
|
||||
|
||||
public static bool IsDynamaxMove(int move) => move is (>= (int)MaxFlare and <= (int)MaxSteelspike);
|
||||
/// <summary>
|
||||
/// Checks if the move is a Dynamax-only move.
|
||||
/// </summary>
|
||||
public static bool IsMoveDynamax(ushort move) => move is (>= (int)MaxFlare and <= (int)MaxSteelspike);
|
||||
|
||||
/// <summary>
|
||||
/// Moves that can not be obtained by using Sketch with Smeargle in any game.
|
||||
/// Checks if the move can be known by anything in any context.
|
||||
/// </summary>
|
||||
internal static readonly HashSet<int> InvalidSketch = new(Z_Moves)
|
||||
/// <remarks> Assumes the move ID is within [0,max]. </remarks>
|
||||
public static bool IsMoveKnowable(ushort move) => !IsMoveZ(move) && !IsMoveDynamax(move);
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the move can be sketched in any game.
|
||||
/// </summary>
|
||||
public static bool IsMoveSketch(ushort move) => move switch
|
||||
{
|
||||
// Can't Sketch
|
||||
(int)Struggle,
|
||||
(int)Chatter,
|
||||
(int)Struggle => false,
|
||||
(int)Chatter => false,
|
||||
|
||||
// Unreleased
|
||||
(int)LightofRuin,
|
||||
(int)LightofRuin => false,
|
||||
|
||||
_ => IsMoveKnowable(move),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the <see cref="move"/> is unable to be used in battle.
|
||||
/// </summary>
|
||||
public static bool IsDummiedMove(PKM pk, ushort move)
|
||||
{
|
||||
var hashSet = GetDummiedMovesHashSet(pk.Context);
|
||||
return hashSet.Contains(move);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if any Move in the currently known moves is an unusable move (yellow triangle).
|
||||
/// </summary>
|
||||
public static bool IsDummiedMoveAny(PKM pk)
|
||||
{
|
||||
var hs = GetDummiedMovesHashSet(pk.Context);
|
||||
@@ -144,4 +119,43 @@ public static bool IsDummiedMoveAny(PKM pk)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if Sketch can obtain the <see cref="move"/> in the requested <see cref="context"/>
|
||||
/// </summary>
|
||||
/// <param name="move">Move ID</param>
|
||||
/// <param name="context">Generation to check</param>
|
||||
/// <returns>True if can be sketched, false if not available.</returns>
|
||||
public static bool IsValidSketch(ushort move, EntityContext context)
|
||||
{
|
||||
if (!IsMoveSketch(move))
|
||||
return false;
|
||||
if (context is Gen6 && move is ((int)ThousandArrows or (int)ThousandWaves))
|
||||
return false;
|
||||
if (context is Gen8b) // can't Sketch unusable moves in BDSP, no Sketch in PLA
|
||||
{
|
||||
if (MoveInfo8b.DummiedMoves_BDSP.Contains(move))
|
||||
return false;
|
||||
if (move > Legal.MaxMoveID_8)
|
||||
return false;
|
||||
}
|
||||
|
||||
return move <= GetMaxMoveID(context);
|
||||
}
|
||||
|
||||
private static int GetMaxMoveID(EntityContext context) => context switch
|
||||
{
|
||||
Gen1 => Legal.MaxMoveID_1,
|
||||
Gen2 => Legal.MaxMoveID_2,
|
||||
Gen3 => Legal.MaxMoveID_3,
|
||||
Gen4 => Legal.MaxMoveID_4,
|
||||
Gen5 => Legal.MaxMoveID_5,
|
||||
Gen6 => Legal.MaxMoveID_6_AO,
|
||||
Gen7 => Legal.MaxMoveID_7_USUM,
|
||||
Gen7b => Legal.MaxMoveID_7b,
|
||||
Gen8 => Legal.MaxMoveID_8a,
|
||||
Gen8a => Legal.MaxMoveID_8a,
|
||||
Gen8b => Legal.MaxMoveID_8b,
|
||||
_ => -1,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
namespace PKHeX.Core;
|
||||
namespace PKHeX.Core;
|
||||
|
||||
public static class MoveInfo1
|
||||
/// <summary>
|
||||
/// Details about moves in <see cref="EntityContext.Gen1"/>
|
||||
/// </summary>
|
||||
internal static class MoveInfo1
|
||||
{
|
||||
internal static readonly byte[] MovePP_RBY =
|
||||
public static readonly byte[] MovePP_RBY =
|
||||
{
|
||||
0,
|
||||
35, 25, 10, 15, 20, 20, 15, 15, 15, 35, 30, 05, 10, 30, 30, 35, 35, 20, 15, 20, 20, 10, 20, 30, 05, 25, 15, 15, 15, 25, 20, 05, 35, 15, 20, 20, 20, 15, 30, 35, 20, 20, 30, 25, 40, 20, 15, 20, 20, 20,
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
namespace PKHeX.Core;
|
||||
namespace PKHeX.Core;
|
||||
|
||||
public static class MoveInfo2
|
||||
/// <summary>
|
||||
/// Details about moves in <see cref="EntityContext.Gen2"/>
|
||||
/// </summary>
|
||||
internal static class MoveInfo2
|
||||
{
|
||||
internal static readonly byte[] MovePP_GSC =
|
||||
public static readonly byte[] MovePP_GSC =
|
||||
{
|
||||
00,
|
||||
35, 25, 10, 15, 20, 20, 15, 15, 15, 35, 30, 05, 10, 30, 30, 35, 35, 20, 15, 20, 20, 10, 20, 30, 05, 25, 15, 15, 15, 25, 20, 05, 35, 15, 20, 20, 20, 15, 30, 35, 20, 20, 30, 25, 40, 20, 15, 20, 20, 20,
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
namespace PKHeX.Core;
|
||||
namespace PKHeX.Core;
|
||||
|
||||
public static class MoveInfo3
|
||||
/// <summary>
|
||||
/// Details about moves in <see cref="EntityContext.Gen3"/>
|
||||
/// </summary>
|
||||
internal static class MoveInfo3
|
||||
{
|
||||
internal static readonly byte[] MovePP_RS =
|
||||
public static readonly byte[] MovePP_RS =
|
||||
{
|
||||
00,
|
||||
35, 25, 10, 15, 20, 20, 15, 15, 15, 35, 30, 05, 10, 30, 30, 35, 35, 20, 15, 20, 20, 10, 20, 30, 05, 25, 15, 15, 15, 25, 20, 05, 35, 15, 20, 20, 20, 15, 30, 35, 20, 20, 30, 25, 40, 20, 15, 20, 20, 20,
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
namespace PKHeX.Core;
|
||||
namespace PKHeX.Core;
|
||||
|
||||
public static class MoveInfo4
|
||||
/// <summary>
|
||||
/// Details about moves in <see cref="EntityContext.Gen4"/>
|
||||
/// </summary>
|
||||
internal static class MoveInfo4
|
||||
{
|
||||
internal static readonly byte[] MovePP_DP =
|
||||
public static readonly byte[] MovePP_DP =
|
||||
{
|
||||
00,
|
||||
35, 25, 10, 15, 20, 20, 15, 15, 15, 35, 30, 05, 10, 30, 30, 35, 35, 20, 15, 20, 20, 15, 20, 30, 05, 25, 15, 15, 15, 25, 20, 05, 35, 15, 20, 20, 20, 15, 30, 35, 20, 20, 30, 25, 40, 20, 15, 20, 20, 20,
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
namespace PKHeX.Core;
|
||||
|
||||
public static class MoveInfo5
|
||||
/// <summary>
|
||||
/// Details about moves in <see cref="EntityContext.Gen5"/>
|
||||
/// </summary>
|
||||
internal static class MoveInfo5
|
||||
{
|
||||
internal static readonly byte[] MovePP_BW =
|
||||
public static readonly byte[] MovePP_BW =
|
||||
{
|
||||
00,
|
||||
35, 25, 10, 15, 20, 20, 15, 15, 15, 35, 30, 05, 10, 30, 30, 35, 35, 20, 15, 20, 20, 15, 20, 30, 05, 10, 15, 15, 15, 25, 20, 05, 35, 15, 20, 20, 10, 15, 30, 35, 20, 20, 30, 25, 40, 20, 15, 20, 20, 20,
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
namespace PKHeX.Core;
|
||||
|
||||
public static class MoveInfo6
|
||||
/// <summary>
|
||||
/// Details about moves in <see cref="EntityContext.Gen6"/>
|
||||
/// </summary>
|
||||
internal static class MoveInfo6
|
||||
{
|
||||
internal static readonly byte[] MovePP =
|
||||
public static readonly byte[] MovePP =
|
||||
{
|
||||
00,
|
||||
35, 25, 10, 15, 20, 20, 15, 15, 15, 35, 30, 05, 10, 20, 30, 35, 35, 20, 15, 20, 20, 25, 20, 30, 05, 10, 15, 15, 15, 25, 20, 05, 35, 15, 20, 20, 10, 15, 30, 35, 20, 20, 30, 25, 40, 20, 15, 20, 20, 20,
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
namespace PKHeX.Core;
|
||||
namespace PKHeX.Core;
|
||||
|
||||
public static class MoveInfo7
|
||||
/// <summary>
|
||||
/// Details about moves in <see cref="EntityContext.Gen7"/>
|
||||
/// </summary>
|
||||
internal static class MoveInfo7
|
||||
{
|
||||
internal static readonly byte[] MovePP_SM =
|
||||
public static readonly byte[] MovePP_SM =
|
||||
{
|
||||
00,
|
||||
35, 25, 10, 15, 20, 20, 15, 15, 15, 35, 30, 05, 10, 20, 30, 35, 35, 20, 15, 20, 20, 25, 20, 30, 05, 10, 15, 15, 15, 25, 20, 05, 35, 15, 20, 20, 10, 15, 30, 35, 20, 20, 30, 25, 40, 20, 15, 20, 20, 20,
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
namespace PKHeX.Core;
|
||||
namespace PKHeX.Core;
|
||||
|
||||
public static class MoveInfo7b
|
||||
/// <summary>
|
||||
/// Details about moves in <see cref="EntityContext.Gen7b"/>
|
||||
/// </summary>
|
||||
internal static class MoveInfo7b
|
||||
{
|
||||
internal static readonly byte[] MovePP_GG =
|
||||
public static readonly byte[] MovePP_GG =
|
||||
{
|
||||
// Absorb: 25 -> 15 (damage buffed from 20->40)
|
||||
// Mega Drain: 15 -> 10 (damage buffed from 40->75)
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
||||
public static class MoveInfo8
|
||||
/// <summary>
|
||||
/// Details about moves in <see cref="EntityContext.Gen8"/>
|
||||
/// </summary>
|
||||
internal static class MoveInfo8
|
||||
{
|
||||
internal static readonly byte[] MovePP_SWSH =
|
||||
public static readonly byte[] MovePP_SWSH =
|
||||
{
|
||||
00,
|
||||
35, 25, 10, 15, 20, 20, 15, 15, 15, 35, 30, 05, 10, 20, 30, 35, 35, 20, 15, 20, 20, 25, 20, 30, 05, 10, 15, 15, 15, 25, 20, 05, 35, 15, 20, 20, 10, 15, 30, 35, 20, 20, 30, 25, 40, 20, 15, 20, 20, 20,
|
||||
@@ -29,7 +32,7 @@ public static class MoveInfo8
|
||||
/// <summary>
|
||||
/// Moves that are kill
|
||||
/// </summary>
|
||||
public static readonly HashSet<int> DummiedMoves_SWSH = new()
|
||||
public static readonly HashSet<ushort> DummiedMoves_SWSH = new()
|
||||
{
|
||||
002, 003, 004, 013, 026, 027, 041, 049, 082, 096,
|
||||
099, 112, 117, 119, 121, 125, 128, 131, 132, 134,
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
||||
public static class MoveInfo8a
|
||||
/// <summary>
|
||||
/// Details about moves in <see cref="EntityContext.Gen8a"/>
|
||||
/// </summary>
|
||||
internal static class MoveInfo8a
|
||||
{
|
||||
internal static readonly byte[] MovePP_LA =
|
||||
public static readonly byte[] MovePP_LA =
|
||||
{
|
||||
00,
|
||||
35, 25, 10, 15, 20, 20, 10, 10, 10, 35, 30, 05, 10, 20, 30, 25, 35, 20, 15, 20, 20, 25, 20, 30, 05, 10, 15, 15, 15, 25, 20, 05, 30, 15, 20, 20, 10, 05, 30, 20, 20, 20, 30, 20, 40, 20, 15, 20, 20, 20,
|
||||
@@ -29,7 +32,7 @@ public static class MoveInfo8a
|
||||
/// <summary>
|
||||
/// Moves that are kill
|
||||
/// </summary>
|
||||
public static readonly HashSet<int> DummiedMoves_LA = new()
|
||||
public static readonly HashSet<ushort> DummiedMoves_LA = new()
|
||||
{
|
||||
001, 002, 003, 004, 005, 006, 010, 011, 012, 013,
|
||||
015, 017, 018, 019, 020, 021, 022, 023, 024, 025,
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
||||
public static class MoveInfo8b
|
||||
/// <summary>
|
||||
/// Details about moves in <see cref="EntityContext.Gen8b"/>
|
||||
/// </summary>
|
||||
internal static class MoveInfo8b
|
||||
{
|
||||
/// <summary>
|
||||
/// Moves that are kill
|
||||
/// </summary>
|
||||
public static readonly HashSet<int> DummiedMoves_BDSP = new()
|
||||
public static readonly HashSet<ushort> DummiedMoves_BDSP = new()
|
||||
{
|
||||
002, 003, 004, 013, 026, 027, 041, 049, 082, 096,
|
||||
099, 112, 117, 119, 121, 125, 128, 131, 132, 140,
|
||||
|
||||
@@ -525,9 +525,9 @@ private void SetIVs(PKM pk)
|
||||
{
|
||||
Span<int> finalIVs = stackalloc int[6];
|
||||
GetIVs(finalIVs);
|
||||
var ivflag = finalIVs.Find(iv => (byte)(iv - 0xFC) < 3);
|
||||
var ivflag = finalIVs.Find(static iv => (byte)(iv - 0xFC) < 3);
|
||||
var rng = Util.Rand;
|
||||
if (ivflag == 0) // Random IVs
|
||||
if (ivflag == default) // Random IVs
|
||||
{
|
||||
for (int i = 0; i < finalIVs.Length; i++)
|
||||
{
|
||||
|
||||
@@ -850,7 +850,7 @@ protected void SetLinkTradeEgg(int day, int month, int y, int location)
|
||||
/// </summary>
|
||||
/// <param name="move">Move ID</param>
|
||||
/// <returns>Amount of PP the move has by default (no PP Ups).</returns>
|
||||
private int GetBasePP(int move) => MoveInfo.GetPP(Context, move);
|
||||
private int GetBasePP(int move) => MoveInfo.GetPP(Context, (ushort)move);
|
||||
|
||||
/// <summary>
|
||||
/// Applies a shiny <see cref="PID"/> to the <see cref="PKM"/>.
|
||||
|
||||
@@ -360,7 +360,7 @@ public void UpdateLegality(LegalityAnalysis? la = null, bool skipMoveRepop = fal
|
||||
{
|
||||
if (isIllegal)
|
||||
return Resources.warn;
|
||||
if (pk.Format >= 8 && MoveInfo.GetDummiedMovesHashSet(pk.Context).Contains(pk.GetMove(index)))
|
||||
if (pk.Format >= 8 && MoveInfo.GetDummiedMovesHashSet(pk.Context).Contains((ushort)pk.GetMove(index)))
|
||||
return Resources.hint;
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user