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-06-19 05:27:40 +00:00
|
|
|
|
/// <summary> e-Reader Berry is Enigma or special berry </summary>
|
|
|
|
|
public static bool EReaderBerryIsEnigma { get; set; } = true;
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2017-06-19 05:27:40 +00:00
|
|
|
|
/// <summary> e-Reader Berry Name </summary>
|
|
|
|
|
public static string EReaderBerryName { get; set; } = string.Empty;
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2017-06-19 05:27:40 +00:00
|
|
|
|
/// <summary> e-Reader Berry Name formatted in Title Case </summary>
|
2018-10-05 01:52:00 +00:00
|
|
|
|
public static string EReaderBerryDisplayName => string.Format(LegalityCheckStrings.L_XEnigmaBerry_0, Util.ToTitleCase(EReaderBerryName.ToLower()));
|
2017-06-19 05:27:40 +00:00
|
|
|
|
|
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-07-26 00:42:15 +00:00
|
|
|
|
internal static bool GetCanBeEgg23(PKM pkm)
|
2017-02-28 04:57:24 +00:00
|
|
|
|
{
|
2017-03-26 22:11:09 +00:00
|
|
|
|
if (pkm.IsEgg)
|
2020-07-18 18:06:14 +00:00
|
|
|
|
return IsEvolutionValid(pkm);
|
2017-02-28 04:57:24 +00:00
|
|
|
|
if (pkm.Format > 2 && pkm.Ball != 4)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
int lvl = pkm.CurrentLevel;
|
|
|
|
|
if (lvl < 5)
|
|
|
|
|
return false;
|
|
|
|
|
|
2017-09-04 20:48:10 +00:00
|
|
|
|
if (pkm.Format > 3 && pkm.Met_Level < 5)
|
2017-03-26 22:11:09 +00:00
|
|
|
|
return false;
|
2017-03-27 19:10:30 +00:00
|
|
|
|
if (pkm.Format > 3 && pkm.FatefulEncounter)
|
|
|
|
|
return false;
|
2017-03-26 22:11:09 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
return IsEvolutionValid(pkm);
|
2017-02-28 04:57:24 +00:00
|
|
|
|
}
|
2016-03-23 05:50:54 +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);
|
|
|
|
|
return pkm.GG ? MovePP_GG : MovePP_SM;
|
2018-11-14 03:10:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-11 05:05:57 +00:00
|
|
|
|
public static IReadOnlyList<byte> GetPPTable(int format)
|
2018-10-27 15:53:09 +00:00
|
|
|
|
{
|
2019-10-08 01:40:09 +00:00
|
|
|
|
return format switch
|
2018-10-27 15:53:09 +00:00
|
|
|
|
{
|
2019-10-08 01:40:09 +00:00
|
|
|
|
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>()
|
|
|
|
|
};
|
2018-10-27 15:53:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-05-31 19:12:48 +00:00
|
|
|
|
internal static ICollection<int> GetWildBalls(int gen, GameVersion game)
|
2016-11-08 16:43:57 +00:00
|
|
|
|
{
|
2020-05-31 19:12:48 +00:00
|
|
|
|
return gen switch
|
2016-11-08 16:43:57 +00:00
|
|
|
|
{
|
2019-10-08 01:40:09 +00:00
|
|
|
|
1 => WildPokeBalls1,
|
|
|
|
|
2 => WildPokeBalls2,
|
|
|
|
|
3 => WildPokeBalls3,
|
2020-05-31 19:12:48 +00:00
|
|
|
|
4 => GameVersion.HGSS.Contains(game) ? WildPokeBalls4_HGSS : WildPokeBalls4_DPPt,
|
2019-10-08 01:40:09 +00:00
|
|
|
|
5 => WildPokeBalls5,
|
|
|
|
|
6 => WildPokeballs6,
|
2020-05-31 19:12:48 +00:00
|
|
|
|
7 => GameVersion.GG.Contains(game) ? WildPokeballs7b : WildPokeballs7,
|
2019-10-08 01:40:09 +00:00
|
|
|
|
8 => WildPokeballs8,
|
2020-01-07 01:50:18 +00:00
|
|
|
|
_ => Array.Empty<int>()
|
2019-10-08 01:40:09 +00:00
|
|
|
|
};
|
2017-02-21 03:40:50 +00:00
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2019-01-21 05:55:28 +00:00
|
|
|
|
internal static ICollection<int> GetSplitBreedGeneration(int generation)
|
2017-03-26 13:39:09 +00:00
|
|
|
|
{
|
|
|
|
|
switch (generation)
|
|
|
|
|
{
|
|
|
|
|
case 3: return SplitBreed_3;
|
2019-09-23 23:56:47 +00:00
|
|
|
|
|
2018-06-22 03:13:41 +00:00
|
|
|
|
case 4:
|
|
|
|
|
case 5:
|
|
|
|
|
case 6:
|
2019-09-23 23:56:47 +00:00
|
|
|
|
case 7:
|
|
|
|
|
case 8:
|
|
|
|
|
return SplitBreed;
|
|
|
|
|
|
2019-01-21 05:55:28 +00:00
|
|
|
|
default: return Array.Empty<int>();
|
2017-03-26 13:39:09 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
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);
|
|
|
|
|
return GetMaxSpeciesOrigin(pkm.GenNumber);
|
2017-02-21 03:40:50 +00:00
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
internal static int GetMaxSpeciesOrigin(int generation)
|
2017-02-21 03:40:50 +00:00
|
|
|
|
{
|
2019-10-08 01:40:09 +00:00
|
|
|
|
return generation switch
|
2017-02-21 03:40:50 +00:00
|
|
|
|
{
|
2019-10-08 01:40:09 +00:00
|
|
|
|
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
|
|
|
|
|
};
|
2017-02-21 03:40:50 +00:00
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2019-01-21 05:55:28 +00:00
|
|
|
|
internal static ICollection<int> GetFutureGenEvolutions(int generation)
|
2017-02-21 03:40:50 +00:00
|
|
|
|
{
|
2019-10-08 01:40:09 +00:00
|
|
|
|
return generation switch
|
2017-02-21 03:40:50 +00:00
|
|
|
|
{
|
2019-10-08 01:40:09 +00:00
|
|
|
|
1 => FutureEvolutionsGen1,
|
|
|
|
|
2 => FutureEvolutionsGen2,
|
|
|
|
|
3 => FutureEvolutionsGen3,
|
|
|
|
|
4 => FutureEvolutionsGen4,
|
|
|
|
|
5 => FutureEvolutionsGen5,
|
2020-01-07 01:50:18 +00:00
|
|
|
|
_ => Array.Empty<int>()
|
2019-10-08 01:40:09 +00:00
|
|
|
|
};
|
2017-02-21 03:40:50 +00:00
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2018-01-10 23:40:33 +00:00
|
|
|
|
internal static int GetDebutGeneration(int species)
|
|
|
|
|
{
|
|
|
|
|
if (species <= MaxSpeciesID_1)
|
|
|
|
|
return 1;
|
|
|
|
|
if (species <= MaxSpeciesID_2)
|
|
|
|
|
return 2;
|
|
|
|
|
if (species <= MaxSpeciesID_3)
|
|
|
|
|
return 3;
|
|
|
|
|
if (species <= MaxSpeciesID_4)
|
|
|
|
|
return 4;
|
|
|
|
|
if (species <= MaxSpeciesID_5)
|
|
|
|
|
return 5;
|
|
|
|
|
if (species <= MaxSpeciesID_6)
|
|
|
|
|
return 6;
|
2018-11-14 03:10:31 +00:00
|
|
|
|
if (species <= MaxSpeciesID_7b)
|
2018-01-10 23:40:33 +00:00
|
|
|
|
return 7;
|
2019-09-23 23:56:47 +00:00
|
|
|
|
if (species <= MaxSpeciesID_8)
|
|
|
|
|
return 8;
|
2018-01-10 23:40:33 +00:00
|
|
|
|
return -1;
|
|
|
|
|
}
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
2017-09-16 00:43:31 +00:00
|
|
|
|
internal static int GetMaxLanguageID(int generation)
|
|
|
|
|
{
|
2019-10-08 01:40:09 +00:00
|
|
|
|
return generation switch
|
2017-09-16 00:43:31 +00:00
|
|
|
|
{
|
2019-10-08 01:40:09 +00:00
|
|
|
|
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
|
|
|
|
|
};
|
2017-09-16 00:43:31 +00:00
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2020-04-24 03:53:57 +00:00
|
|
|
|
private static bool IsEvolvedFormChange(PKM pkm, int expected)
|
2017-02-02 05:59:39 +00:00
|
|
|
|
{
|
2017-02-05 21:08:25 +00:00
|
|
|
|
if (pkm.IsEgg)
|
|
|
|
|
return false;
|
|
|
|
|
|
2020-02-21 06:11:48 +00:00
|
|
|
|
if (pkm.Format >= 7 && (AlolanVariantEvolutions12.Contains(pkm.Species) || GalarVariantFormEvolutions.Contains(pkm.Species)))
|
2017-02-02 05:59:39 +00:00
|
|
|
|
return pkm.AltForm == 1;
|
2019-11-16 01:34:18 +00:00
|
|
|
|
if (pkm.Format >= 8)
|
|
|
|
|
{
|
|
|
|
|
if (GalarVariantFormEvolutions.Contains(pkm.Species))
|
|
|
|
|
return pkm.AltForm == 1;
|
|
|
|
|
if (GalarForm0Evolutions.TryGetValue(pkm.Species, out var orig))
|
|
|
|
|
return pkm.AltForm != orig; // bad compare?
|
2020-04-24 03:53:57 +00:00
|
|
|
|
if ((int) Species.Darmanitan == pkm.Species)
|
|
|
|
|
return pkm.AltForm == (expected == 1 ? 2 : 0);
|
2020-06-20 18:38:12 +00:00
|
|
|
|
if ((int) Species.MrMime == pkm.Species)
|
2020-04-24 15:24:12 +00:00
|
|
|
|
return pkm.AltForm == (expected == 0 ? 1 : 0);
|
2020-06-20 18:38:12 +00:00
|
|
|
|
if ((int) Species.Slowbro == pkm.Species)
|
|
|
|
|
return pkm.AltForm == (expected == 1 ? 2 : 0);
|
2019-11-18 06:04:41 +00:00
|
|
|
|
if ((int) Species.Toxtricity == pkm.Species)
|
|
|
|
|
return pkm.AltForm == EvolutionMethod.GetAmpLowKeyResult(pkm.Nature);
|
2019-12-29 02:59:00 +00:00
|
|
|
|
if ((int) Species.Alcremie == pkm.Species)
|
|
|
|
|
return true;
|
2019-11-16 01:34:18 +00:00
|
|
|
|
}
|
2019-11-18 06:04:41 +00:00
|
|
|
|
if ((pkm.Species == (int)Species.Meowstic || pkm.Species == (int)Species.Indeedee) && pkm.Gender == 1)
|
2017-02-02 05:59:39 +00:00
|
|
|
|
return pkm.AltForm == 1;
|
2020-06-27 16:44:56 +00:00
|
|
|
|
if (pkm.Species == (int)Species.Lycanroc)
|
|
|
|
|
return pkm.AltForm < 3;
|
2018-07-27 02:34:27 +00:00
|
|
|
|
return pkm.Species == 773;
|
2017-02-02 05:59:39 +00:00
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2018-04-18 03:06:23 +00:00
|
|
|
|
internal static bool IsEvolutionValid(PKM pkm, int minSpecies = -1, int minLevel = -1)
|
2016-04-08 01:19:21 +00:00
|
|
|
|
{
|
2019-07-02 15:34:28 +00:00
|
|
|
|
var curr = EvolutionChain.GetValidPreEvolutions(pkm, minLevel: minLevel);
|
2018-07-04 16:15:20 +00:00
|
|
|
|
var min = curr.FindLast(z => z.Species == minSpecies);
|
2018-04-18 03:06:23 +00:00
|
|
|
|
if (min != null && min.Level < minLevel)
|
|
|
|
|
return false;
|
2020-06-28 03:18:29 +00:00
|
|
|
|
var poss = EvolutionChain.GetValidPreEvolutions(pkm, maxLevel: 100, minLevel: minLevel, skipChecks: true);
|
2016-04-08 01:19:21 +00:00
|
|
|
|
|
2017-05-29 22:21:39 +00:00
|
|
|
|
if (minSpecies != -1)
|
2018-07-04 16:15:20 +00:00
|
|
|
|
{
|
|
|
|
|
int last = poss.FindLastIndex(z => z.Species == minSpecies);
|
|
|
|
|
return curr.Count >= last;
|
|
|
|
|
}
|
2019-01-21 05:55:28 +00:00
|
|
|
|
int gen = pkm.GenNumber;
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (gen >= 3 && GetSplitBreedGeneration(gen).Contains(EvoBase.GetBaseSpecies(poss, 1).Species))
|
2018-07-04 16:15:20 +00:00
|
|
|
|
return curr.Count >= poss.Count - 1;
|
|
|
|
|
return curr.Count >= poss.Count;
|
2016-04-08 01:19:21 +00:00
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
internal static bool IsEvolutionValidWithMove(PKM pkm, LegalInfo info)
|
2017-06-07 03:10:05 +00:00
|
|
|
|
{
|
|
|
|
|
// Exclude species that do not evolve leveling with a move
|
2017-06-07 03:52:21 +00:00
|
|
|
|
// Exclude gen 1-3 formats
|
2019-04-17 05:14:21 +00:00
|
|
|
|
// Exclude Mr. Mime and Snorlax for gen 1-3 games
|
|
|
|
|
var gen = info.Generation;
|
|
|
|
|
if (!SpeciesEvolutionWithMove.Contains(pkm.Species) || pkm.Format <= 3 || (BabyEvolutionWithMove.Contains(pkm.Species) && gen <= 3))
|
2017-06-07 03:10:05 +00:00
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
var index = Array.FindIndex(SpeciesEvolutionWithMove, p => p == pkm.Species);
|
|
|
|
|
var levels = MinLevelEvolutionWithMove[index];
|
|
|
|
|
var moves = MoveEvolutionWithMove[index];
|
2019-04-17 05:14:21 +00:00
|
|
|
|
var allowegg = EggMoveEvolutionWithMove[index][gen];
|
2017-06-07 03:10:05 +00:00
|
|
|
|
|
2017-06-07 03:52:21 +00:00
|
|
|
|
// Get the minimum level in any generation when the pokemon could learn the evolve move
|
2017-06-07 03:10:05 +00:00
|
|
|
|
var LearnLevel = 101;
|
2019-04-17 05:14:21 +00:00
|
|
|
|
for (int g = gen; g <= pkm.Format; g++)
|
2018-07-27 02:34:27 +00:00
|
|
|
|
{
|
2017-06-07 03:52:21 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(g) && levels[g] > 0)
|
2017-06-07 03:10:05 +00:00
|
|
|
|
LearnLevel = Math.Min(LearnLevel, levels[g]);
|
2018-07-27 02:34:27 +00:00
|
|
|
|
}
|
2017-06-07 03:10:05 +00:00
|
|
|
|
|
|
|
|
|
// Check also if the current encounter include the evolve move as an special move
|
|
|
|
|
// That means the pokemon have the move from the encounter level
|
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
|
|
|
|
if (info.EncounterMatch is IMoveset s && s.Moves.Any(m => moves.Contains(m)))
|
2017-06-07 03:10:05 +00:00
|
|
|
|
LearnLevel = Math.Min(LearnLevel, info.EncounterMatch.LevelMin);
|
|
|
|
|
|
|
|
|
|
// If the encounter is a player hatched egg check if the move could be an egg move or inherited level up move
|
|
|
|
|
if (info.EncounterMatch.EggEncounter && !pkm.WasGiftEgg && !pkm.WasEventEgg && allowegg)
|
|
|
|
|
{
|
2017-06-18 01:37:19 +00:00
|
|
|
|
if (IsMoveInherited(pkm, info, moves))
|
2019-04-17 05:14:21 +00:00
|
|
|
|
LearnLevel = Math.Min(LearnLevel, gen <= 3 ? 6 : 2);
|
2017-06-07 03:10:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-06-07 03:52:21 +00:00
|
|
|
|
// If has original met location the minimum evolution level is one level after met level
|
|
|
|
|
// Gen 3 pokemon in gen 4 games: minimum level is one level after transfer to generation 4
|
|
|
|
|
// VC pokemon: minimum level is one level after transfer to generation 7
|
2018-05-12 15:13:39 +00:00
|
|
|
|
// Sylveon: always one level after met level, for gen 4 and 5 eevees in gen 6 games minimum for evolution is one level after transfer to generation 5
|
2019-12-09 01:39:19 +00:00
|
|
|
|
if (pkm.HasOriginalMetLocation || (pkm.Format == 4 && pkm.Gen3) || pkm.VC || pkm.Species == (int)Species.Sylveon)
|
2017-06-07 23:15:13 +00:00
|
|
|
|
LearnLevel = Math.Max(pkm.Met_Level + 1, LearnLevel);
|
2017-06-07 03:10:05 +00:00
|
|
|
|
|
2017-06-07 23:15:13 +00:00
|
|
|
|
// Current level must be at least one the minimum learn level
|
|
|
|
|
// the level-up event that triggers the learning of the move also triggers evolution with no further level-up required
|
|
|
|
|
return pkm.CurrentLevel >= LearnLevel;
|
2017-06-07 03:10:05 +00:00
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private static bool IsMoveInherited(PKM pkm, LegalInfo info, int[] moves)
|
2017-06-07 03:52:21 +00:00
|
|
|
|
{
|
|
|
|
|
// In 3DS games, the inherited move must be in the relearn moves.
|
2018-07-04 16:15:20 +00:00
|
|
|
|
if (info.Generation >= 6)
|
2017-06-07 03:52:21 +00:00
|
|
|
|
return pkm.RelearnMoves.Any(moves.Contains);
|
|
|
|
|
|
|
|
|
|
// In Pre-3DS games, the move is inherited if it has the move and it can be hatched with the move.
|
|
|
|
|
if (pkm.Moves.Any(moves.Contains))
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
// If the pokemon does not have the move, it still could be an egg move that was forgotten.
|
|
|
|
|
// This requires the pokemon to not have 4 other moves identified as egg moves or inherited level up moves.
|
2017-06-18 01:37:19 +00:00
|
|
|
|
return 4 > info.Moves.Count(m => m.Source == MoveSource.EggMove || m.Source == MoveSource.InheritLevelUp);
|
2017-06-07 03:52:21 +00:00
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2019-12-29 02:59:00 +00:00
|
|
|
|
/// <summary>Checks if the form may be different than the original encounter detail.</summary>
|
|
|
|
|
/// <param name="pkm">Pokémon</param>
|
|
|
|
|
/// <param name="species">Original species</param>
|
2020-04-24 03:53:57 +00:00
|
|
|
|
/// <param name="form">Original form</param>
|
|
|
|
|
internal static bool IsFormChangeable(PKM pkm, int species, int form)
|
2017-02-21 05:19:25 +00:00
|
|
|
|
{
|
|
|
|
|
if (FormChange.Contains(species))
|
|
|
|
|
return true;
|
2020-04-24 03:53:57 +00:00
|
|
|
|
if (species != pkm.Species && IsEvolvedFormChange(pkm, form))
|
2017-02-21 05:19:25 +00:00
|
|
|
|
return true;
|
2019-12-09 01:39:19 +00:00
|
|
|
|
if (species == (int)Species.Zygarde && pkm.InhabitedGeneration(7) && pkm.AltForm > 1)
|
2017-02-21 05:19:25 +00:00
|
|
|
|
return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-05-12 15:13:39 +00:00
|
|
|
|
|
2018-06-19 04:56:30 +00:00
|
|
|
|
internal static bool GetCanInheritMoves(int species)
|
2017-09-15 01:52:31 +00:00
|
|
|
|
{
|
2018-06-19 04:56:30 +00:00
|
|
|
|
if (FixedGenderFromBiGender.Contains(species)) // Nincada -> Shedinja loses gender causing 'false', edge case
|
2017-09-15 01:52:31 +00:00
|
|
|
|
return true;
|
2018-06-19 04:56:30 +00:00
|
|
|
|
var pi = PKX.Personal[species];
|
|
|
|
|
if (!pi.Genderless && !pi.OnlyMale)
|
2017-09-15 01:52:31 +00:00
|
|
|
|
return true;
|
2018-06-19 04:56:30 +00:00
|
|
|
|
if (MixedGenderBreeding.Contains(species))
|
2017-09-15 01:52:31 +00:00
|
|
|
|
return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
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-06-21 00:44:05 +00:00
|
|
|
|
return MoveList.GetValidMoves(pkm, version, EvolutionChain.GetValidPreEvolutions(pkm), generation, Machine: true).Contains(move);
|
2017-02-15 22:33:59 +00:00
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
internal static bool GetCanRelearnMove(PKM pkm, int move, int generation, GameVersion version = GameVersion.Any)
|
2016-05-10 01:19:31 +00:00
|
|
|
|
{
|
2020-06-21 00:44:05 +00:00
|
|
|
|
return MoveList.GetValidMoves(pkm, version, EvolutionChain.GetValidPreEvolutions(pkm), generation, LVL: true, Relearn: true).Contains(move);
|
2016-05-10 02:24:52 +00:00
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
internal static bool GetCanKnowMove(PKM pkm, int move, int generation, 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-06-21 00:44:05 +00:00
|
|
|
|
return MoveList.GetValidMoves(pkm, version, EvolutionChain.GetValidPreEvolutions(pkm), generation, LVL: true, Relearn: true, Tutor: true, Machine: true).Contains(move);
|
2016-02-26 15:52:08 +00:00
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private static int GetMaxLevelGeneration(PKM pkm)
|
2017-02-16 10:59:07 +00:00
|
|
|
|
{
|
2017-06-18 01:37:19 +00:00
|
|
|
|
return GetMaxLevelGeneration(pkm, pkm.GenNumber);
|
2017-02-16 10:59:07 +00:00
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private static int GetMaxLevelGeneration(PKM pkm, int generation)
|
2017-02-16 10:59:07 +00:00
|
|
|
|
{
|
|
|
|
|
if (!pkm.InhabitedGeneration(generation))
|
2017-06-27 03:30:44 +00:00
|
|
|
|
return pkm.Met_Level;
|
2017-02-16 10:59:07 +00:00
|
|
|
|
|
|
|
|
|
if (pkm.Format <= 2)
|
|
|
|
|
{
|
|
|
|
|
if (generation == 1 && FutureEvolutionsGen1_Gen2LevelUp.Contains(pkm.Species))
|
|
|
|
|
return pkm.CurrentLevel - 1;
|
|
|
|
|
return pkm.CurrentLevel;
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-09 01:39:19 +00:00
|
|
|
|
if (pkm.Species == (int)Species.Sylveon && generation == 5)
|
2017-02-16 10:59:07 +00:00
|
|
|
|
return pkm.CurrentLevel - 1;
|
|
|
|
|
|
2017-03-26 16:45:01 +00:00
|
|
|
|
if (pkm.Gen3 && pkm.Format > 4 && pkm.Met_Level == pkm.CurrentLevel && FutureEvolutionsGen3_LevelUpGen4.Contains(pkm.Species))
|
2017-02-16 10:59:07 +00:00
|
|
|
|
return pkm.Met_Level - 1;
|
|
|
|
|
|
2017-02-21 03:40:50 +00:00
|
|
|
|
if (!pkm.HasOriginalMetLocation)
|
|
|
|
|
return pkm.Met_Level;
|
2018-05-12 15:13:39 +00:00
|
|
|
|
|
2017-02-21 03:40:50 +00:00
|
|
|
|
return pkm.CurrentLevel;
|
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2020-06-28 03:18:29 +00:00
|
|
|
|
internal static int GetMaxLevelEncounter(PKM pkm)
|
2017-02-21 03:40:50 +00:00
|
|
|
|
{
|
2018-07-27 02:34:27 +00:00
|
|
|
|
// Only for gen 3 pokemon in format 3, after transfer to gen 4 it should return transfer level
|
2017-03-26 16:05:58 +00:00
|
|
|
|
if (pkm.Format == 3 && pkm.WasEgg)
|
|
|
|
|
return 5;
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
|
|
|
|
// Only for gen 4 pokemon in format 4, after transfer to gen 5 it should return transfer level
|
2017-11-18 06:19:23 +00:00
|
|
|
|
if (pkm.Format == 4 && pkm.Gen4 && pkm.WasEgg)
|
2017-03-30 18:58:30 +00:00
|
|
|
|
return 1;
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
return pkm.HasOriginalMetLocation ? pkm.Met_Level : GetMaxLevelGeneration(pkm);
|
2017-02-16 10:59:07 +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;
|
|
|
|
|
internal static readonly LearnVersion LearnNONE = new LearnVersion(-1);
|
|
|
|
|
|
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);
|
2020-02-13 04:25:39 +00:00
|
|
|
|
internal static bool IsMovesetRestricted(this PKM pkm, int gen) => (pkm.GG && gen == 7) || pkm.IsUntraded;
|
2018-06-09 03:10:41 +00:00
|
|
|
|
|
2018-05-20 17:35:58 +00:00
|
|
|
|
public static bool HasMetLocationUpdatedTransfer(int originalGeneration, int currentGeneration)
|
|
|
|
|
{
|
|
|
|
|
if (originalGeneration < 3)
|
|
|
|
|
return currentGeneration >= 3;
|
|
|
|
|
if (originalGeneration <= 4)
|
|
|
|
|
return currentGeneration != originalGeneration;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
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
|
|
|
|
|
|
|
|
|
public static string GetG1OT_GFMew(int lang) => lang == (int)LanguageID.Japanese ? "ゲーフリ" : "GF";
|
|
|
|
|
public static string GetG5OT_NSparkle(int lang) => lang == (int)LanguageID.Japanese ? "N" : "N";
|
2018-08-03 14:38:29 +00:00
|
|
|
|
|
2020-02-04 04:10:07 +00:00
|
|
|
|
public const string Stadium1JP = "スタジアム";
|
2020-06-22 00:46:06 +00:00
|
|
|
|
|
2020-02-04 04:10:07 +00:00
|
|
|
|
public static int GetGBStadiumOTID_JPN(GameVersion s)
|
|
|
|
|
{
|
|
|
|
|
return s == GameVersion.Stadium2 ? 2000 : 1999;
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-27 23:06:06 +00:00
|
|
|
|
public static int GetMaxLengthOT(int gen, LanguageID lang)
|
|
|
|
|
{
|
|
|
|
|
switch (lang)
|
|
|
|
|
{
|
|
|
|
|
case LanguageID.Korean:
|
|
|
|
|
case LanguageID.Japanese: return gen >= 6 ? 6 : 5;
|
|
|
|
|
default: return gen >= 6 ? 12 : 7;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static int GetMaxLengthNickname(int gen, LanguageID lang)
|
2018-08-15 21:58:55 +00:00
|
|
|
|
{
|
|
|
|
|
switch (lang)
|
|
|
|
|
{
|
|
|
|
|
case LanguageID.Korean:
|
|
|
|
|
case LanguageID.Japanese: return gen >= 6 ? 6 : 5;
|
2018-08-15 22:26:42 +00:00
|
|
|
|
default: return gen >= 6 ? 12 : 10;
|
2018-08-15 21:58:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
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
|
|
|
|
}
|
|
|
|
|
}
|