2017-01-04 04:51:33 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2016-02-23 06:52:48 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
2017-01-08 07:54:09 +00:00
|
|
|
|
namespace PKHeX.Core
|
2016-02-23 06:52:48 +00:00
|
|
|
|
{
|
|
|
|
|
public static partial class Legal
|
|
|
|
|
{
|
2017-02-11 23:20:44 +00:00
|
|
|
|
// Gen 1
|
PKHeX.Core Nullable cleanup (#2401)
* Handle some nullable cases
Refactor MysteryGift into a second abstract class (backed by a byte array, or fake data)
Make some classes have explicit constructors instead of { } initialization
* Handle bits more obviously without null
* Make SaveFile.BAK explicitly readonly again
* merge constructor methods to have readonly fields
* Inline some properties
* More nullable handling
* Rearrange box actions
define straightforward classes to not have any null properties
* Make extrabyte reference array immutable
* Move tooltip creation to designer
* Rearrange some logic to reduce nesting
* Cache generated fonts
* Split mystery gift album purpose
* Handle more tooltips
* Disallow null setters
* Don't capture RNG object, only type enum
* Unify learnset objects
Now have readonly properties which are never null
don't new() empty learnsets (>800 Learnset objects no longer created,
total of 2400 objects since we also new() a move & level array)
optimize g1/2 reader for early abort case
* Access rewrite
Initialize blocks in a separate object, and get via that object
removes a couple hundred "might be null" warnings since blocks are now readonly getters
some block references have been relocated, but interfaces should expose all that's needed
put HoF6 controls in a groupbox, and disable
* Readonly personal data
* IVs non nullable for mystery gift
* Explicitly initialize forced encounter moves
* Make shadow objects readonly & non-null
Put murkrow fix in binary data resource, instead of on startup
* Assign dex form fetch on constructor
Fixes legality parsing edge cases
also handle cxd parse for valid; exit before exception is thrown in FrameGenerator
* Remove unnecessary null checks
* Keep empty value until init
SetPouch sets the value to an actual one during load, but whatever
* Readonly team lock data
* Readonly locks
Put locked encounters at bottom (favor unlocked)
* Mail readonly data / offset
Rearrange some call flow and pass defaults
Add fake classes for SaveDataEditor mocking
Always party size, no need to check twice in stat editor
use a fake save file as initial data for savedata editor, and for
gamedata (wow i found a usage)
constrain eventwork editor to struct variable types (uint, int, etc),
thus preventing null assignment errors
2019-10-17 01:47:31 +00:00
|
|
|
|
internal static readonly Learnset[] LevelUpRB = LearnsetReader.GetArray(Util.GetBinaryResource("lvlmove_rb.pkl"), MaxSpeciesID_1);
|
|
|
|
|
internal static readonly Learnset[] LevelUpY = LearnsetReader.GetArray(Util.GetBinaryResource("lvlmove_y.pkl"), MaxSpeciesID_1);
|
2017-02-11 23:20:44 +00:00
|
|
|
|
|
2017-02-25 20:37:01 +00:00
|
|
|
|
// Gen 2
|
2018-03-30 08:02:22 +00:00
|
|
|
|
internal static readonly EggMoves[] EggMovesGS = EggMoves2.GetArray(Util.GetBinaryResource("eggmove_gs.pkl"), MaxSpeciesID_2);
|
PKHeX.Core Nullable cleanup (#2401)
* Handle some nullable cases
Refactor MysteryGift into a second abstract class (backed by a byte array, or fake data)
Make some classes have explicit constructors instead of { } initialization
* Handle bits more obviously without null
* Make SaveFile.BAK explicitly readonly again
* merge constructor methods to have readonly fields
* Inline some properties
* More nullable handling
* Rearrange box actions
define straightforward classes to not have any null properties
* Make extrabyte reference array immutable
* Move tooltip creation to designer
* Rearrange some logic to reduce nesting
* Cache generated fonts
* Split mystery gift album purpose
* Handle more tooltips
* Disallow null setters
* Don't capture RNG object, only type enum
* Unify learnset objects
Now have readonly properties which are never null
don't new() empty learnsets (>800 Learnset objects no longer created,
total of 2400 objects since we also new() a move & level array)
optimize g1/2 reader for early abort case
* Access rewrite
Initialize blocks in a separate object, and get via that object
removes a couple hundred "might be null" warnings since blocks are now readonly getters
some block references have been relocated, but interfaces should expose all that's needed
put HoF6 controls in a groupbox, and disable
* Readonly personal data
* IVs non nullable for mystery gift
* Explicitly initialize forced encounter moves
* Make shadow objects readonly & non-null
Put murkrow fix in binary data resource, instead of on startup
* Assign dex form fetch on constructor
Fixes legality parsing edge cases
also handle cxd parse for valid; exit before exception is thrown in FrameGenerator
* Remove unnecessary null checks
* Keep empty value until init
SetPouch sets the value to an actual one during load, but whatever
* Readonly team lock data
* Readonly locks
Put locked encounters at bottom (favor unlocked)
* Mail readonly data / offset
Rearrange some call flow and pass defaults
Add fake classes for SaveDataEditor mocking
Always party size, no need to check twice in stat editor
use a fake save file as initial data for savedata editor, and for
gamedata (wow i found a usage)
constrain eventwork editor to struct variable types (uint, int, etc),
thus preventing null assignment errors
2019-10-17 01:47:31 +00:00
|
|
|
|
internal static readonly Learnset[] LevelUpGS = LearnsetReader.GetArray(Util.GetBinaryResource("lvlmove_gs.pkl"), MaxSpeciesID_2);
|
2018-03-30 08:02:22 +00:00
|
|
|
|
internal static readonly EggMoves[] EggMovesC = EggMoves2.GetArray(Util.GetBinaryResource("eggmove_c.pkl"), MaxSpeciesID_2);
|
PKHeX.Core Nullable cleanup (#2401)
* Handle some nullable cases
Refactor MysteryGift into a second abstract class (backed by a byte array, or fake data)
Make some classes have explicit constructors instead of { } initialization
* Handle bits more obviously without null
* Make SaveFile.BAK explicitly readonly again
* merge constructor methods to have readonly fields
* Inline some properties
* More nullable handling
* Rearrange box actions
define straightforward classes to not have any null properties
* Make extrabyte reference array immutable
* Move tooltip creation to designer
* Rearrange some logic to reduce nesting
* Cache generated fonts
* Split mystery gift album purpose
* Handle more tooltips
* Disallow null setters
* Don't capture RNG object, only type enum
* Unify learnset objects
Now have readonly properties which are never null
don't new() empty learnsets (>800 Learnset objects no longer created,
total of 2400 objects since we also new() a move & level array)
optimize g1/2 reader for early abort case
* Access rewrite
Initialize blocks in a separate object, and get via that object
removes a couple hundred "might be null" warnings since blocks are now readonly getters
some block references have been relocated, but interfaces should expose all that's needed
put HoF6 controls in a groupbox, and disable
* Readonly personal data
* IVs non nullable for mystery gift
* Explicitly initialize forced encounter moves
* Make shadow objects readonly & non-null
Put murkrow fix in binary data resource, instead of on startup
* Assign dex form fetch on constructor
Fixes legality parsing edge cases
also handle cxd parse for valid; exit before exception is thrown in FrameGenerator
* Remove unnecessary null checks
* Keep empty value until init
SetPouch sets the value to an actual one during load, but whatever
* Readonly team lock data
* Readonly locks
Put locked encounters at bottom (favor unlocked)
* Mail readonly data / offset
Rearrange some call flow and pass defaults
Add fake classes for SaveDataEditor mocking
Always party size, no need to check twice in stat editor
use a fake save file as initial data for savedata editor, and for
gamedata (wow i found a usage)
constrain eventwork editor to struct variable types (uint, int, etc),
thus preventing null assignment errors
2019-10-17 01:47:31 +00:00
|
|
|
|
internal static readonly Learnset[] LevelUpC = LearnsetReader.GetArray(Util.GetBinaryResource("lvlmove_c.pkl"), MaxSpeciesID_2);
|
2017-02-25 20:37:01 +00:00
|
|
|
|
|
2017-03-18 23:50:34 +00:00
|
|
|
|
// Gen 3
|
2020-03-20 22:18:59 +00:00
|
|
|
|
internal static readonly Learnset[] LevelUpE = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_e.pkl"), "em"));
|
|
|
|
|
internal static readonly Learnset[] LevelUpRS = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_rs.pkl"), "rs"));
|
|
|
|
|
internal static readonly Learnset[] LevelUpFR = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_fr.pkl"), "fr"));
|
|
|
|
|
internal static readonly Learnset[] LevelUpLG = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_lg.pkl"), "lg"));
|
|
|
|
|
internal static readonly EggMoves6[] EggMovesRS = EggMoves6.GetArray(BinLinker.Unpack(Util.GetBinaryResource("eggmove_rs.pkl"), "rs"));
|
2017-03-18 23:50:34 +00:00
|
|
|
|
|
|
|
|
|
// Gen 4
|
2020-03-20 22:18:59 +00:00
|
|
|
|
internal static readonly Learnset[] LevelUpDP = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_dp.pkl"), "dp"));
|
|
|
|
|
internal static readonly Learnset[] LevelUpPt = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_pt.pkl"), "pt"));
|
|
|
|
|
internal static readonly Learnset[] LevelUpHGSS = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_hgss.pkl"), "hs"));
|
|
|
|
|
internal static readonly EggMoves6[] EggMovesDPPt = EggMoves6.GetArray(BinLinker.Unpack(Util.GetBinaryResource("eggmove_dppt.pkl"), "dp"));
|
|
|
|
|
internal static readonly EggMoves6[] EggMovesHGSS = EggMoves6.GetArray(BinLinker.Unpack(Util.GetBinaryResource("eggmove_hgss.pkl"), "hs"));
|
2017-03-18 23:50:34 +00:00
|
|
|
|
|
|
|
|
|
// Gen 5
|
2020-03-20 22:18:59 +00:00
|
|
|
|
internal static readonly Learnset[] LevelUpBW = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_bw.pkl"), "51"));
|
|
|
|
|
internal static readonly Learnset[] LevelUpB2W2 = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_b2w2.pkl"), "52"));
|
|
|
|
|
internal static readonly EggMoves6[] EggMovesBW = EggMoves6.GetArray(BinLinker.Unpack(Util.GetBinaryResource("eggmove_bw.pkl"), "bw"));
|
2017-03-18 23:50:34 +00:00
|
|
|
|
|
2016-10-24 05:03:19 +00:00
|
|
|
|
// Gen 6
|
2020-03-20 22:18:59 +00:00
|
|
|
|
internal static readonly EggMoves6[] EggMovesXY = EggMoves6.GetArray(BinLinker.Unpack(Util.GetBinaryResource("eggmove_xy.pkl"), "xy"));
|
|
|
|
|
internal static readonly Learnset[] LevelUpXY = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_xy.pkl"), "xy"));
|
|
|
|
|
internal static readonly EggMoves6[] EggMovesAO = EggMoves6.GetArray(BinLinker.Unpack(Util.GetBinaryResource("eggmove_ao.pkl"), "ao"));
|
|
|
|
|
internal static readonly Learnset[] LevelUpAO = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_ao.pkl"), "ao"));
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
|
|
|
|
// Gen 7
|
2020-03-20 22:18:59 +00:00
|
|
|
|
internal static readonly EggMoves7[] EggMovesSM = EggMoves7.GetArray(BinLinker.Unpack(Util.GetBinaryResource("eggmove_sm.pkl"), "sm"));
|
|
|
|
|
internal static readonly Learnset[] LevelUpSM = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_sm.pkl"), "sm"));
|
|
|
|
|
internal static readonly EggMoves7[] EggMovesUSUM = EggMoves7.GetArray(BinLinker.Unpack(Util.GetBinaryResource("eggmove_uu.pkl"), "uu"));
|
|
|
|
|
internal static readonly Learnset[] LevelUpUSUM = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_uu.pkl"), "uu"));
|
|
|
|
|
internal static readonly Learnset[] LevelUpGG = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_gg.pkl"), "gg"));
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
2019-09-23 23:56:47 +00:00
|
|
|
|
// Gen 8
|
2020-03-20 22:18:59 +00:00
|
|
|
|
internal static readonly EggMoves7[] EggMovesSWSH = EggMoves7.GetArray(BinLinker.Unpack(Util.GetBinaryResource("eggmove_swsh.pkl"), "ss"));
|
|
|
|
|
internal static readonly Learnset[] LevelUpSWSH = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_swsh.pkl"), "ss"));
|
2019-09-23 23:56:47 +00:00
|
|
|
|
|
2019-04-11 05:05:57 +00:00
|
|
|
|
public static IReadOnlyList<byte> GetPPTable(PKM pkm, int format)
|
2018-11-14 03:10:31 +00:00
|
|
|
|
{
|
2019-04-11 05:05:57 +00:00
|
|
|
|
if (format != 7)
|
|
|
|
|
return GetPPTable(format);
|
2021-01-01 01:45:11 +00:00
|
|
|
|
var lgpe = pkm.Version is (int) GameVersion.GO or (int) GameVersion.GP or (int) GameVersion.GE;
|
|
|
|
|
return lgpe ? MovePP_GG : MovePP_SM;
|
2018-11-14 03:10:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-02 01:08:49 +00:00
|
|
|
|
public static IReadOnlyList<byte> GetPPTable(int format) => format switch
|
|
|
|
|
{
|
|
|
|
|
1 => MovePP_RBY,
|
|
|
|
|
2 => MovePP_GSC,
|
|
|
|
|
3 => MovePP_RS,
|
|
|
|
|
4 => MovePP_DP,
|
|
|
|
|
5 => MovePP_BW,
|
|
|
|
|
6 => MovePP_XY,
|
|
|
|
|
7 => MovePP_SM,
|
|
|
|
|
8 => MovePP_SWSH,
|
|
|
|
|
_ => Array.Empty<byte>()
|
|
|
|
|
};
|
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
internal static int GetMaxSpeciesOrigin(PKM pkm)
|
2017-02-21 03:40:50 +00:00
|
|
|
|
{
|
2018-06-13 01:46:31 +00:00
|
|
|
|
if (pkm.Format == 1)
|
2017-06-18 01:37:19 +00:00
|
|
|
|
return GetMaxSpeciesOrigin(1);
|
2018-06-13 01:46:31 +00:00
|
|
|
|
if (pkm.Format == 2 || pkm.VC)
|
2017-06-18 01:37:19 +00:00
|
|
|
|
return GetMaxSpeciesOrigin(2);
|
2020-12-11 04:42:30 +00:00
|
|
|
|
return GetMaxSpeciesOrigin(pkm.Generation);
|
2017-02-21 03:40:50 +00:00
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2021-01-02 01:08:49 +00:00
|
|
|
|
internal static int GetMaxSpeciesOrigin(int generation) => generation switch
|
|
|
|
|
{
|
|
|
|
|
1 => MaxSpeciesID_1,
|
|
|
|
|
2 => MaxSpeciesID_2,
|
|
|
|
|
3 => MaxSpeciesID_3,
|
|
|
|
|
4 => MaxSpeciesID_4,
|
|
|
|
|
5 => MaxSpeciesID_5,
|
|
|
|
|
6 => MaxSpeciesID_6,
|
|
|
|
|
7 => MaxSpeciesID_7b,
|
|
|
|
|
8 => MaxSpeciesID_8,
|
|
|
|
|
_ => -1
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
internal static int GetDebutGeneration(int species) => species switch
|
|
|
|
|
{
|
|
|
|
|
<= MaxSpeciesID_1 => 1,
|
|
|
|
|
<= MaxSpeciesID_2 => 2,
|
|
|
|
|
<= MaxSpeciesID_3 => 3,
|
|
|
|
|
<= MaxSpeciesID_4 => 4,
|
|
|
|
|
<= MaxSpeciesID_5 => 5,
|
|
|
|
|
<= MaxSpeciesID_6 => 6,
|
|
|
|
|
<= MaxSpeciesID_7b => 7,
|
|
|
|
|
<= MaxSpeciesID_8 => 8,
|
|
|
|
|
_ => -1
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
internal static int GetMaxLanguageID(int generation) => generation switch
|
|
|
|
|
{
|
|
|
|
|
1 => (int) LanguageID.Spanish, // 1-7 except 6
|
|
|
|
|
3 => (int) LanguageID.Spanish, // 1-7 except 6
|
|
|
|
|
2 => (int) LanguageID.Korean,
|
|
|
|
|
4 => (int) LanguageID.Korean,
|
|
|
|
|
5 => (int) LanguageID.Korean,
|
|
|
|
|
6 => (int) LanguageID.Korean,
|
|
|
|
|
7 => (int) LanguageID.ChineseT,
|
|
|
|
|
8 => (int) LanguageID.ChineseT,
|
|
|
|
|
_ => -1
|
|
|
|
|
};
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
internal static bool GetCanLearnMachineMove(PKM pkm, int move, int generation, GameVersion version = GameVersion.Any)
|
2017-02-15 22:33:59 +00:00
|
|
|
|
{
|
2020-12-22 17:10:10 +00:00
|
|
|
|
var evos = EvolutionChain.GetValidPreEvolutions(pkm);
|
|
|
|
|
return MoveList.GetValidMoves(pkm, version, evos, generation, types: MoveSourceType.AllMachines).Contains(move);
|
2017-02-15 22:33:59 +00:00
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2020-07-19 02:57:15 +00:00
|
|
|
|
internal static bool GetCanRelearnMove(PKM pkm, int move, int generation, IReadOnlyList<EvoCriteria> evos, GameVersion version = GameVersion.Any)
|
2016-05-10 01:19:31 +00:00
|
|
|
|
{
|
2020-12-22 17:10:10 +00:00
|
|
|
|
return MoveList.GetValidMoves(pkm, version, evos, generation, types: MoveSourceType.Reminder).Contains(move);
|
2016-05-10 02:24:52 +00:00
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2021-01-04 23:38:30 +00:00
|
|
|
|
internal static bool GetCanKnowMove(PKM pkm, int move, int generation, IReadOnlyList<IReadOnlyList<EvoCriteria>> evos, GameVersion version = GameVersion.Any)
|
2016-05-10 02:24:52 +00:00
|
|
|
|
{
|
2019-12-09 01:39:19 +00:00
|
|
|
|
if (pkm.Species == (int)Species.Smeargle)
|
2019-03-20 05:05:13 +00:00
|
|
|
|
return !InvalidSketch.Contains(move);
|
2020-12-22 00:49:42 +00:00
|
|
|
|
|
|
|
|
|
if (generation >= 8 && MoveEgg.GetIsSharedEggMove(pkm, generation, move))
|
|
|
|
|
return true;
|
|
|
|
|
|
2021-01-04 23:38:30 +00:00
|
|
|
|
if (evos.Count <= generation)
|
|
|
|
|
return false;
|
|
|
|
|
for (int i = 1; i <= generation; i++)
|
|
|
|
|
{
|
|
|
|
|
var moves = MoveList.GetValidMoves(pkm, version, evos[i], i, types: MoveSourceType.All);
|
|
|
|
|
if (moves.Contains(move))
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
2016-02-26 15:52:08 +00:00
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2018-10-06 02:58:30 +00:00
|
|
|
|
internal static bool IsCatchRateHeldItem(int rate) => ParseSettings.AllowGen1Tradeback && HeldItems_GSC.Contains((ushort) rate);
|
2018-07-25 02:33:42 +00:00
|
|
|
|
|
2018-06-09 03:10:41 +00:00
|
|
|
|
internal const GameVersion NONE = GameVersion.Invalid;
|
2020-12-22 01:17:56 +00:00
|
|
|
|
internal static readonly LearnVersion LearnNONE = new(-1);
|
2018-06-09 03:10:41 +00:00
|
|
|
|
|
2020-06-27 19:04:28 +00:00
|
|
|
|
internal static bool HasVisitedB2W2(this PKM pkm, int species) => pkm.InhabitedGeneration(5, species);
|
|
|
|
|
internal static bool HasVisitedORAS(this PKM pkm, int species) => pkm.InhabitedGeneration(6, species) && (pkm.AO || !pkm.IsUntraded);
|
|
|
|
|
internal static bool HasVisitedUSUM(this PKM pkm, int species) => pkm.InhabitedGeneration(7, species) && (pkm.USUM || !pkm.IsUntraded);
|
2021-01-01 01:45:11 +00:00
|
|
|
|
internal static bool IsMovesetRestricted(this PKM pkm, int gen) => (gen == 7 && pkm.Version is (int)GameVersion.GO or (int)GameVersion.GP or (int)GameVersion.GE) || pkm.IsUntraded;
|
2018-06-09 03:10:41 +00:00
|
|
|
|
|
2018-05-26 21:40:02 +00:00
|
|
|
|
public static bool IsValidMissingLanguage(PKM pkm)
|
|
|
|
|
{
|
|
|
|
|
return pkm.Format == 5 && pkm.BW;
|
|
|
|
|
}
|
2018-06-23 16:49:04 +00:00
|
|
|
|
|
2021-01-02 01:08:49 +00:00
|
|
|
|
public static int GetMaxLengthOT(int generation, LanguageID language) => language switch
|
2018-10-27 23:06:06 +00:00
|
|
|
|
{
|
2021-01-02 01:08:49 +00:00
|
|
|
|
LanguageID.ChineseS or LanguageID.ChineseT => 6,
|
|
|
|
|
LanguageID.Japanese or LanguageID.Korean => generation >= 6 ? 6 : 5,
|
|
|
|
|
_ => generation >= 6 ? 12 : 7
|
|
|
|
|
};
|
2018-10-27 23:06:06 +00:00
|
|
|
|
|
2021-01-02 01:08:49 +00:00
|
|
|
|
public static int GetMaxLengthNickname(int generation, LanguageID language) => language switch
|
2018-08-15 21:58:55 +00:00
|
|
|
|
{
|
2021-01-02 01:08:49 +00:00
|
|
|
|
LanguageID.ChineseS or LanguageID.ChineseT => 6,
|
|
|
|
|
LanguageID.Japanese or LanguageID.Korean => generation >= 6 ? 6 : 5,
|
|
|
|
|
_ => generation >= 6 ? 12 : 10
|
|
|
|
|
};
|
2019-01-05 18:51:41 +00:00
|
|
|
|
|
2019-05-15 19:07:48 +00:00
|
|
|
|
public static bool GetIsFixedIVSequenceValidSkipRand(IReadOnlyList<int> IVs, PKM pkm, int max = 31)
|
2019-01-05 18:51:41 +00:00
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 6; i++)
|
|
|
|
|
{
|
|
|
|
|
if ((uint) IVs[i] > max) // random
|
|
|
|
|
continue;
|
|
|
|
|
if (IVs[i] != pkm.GetIV(i))
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool GetIsFixedIVSequenceValidNoRand(IReadOnlyList<int> IVs, PKM pkm)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 6; i++)
|
|
|
|
|
{
|
|
|
|
|
if (IVs[i] != pkm.GetIV(i))
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2016-02-23 06:52:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|