Merge branch 'kwsch'

# Conflicts:
#	PKHeX/Legality/Checks.cs
#	PKHeX/PKM/PKM.cs
This commit is contained in:
javierhimura 2017-03-25 18:24:56 +01:00
commit 66a9f8901c
30 changed files with 1231 additions and 579 deletions

View file

@ -12,6 +12,7 @@ using System.Windows.Forms;
using PKHeX.Core;
using PKHeX.Core.Properties;
using System.Configuration;
using System.Threading.Tasks;
namespace PKHeX.WinForms
{
@ -1390,6 +1391,14 @@ namespace PKHeX.WinForms
// Language Translation
private void changeMainLanguage(object sender, EventArgs e)
{
if (CB_MainLanguage.SelectedIndex < 8)
curlanguage = GameInfo.lang_val[CB_MainLanguage.SelectedIndex];
// Set the culture (makes it easy to pass language to other forms)
Properties.Settings.Default.Language = curlanguage;
Thread.CurrentThread.CurrentCulture = new CultureInfo(curlanguage.Substring(0, 2));
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
PKM pk = SAV.getPKM((fieldsInitialized ? preparePKM() : pkm).Data);
bool alreadyInit = fieldsInitialized;
fieldsInitialized = false;
@ -1402,24 +1411,16 @@ namespace PKHeX.WinForms
// Recenter PKM SubEditors
FLP_PKMEditors.Location = new Point((Tab_OTMisc.Width - FLP_PKMEditors.Width)/2, FLP_PKMEditors.Location.Y);
populateFields(pk); // put data back in form
fieldsInitialized |= alreadyInit;
// Set the culture (makes it easy to pass language to other forms)
Properties.Settings.Default.Language = curlanguage;
Thread.CurrentThread.CurrentCulture = new CultureInfo(curlanguage.Substring(0, 2));
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
fieldsInitialized |= alreadyInit;
}
private void InitializeStrings()
{
if (CB_MainLanguage.SelectedIndex < 8)
curlanguage = GameInfo.lang_val[CB_MainLanguage.SelectedIndex];
{
string l = curlanguage;
GameInfo.Strings = GameInfo.getStrings(l);
// Update Legality Strings
// Clipboard.SetText(string.Join(Environment.NewLine, CheckStrings.getLocalization()));
new Thread(() => { CheckStrings.setLocalization(GameInfo.getCheckStrings(l)); }).Start();
Task.Run(() => Util.setLocalization(typeof(LegalityCheckStrings)));
// Force an update to the met locations
origintrack = GameVersion.Unknown;
@ -1963,9 +1964,9 @@ namespace PKHeX.WinForms
CB_Language.SelectedValue = SAV.Language;
if (SAV.HasGeolocation)
{
CB_SubRegion.SelectedValue = SAV.SubRegion;
CB_Country.SelectedValue = SAV.Country;
CB_3DSReg.SelectedValue = SAV.ConsoleRegion;
CB_Country.SelectedValue = SAV.Country;
CB_SubRegion.SelectedValue = SAV.SubRegion;
}
updateNickname(null, null);
}

View file

@ -29,7 +29,8 @@ namespace PKHeX.WinForms
Label_OTGender.ForeColor = ck3.OT_Gender == 1 ? Color.Red : Color.Blue;
TB_PID.Text = ck3.PID.ToString("X8");
CB_HeldItem.SelectedValue = ck3.HeldItem;
CB_Ability.SelectedIndex = ck3.AbilityNumber > CB_Ability.Items.Count ? 0 : ck3.AbilityNumber;
int abil = ck3.AbilityNumber >> 1;
CB_Ability.SelectedIndex = abil > CB_Ability.Items.Count ? 0 : abil;
CB_Nature.SelectedValue = ck3.Nature;
TB_TID.Text = ck3.TID.ToString("00000");
TB_SID.Text = ck3.SID.ToString("00000");
@ -136,7 +137,7 @@ namespace PKHeX.WinForms
ck3.SID = Util.ToInt32(TB_SID.Text);
ck3.EXP = Util.ToUInt32(TB_EXP.Text);
ck3.PID = Util.getHEXval(TB_PID.Text);
ck3.AbilityNumber = CB_Ability.SelectedIndex;
ck3.AbilityNumber = 1 << CB_Ability.SelectedIndex; // to match gen6+
ck3.FatefulEncounter = CHK_Fateful.Checked;
ck3.Gender = PKX.getGender(Label_Gender.Text);

View file

@ -29,7 +29,8 @@ namespace PKHeX.WinForms
Label_OTGender.ForeColor = pk3.OT_Gender == 1 ? Color.Red : Color.Blue;
TB_PID.Text = pk3.PID.ToString("X8");
CB_HeldItem.SelectedValue = pk3.HeldItem;
CB_Ability.SelectedIndex = pk3.AbilityNumber > CB_Ability.Items.Count ? 0 : pk3.AbilityNumber;
int abil = pk3.AbilityNumber >> 1;
CB_Ability.SelectedIndex = abil > CB_Ability.Items.Count ? 0 : abil;
CB_Nature.SelectedValue = pk3.Nature;
TB_TID.Text = pk3.TID.ToString("00000");
TB_SID.Text = pk3.SID.ToString("00000");
@ -114,7 +115,7 @@ namespace PKHeX.WinForms
pk3.SID = Util.ToInt32(TB_SID.Text);
pk3.EXP = Util.ToUInt32(TB_EXP.Text);
pk3.PID = Util.getHEXval(TB_PID.Text);
pk3.AbilityNumber = CB_Ability.SelectedIndex; // 0/1 (stored in IVbits)
pk3.AbilityNumber = 1 << CB_Ability.SelectedIndex; // to match gen6+
pk3.FatefulEncounter = CHK_Fateful.Checked;
pk3.Gender = PKX.getGender(Label_Gender.Text);

View file

@ -29,7 +29,8 @@ namespace PKHeX.WinForms
Label_OTGender.ForeColor = xk3.OT_Gender == 1 ? Color.Red : Color.Blue;
TB_PID.Text = xk3.PID.ToString("X8");
CB_HeldItem.SelectedValue = xk3.HeldItem;
CB_Ability.SelectedIndex = xk3.AbilityNumber > CB_Ability.Items.Count ? 0 : xk3.AbilityNumber;
int abil = xk3.AbilityNumber >> 1;
CB_Ability.SelectedIndex = abil > CB_Ability.Items.Count ? 0 : abil;
CB_Nature.SelectedValue = xk3.Nature;
TB_TID.Text = xk3.TID.ToString("00000");
TB_SID.Text = xk3.SID.ToString("00000");
@ -136,7 +137,7 @@ namespace PKHeX.WinForms
xk3.SID = Util.ToInt32(TB_SID.Text);
xk3.EXP = Util.ToUInt32(TB_EXP.Text);
xk3.PID = Util.getHEXval(TB_PID.Text);
xk3.AbilityNumber = CB_Ability.SelectedIndex; // 0/1 (stored in IVbits)
xk3.AbilityNumber = 1 << CB_Ability.SelectedIndex; // to match gen6+
xk3.FatefulEncounter = CHK_Fateful.Checked;
xk3.Gender = PKX.getGender(Label_Gender.Text);

View file

@ -68,9 +68,13 @@ namespace PKHeX.WinForms
if (SAV.BoxesUnlocked > 0)
{
CB_Unlocked.Items.Clear();
for (int i = 0; i <= SAV.BoxCount; i++)
int max = SAV.BoxCount;
if (SAV.Generation == 6)
max -= 1; // cover legendary captured unlocks final box, not governed by BoxesUnlocked
for (int i = 0; i <= max; i++)
CB_Unlocked.Items.Add(i);
CB_Unlocked.SelectedIndex = Math.Min(SAV.BoxCount, SAV.BoxesUnlocked);
CB_Unlocked.SelectedIndex = Math.Min(max, SAV.BoxesUnlocked);
}
else
{

View file

@ -9,9 +9,7 @@ namespace PKHeX.Core
private static readonly string[] ptransp = { "ポケシフター", "Poké Transfer", "Poké Fret", "Pokétrasporto", "Poképorter", "Pokétransfer", "포케시프터", "宝可传送", "寶可傳送", "ポケシフター" };
public static readonly string[] lang_val = { "ja", "en", "fr", "it", "de", "es", "ko", "zh", "zh2", "pt" };
private const string DefaultLanguage = "en";
private const string LegalityName = "legality_";
private static readonly GameStrings[] Languages = new GameStrings[lang_val.Length];
private static readonly string[][] CheckStrings = new string[lang_val.Length][];
// Lazy fetch implementation
private static int DefaultLanguageIndex => Array.IndexOf(lang_val, DefaultLanguage);
@ -25,11 +23,6 @@ namespace PKHeX.Core
int index = getLanguageIndex(lang);
return Languages[index] ?? (Languages[index] = new GameStrings(lang_val[index]));
}
public static IEnumerable<string> getCheckStrings(string lang)
{
int index = getLanguageIndex(lang);
return CheckStrings[index] ?? (CheckStrings[index] = Util.getStringList(LegalityName + lang_val[index]));
}
private static string getTransporterName(string lang)
{
int index = getLanguageIndex(lang);

View file

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using static PKHeX.Core.CheckStrings;
using static PKHeX.Core.LegalityCheckStrings;
namespace PKHeX.Core
{
@ -50,7 +50,7 @@ namespace PKHeX.Core
if (!Parse.Any())
switch (pk.GenNumber)
{
case 3: parsePK3(pk); break;
case 3: if (pk.Version != 15) parsePK3(pk); break;
case 4: parsePK4(pk); break;
case 5: parsePK5(pk); break;
case 6: parsePK6(pk); break;
@ -75,7 +75,15 @@ namespace PKHeX.Core
else
return;
}
catch { Valid = false; }
catch (Exception e)
{
Console.WriteLine(e.Message);
Valid = false;
Parsed = true;
AddLine(Severity.Invalid, V190, CheckIdentifier.Misc);
AllSuggestedMoves = AllSuggestedRelearnMoves = AllSuggestedMovesAndRelearn = new int[0];
return;
}
AllSuggestedMoves = !pkm.IsOriginValid ? new int[4] : getSuggestedMoves(true, true, true);
AllSuggestedRelearnMoves = !pkm.IsOriginValid ? new int[4] : Legal.getValidRelearn(pkm, -1).ToArray();
AllSuggestedMovesAndRelearn = AllSuggestedMoves.Concat(AllSuggestedRelearnMoves).ToArray();
@ -121,7 +129,8 @@ namespace PKHeX.Core
pkm = pk;
if (!pkm.IsOriginValid)
{ AddLine(Severity.Invalid, V187, CheckIdentifier.None); return; }
verifyPreRelearn();
updateEncounterChain();
updateMoveLegality();
updateEncounterInfo();
@ -133,7 +142,8 @@ namespace PKHeX.Core
pkm = pk;
if (!pkm.IsOriginValid)
{ AddLine(Severity.Invalid, V187, CheckIdentifier.None); return; }
verifyPreRelearn();
updateEncounterChain();
updateMoveLegality();
updateEncounterInfo();
@ -220,11 +230,11 @@ namespace PKHeX.Core
verifyHyperTraining();
verifyMedals();
verifyRegion();
verifyVersionEvolution();
}
if (pkm.GenNumber < 5)
verifyEggMoves();
verifyVersionEvolution();
// SecondaryChecked = true;
}
private string getLegalityReport()
@ -293,14 +303,10 @@ namespace PKHeX.Core
return RelearnBase;
List<int> window = new List<int>(RelearnBase);
for (int i = 0; i < 4; i++)
if (!vMoves[i].Valid || vMoves[i].Flag)
window.Add(pkm.Moves[i]);
window.AddRange(pkm.Moves.Where((v, i) => !vMoves[i].Valid || vMoves[i].Flag));
if (window.Count < 4)
window.AddRange(new int[4 - window.Count]);
return window.Skip(window.Count - 4).Take(4).ToArray();
return window.Skip(window.Count - 4).ToArray();
}
public int[] getSuggestedMoves(bool tm, bool tutor, bool reminder)
{
@ -318,12 +324,19 @@ namespace PKHeX.Core
int loc = getSuggestedTransferLocation(pkm);
if (pkm.WasEgg)
{
int lvl = 1; // gen5+
if (!pkm.IsNative)
lvl = pkm.CurrentLevel; // be generous with transfer conditions
else if (pkm.Format < 5) // and native
lvl = 0;
return new EncounterStatic
{
Species = Legal.getBaseSpecies(pkm),
Location = loc != -1 ? loc : getSuggestedEggMetLocation(pkm),
Level = 1,
Level = lvl,
};
}
var area = Legal.getCaptureLocation(pkm);
if (area != null)
@ -347,6 +360,21 @@ namespace PKHeX.Core
// Return one of legal hatch locations for game
switch ((GameVersion)pkm.Version)
{
case GameVersion.R:
case GameVersion.S:
case GameVersion.E:
case GameVersion.FR:
case GameVersion.LG:
switch (pkm.Format)
{
case 3:
return pkm.FRLG ? 146 /* Four Island */ : 32; // Route 117
case 4:
return 0x37; // Pal Park
default:
return 30001; // Transporter
}
case GameVersion.D:
case GameVersion.P:
case GameVersion.Pt:

View file

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using static PKHeX.Core.CheckStrings;
using static PKHeX.Core.LegalityCheckStrings;
namespace PKHeX.Core
{
@ -42,7 +42,8 @@ namespace PKHeX.Core
Training,
Ability,
Evolution,
Special
Special,
Nature
}
public class CheckResult
{
@ -65,10 +66,36 @@ namespace PKHeX.Core
private void verifyGender()
{
if (pkm.PersonalInfo.Gender == 255 && pkm.Gender != 2)
{
AddLine(Severity.Invalid, V203, CheckIdentifier.Gender);
// return;
// Check for PID relationship to Gender & Nature if applicable
int gen = pkm.GenNumber;
bool PIDGender = 3 <= gen && gen <= 5;
if (!PIDGender)
return;
bool genderValid = pkm.getGenderIsValid();
if (!genderValid && pkm.Format > 5 && (pkm.Species == 183 || pkm.Species == 184))
{
var gv = pkm.PID & 0xFF;
if (gv > 63 && pkm.Gender == 1) // evolved from azurill after transferring to keep gender
genderValid = true;
}
if (genderValid)
AddLine(Severity.Valid, V250, CheckIdentifier.Gender);
else
AddLine(Severity.Invalid, V251, CheckIdentifier.Gender);
bool PIDNature = gen != 5;
if (!PIDNature)
return;
if (pkm.PID % 25 == pkm.Nature)
AddLine(Severity.Valid, V252, CheckIdentifier.Nature);
else
AddLine(Severity.Invalid, V253, CheckIdentifier.Nature);
}
private void verifyItem()
{
@ -145,6 +172,7 @@ namespace PKHeX.Core
: V216, CheckIdentifier.ECPID);
}
}
private void verifyNickname()
{
// If the Pokémon is not nicknamed, it should match one of the language strings.
@ -185,72 +213,13 @@ namespace PKHeX.Core
if (EncounterType == typeof(EncounterTrade))
{
string[] validOT = new string[0];
int index = -1;
if (pkm.XY)
{
validOT = Legal.TradeXY[pkm.Language];
index = Array.IndexOf(Legal.TradeGift_XY, EncounterMatch);
}
else if (pkm.AO)
{
validOT = Legal.TradeAO[pkm.Language];
index = Array.IndexOf(Legal.TradeGift_AO, EncounterMatch);
}
else if (pkm.SM)
{
// TODO
AddLine(Severity.Valid, V194, CheckIdentifier.Nickname);
return;
}
else if (pkm.Format <= 2 || pkm.VC)
{
var et = EncounterOriginal as EncounterTrade;
if (et?.TID == 0) // Gen1 Trade
{
if (!Legal.getEncounterTrade1Valid(pkm))
AddLine(Severity.Invalid, V10, CheckIdentifier.Trainer);
}
else // Gen2
{
return; // already checked all relevant properties when fetching with getValidEncounterTradeVC2
}
return;
}
if (validOT.Length == 0)
{
AddLine(Severity.Indeterminate, V7, CheckIdentifier.Trainer);
return;
}
if (index == -1 || validOT.Length < index*2)
{
AddLine(Severity.Indeterminate, V8, CheckIdentifier.Trainer);
return;
}
string nick = validOT[index];
string OT = validOT[validOT.Length/2 + index];
if (nick != pkm.Nickname)
AddLine(Severity.Fishy, V9, CheckIdentifier.Nickname);
else if (OT != pkm.OT_Name)
AddLine(Severity.Invalid, V10, CheckIdentifier.Trainer);
else
AddLine(Severity.Valid, V11, CheckIdentifier.Nickname);
verifyNicknameTrade();
return;
}
if (pkm.IsEgg)
{
if (!pkm.IsNicknamed && (pkm.Format != 7))
AddLine(Severity.Invalid, V12, CheckIdentifier.Egg);
else if (PKX.SpeciesLang[pkm.Language][0] != pkm.Nickname)
AddLine(Severity.Invalid, V13, CheckIdentifier.Egg);
else
AddLine(Severity.Valid, V14, CheckIdentifier.Egg);
verifyNicknameEgg();
return;
}
@ -280,7 +249,10 @@ namespace PKHeX.Core
{
// Can't have another language name if it hasn't evolved or wasn't a language-traded egg.
bool match = PKX.getSpeciesNameGeneration(pkm.Species, pkm.Language, pkm.Format) == nickname;
match |= (pkm.WasTradedEgg || Legal.getHasEvolved(pkm)) && PKX.getIsNicknamedAnyLanguage(pkm.Species, nickname, pkm.Format);
if (pkm.WasTradedEgg || Legal.getHasEvolved(pkm))
match |= !PKX.getIsNicknamedAnyLanguage(pkm.Species, nickname, pkm.Format);
if (pkm.Format == 5 && !pkm.IsNative) // transfer
match |= PKX.getSpeciesNameGeneration(pkm.Species, pkm.Language, 4) == nickname;
if (!match)
{
@ -293,13 +265,79 @@ namespace PKHeX.Core
AddLine(Severity.Valid, V18, CheckIdentifier.Nickname);
}
}
private void verifyNicknameEgg()
{
if (!pkm.IsNicknamed && (pkm.Format != 7))
AddLine(Severity.Invalid, V12, CheckIdentifier.Egg);
else if (PKX.SpeciesLang[pkm.Language][0] != pkm.Nickname)
AddLine(Severity.Invalid, V13, CheckIdentifier.Egg);
else
AddLine(Severity.Valid, V14, CheckIdentifier.Egg);
}
private void verifyNicknameTrade()
{
string[] validOT = new string[0];
int index = -1;
if (pkm.XY)
{
validOT = Legal.TradeXY[pkm.Language];
index = Array.IndexOf(Legal.TradeGift_XY, EncounterMatch);
}
else if (pkm.AO)
{
validOT = Legal.TradeAO[pkm.Language];
index = Array.IndexOf(Legal.TradeGift_AO, EncounterMatch);
}
else if (pkm.SM)
{
// TODO
AddLine(Severity.Valid, V194, CheckIdentifier.Nickname);
return;
}
else if (pkm.Format <= 2 || pkm.VC)
{
var et = EncounterOriginal as EncounterTrade;
if (et?.TID == 0) // Gen1 Trade
{
if (!Legal.getEncounterTrade1Valid(pkm))
AddLine(Severity.Invalid, V10, CheckIdentifier.Trainer);
}
else // Gen2
{
return; // already checked all relevant properties when fetching with getValidEncounterTradeVC2
}
return;
}
if (validOT.Length == 0)
{
AddLine(Severity.Indeterminate, V7, CheckIdentifier.Trainer);
return;
}
if (index == -1 || validOT.Length < index * 2)
{
AddLine(Severity.Indeterminate, V8, CheckIdentifier.Trainer);
return;
}
string nick = validOT[index];
string OT = validOT[validOT.Length / 2 + index];
if (nick != pkm.Nickname)
AddLine(Severity.Fishy, V9, CheckIdentifier.Nickname);
else if (OT != pkm.OT_Name)
AddLine(Severity.Invalid, V10, CheckIdentifier.Trainer);
else
AddLine(Severity.Valid, V11, CheckIdentifier.Nickname);
}
private void verifyEVs()
{
var evs = pkm.EVs;
int sum = evs.Sum();
if (pkm.IsEgg && sum > 0)
AddLine(Severity.Invalid, V22, CheckIdentifier.EVs);
else if (sum == 0 && pkm.Stat_Level - pkm.Met_Level > 0)
else if (sum == 0 && pkm.CurrentLevel - Math.Max(1, pkm.Met_Level) > 0)
AddLine(Severity.Fishy, V23, CheckIdentifier.EVs);
else if (sum == 508)
AddLine(Severity.Fishy, V24, CheckIdentifier.EVs);
@ -448,9 +486,9 @@ namespace PKHeX.Core
private CheckResult verifyEncounterEvent()
{
MysteryGift MatchedGift = EncounterMatch as MysteryGift;
if (MatchedGift != null)
return new CheckResult(Severity.Valid, string.Format(V21, MatchedGift.CardID.ToString("0000"), MatchedGift.CardTitle), CheckIdentifier.Encounter);
return null;
if (MatchedGift == null)
return null;
return new CheckResult(Severity.Valid, string.Format(V21, MatchedGift.CardID.ToString("0000"), MatchedGift.CardTitle), CheckIdentifier.Encounter);
}
private CheckResult verifyEncounterEgg()
@ -475,41 +513,44 @@ namespace PKHeX.Core
}
private CheckResult verifyEncounterEgg3()
{
if (pkm.Format == 3)
return pkm.Format == 3 ? verifyEncounterEgg3Native() : verifyEncounterEgg3Transfer();
}
private CheckResult verifyEncounterEgg3Native()
{
if (pkm.Met_Level != 0)
return new CheckResult(Severity.Invalid, string.Format(V52, 0), CheckIdentifier.Encounter);
if (pkm.IsEgg)
{
if (pkm.Met_Level != 0)
return new CheckResult(Severity.Invalid, string.Format(V52, 0), CheckIdentifier.Encounter);
if (pkm.IsEgg)
{
var loc = pkm.FRLG ? 146 /* Four Island */ : 32; /* RSE: Route 117 */
if (pkm.Met_Location != loc)
return new CheckResult(Severity.Invalid, V55, CheckIdentifier.Encounter);
}
else
{
var locs = pkm.FRLG ? Legal.ValidMet_FRLG : pkm.E ? Legal.ValidMet_E : Legal.ValidMet_RS;
if (locs.Contains(pkm.Met_Location))
return new CheckResult(Severity.Valid, V53, CheckIdentifier.Encounter);
if (Legal.ValidMet_FRLG.Contains(pkm.Met_Location) || Legal.ValidMet_E.Contains(pkm.Met_Location) || Legal.ValidMet_RS.Contains(pkm.Met_Location))
return new CheckResult(Severity.Valid, V56, CheckIdentifier.Encounter);
return new CheckResult(Severity.Invalid, V54, CheckIdentifier.Encounter);
}
var loc = pkm.FRLG ? 146 /* Four Island */ : 32; /* RSE: Route 117 */
if (pkm.Met_Location != loc)
return new CheckResult(Severity.Invalid, V55, CheckIdentifier.Encounter);
}
else
{
if (pkm.IsEgg)
return new CheckResult(Severity.Invalid, V57, CheckIdentifier.Encounter);
if (pkm.Met_Level < 5)
return new CheckResult(Severity.Invalid, V58, CheckIdentifier.Encounter);
if (pkm.Egg_Location != 0)
return new CheckResult(Severity.Invalid, V59, CheckIdentifier.Encounter);
if (pkm.Format == 4 && pkm.Met_Location != 0x37) // Pal Park
return new CheckResult(Severity.Invalid, V60, CheckIdentifier.Encounter);
if (pkm.Format != 4 && pkm.Met_Location != 30001)
return new CheckResult(Severity.Invalid, V61, CheckIdentifier.Encounter);
var locs = pkm.FRLG ? Legal.ValidMet_FRLG : pkm.E ? Legal.ValidMet_E : Legal.ValidMet_RS;
if (locs.Contains(pkm.Met_Location))
return new CheckResult(Severity.Valid, V53, CheckIdentifier.Encounter);
if (Legal.ValidMet_FRLG.Contains(pkm.Met_Location) || Legal.ValidMet_E.Contains(pkm.Met_Location) || Legal.ValidMet_RS.Contains(pkm.Met_Location))
return new CheckResult(Severity.Valid, V56, CheckIdentifier.Encounter);
return new CheckResult(Severity.Invalid, V54, CheckIdentifier.Encounter);
}
return new CheckResult(Severity.Valid, V53, CheckIdentifier.Encounter);
}
private CheckResult verifyEncounterEgg3Transfer()
{
if (pkm.IsEgg)
return new CheckResult(Severity.Invalid, V57, CheckIdentifier.Encounter);
if (pkm.Met_Level < 5)
return new CheckResult(Severity.Invalid, V58, CheckIdentifier.Encounter);
if (pkm.Egg_Location != 0)
return new CheckResult(Severity.Invalid, V59, CheckIdentifier.Encounter);
if (pkm.Format == 4 && pkm.Met_Location != 0x37) // Pal Park
return new CheckResult(Severity.Invalid, V60, CheckIdentifier.Encounter);
if (pkm.Format != 4 && pkm.Met_Location != 30001)
return new CheckResult(Severity.Invalid, V61, CheckIdentifier.Encounter);
return new CheckResult(Severity.Valid, V53, CheckIdentifier.Encounter);
}
private CheckResult verifyEncounterEgg4()
{
if (pkm.Format == 4)
@ -577,7 +618,7 @@ namespace PKHeX.Core
break;
case 710: // Pumpkaboo
case 711: // Goregeist
if (pkm.AltForm != 1) // Average
if (pkm.AltForm != 0) // Average
return new CheckResult(Severity.Invalid, V6, CheckIdentifier.Encounter);
break;
case 586: // Sawsbuck
@ -588,7 +629,6 @@ namespace PKHeX.Core
return new CheckResult(Severity.Valid, V66, CheckIdentifier.Encounter);
}
private CheckResult verifyEncounterWild()
{
EncounterSlot[] enc = (EncounterSlot[])EncounterMatch;
@ -657,25 +697,27 @@ namespace PKHeX.Core
Console.WriteLine($"Gen1 encounter fallthrough: {pkm.FileName}");
return new CheckResult(Severity.Invalid, V80, CheckIdentifier.Encounter);
}
private CheckResult verifyEncounterVC()
{
int baseSpecies = Legal.getBaseSpecies(pkm);
bool g1 = pkm.VC1 || pkm.Format == 1;
if ((g1 && baseSpecies > Legal.MaxSpeciesID_1) || (baseSpecies > Legal.MaxSpeciesID_2))
return new CheckResult(Severity.Invalid, V77, CheckIdentifier.Encounter);
// Get EncounterMatch prior to parsing transporter legality
var result = verifyEncounterG12();
EncounterOriginal = EncounterMatch;
if (pkm.Format > 2) // transported to 7+
AddLine(verifyVCEncounter(baseSpecies));
return result;
}
private CheckResult verifyEncounter()
{
if (pkm.VC || pkm.Format < 3)
{
int baseSpecies = Legal.getBaseSpecies(pkm);
bool g1 = pkm.VC1 || pkm.Format == 1;
if ((g1 && baseSpecies > Legal.MaxSpeciesID_1) || (baseSpecies > Legal.MaxSpeciesID_2))
return new CheckResult(Severity.Invalid, V77, CheckIdentifier.Encounter);
// Get EncounterMatch prior to parsing transporter legality
var result = verifyEncounterG12();
EncounterOriginal = EncounterMatch;
if (pkm.Format > 2) // transported to 7+
AddLine(verifyVCEncounter(baseSpecies));
return result;
}
return verifyEncounterVC();
if (pkm.WasLink)
return verifyEncounterLink();
@ -781,12 +823,17 @@ namespace PKHeX.Core
else
AddLine(Severity.Valid, V88, CheckIdentifier.Level);
}
private void verifyMedals()
{
if (pkm.Format < 6)
return;
// Training Medals
verifyMedalsRegular();
verifyMedalsEvent();
}
private void verifyMedalsRegular()
{
var TrainNames = ReflectUtil.getPropertiesStartWithPrefix(pkm.GetType(), "SuperTrain").ToArray();
var TrainCount = TrainNames.Count(MissionName => ReflectUtil.GetValue(pkm, MissionName) as bool? == true);
if (pkm.IsEgg && TrainCount > 0)
@ -808,8 +855,9 @@ namespace PKHeX.Core
{ AddLine(Severity.Invalid, V93, CheckIdentifier.Training); }
}
}
// Distribution Training Medals
}
private void verifyMedalsEvent()
{
var DistNames = ReflectUtil.getPropertiesStartWithPrefix(pkm.GetType(), "DistSuperTrain");
var DistCount = DistNames.Count(MissionName => ReflectUtil.GetValue(pkm, MissionName) as bool? == true);
if (pkm.IsEgg && DistCount > 0)
@ -819,6 +867,7 @@ namespace PKHeX.Core
else if (DistCount > 0)
{ AddLine(Severity.Fishy, V94, CheckIdentifier.Training); }
}
private void verifyRibbons()
{
if (!Encounter.Valid)
@ -851,13 +900,13 @@ namespace PKHeX.Core
};
if (MatchedGift != null) // Wonder Card
{
var mgRibbons = ReflectUtil.getPropertiesStartWithPrefix(MatchedGift.Content.GetType(), "Ribbon");
var mgRibbons = MatchedGift.Format == 4 ? EventRib : ReflectUtil.getPropertiesStartWithPrefix(MatchedGift.Content.GetType(), "Ribbon");
var commonRibbons = mgRibbons.Intersect(RibbonData).ToArray();
foreach (string r in commonRibbons)
{
bool? pk = ReflectUtil.getBooleanState(pkm, r);
bool? mg = ReflectUtil.getBooleanState(MatchedGift, r);
bool? mg = ReflectUtil.getBooleanState(MatchedGift.Content, r);
if (pk != mg) // Mismatch
{
if (pk ?? false)
@ -1067,7 +1116,7 @@ namespace PKHeX.Core
if (3 <= pkm.Format && pkm.Format <= 5) // 3-5
{
if (pkm.Version != (int) GameVersion.CXD && abilities[0] != abilities[1] && pkm.PIDAbility != abilval)
if (pkm.Version != (int) GameVersion.CXD && abilities[0] != abilities[1] && pkm.AbilityNumber != 1 << abilval)
{
AddLine(Severity.Invalid, V113, CheckIdentifier.Ability);
return;
@ -1363,7 +1412,6 @@ namespace PKHeX.Core
return;
}
if (ball >= 27)
{
AddLine(Severity.Invalid, V126, CheckIdentifier.Ball);
@ -1759,13 +1807,12 @@ namespace PKHeX.Core
int species = pkm.Species;
if (species == 201) // Unown
{
if (pkm.GenNumber == 2 && pkm.AltForm < 26) // A-Z
valid = true;
else if (pkm.GenNumber >= 3 && pkm.AltForm >= 28) // A-Z?!
int maxCount = pkm.GenNumber == 2 ? 26 : 28; // A-Z : A-Z?!
if (pkm.AltForm < maxCount)
valid = true;
}
if (species == 414 && pkm.AltForm < 3) // Wormadam base form kept
valid = true;
valid = true;
if ((species == 664 || species == 665) && pkm.AltForm < 18) // Vivillon Pre-evolutions
valid = true;
@ -1849,10 +1896,8 @@ namespace PKHeX.Core
AddLine(Severity.Invalid, V311, CheckIdentifier.Form);
return;
}
else if (!Legal.CheckVivillonPattern(pkm.AltForm,pkm.Country,pkm.Region))
{
AddLine(Severity.Invalid, V312, CheckIdentifier.Form);
}
if (!Legal.CheckVivillonPattern(pkm.AltForm, pkm.Country, pkm.Region))
AddLine(Severity.Fishy, V312, CheckIdentifier.Form);
break;
case 666: // Vivillon
if (pkm.AltForm > 17) // Fancy & Pokéball
@ -1864,10 +1909,8 @@ namespace PKHeX.Core
return;
}
else if (!Legal.CheckVivillonPattern(pkm.AltForm, pkm.Country, pkm.Region))
{
AddLine(Severity.Invalid, V312, CheckIdentifier.Form);
}
if (!Legal.CheckVivillonPattern(pkm.AltForm, pkm.Country, pkm.Region))
AddLine(Severity.Fishy, V312, CheckIdentifier.Form);
break;
case 670: // Floette
if (pkm.AltForm == 5) // Eternal Flower -- Never Released
@ -2031,6 +2074,8 @@ namespace PKHeX.Core
res = parseMovesSketch(Moves);
else if (EventGiftMatch?.Count > 1) // Multiple possible Mystery Gifts matched, get the best match too
res = parseMovesGetGift(Moves, validLevelMoves, validTMHM, validTutor);
else if (pkm.WasEgg && pkm.GenNumber < 6)
res = verifyMovesEggPreRelearn(Moves, validLevelMoves, validTMHM, validTutor);
else // Everything else
res = parseMovesRegular(Moves, validLevelMoves, validTMHM, validTutor, game);
@ -2041,6 +2086,38 @@ namespace PKHeX.Core
return res;
}
private CheckResult[] verifyMovesEggPreRelearn(int[] Moves, int[] validLevelMoves, int[] validTMHM, int[] validTutor)
{
CheckResult[] res = new CheckResult[4];
// Some games can have different egg movepools. Have to check all situations.
GameVersion[] Games = { };
switch (pkm.GenNumber)
{
case 3:
Games = new[] { GameVersion.RS, GameVersion.E, GameVersion.FRLG };
break;
case 4:
Games = new[] { GameVersion.DP, GameVersion.Pt, GameVersion.HGSS };
break;
case 5:
Games = new[] { GameVersion.BW, GameVersion.B2W2 };
break;
}
int splitctr = Legal.SplitBreed.Contains(pkm.Species) ? 1 : 0;
foreach (var ver in Games)
{
for (int i = 0; i <= splitctr; i++)
{
var lvlMoves = validLevelMoves.Concat(Legal.getBaseEggMoves(pkm, i, ver, 100)).ToArray();
res = parseMovesRegular(Moves, lvlMoves, validTMHM, validTutor, ver);
if (res.All(r => r.Valid)) // moves is satisfactory
return res;
}
}
return res;
}
private CheckResult[] parseMovesSketch(int[] Moves)
{
CheckResult[] res = new CheckResult[4];
@ -2260,6 +2337,16 @@ namespace PKHeX.Core
}
return res;
}
private void verifyPreRelearn()
{
// For origins prior to relearn moves, need to try to match a mystery gift if applicable.
if (pkm.WasEvent || pkm.WasEventEgg)
{
EventGiftMatch = new List<MysteryGift>(Legal.getValidGifts(pkm));
EncounterMatch = EventGiftMatch.FirstOrDefault();
}
}
private CheckResult[] verifyRelearn()
{
RelearnBase = null;
@ -2412,7 +2499,7 @@ namespace PKHeX.Core
CheckResult[] res = new CheckResult[4];
// Obtain level1 moves
List<int> baseMoves = new List<int>(Legal.getBaseEggMoves(pkm, skipOption, ver));
List<int> baseMoves = new List<int>(Legal.getBaseEggMoves(pkm, skipOption, ver, 1));
int baseCt = baseMoves.Count;
if (baseCt > 4) baseCt = 4;
@ -2421,24 +2508,11 @@ namespace PKHeX.Core
var inherited = RelearnMoves.Where(m => m != 0 && (!baseMoves.Contains(m) || inheritMoves.Contains(m))).ToList();
int inheritCt = inherited.Count;
// Get Move Window
var window = new List<int>();
window.AddRange(baseMoves); // initial moves (levelup for current level of egg)
window.AddRange(inherited); // nonstandard (egg or higher levelup moves)
// Get required amount of base moves
int unique = baseMoves.Concat(inherited).Distinct().Count();
int reqBase = inheritCt == 4 || baseCt + inheritCt > 4 ? 4 - inheritCt : baseCt;
if (RelearnMoves.Where(m => m != 0).Count() < Math.Min(4, baseMoves.Count))
reqBase = Math.Min(4, unique);
// Store the base moves suggestion.
string em = string.Join(", ", baseMoves.Select(m => m >= movelist.Length ? V190 : movelist[m]));
// Store the suggested relearn moves.
int[] moves = window.Skip(baseCt + inheritCt - 4).Take(4).ToArray();
Array.Resize(ref moves, 4);
RelearnBase = moves;
// Check if the required amount of Base Egg Moves are present.
for (int i = 0; i < reqBase; i++)
@ -2452,6 +2526,7 @@ namespace PKHeX.Core
res[z] = new CheckResult(Severity.Invalid, V180, CheckIdentifier.RelearnMove);
// provide the list of suggested base moves for the last required slot
string em = string.Join(", ", baseMoves.Select(m => m >= movelist.Length ? V190 : movelist[m]));
res[reqBase - 1].Comment += string.Format(Environment.NewLine + V181, em);
break;
}
@ -2472,6 +2547,7 @@ namespace PKHeX.Core
res[i] = new CheckResult(Severity.Invalid, V182, CheckIdentifier.RelearnMove);
}
RelearnBase = baseMoves.ToArray();
return res;
}

View file

@ -99,14 +99,14 @@ namespace PKHeX.Core
table = Encounter_DPPt;
break;
case GameVersion.HG: case GameVersion.SS:
table = Encounter_HGSS;
table = Encounter_HGSS.Concat(Encounter_PokeWalker).ToArray();
break;
case GameVersion.B: case GameVersion.W:
table = Encounter_BW;
table = Encounter_BW.Concat(BW_DreamWorld).ToArray();
break;
case GameVersion.B2: case GameVersion.W2:
table = Encounter_B2W2;
table = Encounter_B2W2.Concat(B2W2_DreamWorld).ToArray();
break;
case GameVersion.X: case GameVersion.Y:
@ -159,14 +159,16 @@ namespace PKHeX.Core
{
return EncounterArea.getArray(Data.unpackMini(mini, ident));
}
private static IEnumerable<EncounterArea> addExtraTableSlots(IEnumerable<EncounterArea> GameSlots, IEnumerable<EncounterArea> SpecialSlots)
private static EncounterArea[] addExtraTableSlots(EncounterArea[] GameSlots, EncounterArea[] SpecialSlots)
{
foreach (EncounterArea g in GameSlots)
{
foreach (var slots in SpecialSlots.Where(l => l.Location == g.Location))
g.Slots = g.Slots.Concat(slots.Slots).ToArray();
var tables = SpecialSlots.Where(l => l.Location == g.Location).ToList();
if (tables.Any())
g.Slots = g.Slots.Concat(tables.SelectMany(t => t.Slots)).ToArray();
}
return GameSlots.Concat(SpecialSlots.Where(s => !GameSlots.Any(g => g.Location == s.Location))).ToArray();
var notInserted = SpecialSlots.Where(s => GameSlots.All(g => g.Location != s.Location));
return GameSlots.Concat(notInserted).ToArray();
}
private static void ReduceAreasSize(ref EncounterArea[] Areas)
{
@ -195,6 +197,14 @@ namespace PKHeX.Core
{
ReduceAreasSize(ref Areas);
}
private static void MarkG4PokeWalker(ref EncounterStatic[] t)
{
foreach (EncounterStatic s in t)
{
s.Location = 233; //Pokéwalker
s.Gift = true; //Pokeball only
}
}
private static void MarkG4SwarmSlots(ref EncounterArea[] Areas, EncounterArea[] SwarmAreas)
{
// Swarm slots replace slots 0 and 1 from encounters data
@ -249,6 +259,14 @@ namespace PKHeX.Core
foreach (EncounterSlot s in Areas[0].Slots) //Only 1 area
s.Type = SlotType.HiddenGrotto;
}
private static void MarkG5DreamWorld(ref EncounterStatic[] t)
{
foreach (EncounterStatic s in t)
{
s.Location = 75; //Entree Forest. Location can be a flag from dream world
s.Ability = 4; //What if 1=2=HA?
}
}
private static void MarkG5Slots(ref EncounterArea[] Areas)
{
foreach (var area in Areas)
@ -348,7 +366,7 @@ namespace PKHeX.Core
var h_g = EncounterArea.getArray2_H(Resources.encounter_gold_h);
var h_s = EncounterArea.getArray2_H(Resources.encounter_silver_h);
Slots = addExtraTableSlots(addExtraTableSlots(addExtraTableSlots(addExtraTableSlots(g, s), h_g), h_s),f).ToArray();
Slots = addExtraTableSlots(addExtraTableSlots(addExtraTableSlots(addExtraTableSlots(g, s), h_g), h_s),f);
}
if (Version == GameVersion.C || Version == GameVersion.GSC)
{
@ -358,7 +376,7 @@ namespace PKHeX.Core
var h_c = EncounterArea.getArray2_H(Resources.encounter_crystal_h);
var extra = addExtraTableSlots(addExtraTableSlots(c, h_c),f);
return Version == GameVersion.C ? extra.ToArray() : addExtraTableSlots(Slots, extra).ToArray();
return Version == GameVersion.C ? extra : addExtraTableSlots(Slots, extra);
}
return Slots;
@ -406,11 +424,11 @@ namespace PKHeX.Core
MarkG3Slots_FRLG(ref FR_Slots);
MarkG3Slots_FRLG(ref LG_Slots);
SlotsR = addExtraTableSlots(R_Slots, SlotsRSEAlt).ToArray();
SlotsS = addExtraTableSlots(S_Slots, SlotsRSEAlt).ToArray();
SlotsE = addExtraTableSlots(E_Slots, SlotsRSEAlt).ToArray();
SlotsFR = addExtraTableSlots(FR_Slots, SlotsFRLGAlt).ToArray();
SlotsLG = addExtraTableSlots(LG_Slots, SlotsFRLGAlt).ToArray();
SlotsR = addExtraTableSlots(R_Slots, SlotsRSEAlt);
SlotsS = addExtraTableSlots(S_Slots, SlotsRSEAlt);
SlotsE = addExtraTableSlots(E_Slots, SlotsRSEAlt);
SlotsFR = addExtraTableSlots(FR_Slots, SlotsFRLGAlt);
SlotsLG = addExtraTableSlots(LG_Slots, SlotsFRLGAlt);
Evolves3 = new EvolutionTree(new[] { Resources.evos_g3 }, GameVersion.RS, PersonalTable.RS, MaxSpeciesID_3);
@ -426,6 +444,7 @@ namespace PKHeX.Core
}
// Gen 4
{
MarkG4PokeWalker(ref Encounter_PokeWalker);
StaticD = getStaticEncounters(GameVersion.D);
StaticP = getStaticEncounters(GameVersion.P);
StaticPt = getStaticEncounters(GameVersion.Pt);
@ -465,11 +484,11 @@ namespace PKHeX.Core
MarkG4Slots(ref HG_Headbutt_Slots);
MarkG4Slots(ref SS_Headbutt_Slots);
SlotsD = addExtraTableSlots(addExtraTableSlots(D_Slots, D_HoneyTrees_Slots), SlotsDPPPtAlt).ToArray();
SlotsP = addExtraTableSlots(addExtraTableSlots(P_Slots, P_HoneyTrees_Slots), SlotsDPPPtAlt).ToArray();
SlotsPt = addExtraTableSlots(addExtraTableSlots(Pt_Slots, Pt_HoneyTrees_Slots), SlotsDPPPtAlt).ToArray();
SlotsHG = addExtraTableSlots(addExtraTableSlots(HG_Slots, HG_Headbutt_Slots), SlotsHGSSAlt).ToArray();
SlotsSS = addExtraTableSlots(addExtraTableSlots(SS_Slots, SS_Headbutt_Slots), SlotsHGSSAlt).ToArray();
SlotsD = addExtraTableSlots(addExtraTableSlots(D_Slots, D_HoneyTrees_Slots), SlotsDPPPtAlt);
SlotsP = addExtraTableSlots(addExtraTableSlots(P_Slots, P_HoneyTrees_Slots), SlotsDPPPtAlt);
SlotsPt = addExtraTableSlots(addExtraTableSlots(Pt_Slots, Pt_HoneyTrees_Slots), SlotsDPPPtAlt);
SlotsHG = addExtraTableSlots(addExtraTableSlots(HG_Slots, HG_Headbutt_Slots), SlotsHGSSAlt);
SlotsSS = addExtraTableSlots(addExtraTableSlots(SS_Slots, SS_Headbutt_Slots), SlotsHGSSAlt);
Evolves4 = new EvolutionTree(new[] { Resources.evos_g4 }, GameVersion.DP, PersonalTable.DP, MaxSpeciesID_4);
@ -480,6 +499,8 @@ namespace PKHeX.Core
}
// Gen 5
{
MarkG5DreamWorld(ref BW_DreamWorld);
MarkG5DreamWorld(ref B2W2_DreamWorld);
StaticB = getStaticEncounters(GameVersion.B);
StaticW = getStaticEncounters(GameVersion.W);
StaticB2 = getStaticEncounters(GameVersion.B2);
@ -491,8 +512,8 @@ namespace PKHeX.Core
MarkG5Slots(ref WSlots);
MarkBWSwarmSlots(ref SlotsB_Swarm);
MarkBWSwarmSlots(ref SlotsW_Swarm);
SlotsB = addExtraTableSlots(BSlots, SlotsB_Swarm).ToArray();
SlotsW = addExtraTableSlots(WSlots, SlotsW_Swarm).ToArray();
SlotsB = addExtraTableSlots(BSlots, SlotsB_Swarm);
SlotsW = addExtraTableSlots(WSlots, SlotsW_Swarm);
var B2Slots = getEncounterTables(GameVersion.B2);
var W2Slots = getEncounterTables(GameVersion.W2);
@ -518,8 +539,8 @@ namespace PKHeX.Core
var YSlots = getEncounterTables(GameVersion.Y);
MarkG6XYSlots(ref XSlots);
MarkG6XYSlots(ref YSlots);
SlotsX = addExtraTableSlots(XSlots, SlotsXYAlt).ToArray();
SlotsY = addExtraTableSlots(YSlots, SlotsXYAlt).ToArray();
SlotsX = addExtraTableSlots(XSlots, SlotsXYAlt);
SlotsY = addExtraTableSlots(YSlots, SlotsXYAlt);
SlotsA = getEncounterTables(GameVersion.AS);
SlotsO = getEncounterTables(GameVersion.OR);
@ -609,7 +630,7 @@ namespace PKHeX.Core
r.AddRange(getRelearnLVLMoves(pkm, species, 100, pkm.AltForm));
return r.Distinct();
}
internal static IEnumerable<int> getBaseEggMoves(PKM pkm, int skipOption, GameVersion gameSource)
internal static IEnumerable<int> getBaseEggMoves(PKM pkm, int skipOption, GameVersion gameSource, int lvl)
{
int species = getBaseSpecies(pkm, skipOption);
@ -622,49 +643,63 @@ namespace PKHeX.Core
case GameVersion.S:
case GameVersion.RS:
if (pkm.InhabitedGeneration(3))
return LevelUpRS[species].getMoves(1);
return LevelUpRS[species].getMoves(lvl);
break;
case GameVersion.E:
if (pkm.InhabitedGeneration(3))
return LevelUpE[species].getMoves(1);
return LevelUpE[species].getMoves(lvl);
break;
case GameVersion.FR:
case GameVersion.LG:
case GameVersion.FRLG:
// only difference in FR/LG is deoxys which doesn't breed.
if (pkm.InhabitedGeneration(3))
return LevelUpFR[species].getMoves(1);
return LevelUpFR[species].getMoves(lvl);
break;
case GameVersion.D:
case GameVersion.P:
case GameVersion.DP:
if (pkm.InhabitedGeneration(4))
return LevelUpDP[species].getMoves(1);
return LevelUpDP[species].getMoves(lvl);
break;
case GameVersion.Pt:
if (pkm.InhabitedGeneration(4))
return LevelUpPt[species].getMoves(1);
return LevelUpPt[species].getMoves(lvl);
break;
case GameVersion.HG:
case GameVersion.SS:
case GameVersion.HGSS:
if (pkm.InhabitedGeneration(4))
return LevelUpHGSS[species].getMoves(1);
return LevelUpHGSS[species].getMoves(lvl);
break;
case GameVersion.B:
case GameVersion.W:
case GameVersion.BW:
if (pkm.InhabitedGeneration(5))
return LevelUpBW[species].getMoves(lvl);
break;
case GameVersion.B2:
case GameVersion.W2:
case GameVersion.B2W2:
if (pkm.InhabitedGeneration(5))
return LevelUpBW[species].getMoves(lvl);
break;
case GameVersion.X:
case GameVersion.Y:
case GameVersion.XY:
if (pkm.InhabitedGeneration(6))
return LevelUpXY[species].getMoves(1);
return LevelUpXY[species].getMoves(lvl);
break;
case GameVersion.AS:
case GameVersion.OR:
case GameVersion.ORAS:
if (pkm.InhabitedGeneration(6))
return LevelUpAO[species].getMoves(1);
return LevelUpAO[species].getMoves(lvl);
break;
case GameVersion.SN:
@ -672,7 +707,7 @@ namespace PKHeX.Core
case GameVersion.SM:
int index = PersonalTable.SM.getFormeIndex(species, pkm.AltForm);
if (pkm.InhabitedGeneration(7))
return LevelUpSM[index].getMoves(1);
return LevelUpSM[index].getMoves(lvl);
break;
}
return null;
@ -1042,7 +1077,16 @@ namespace PKHeX.Core
if (DB == null)
return validPCD;
// todo
if (pkm.Species == 490 && (pkm.WasEgg || pkm.IsEgg)) // Manaphy
{
int loc = pkm.IsEgg ? pkm.Met_Location : pkm.Egg_Location;
bool valid = loc == 2001; // Link Trade Egg
valid |= loc == 3001 && !pkm.IsShiny; // Ranger & notShiny
if (valid)
validPCD.Add(new PGT { Data = { [0] = 7, [8] = 1 } });
return validPCD;
}
var vs = getValidPreEvolutions(pkm).ToArray();
foreach (PCD mg in DB.OfType<PCD>().Where(wc => vs.Any(dl => dl.Species == wc.Species)))
{
@ -1057,12 +1101,32 @@ namespace PKHeX.Core
if (wc.Language != 0 && wc.Language != pkm.Language) continue;
}
if (wc.AltForm != pkm.AltForm && vs.All(dl => !getCanFormChange(pkm, dl.Species))) continue;
if (wc.Met_Location != pkm.Met_Location) continue;
if (wc.Egg_Location != pkm.Egg_Location) continue;
if (wc.IsEgg)
{
if (wc.Egg_Location + 3000 != pkm.Egg_Location) continue;
}
else
{
if (pkm.Format != 4) // transferred
{
bool valid = false;
if (pkm.Met_Location == 30001)
valid = true;
else if (CrownBeasts[0] == pkm.Species) // 251 = Celebi
valid = pkm.Met_Location == 30010 || pkm.Met_Location == 30011; // unused || used
else if (CrownBeasts.Skip(1).Any(x => x == pkm.Species)) // Raikou, Entei, Suicune
valid = pkm.Met_Location == 30012 || pkm.Met_Location == 30013; // unused || used
if (!valid)
continue;
}
else if (wc.Egg_Location + 3000 != pkm.Met_Location) continue;
}
if (wc.CurrentLevel != pkm.Met_Level) continue;
if (wc.Ball != pkm.Ball) continue;
if (wc.OT_Gender < 3 && wc.OT_Gender != pkm.OT_Gender) continue;
if (wc.Nature != 0xFF && wc.Nature != pkm.Nature) continue;
if (wc.PID == 1 && pkm.IsShiny) continue;
if (wc.Gender != 3 && wc.Gender != pkm.Gender) continue;
if (wc.CNT_Cool > pkm.CNT_Cool) continue;
@ -1092,13 +1156,12 @@ namespace PKHeX.Core
{
if (pkm.Egg_Location == 0) // Not Egg
{
if (wc.CardID != pkm.SID) continue;
if (wc.SID != pkm.SID) continue;
if (wc.TID != pkm.TID) continue;
if (wc.OT != pkm.OT_Name) continue;
if (wc.OTGender != pkm.OT_Gender) continue;
if (wc.PIDType == 0 && pkm.PID != wc.PID) continue;
if (wc.PID != 0 && pkm.PID != wc.PID) continue;
if (wc.PIDType == 0 && pkm.IsShiny) continue;
if (wc.PIDType == 2 && !pkm.IsShiny) continue;
if (wc.PIDType == 3 && pkm.IsShiny) continue;
if (wc.OriginGame != 0 && wc.OriginGame != pkm.Version) continue;
if (wc.Language != 0 && wc.Language != pkm.Language) continue;
}

View file

@ -1,63 +1,10 @@
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Local
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
using System;
using System.Collections.Generic;
using System.Linq;
namespace PKHeX.Core
{
public static class CheckStrings
public static class LegalityCheckStrings
{
private const string splitter = " = ";
private static readonly Type t = typeof(CheckStrings);
private static string[] getProps(IEnumerable<string> input)
{
return input.Select(l => l.Substring(0, l.IndexOf(splitter, StringComparison.Ordinal))).ToArray();
}
private static IEnumerable<string> DumpStrings()
{
var props = ReflectUtil.getPropertiesStartWithPrefix(t, "V");
return props.Select(p => $"{p}{splitter}{ReflectUtil.GetValue(t, p).ToString()}");
}
public static void setLocalization(IEnumerable<string> lines)
{
if (lines == null)
return;
foreach (var line in lines.Where(l => l != null))
{
var index = line.IndexOf(splitter, StringComparison.Ordinal);
if (index < 0)
continue;
var prop = line.Substring(0, index);
var value = line.Substring(index + splitter.Length);
try
{
ReflectUtil.SetValue(t, prop.ToUpper(), value);
}
catch
{
Console.WriteLine($"Property not present: {prop} || Value written: {value}");
}
}
}
public static string[] getLocalization(string[] existingLines = null)
{
existingLines = existingLines ?? new string[0];
var currentLines = DumpStrings().ToArray();
var existing = getProps(existingLines);
var current = getProps(currentLines);
var result = new string[currentLines.Length];
for (int i = 0; i < current.Length; i++)
{
int index = Array.IndexOf(existing, current[i]);
result[i] = index < 0 ? currentLines[i] : existingLines[index];
}
return result;
}
#region General Strings
@ -99,6 +46,10 @@ namespace PKHeX.Core
#region Legality Check Result Strings
public static string V250 {get; set;} = "Gender matches PID.";
public static string V251 {get; set;} = "PID-Gender mismatch.";
public static string V252 {get; set;} = "Nature matches PID.";
public static string V253 {get; set;} = "PID-Nature mismatch.";
public static string V203 {get; set;} = "Genderless Pokémon should not have a gender.";
public static string V201 {get; set;} = "Encryption Constant is not set.";
public static string V204 {get; set;} = "Held item is unreleased.";

View file

@ -66,6 +66,44 @@
};
}
public EncounterStatic[] DreamRadarClone()
{
EncounterStatic[] Encounters = new EncounterStatic[8];
for (int i = 0; i < 8; i++)
Encounters[i] = DreamRadarClone(5 * i + 5); //Level from 5->40 depends on the number of badage
return Encounters;
}
public EncounterStatic DreamRadarClone(int level)
{
return new EncounterStatic()
{
Species = Species,
Level = level,
Location = 30015, //Pokemon Dream Radar
Ability = Ability,
Form = Form,
Shiny = Shiny,
Relearn = Relearn,
Moves = Moves,
Gender = Gender,
EggLocation = EggLocation,
Nature = Nature,
Gift = Gift,
Ball = 25, //Dream Ball
Version = Version,
IVs = IVs,
IV3 = IV3,
Contest = Contest,
HeldItem = HeldItem,
Fateful = Fateful,
RibbonWishing = RibbonWishing,
SkipFormCheck = SkipFormCheck,
NSparkle = NSparkle,
Roaming = Roaming
};
}
public string Name
{
get

View file

@ -198,6 +198,180 @@ namespace PKHeX.Core
new[] { 147, 148, 149, 230, 329, 330, 334, 371, 372, 373, 380, 381, 384, 443, 444, 445, 483, 484, 487 }
};
#region Pokéwalker Encounter
// all pkm are in Poke Ball and have a met location of "PokeWalker"
internal static readonly EncounterStatic[] Encounter_PokeWalker =
{
// Some pkm has a pre-level move, an egg move or even a special move, it might be also available via HM/TM/Tutor
// Johto/Kanto Courses
new EncounterStatic{ Species = 084, Gender = 1, Level = 08, }, // Doduo
new EncounterStatic{ Species = 115, Gender = 1, Level = 08, }, // Kangaskhan
new EncounterStatic{ Species = 029, Gender = 1, Level = 05, }, // Nidoran1
new EncounterStatic{ Species = 032, Gender = 0, Level = 05, }, // Nidoran0
new EncounterStatic{ Species = 016, Gender = 0, Level = 05, }, // Pidgey
new EncounterStatic{ Species = 161, Gender = 1, Level = 05, }, // Sentret
new EncounterStatic{ Species = 202, Gender = 1, Level = 15, }, // Wobbuffet
new EncounterStatic{ Species = 069, Gender = 1, Level = 08, }, // Bellsprout
new EncounterStatic{ Species = 046, Gender = 1, Level = 06, }, // Paras
new EncounterStatic{ Species = 048, Gender = 0, Level = 06, }, // Venonat
new EncounterStatic{ Species = 021, Gender = 0, Level = 05, }, // Spearow
new EncounterStatic{ Species = 043, Gender = 1, Level = 05, }, // Oddish
new EncounterStatic{ Species = 095, Gender = 0, Level = 09, }, // Onix
new EncounterStatic{ Species = 240, Gender = 0, Level = 09, Moves = new[]{241},}, // Magby: Sunny Day
new EncounterStatic{ Species = 066, Gender = 1, Level = 07, }, // Machop
new EncounterStatic{ Species = 077, Gender = 1, Level = 07, }, // Ponyta
new EncounterStatic{ Species = 074, Gender = 1, Level = 08, Moves = new[]{189},}, // Geodude: Mud-Slap
new EncounterStatic{ Species = 163, Gender = 1, Level = 06, }, // Hoothoot
new EncounterStatic{ Species = 054, Gender = 1, Level = 10, }, // Psyduck
new EncounterStatic{ Species = 120, Gender = 2, Level = 10, }, // Staryu
new EncounterStatic{ Species = 060, Gender = 0, Level = 08, }, // Poliwag
new EncounterStatic{ Species = 079, Gender = 0, Level = 08, }, // Slowpoke
new EncounterStatic{ Species = 191, Gender = 1, Level = 06, }, // Sunkern
new EncounterStatic{ Species = 194, Gender = 0, Level = 06, }, // Wooper
new EncounterStatic{ Species = 081, Gender = 2, Level = 11, }, // Magnemite
new EncounterStatic{ Species = 239, Gender = 0, Level = 11, Moves = new[]{009},}, // Elekid: Thunder Punch
new EncounterStatic{ Species = 081, Gender = 2, Level = 08, }, // Magnemite
new EncounterStatic{ Species = 198, Gender = 1, Level = 11, }, // Murkrow
new EncounterStatic{ Species = 019, Gender = 1, Level = 07, }, // Rattata
new EncounterStatic{ Species = 163, Gender = 1, Level = 07, }, // Hoothoot
new EncounterStatic{ Species = 092, Gender = 1, Level = 15, Moves = new[]{194},}, // Gastly: Destiny Bond
new EncounterStatic{ Species = 238, Gender = 1, Level = 12, Moves = new[]{419},}, // Smoochum: Avalanche
new EncounterStatic{ Species = 092, Gender = 1, Level = 10, }, // Gastly
new EncounterStatic{ Species = 095, Gender = 0, Level = 10, }, // Onix
new EncounterStatic{ Species = 041, Gender = 0, Level = 08, }, // Zubat
new EncounterStatic{ Species = 066, Gender = 0, Level = 08, }, // Machop
new EncounterStatic{ Species = 060, Gender = 1, Level = 15, Moves = new[]{187}, }, // Poliwag: Belly Drum
new EncounterStatic{ Species = 147, Gender = 1, Level = 10, }, // Dratini
new EncounterStatic{ Species = 090, Gender = 1, Level = 12, }, // Shellder
new EncounterStatic{ Species = 098, Gender = 0, Level = 12, Moves = new[]{152}, }, // Krabby: Crabhammer
new EncounterStatic{ Species = 072, Gender = 1, Level = 09, }, // Tentacool
new EncounterStatic{ Species = 118, Gender = 1, Level = 09, }, // Goldeen
new EncounterStatic{ Species = 063, Gender = 1, Level = 15, }, // Abra
new EncounterStatic{ Species = 100, Gender = 2, Level = 15, }, // Voltorb
new EncounterStatic{ Species = 088, Gender = 0, Level = 13, }, // Grimer
new EncounterStatic{ Species = 109, Gender = 1, Level = 13, Moves = new[]{120}, }, // Koffing: Self-Destruct
new EncounterStatic{ Species = 019, Gender = 1, Level = 16, }, // Rattata
new EncounterStatic{ Species = 162, Gender = 0, Level = 15, }, // Furret
// Hoenn Courses
new EncounterStatic{ Species = 264, Gender = 1, Level = 30, }, // Linoone
new EncounterStatic{ Species = 300, Gender = 1, Level = 30, }, // Skitty
new EncounterStatic{ Species = 313, Gender = 0, Level = 25, }, // Volbeat
new EncounterStatic{ Species = 314, Gender = 1, Level = 25, }, // Illumise
new EncounterStatic{ Species = 263, Gender = 1, Level = 17, }, // Zigzagoon
new EncounterStatic{ Species = 265, Gender = 1, Level = 15, }, // Wurmple
new EncounterStatic{ Species = 298, Gender = 1, Level = 20, }, // Azurill
new EncounterStatic{ Species = 320, Gender = 1, Level = 31, }, // Wailmer
new EncounterStatic{ Species = 116, Gender = 1, Level = 20, }, // Horsea
new EncounterStatic{ Species = 318, Gender = 1, Level = 26, }, // Carvanha
new EncounterStatic{ Species = 118, Gender = 1, Level = 22, Moves = new[]{401}, }, // Goldeen: Aqua Tail
new EncounterStatic{ Species = 129, Gender = 1, Level = 15, }, // Magikarp
new EncounterStatic{ Species = 218, Gender = 1, Level = 31, }, // Slugma
new EncounterStatic{ Species = 307, Gender = 0, Level = 32, }, // Meditite
new EncounterStatic{ Species = 111, Gender = 0, Level = 25, }, // Rhyhorn
new EncounterStatic{ Species = 228, Gender = 0, Level = 27, }, // Houndour
new EncounterStatic{ Species = 074, Gender = 0, Level = 29, }, // Geodude
new EncounterStatic{ Species = 077, Gender = 1, Level = 19, }, // Ponyta
new EncounterStatic{ Species = 351, Gender = 1, Level = 30, }, // Castform
new EncounterStatic{ Species = 352, Gender = 0, Level = 30, }, // Kecleon
new EncounterStatic{ Species = 203, Gender = 1, Level = 28, }, // Girafarig
new EncounterStatic{ Species = 234, Gender = 1, Level = 28, }, // Stantler
new EncounterStatic{ Species = 044, Gender = 1, Level = 14, }, // Gloom
new EncounterStatic{ Species = 070, Gender = 0, Level = 13, }, // Weepinbell
new EncounterStatic{ Species = 105, Gender = 1, Level = 30, Moves = new[]{037}, }, // Marowak: Tharsh
new EncounterStatic{ Species = 128, Gender = 0, Level = 30, }, // Tauros
new EncounterStatic{ Species = 042, Gender = 0, Level = 33, }, // Golbat
new EncounterStatic{ Species = 177, Gender = 1, Level = 24, }, // Natu
new EncounterStatic{ Species = 066, Gender = 0, Level = 13, Moves = new[]{418}, }, // Machop: Bullet Punch
new EncounterStatic{ Species = 092, Gender = 1, Level = 15, }, // Gastly
// Sinnoh Courses
new EncounterStatic{ Species = 415, Gender = 0, Level = 30, }, // Combee
new EncounterStatic{ Species = 439, Gender = 0, Level = 29, }, // Mime Jr.
new EncounterStatic{ Species = 403, Gender = 1, Level = 33, }, // Shinx
new EncounterStatic{ Species = 406, Gender = 0, Level = 30, }, // Budew
new EncounterStatic{ Species = 399, Gender = 1, Level = 13, }, // Bidoof
new EncounterStatic{ Species = 401, Gender = 0, Level = 15, }, // Kricketot
new EncounterStatic{ Species = 361, Gender = 1, Level = 28, }, // Snorunt
new EncounterStatic{ Species = 459, Gender = 0, Level = 31, Moves = new[]{452}, }, // Snover: Wood Hammer
new EncounterStatic{ Species = 215, Gender = 0, Level = 28, Moves = new[]{306}, }, // Sneasel: Crash Claw
new EncounterStatic{ Species = 436, Gender = 2, Level = 20, }, // Bronzor
new EncounterStatic{ Species = 179, Gender = 1, Level = 15, }, // Mareep
new EncounterStatic{ Species = 220, Gender = 1, Level = 16, }, // Swinub
new EncounterStatic{ Species = 357, Gender = 1, Level = 35, }, // Tropius
new EncounterStatic{ Species = 438, Gender = 0, Level = 30, }, // Bonsly
new EncounterStatic{ Species = 114, Gender = 1, Level = 30, }, // Tangela
new EncounterStatic{ Species = 400, Gender = 1, Level = 30, }, // Bibarel
new EncounterStatic{ Species = 102, Gender = 1, Level = 17, }, // Exeggcute
new EncounterStatic{ Species = 179, Gender = 0, Level = 19, }, // Mareep
new EncounterStatic{ Species = 200, Gender = 1, Level = 32, Moves = new[]{194},}, // Misdreavus: Destiny Bond
new EncounterStatic{ Species = 433, Gender = 0, Level = 22, Moves = new[]{105},}, // Chingling: Recover
new EncounterStatic{ Species = 093, Gender = 0, Level = 25, }, // Haunter
new EncounterStatic{ Species = 418, Gender = 0, Level = 28, Moves = new[]{226},}, // Buizel: Baton Pass
new EncounterStatic{ Species = 170, Gender = 1, Level = 17, }, // Chinchou
new EncounterStatic{ Species = 223, Gender = 1, Level = 19, }, // Remoraid
new EncounterStatic{ Species = 422, Gender = 1, Level = 30, }, // Shellos
new EncounterStatic{ Species = 456, Gender = 1, Level = 26, }, // Finneon
new EncounterStatic{ Species = 086, Gender = 1, Level = 27, }, // Seel
new EncounterStatic{ Species = 129, Gender = 1, Level = 30, }, // Magikarp
new EncounterStatic{ Species = 054, Gender = 1, Level = 22, }, // Psyduck
new EncounterStatic{ Species = 090, Gender = 0, Level = 20, }, // Shellder
new EncounterStatic{ Species = 025, Gender = 1, Level = 30, }, // Pikachu
new EncounterStatic{ Species = 417, Gender = 1, Level = 33, }, // Pachirisu
new EncounterStatic{ Species = 035, Gender = 1, Level = 31, }, // Clefairy
new EncounterStatic{ Species = 039, Gender = 1, Level = 30, }, // Jigglypuff
new EncounterStatic{ Species = 183, Gender = 1, Level = 25, }, // Marill
new EncounterStatic{ Species = 187, Gender = 1, Level = 25, }, // Hoppip
new EncounterStatic{ Species = 442, Gender = 0, Level = 31, }, // Spiritomb
new EncounterStatic{ Species = 446, Gender = 0, Level = 33, }, // Munchlax
new EncounterStatic{ Species = 349, Gender = 0, Level = 30, }, // Feebas
new EncounterStatic{ Species = 433, Gender = 1, Level = 26, }, // Chingling
new EncounterStatic{ Species = 042, Gender = 0, Level = 33, }, // Golbat
new EncounterStatic{ Species = 164, Gender = 1, Level = 30, }, // Noctowl
// Special Courses
new EncounterStatic{ Species = 120, Gender = 2, Level = 18, Moves = new[]{113}, }, // Staryu: Light Screen
new EncounterStatic{ Species = 224, Gender = 1, Level = 19, Moves = new[]{324}, }, // Octillery: Signal Beam
new EncounterStatic{ Species = 116, Gender = 0, Level = 15, }, // Horsea
new EncounterStatic{ Species = 222, Gender = 1, Level = 16, }, // Corsola
new EncounterStatic{ Species = 170, Gender = 1, Level = 12, }, // Chinchou
new EncounterStatic{ Species = 223, Gender = 0, Level = 14, }, // Remoraid
new EncounterStatic{ Species = 035, Gender = 0, Level = 08, Moves = new[]{236}, }, // Clefairy: Moonlight
new EncounterStatic{ Species = 039, Gender = 0, Level = 10, }, // Jigglypuff
new EncounterStatic{ Species = 041, Gender = 0, Level = 09, }, // Zubat
new EncounterStatic{ Species = 163, Gender = 1, Level = 06, }, // Hoothoot
new EncounterStatic{ Species = 074, Gender = 0, Level = 05, }, // Geodude
new EncounterStatic{ Species = 095, Gender = 1, Level = 05, Moves = new[]{088}, }, // Onix: Rock Throw
new EncounterStatic{ Species = 025, Gender = 0, Level = 15, Moves = new[]{019}, }, // Pikachu: Fly
new EncounterStatic{ Species = 025, Gender = 1, Level = 14, Moves = new[]{057}, }, // Pikachu: Surf
new EncounterStatic{ Species = 025, Gender = 1, Level = 12, Moves = new[]{344}, }, // Pikachu: Volt Tackle
new EncounterStatic{ Species = 025, Gender = 0, Level = 13, Moves = new[]{175}, }, // Pikachu: Flail
new EncounterStatic{ Species = 025, Gender = 0, Level = 10, }, // Pikachu
new EncounterStatic{ Species = 025, Gender = 1, Level = 10, }, // Pikachu
new EncounterStatic{ Species = 302, Gender = 1, Level = 15, }, // Sableye
new EncounterStatic{ Species = 441, Gender = 0, Level = 15, }, // Chatot
new EncounterStatic{ Species = 025, Gender = 1, Level = 10, }, // Pikachu
new EncounterStatic{ Species = 453, Gender = 0, Level = 10, }, // Croagunk
new EncounterStatic{ Species = 417, Gender = 0, Level = 05, }, // Pachirisu
new EncounterStatic{ Species = 427, Gender = 1, Level = 05, }, // Buneary
new EncounterStatic{ Species = 133, Gender = 0, Level = 10, }, // Eevee
new EncounterStatic{ Species = 255, Gender = 0, Level = 10, }, // Torchic
new EncounterStatic{ Species = 061, Gender = 1, Level = 15, Moves = new[]{003}, }, // Poliwhirl: Double Slap
new EncounterStatic{ Species = 279, Gender = 0, Level = 15, }, // Pelipper
new EncounterStatic{ Species = 025, Gender = 1, Level = 08, }, // Pikachu
new EncounterStatic{ Species = 052, Gender = 0, Level = 10, }, // Meowth
new EncounterStatic{ Species = 374, Gender = 2, Level = 05, Moves = new[]{428,334,442}, }, // Beldum: Zen Headbutt, Iron Defense & Iron Head.
new EncounterStatic{ Species = 446, Gender = 0, Level = 05, Moves = new[]{120}, }, // Munchlax: Self-Destruct
new EncounterStatic{ Species = 116, Gender = 0, Level = 05, Moves = new[]{330}, }, // Horsea: Muddy Water
new EncounterStatic{ Species = 355, Gender = 0, Level = 05, Moves = new[]{286}, }, // Duskull: Imprison
new EncounterStatic{ Species = 129, Gender = 0, Level = 05, Moves = new[]{340}, }, // Magikarp: Bounce
new EncounterStatic{ Species = 436, Gender = 2, Level = 05, Moves = new[]{433}, }, // Bronzor: Trick Room
new EncounterStatic{ Species = 239, Gender = 0, Level = 05, }, // Elekid
new EncounterStatic{ Species = 240, Gender = 0, Level = 05, }, // Magby
new EncounterStatic{ Species = 238, Gender = 1, Level = 05, }, // Smoochum
new EncounterStatic{ Species = 440, Gender = 1, Level = 05, }, // Happiny
new EncounterStatic{ Species = 173, Gender = 1, Level = 05, }, // Cleffa
new EncounterStatic{ Species = 174, Gender = 0, Level = 05, }, // Igglybuff
};
#endregion
#region Static Encounter/Gift Tables
internal static readonly int[] Roaming_MetLocation_DPPt =
{
// Route 201-222 can be encountered in either grass or water
@ -225,7 +399,6 @@ namespace PKHeX.Core
new EncounterStatic { Gift = true, Species = 387, Level = 5, Location = 016, Version = GameVersion.Pt,}, // Turtwig @ Route 201
new EncounterStatic { Gift = true, Species = 390, Level = 5, Location = 016, Version = GameVersion.Pt,}, // Chimchar
new EncounterStatic { Gift = true, Species = 393, Level = 5, Location = 016, Version = GameVersion.Pt,}, // Piplup
//Fossil @ Mining Museum
new EncounterStatic { Gift = true, Species = 138, Level = 20, Location = 094, }, // Omanyte
new EncounterStatic { Gift = true, Species = 140, Level = 20, Location = 094, }, // Kabuto
@ -234,7 +407,6 @@ namespace PKHeX.Core
new EncounterStatic { Gift = true, Species = 347, Level = 20, Location = 094, }, // Anorith
new EncounterStatic { Gift = true, Species = 408, Level = 20, Location = 094, }, // Cranidos
new EncounterStatic { Gift = true, Species = 410, Level = 20, Location = 094, }, // Shieldon
//Gift
new EncounterStatic { Gift = true, Species = 133, Level = 05, Location = 010, Version = GameVersion.DP,}, //Eevee @ Hearthome City
new EncounterStatic { Gift = true, Species = 133, Level = 20, Location = 010, Version = GameVersion.Pt,}, //Eevee @ Hearthome City
@ -242,13 +414,17 @@ namespace PKHeX.Core
new EncounterStatic { Gift = true, Species = 175, Level = 01, EggLocation = 2011, Version = GameVersion.Pt,}, //Togepi Egg from Cynthia
new EncounterStatic { Gift = true, Species = 440, Level = 01, EggLocation = 2009, Version = GameVersion.DP,}, //Happiny Egg from Traveling Man
new EncounterStatic { Gift = true, Species = 447, Level = 01, EggLocation = 2010,}, //Riolu Egg from Riley
//Stationary
new EncounterStatic { Species = 425, Level = 22, Location = 47, Version = GameVersion.DP, },// Drifloon @ Valley Windworks
new EncounterStatic { Species = 425, Level = 15, Location = 47, Version = GameVersion.Pt, },// Drifloon @ Valley Windworks
new EncounterStatic { Species = 479, Level = 15, Location = 70, Version = GameVersion.DP, },// Rotom @ Old Chateau
new EncounterStatic { Species = 479, Level = 20, Location = 70, Version = GameVersion.Pt, },// Rotom @ Old Chateau
//Stationary Lengerdary
new EncounterStatic { Species = 377, Level = 30, Location = 125, Version = GameVersion.Pt,}, //Regirock @ Rock Peak Ruins
new EncounterStatic { Species = 378, Level = 30, Location = 124, Version = GameVersion.Pt,}, //Regice @ Iceberg Ruins
new EncounterStatic { Species = 379, Level = 30, Location = 123, Version = GameVersion.Pt,}, //Registeel @ Iron Ruins
new EncounterStatic { Species = 480, Level = 50, Location = 078,}, //Uxie @ Lake Acuity
new EncounterStatic { Species = 482, Level = 50, Location = 077,}, //Azelf @ Lake Valor
new EncounterStatic { Species = 480, Level = 50, Location = 089,}, //Uxie @ Acuity Cavern
new EncounterStatic { Species = 482, Level = 50, Location = 088,}, //Azelf @ Valor Cavern
new EncounterStatic { Species = 483, Level = 47, Location = 051, Version = GameVersion.D,}, //Dialga @ Spear Pillar
new EncounterStatic { Species = 483, Level = 70, Location = 051, Version = GameVersion.Pt,}, //Dialga @ Spear Pillar
new EncounterStatic { Species = 484, Level = 47, Location = 051, Version = GameVersion.P,}, //Palkia @ Spear Pillar
@ -260,7 +436,6 @@ namespace PKHeX.Core
new EncounterStatic { Species = 487, Level = 70, Location = 062, Version = GameVersion.DP, Form = 0, }, //Giratina @ Turnback Cave
new EncounterStatic { Species = 487, Level = 47, Location = 117, Version = GameVersion.Pt, Form = 1, }, //Giratina @ Distortion World
new EncounterStatic { Species = 487, Level = 47, Location = 062, Version = GameVersion.Pt, Form = 0, }, //Giratina @ Turnback Cave
//Event
new EncounterStatic { Species = 490, Level = 01, EggLocation = 3001, Fateful = true, Gift = true }, //Manaphy from Pokemon Ranger
new EncounterStatic { Species = 491, Level = 40, Location = 079, Version = GameVersion.DP,}, //Darkrai @ Newmoon Island
@ -268,7 +443,6 @@ namespace PKHeX.Core
new EncounterStatic { Species = 492, Form = 0, Level = 30, Location = 063,}, //Shaymin @ Flower Paradise
//new EncounterStatic { Species = 493, Level = 80, Location = 086,}, //Arceus @ Hall of Origin
};
internal static readonly EncounterStatic[] Encounter_DPPt = Encounter_DPPt_Roam.SelectMany(e => e.Clone(Roaming_MetLocation_DPPt)).Concat(Encounter_DPPt_Regular).ToArray();
internal static readonly int[] Roaming_MetLocation_HGSS_Johto =
@ -282,7 +456,6 @@ namespace PKHeX.Core
new EncounterStatic { Species = 243, Level = 40, Roaming = true }, // Raikou
new EncounterStatic { Species = 244, Level = 40, Roaming = true }, // Entei
};
internal static readonly int[] Roaming_MetLocation_HGSS_Kanto =
{
// Route 01-28 can be encountered in either grass or water
@ -295,7 +468,6 @@ namespace PKHeX.Core
new EncounterStatic { Species = 380, Level = 35, Version = GameVersion.HG, Roaming = true }, //Latias
new EncounterStatic { Species = 381, Level = 35, Version = GameVersion.SS, Roaming = true }, //Latios
};
internal static readonly EncounterStatic[] Encounter_HGSS_Regular =
{
//Starters
@ -308,7 +480,6 @@ namespace PKHeX.Core
new EncounterStatic { Gift = true, Species = 252, Level = 05, Location = 148, }, // Treecko @ Saffron City
new EncounterStatic { Gift = true, Species = 255, Level = 05, Location = 148, }, // Torchic
new EncounterStatic { Gift = true, Species = 258, Level = 05, Location = 148, }, // Mudkip
//Fossil @ Pewter City
new EncounterStatic { Gift = true, Species = 138, Level = 20, Location = 140, }, // Omanyte
new EncounterStatic { Gift = true, Species = 140, Level = 20, Location = 140, }, // Kabuto
@ -317,7 +488,6 @@ namespace PKHeX.Core
new EncounterStatic { Gift = true, Species = 347, Level = 20, Location = 140, }, // Anorith
new EncounterStatic { Gift = true, Species = 408, Level = 20, Location = 140, }, // Cranidos
new EncounterStatic { Gift = true, Species = 410, Level = 20, Location = 140, }, // Shieldon
//Gift
new EncounterStatic { Gift = true, Species = 133, Level = 05, Location = 131, }, // Eevee @ Goldenrod City
new EncounterStatic { Gift = true, Species = 147, Level = 15, Location = 222, Moves = new[] {245, 086, 239, 082}, }, // Dratini @ Dragon's Den (ExtremeSpeed)
@ -328,14 +498,14 @@ namespace PKHeX.Core
new EncounterStatic { Gift = true, Species = 194, Level = 01, EggLocation = 2014,}, // Wooper Egg from Primo
new EncounterStatic { Gift = true, Species = 218, Level = 01, EggLocation = 2014,}, // Slugma Egg from Primo
new EncounterStatic { Gift = true, Species = 490, Level = 01, EggLocation = 3001, Fateful = true, }, //Manaphy from Pokemon Ranger
//Stationary
new EncounterStatic { Species = 130, Level = 30, Location = 135, Shiny = true }, //Gyarados @ Lake of Rage
new EncounterStatic { Species = 131, Level = 20, Location = 210, }, //Lapras @ Union Cave Friday Only
new EncounterStatic { Species = 101, Level = 23, Location = 213, }, //Electrode @ Team Rocket HQ
new EncounterStatic { Species = 143, Level = 50, Location = 159, }, //Snorlax @ Route 11
new EncounterStatic { Species = 143, Level = 50, Location = 160, }, //Snorlax @ Route 12
new EncounterStatic { Species = 185, Level = 20, Location = 184, }, //Sudowoodo @ Route 36
new EncounterStatic { Species = 172, Level = 30, Location = 214, Gender = 1, Form = 1, Moves = new[]{344,270,207,220} }, //Spiky-eared Pichu @ Ilex forest
//Stationary Lengerdary
new EncounterStatic { Species = 144, Level = 50, Location = 203, }, //Articuno @ Seafoam Islands
new EncounterStatic { Species = 145, Level = 50, Location = 158, }, //Zapdos @ Route 10
@ -352,15 +522,15 @@ namespace PKHeX.Core
new EncounterStatic { Species = 382, Level = 50, Location = 232, Version = GameVersion.HG, }, //Kyogre @ Embedded Tower
new EncounterStatic { Species = 383, Level = 50, Location = 232, Version = GameVersion.SS, }, //Groudon @ Embedded Tower
new EncounterStatic { Species = 384, Level = 50, Location = 232, }, //Rayquaza @ Embedded Tower
new EncounterStatic { Species = 483, Level = 01, Location = 231, }, //Dialga @ Sinjoh Ruins
new EncounterStatic { Species = 484, Level = 01, Location = 231, }, //Palkia @ Sinjoh Ruins
new EncounterStatic { Species = 487, Level = 01, Location = 231, Form = 1}, //Giratina @ Sinjoh Ruins
new EncounterStatic { Species = 483, Level = 01, Location = 231, Gift = true }, //Dialga @ Sinjoh Ruins
new EncounterStatic { Species = 484, Level = 01, Location = 231, Gift = true }, //Palkia @ Sinjoh Ruins
new EncounterStatic { Species = 487, Level = 01, Location = 231, Gift = true, Form = 1}, //Giratina @ Sinjoh Ruins
};
internal static readonly EncounterStatic[] Encounter_HGSS = Encounter_HGSS_KantoRoam.SelectMany(e => e.Clone(Roaming_MetLocation_HGSS_Kanto)).Concat(
Encounter_HGSS_JohtoRoam.SelectMany(e => e.Clone(Roaming_MetLocation_HGSS_Johto))).Concat(
Encounter_HGSS_Regular).ToArray();
#endregion
#region Trade Tables
internal static readonly EncounterTrade[] TradeGift_DPPt =
{
new EncounterTrade { Species = 063, Ability = 1, TID = 25643, SID = 00000, OTGender = 1, Gender = 0, IVs = new[] {15,15,15,25,25,20}, Nature = Nature.Quiet,}, // Abra
@ -380,11 +550,11 @@ namespace PKHeX.Core
new EncounterTrade { Species = 374, Ability = 1, TID = 23478, SID = 00000, OTGender = 0, Gender = 2, IVs = new[] {28,29,24,24,25,23}, Nature = Nature.Brave,}, // Beldum
new EncounterTrade { Species = 111, Ability = 1, TID = 06845, SID = 00000, OTGender = 0, Gender = 1, IVs = new[] {22,31,13,22,09,00}, Nature = Nature.Relaxed, Moves= new[]{422,-1,-1,-1} }, // Rhyhorn
new EncounterTrade { Species = 208, Ability = 1, TID = 26491, SID = 00000, OTGender = 1, Gender = 0, IVs = new[] {08,30,28,18,20,06}, Nature = Nature.Brave,}, // Steelix
//Gift
new EncounterTrade { Species = 021, Ability = 1, TID = 01001, SID = 00000, OTGender = 0, Gender = 1, Nature = Nature.Hasty, Level = 20, Location = 183, Moves= new[]{043,031,228,332}},//Webster's Spearow
new EncounterTrade { Species = 213, Ability = 2, TID = 04336, SID = 00000, OTGender = 0, Gender = 1, Nature = Nature.Relaxed, Level = 20, Location = 130, Moves= new[]{132,117,227,219}},//Kirk's Shuckle
};
#endregion
// Encounter Slots that are replaced
internal static readonly int[] Slot4_Time = {2, 3};

View file

@ -118,12 +118,365 @@ namespace PKHeX.Core
internal static readonly bool[] ReleasedHeldItems_5 = Enumerable.Range(0, MaxItemID_5_B2W2 + 1).Select(i => HeldItems_BW.Contains((ushort)i) && !UnreleasedItems_5.Contains(i)).ToArray();
internal static readonly int[][] Tutors_B2W2 =
{
new[] { 343, 450, 529, 340, 324, 442, 162, 253, 402, 530, 067, 441, 007, 009, 008 }, // Driftveil City
new[] { 387, 334, 393, 277, 335, 304, 527, 196, 231, 401, 414, 428, 492, 276, 356, 406, 399 }, // Lentimas Town
new[] { 020, 173, 215, 282, 235, 355, 143, 272, 257, 202, 409, 220, 366 }, // Humilau City
new[] { 388, 380, 270, 495, 478, 472, 180, 278, 271, 446, 200, 283, 214, 285, 289, } // Nacrene City
new[] { 450, 343, 162, 530, 324, 442, 402, 529, 340, 067, 441, 253, 009, 007, 008 }, // Driftveil City
new[] { 277, 335, 414, 492, 356, 393, 334, 387, 276, 527, 196, 401, 399, 428, 406, 304 }, // Lentimas Town
new[] { 231, 020, 173, 282, 235, 257, 272, 215, 366, 143, 220, 202, 409, 355 }, // Humilau City
new[] { 380, 388, 180, 495, 270, 271, 478, 472, 283, 200, 278, 289, 446, 214, 285 } // Nacrene City
};
#region Dream Radar Tables
internal static readonly EncounterStatic[] Encounter_DreamRadar =
{
new EncounterStatic { Species=120, Ability = 4 },
new EncounterStatic { Species=137, Ability = 4 },
new EncounterStatic { Species=174, Ability = 4 },
new EncounterStatic { Species=175, Ability = 4 },
new EncounterStatic { Species=213, Ability = 4 },
new EncounterStatic { Species=238, Ability = 4 },
new EncounterStatic { Species=280, Ability = 4 },
new EncounterStatic { Species=333, Ability = 4 },
new EncounterStatic { Species=425, Ability = 4 },
new EncounterStatic { Species=436, Ability = 4 },
new EncounterStatic { Species=442, Ability = 4 },
new EncounterStatic { Species=447, Ability = 4 },
new EncounterStatic { Species=479,}, // Rotom has no HA
new EncounterStatic { Species=517, Ability = 4 },
new EncounterStatic { Species=561, Ability = 4 },
new EncounterStatic { Species=641, Ability = 4, Form = 1}, //Tornadus-T
new EncounterStatic { Species=642, Ability = 4, Form = 1}, //Thunderus-T
new EncounterStatic { Species=645, Ability = 4, Form = 1}, //Landorus-T
new EncounterStatic { Species=249, Ability = 4 }, //SS
new EncounterStatic { Species=250, Ability = 4 }, //HG
new EncounterStatic { Species=483, Ability = 4 }, //D
new EncounterStatic { Species=484, Ability = 4 }, //P
new EncounterStatic { Species=487, Ability = 4 }, //Pt
new EncounterStatic { Species=079, Ability = 4 }, //Slowpoke
new EncounterStatic { Species=163, Ability = 4 }, //Hoothoot
new EncounterStatic { Species=374, Ability = 4 }, //Beldum
};
#endregion
#region DreamWorld Encounter
internal static readonly EncounterStatic[] DreamWorld_Common =
{
// Pleasant forest
new EncounterStatic { Species=019, Level = 10, Moves = new[]{098, 382, 231}, }, //Rattata
new EncounterStatic { Species=043, Level = 10, Moves = new[]{230, 298, 202}, }, //Oddish
new EncounterStatic { Species=069, Level = 10, Moves = new[]{022, 235, 402}, }, //Bellsprout
new EncounterStatic { Species=077, Level = 10, Moves = new[]{033, 037, 257}, }, //Ponyta
new EncounterStatic { Species=083, Level = 10, Moves = new[]{210, 355, 348}, }, //Farfetch'd
new EncounterStatic { Species=084, Level = 10, Moves = new[]{045, 175, 355}, }, //Doduo
new EncounterStatic { Species=102, Level = 10, Moves = new[]{140, 235, 202}, }, //Exeggcute
new EncounterStatic { Species=108, Level = 10, Moves = new[]{122, 214, 431}, }, //Lickitung
new EncounterStatic { Species=114, Level = 10, Moves = new[]{079, 073, 402}, }, //Tangela
new EncounterStatic { Species=115, Level = 10, Moves = new[]{252, 068, 409}, }, //Kangaskhan
new EncounterStatic { Species=161, Level = 10, Moves = new[]{010, 203, 343}, }, //Sentret
new EncounterStatic { Species=179, Level = 10, Moves = new[]{084, 115, 351}, }, //Mareep
new EncounterStatic { Species=191, Level = 10, Moves = new[]{072, 230, 414}, }, //Sunkern
new EncounterStatic { Species=234, Level = 10, Moves = new[]{033, 050, 285}, }, //Stantler
new EncounterStatic { Species=261, Level = 10, Moves = new[]{336, 305, 399}, }, //Poochyena
new EncounterStatic { Species=283, Level = 10, Moves = new[]{145, 056, 202}, }, //Surskit
new EncounterStatic { Species=399, Level = 10, Moves = new[]{033, 401, 290}, }, //Bidoof
new EncounterStatic { Species=403, Level = 10, Moves = new[]{268, 393, 400}, }, //Shinx
new EncounterStatic { Species=431, Level = 10, Moves = new[]{252, 372, 290}, }, //Glameow
new EncounterStatic { Species=054, Level = 10, Moves = new[]{346, 227, 362}, }, //Psyduck
new EncounterStatic { Species=058, Level = 10, Moves = new[]{044, 034, 203}, }, //Growlithe
new EncounterStatic { Species=123, Level = 10, Moves = new[]{098, 226, 366}, }, //Scyther
new EncounterStatic { Species=128, Level = 10, Moves = new[]{099, 231, 431}, }, //Tauros
new EncounterStatic { Species=183, Level = 10, Moves = new[]{111, 453, 008}, }, //Marill
new EncounterStatic { Species=185, Level = 10, Moves = new[]{175, 205, 272}, }, //Sudowoodo
new EncounterStatic { Species=203, Level = 10, Moves = new[]{093, 243, 285}, }, //Girafarig
new EncounterStatic { Species=241, Level = 10, Moves = new[]{111, 174, 231}, }, //Miltank
new EncounterStatic { Species=263, Level = 10, Moves = new[]{033, 271, 387}, }, //Zigzagoon
new EncounterStatic { Species=427, Level = 10, Moves = new[]{193, 252, 409}, }, //Buneary
new EncounterStatic { Species=037, Level = 10, Moves = new[]{046, 257, 399}, }, //Vulpix
new EncounterStatic { Species=060, Level = 10, Moves = new[]{095, 054, 214}, }, //Poliwag
new EncounterStatic { Species=177, Level = 10, Moves = new[]{101, 297, 202}, }, //Natu
new EncounterStatic { Species=239, Level = 10, Moves = new[]{084, 238, 393}, }, //Elekid
new EncounterStatic { Species=300, Level = 10, Moves = new[]{193, 321, 445}, }, //Skitty
// Windskept Sky
new EncounterStatic { Species=016, Level = 10, Moves = new[]{016, 211, 290}, }, //Pidgey
new EncounterStatic { Species=021, Level = 10, Moves = new[]{064, 185, 211}, }, //Spearow
new EncounterStatic { Species=041, Level = 10, Moves = new[]{048, 095, 162}, }, //Zubat
new EncounterStatic { Species=142, Level = 10, Moves = new[]{044, 372, 446}, }, //Aerodactyl
new EncounterStatic { Species=165, Level = 10, Moves = new[]{004, 450, 009}, }, //Ledyba
new EncounterStatic { Species=187, Level = 10, Moves = new[]{235, 227, 340}, }, //Hoppip
new EncounterStatic { Species=193, Level = 10, Moves = new[]{098, 364, 202}, }, //Yanma
new EncounterStatic { Species=198, Level = 10, Moves = new[]{064, 109, 355}, }, //Murkrow
new EncounterStatic { Species=207, Level = 10, Moves = new[]{028, 364, 366}, }, //Gligar
new EncounterStatic { Species=225, Level = 10, Moves = new[]{217, 420, 264}, }, //Delibird
new EncounterStatic { Species=276, Level = 10, Moves = new[]{064, 203, 413}, }, //Taillow
new EncounterStatic { Species=397, Level = 14, Moves = new[]{017, 297, 366}, }, //Staravia
new EncounterStatic { Species=227, Level = 10, Moves = new[]{064, 065, 355}, }, //Skarmory
new EncounterStatic { Species=357, Level = 10, Moves = new[]{016, 073, 318}, }, //Tropius
// Sprakling Sea
new EncounterStatic { Species=086, Level = 10, Moves = new[]{029, 333, 214}, }, //Seel
new EncounterStatic { Species=090, Level = 10, Moves = new[]{110, 112, 196}, }, //Shellder
new EncounterStatic { Species=116, Level = 10, Moves = new[]{145, 190, 362}, }, //Horsea
new EncounterStatic { Species=118, Level = 10, Moves = new[]{064, 060, 352}, }, //Goldeen
new EncounterStatic { Species=129, Level = 10, Moves = new[]{150, 175, 340}, }, //Magikarp
new EncounterStatic { Species=138, Level = 10, Moves = new[]{044, 330, 196}, }, //Omanyte
new EncounterStatic { Species=140, Level = 10, Moves = new[]{071, 175, 446}, }, //Kabuto
new EncounterStatic { Species=170, Level = 10, Moves = new[]{086, 133, 351}, }, //Chinchou
new EncounterStatic { Species=194, Level = 10, Moves = new[]{055, 034, 401}, }, //Wooper
new EncounterStatic { Species=211, Level = 10, Moves = new[]{040, 453, 290}, }, //Qwilfish
new EncounterStatic { Species=223, Level = 10, Moves = new[]{199, 350, 362}, }, //Remoraid
new EncounterStatic { Species=226, Level = 10, Moves = new[]{048, 243, 314}, }, //Mantine
new EncounterStatic { Species=320, Level = 10, Moves = new[]{055, 214, 340}, }, //Wailmer
new EncounterStatic { Species=339, Level = 10, Moves = new[]{189, 214, 209}, }, //Barboach
new EncounterStatic { Species=366, Level = 10, Moves = new[]{250, 445, 392}, }, //Clamperl
new EncounterStatic { Species=369, Level = 10, Moves = new[]{055, 214, 414}, }, //Relicanth
new EncounterStatic { Species=370, Level = 10, Moves = new[]{204, 300, 196}, }, //Luvdisc
new EncounterStatic { Species=418, Level = 10, Moves = new[]{346, 163, 352}, }, //Buizel
new EncounterStatic { Species=456, Level = 10, Moves = new[]{213, 186, 352}, }, //Finneon
new EncounterStatic { Species=072, Level = 10, Moves = new[]{048, 367, 202}, }, //Tentacool
new EncounterStatic { Species=318, Level = 10, Moves = new[]{044, 037, 399}, }, //Carvanha
new EncounterStatic { Species=341, Level = 10, Moves = new[]{106, 232, 283}, }, //Corphish
new EncounterStatic { Species=345, Level = 10, Moves = new[]{051, 243, 202}, }, //Lileep
new EncounterStatic { Species=347, Level = 10, Moves = new[]{010, 446, 440}, }, //Anorith
new EncounterStatic { Species=349, Level = 10, Moves = new[]{150, 445, 243}, }, //Feebas
new EncounterStatic { Species=131, Level = 10, Moves = new[]{109, 032, 196}, }, //Lapras
new EncounterStatic { Species=147, Level = 10, Moves = new[]{086, 352, 225}, }, //Dratini
// Spooky Mannor
new EncounterStatic { Species=092, Level = 10, Moves = new[]{095, 050, 482}, }, //Gastly
new EncounterStatic { Species=096, Level = 10, Moves = new[]{095, 427, 409}, }, //Drowzee
new EncounterStatic { Species=122, Level = 10, Moves = new[]{112, 298, 285}, }, //Mr. Mime
new EncounterStatic { Species=167, Level = 10, Moves = new[]{040, 527, 450}, }, //Spinarak
new EncounterStatic { Species=200, Level = 10, Moves = new[]{149, 194, 517}, }, //Misdreavus
new EncounterStatic { Species=228, Level = 10, Moves = new[]{336, 364, 399}, }, //Houndour
new EncounterStatic { Species=325, Level = 10, Moves = new[]{149, 285, 278}, }, //Spoink
new EncounterStatic { Species=353, Level = 10, Moves = new[]{101, 194, 220}, }, //Shuppet
new EncounterStatic { Species=355, Level = 10, Moves = new[]{050, 220, 271}, }, //Duskull
new EncounterStatic { Species=358, Level = 10, Moves = new[]{035, 095, 304}, }, //Chimecho
new EncounterStatic { Species=434, Level = 10, Moves = new[]{103, 492, 389}, }, //Stunky
new EncounterStatic { Species=209, Level = 10, Moves = new[]{204, 370, 038}, }, //Snubbull
new EncounterStatic { Species=235, Level = 10, Moves = new[]{166, 445, 214}, }, //Smeargle
new EncounterStatic { Species=313, Level = 10, Moves = new[]{148, 271, 366}, }, //Volbeat
new EncounterStatic { Species=314, Level = 10, Moves = new[]{204, 313, 366}, }, //Illumise
new EncounterStatic { Species=063, Level = 10, Moves = new[]{100, 285, 356}, }, //Abra
// Rugged Mountain
new EncounterStatic { Species=066, Level = 10, Moves = new[]{067, 418, 270}, }, //Machop
new EncounterStatic { Species=081, Level = 10, Moves = new[]{319, 278, 356}, }, //Magnemite
new EncounterStatic { Species=109, Level = 10, Moves = new[]{123, 399, 482}, }, //Koffing
new EncounterStatic { Species=218, Level = 10, Moves = new[]{052, 517, 257}, }, //Slugma
new EncounterStatic { Species=246, Level = 10, Moves = new[]{044, 399, 446}, }, //Larvitar
new EncounterStatic { Species=324, Level = 10, Moves = new[]{052, 090, 446}, }, //Torkoal
new EncounterStatic { Species=328, Level = 10, Moves = new[]{044, 324, 202}, }, //Trapinch
new EncounterStatic { Species=331, Level = 10, Moves = new[]{071, 298, 009}, }, //Cacnea
new EncounterStatic { Species=412, Level = 10, Moves = new[]{182, 450, 173}, }, //Burmy
new EncounterStatic { Species=449, Level = 10, Moves = new[]{044, 254, 276}, }, //Hippopotas
new EncounterStatic { Species=240, Level = 10, Moves = new[]{052, 009, 257}, }, //Magby
new EncounterStatic { Species=322, Level = 10, Moves = new[]{052, 034, 257}, }, //Numel
new EncounterStatic { Species=359, Level = 10, Moves = new[]{364, 224, 276}, }, //Absol
new EncounterStatic { Species=453, Level = 10, Moves = new[]{040, 409, 441}, }, //Croagunk
new EncounterStatic { Species=236, Level = 10, Moves = new[]{252, 364, 183}, }, //Tyrogue
new EncounterStatic { Species=371, Level = 10, Moves = new[]{044, 349, 200}, }, //Bagon
// Icy Cave
new EncounterStatic { Species=027, Level = 10, Moves = new[]{028, 068, 162}, }, //Sandshrew
new EncounterStatic { Species=074, Level = 10, Moves = new[]{111, 446, 431}, }, //Geodude
new EncounterStatic { Species=095, Level = 10, Moves = new[]{020, 446, 431}, }, //Onix
new EncounterStatic { Species=100, Level = 10, Moves = new[]{268, 324, 363}, }, //Voltorb
new EncounterStatic { Species=104, Level = 10, Moves = new[]{125, 195, 067}, }, //Cubone
new EncounterStatic { Species=293, Level = 10, Moves = new[]{253, 283, 428}, }, //Whismur
new EncounterStatic { Species=304, Level = 10, Moves = new[]{106, 283, 457}, }, //Aron
new EncounterStatic { Species=337, Level = 10, Moves = new[]{093, 414, 236}, }, //Lunatone
new EncounterStatic { Species=338, Level = 10, Moves = new[]{093, 428, 234}, }, //Solrock
new EncounterStatic { Species=343, Level = 10, Moves = new[]{229, 356, 428}, }, //Baltoy
new EncounterStatic { Species=459, Level = 10, Moves = new[]{075, 419, 202}, }, //Snover
new EncounterStatic { Species=050, Level = 10, Moves = new[]{028, 251, 446}, }, //Diglett
new EncounterStatic { Species=215, Level = 10, Moves = new[]{269, 008, 067}, }, //Sneasel
new EncounterStatic { Species=361, Level = 10, Moves = new[]{181, 311, 352}, }, //Snorunt
new EncounterStatic { Species=220, Level = 10, Moves = new[]{316, 246, 333}, }, //Swinub
new EncounterStatic { Species=443, Level = 10, Moves = new[]{082, 200, 203}, }, //Gible
// Dream Park
new EncounterStatic { Species=046, Level = 10, Moves = new[]{078, 440, 235}, }, //Paras
new EncounterStatic { Species=204, Level = 10, Moves = new[]{120, 390, 356}, }, //Pineco
new EncounterStatic { Species=265, Level = 10, Moves = new[]{040, 450, 173}, }, //Wurmple
new EncounterStatic { Species=273, Level = 10, Moves = new[]{074, 331, 492}, }, //Seedot
new EncounterStatic { Species=287, Level = 10, Moves = new[]{281, 400, 389}, }, //Slakoth
new EncounterStatic { Species=290, Level = 10, Moves = new[]{141, 203, 400}, }, //Nincada
new EncounterStatic { Species=311, Level = 10, Moves = new[]{086, 435, 324}, }, //Plusle
new EncounterStatic { Species=312, Level = 10, Moves = new[]{086, 435, 324}, }, //Minun
new EncounterStatic { Species=316, Level = 10, Moves = new[]{139, 151, 202}, }, //Gulpin
new EncounterStatic { Species=352, Level = 10, Moves = new[]{185, 285, 513}, }, //Kecleon
new EncounterStatic { Species=401, Level = 10, Moves = new[]{522, 283, 253}, }, //Kricketot
new EncounterStatic { Species=420, Level = 10, Moves = new[]{073, 505, 331}, }, //Cherubi
new EncounterStatic { Species=455, Level = 10, Moves = new[]{044, 476, 380}, }, //Carnivine
new EncounterStatic { Species=023, Level = 10, Moves = new[]{040, 251, 399}, }, //Ekans
new EncounterStatic { Species=175, Level = 10, Moves = new[]{118, 381, 253}, }, //Togepi
new EncounterStatic { Species=190, Level = 10, Moves = new[]{010, 252, 007}, }, //Aipom
new EncounterStatic { Species=285, Level = 10, Moves = new[]{078, 331, 264}, }, //Shroomish
new EncounterStatic { Species=315, Level = 10, Moves = new[]{074, 079, 129}, }, //Roselia
new EncounterStatic { Species=113, Level = 10, Moves = new[]{045, 068, 270}, }, //Chansey
new EncounterStatic { Species=127, Level = 10, Moves = new[]{011, 370, 382}, }, //Pinsir
new EncounterStatic { Species=133, Level = 10, Moves = new[]{028, 204, 129}, }, //Eevee
new EncounterStatic { Species=143, Level = 10, Moves = new[]{133, 007, 278}, }, //Snorlax
new EncounterStatic { Species=214, Level = 10, Moves = new[]{030, 175, 264}, }, //Heracross
// Pokémon Café Forest
new EncounterStatic { Species=061, Level = 25, Moves = new[]{240, 114, 352}, }, //Poliwhirl
new EncounterStatic { Species=133, Level = 10, Moves = new[]{270, 204, 129}, }, //Eevee
new EncounterStatic { Species=235, Level = 10, Moves = new[]{166, 445, 214}, }, //Smeargle
new EncounterStatic { Species=412, Level = 10, Moves = new[]{182, 450, 173}, }, //Burmy
//PGL
new EncounterStatic { Species=212, Level = 10, Moves = new[]{211}, Gender = 0, }, //Scizor
new EncounterStatic { Species=445, Level = 48, Gender = 0, }, //Garchomp
new EncounterStatic { Species=149, Level = 55, Moves = new[]{009}, Gender = 0, }, //Dragonite
new EncounterStatic { Species=248, Level = 55, Moves = new[]{069}, Gender = 0, }, //Tyranitar
new EncounterStatic { Species=149, Level = 55, Moves = new[]{245}, Gender = 0, }, //Dragonite
new EncounterStatic { Species=376, Level = 45, Moves = new[]{038}, Gender = 2, }, //Metagross
};
internal static readonly EncounterStatic[] BW_DreamWorld = DreamWorld_Common.Concat(new[]
{
// Pleasant forest
new EncounterStatic { Species=029, Level = 10, Moves = new[]{010, 389, 162}, }, //Nidoran (F)
new EncounterStatic { Species=032, Level = 10, Moves = new[]{064, 068, 162}, }, //Nidoran (M)
new EncounterStatic { Species=174, Level = 10, Moves = new[]{047, 313, 270}, }, //Igglybuff
new EncounterStatic { Species=187, Level = 10, Moves = new[]{235, 270, 331}, }, //Hoppip
new EncounterStatic { Species=270, Level = 10, Moves = new[]{071, 073, 352}, }, //Lotad
new EncounterStatic { Species=276, Level = 10, Moves = new[]{064, 119, 366}, }, //Taillow
new EncounterStatic { Species=309, Level = 10, Moves = new[]{086, 423, 324}, }, //Electrike
new EncounterStatic { Species=351, Level = 10, Moves = new[]{052, 466, 352}, }, //Castform
new EncounterStatic { Species=417, Level = 10, Moves = new[]{098, 343, 351}, }, //Pachirisu
// Windskept Sky
new EncounterStatic { Species=012, Level = 10, Moves = new[]{093, 355, 314}, }, //Butterfree
new EncounterStatic { Species=163, Level = 10, Moves = new[]{193, 101, 278}, }, //Hoothoot
new EncounterStatic { Species=278, Level = 10, Moves = new[]{055, 239, 351}, }, //Wingull
new EncounterStatic { Species=333, Level = 10, Moves = new[]{064, 297, 355}, }, //Swablu
new EncounterStatic { Species=425, Level = 10, Moves = new[]{107, 095, 285}, }, //Drifloon
new EncounterStatic { Species=441, Level = 10, Moves = new[]{119, 417, 272}, }, //Chatot
// Sprakling Sea
new EncounterStatic { Species=079, Level = 10, Moves = new[]{281, 335, 362}, }, //Slowpoke
new EncounterStatic { Species=098, Level = 10, Moves = new[]{011, 133, 290}, }, //Krabby
new EncounterStatic { Species=119, Level = 33, Moves = new[]{352, 214, 203}, }, //Seaking
new EncounterStatic { Species=120, Level = 10, Moves = new[]{055, 278, 196}, }, //Staryu
new EncounterStatic { Species=222, Level = 10, Moves = new[]{145, 109, 446}, }, //Corsola
new EncounterStatic { Species=422, Level = 10, Moves = new[]{189, 281, 290}, Form = 0 }, //Shellos
new EncounterStatic { Species=422, Level = 10, Moves = new[]{189, 281, 290}, Form = 1 },
// Spooky Mannor
new EncounterStatic { Species=202, Level = 15, Moves = new[]{243, 204, 227}, }, //Wobbuffet
new EncounterStatic { Species=238, Level = 10, Moves = new[]{186, 445, 285}, }, //Smoochum
new EncounterStatic { Species=303, Level = 10, Moves = new[]{313, 424, 008}, }, //Mawile
new EncounterStatic { Species=307, Level = 10, Moves = new[]{096, 409, 203}, }, //Meditite
new EncounterStatic { Species=436, Level = 10, Moves = new[]{095, 285, 356}, }, //Bronzor
new EncounterStatic { Species=052, Level = 10, Moves = new[]{010, 095, 290}, }, //Meowth
new EncounterStatic { Species=479, Level = 10, Moves = new[]{086, 351, 324}, }, //Rotom
new EncounterStatic { Species=280, Level = 10, Moves = new[]{093, 194, 270}, }, //Ralts
new EncounterStatic { Species=302, Level = 10, Moves = new[]{193, 389, 180}, }, //Sableye
new EncounterStatic { Species=442, Level = 10, Moves = new[]{180, 220, 196}, }, //Spiritomb
// Rugged Mountain
new EncounterStatic { Species=056, Level = 10, Moves = new[]{067, 179, 009}, }, //Mankey
new EncounterStatic { Species=111, Level = 10, Moves = new[]{030, 068, 038}, }, //Rhyhorn
new EncounterStatic { Species=231, Level = 10, Moves = new[]{175, 484, 402}, }, //Phanpy
new EncounterStatic { Species=451, Level = 10, Moves = new[]{044, 097, 401}, }, //Skorupi
new EncounterStatic { Species=216, Level = 10, Moves = new[]{313, 242, 264}, }, //Teddiursa
new EncounterStatic { Species=296, Level = 10, Moves = new[]{292, 270, 008}, }, //Makuhita
new EncounterStatic { Species=327, Level = 10, Moves = new[]{383, 252, 276}, }, //Spinda
new EncounterStatic { Species=374, Level = 10, Moves = new[]{036, 428, 442}, }, //Beldum
new EncounterStatic { Species=447, Level = 10, Moves = new[]{203, 418, 264}, }, //Riolu
// Icy Cave
new EncounterStatic { Species=173, Level = 10, Moves = new[]{227, 312, 214}, }, //Cleffa
new EncounterStatic { Species=213, Level = 10, Moves = new[]{227, 270, 504}, }, //Shuckle
new EncounterStatic { Species=299, Level = 10, Moves = new[]{033, 446, 246}, }, //Nosepass
new EncounterStatic { Species=363, Level = 10, Moves = new[]{181, 090, 401}, }, //Spheal
new EncounterStatic { Species=408, Level = 10, Moves = new[]{029, 442, 007}, }, //Cranidos
new EncounterStatic { Species=206, Level = 10, Moves = new[]{111, 277, 446}, }, //Dunsparce
new EncounterStatic { Species=410, Level = 10, Moves = new[]{182, 068, 090}, }, //Shieldon
// Dream Park
new EncounterStatic { Species=048, Level = 10, Moves = new[]{050, 226, 285}, }, //Venonat
new EncounterStatic { Species=088, Level = 10, Moves = new[]{139, 114, 425}, }, //Grimer
new EncounterStatic { Species=415, Level = 10, Moves = new[]{016, 366, 314}, }, //Combee
new EncounterStatic { Species=015, Level = 10, Moves = new[]{031, 314, 210}, }, //Beedrill
new EncounterStatic { Species=335, Level = 10, Moves = new[]{098, 458, 067}, }, //Zangoose
new EncounterStatic { Species=336, Level = 10, Moves = new[]{044, 034, 401}, }, //Seviper
// PGL
new EncounterStatic { Species=134, Level = 10, Gender = 0, }, //Vaporeon
new EncounterStatic { Species=135, Level = 10, Gender = 0, }, //Jolteon
new EncounterStatic { Species=136, Level = 10, Gender = 0, }, //Flareon
new EncounterStatic { Species=196, Level = 10, Gender = 0, }, //Espeon
new EncounterStatic { Species=197, Level = 10, Gender = 0, }, //Umbreon
new EncounterStatic { Species=470, Level = 10, Gender = 0, }, //Leafeon
new EncounterStatic { Species=471, Level = 10, Gender = 0, }, //Glaceon
new EncounterStatic { Species=001, Level = 10, Gender = 0, }, //Bulbasaur
new EncounterStatic { Species=004, Level = 10, Gender = 0, }, //Charmander
new EncounterStatic { Species=007, Level = 10, Gender = 0, }, //Squirtle
new EncounterStatic { Species=453, Level = 10, Gender = 0, }, //Croagunk
new EncounterStatic { Species=387, Level = 10, Gender = 0, }, //Turtwig
new EncounterStatic { Species=390, Level = 10, Gender = 0, }, //Chimchar
new EncounterStatic { Species=393, Level = 10, Gender = 0, }, //Piplup
new EncounterStatic { Species=493, Level = 100 }, //Arceus
new EncounterStatic { Species=252, Level = 10, Gender = 0, }, //Treecko
new EncounterStatic { Species=255, Level = 10, Gender = 0, }, //Torchic
new EncounterStatic { Species=258, Level = 10, Gender = 0, }, //Mudkip
new EncounterStatic { Species=468, Level = 10, Moves = new[]{217}, Gender = 0, }, //Togekiss
new EncounterStatic { Species=473, Level = 34, Gender = 0, }, //Mamoswine
new EncounterStatic { Species=137, Level = 10 }, //Porygon
new EncounterStatic { Species=384, Level = 50 }, //Rayquaza
new EncounterStatic { Species=354, Level = 37, Moves = new[]{538}, Gender = 1, }, //Banette
new EncounterStatic { Species=453, Level = 10, Moves = new[]{398}, Gender = 0, }, //Croagunk
new EncounterStatic { Species=334, Level = 35, Moves = new[]{206}, Gender = 0,}, //Altaria
new EncounterStatic { Species=242, Level = 10 }, //Blissey
new EncounterStatic { Species=448, Level = 10, Moves = new[]{418}, Gender = 0, }, //Lucario
new EncounterStatic { Species=189, Level = 27, Moves = new[]{206}, Gender = 0, }, //Jumpluff
}).ToArray();
internal static readonly EncounterStatic[] B2W2_DreamWorld = DreamWorld_Common.Concat(new[]
{
// Pleasant forest
new EncounterStatic { Species=535, Level = 10, Moves = new[]{496, 414, 352}, }, //Tympole
new EncounterStatic { Species=546, Level = 10, Moves = new[]{073, 227, 388}, }, //Cottonee
new EncounterStatic { Species=548, Level = 10, Moves = new[]{079, 204, 230}, }, //Petilil
new EncounterStatic { Species=588, Level = 10, Moves = new[]{203, 224, 450}, }, //Karrablast
new EncounterStatic { Species=616, Level = 10, Moves = new[]{051, 226, 227}, }, //Shelmet
new EncounterStatic { Species=545, Level = 30, Moves = new[]{342, 390, 276}, }, //Scolipede
// Windskept Sky
new EncounterStatic { Species=519, Level = 10, Moves = new[]{016, 095, 234}, }, //Pidove
new EncounterStatic { Species=561, Level = 10, Moves = new[]{095, 500, 257}, }, //Sigilyph
new EncounterStatic { Species=580, Level = 10, Moves = new[]{432, 362, 382}, }, //Ducklett
new EncounterStatic { Species=587, Level = 10, Moves = new[]{098, 403, 204}, }, //Emolga
// Sprakling Sea
new EncounterStatic { Species=550, Level = 10, Moves = new[]{029, 097, 428}, Form = 0 },//Basculin
new EncounterStatic { Species=550, Level = 10, Moves = new[]{029, 097, 428}, Form = 1 },
new EncounterStatic { Species=594, Level = 10, Moves = new[]{392, 243, 220}, }, //Alomomola
new EncounterStatic { Species=618, Level = 10, Moves = new[]{189, 174, 281}, }, //Stunfisk
new EncounterStatic { Species=564, Level = 10, Moves = new[]{205, 175, 334}, }, //Tirtouga
// Spooky Mannor
new EncounterStatic { Species=605, Level = 10, Moves = new[]{377, 112, 417}, }, //Elgyem
new EncounterStatic { Species=624, Level = 10, Moves = new[]{210, 427, 389}, }, //Pawniard
new EncounterStatic { Species=596, Level = 36, Moves = new[]{486, 050, 228}, }, //Galvantula
new EncounterStatic { Species=578, Level = 32, Moves = new[]{105, 286, 271}, }, //Duosion
new EncounterStatic { Species=622, Level = 10, Moves = new[]{205, 007, 009}, }, //Golett
// Rugged Mountain
new EncounterStatic { Species=631, Level = 10, Moves = new[]{510, 257, 202}, }, //Heatmor
new EncounterStatic { Species=632, Level = 10, Moves = new[]{210, 203, 422}, }, //Durant
new EncounterStatic { Species=556, Level = 10, Moves = new[]{042, 073, 191}, }, //Maractus
new EncounterStatic { Species=558, Level = 34, Moves = new[]{157, 068, 400}, }, //Crustle
new EncounterStatic { Species=553, Level = 40, Moves = new[]{242, 068, 212}, }, //Krookodile
// Icy Cave
new EncounterStatic { Species=529, Level = 10, Moves = new[]{229, 319, 431}, }, //Drilbur
new EncounterStatic { Species=621, Level = 10, Moves = new[]{044, 424, 389}, }, //Druddigon
new EncounterStatic { Species=525, Level = 25, Moves = new[]{479, 174, 484}, }, //Boldore
new EncounterStatic { Species=583, Level = 35, Moves = new[]{429, 420, 286}, }, //Vanillish
new EncounterStatic { Species=600, Level = 38, Moves = new[]{451, 356, 393}, }, //Klang
new EncounterStatic { Species=610, Level = 10, Moves = new[]{082, 068, 400}, }, //Axew
// Dream Park
new EncounterStatic { Species=531, Level = 10, Moves = new[]{270, 227, 281}, }, //Audino
new EncounterStatic { Species=538, Level = 10, Moves = new[]{020, 008, 276}, }, //Throh
new EncounterStatic { Species=539, Level = 10, Moves = new[]{249, 009, 530}, }, //Sawk
new EncounterStatic { Species=559, Level = 10, Moves = new[]{067, 252, 409}, }, //Scraggy
new EncounterStatic { Species=533, Level = 25, Moves = new[]{067, 183, 409}, }, //Gurdurr
// PGL
new EncounterStatic { Species=575, Level = 32, Moves = new[]{243}, Gender = 0, }, //Gothorita
new EncounterStatic { Species=025, Level = 10, Moves = new[]{029}, Gender = 0, }, //Pikachu
new EncounterStatic { Species=511, Level = 10, Moves = new[]{437}, Gender = 0, }, //Pansage
new EncounterStatic { Species=513, Level = 10, Moves = new[]{257}, Gender = 0, }, //Pansear
new EncounterStatic { Species=515, Level = 10, Moves = new[]{056}, Gender = 0, }, //Panpour
new EncounterStatic { Species=387, Level = 10, Moves = new[]{254}, Gender = 0, }, //Turtwig
new EncounterStatic { Species=390, Level = 10, Moves = new[]{252}, Gender = 0, }, //Chimchar
new EncounterStatic { Species=393, Level = 10, Moves = new[]{297}, Gender = 0, }, //Piplup
new EncounterStatic { Species=575, Level = 32, Moves = new[]{286}, Gender = 0, }, //Gothorita
}).ToArray();
#endregion
#region Static Encounter/Gift Tables
internal static readonly int[] Roaming_MetLocation_BW =
{
25,26,27,28, // Route 12,13,14,15 Night latter half
@ -137,14 +490,12 @@ namespace PKHeX.Core
new EncounterStatic { Species = 641, Level = 40, Version = GameVersion.B, Roaming = true }, //Tornadus
new EncounterStatic { Species = 642, Level = 40, Version = GameVersion.W, Roaming = true }, //Thundurus
};
internal static readonly EncounterStatic[] Encounter_BW_Regular =
{
//Starters @ Nuvema Town
new EncounterStatic { Gift = true, Species = 495, Level = 5, Location = 4, }, // Snivys
new EncounterStatic { Gift = true, Species = 498, Level = 5, Location = 4, }, // Tepig
new EncounterStatic { Gift = true, Species = 501, Level = 5, Location = 4, }, // Oshawott
//Fossil @ Nacrene City
new EncounterStatic { Gift = true, Species = 138, Level = 25, Location = 7, }, // Omanyte
new EncounterStatic { Gift = true, Species = 140, Level = 25, Location = 7, }, // Kabuto
@ -155,14 +506,12 @@ namespace PKHeX.Core
new EncounterStatic { Gift = true, Species = 410, Level = 25, Location = 7, }, // Shieldon
new EncounterStatic { Gift = true, Species = 564, Level = 25, Location = 7, }, // Tirtouga
new EncounterStatic { Gift = true, Species = 566, Level = 25, Location = 7, }, // Archen
//Gift
new EncounterStatic { Gift = true, Species = 511, Level = 10, Location = 32, }, // Pansage @ Dreamyard
new EncounterStatic { Gift = true, Species = 513, Level = 10, Location = 32, }, // Pansear
new EncounterStatic { Gift = true, Species = 515, Level = 10, Location = 32, }, // Panpour
new EncounterStatic { Gift = true, Species = 129, Level = 05, Location = 68, }, // Magikarp @ Marvelous Bridge
new EncounterStatic { Gift = true, Species = 636, Level = 01, EggLocation = 60003, }, // Larvesta Egg from Treasure Hunter
//Stationary
new EncounterStatic { Species = 518, Level = 50, Location = 32, Ability = 4, }, //Musharna @ Dreamyard Friday Only
new EncounterStatic { Species = 590, Level = 20, Location = 19, }, //Foongus @ Route 6
@ -170,7 +519,6 @@ namespace PKHeX.Core
new EncounterStatic { Species = 591, Level = 40, Location = 23, }, //Amoonguss @ Route 10
new EncounterStatic { Species = 555, Level = 35, Location = 34, Ability = 4, }, //Darmanitan @ Desert Resort
new EncounterStatic { Species = 637, Level = 70, Location = 35, }, //Volcarona @ Relic Castle
//Stationary Lengerdary
new EncounterStatic { Species = 638, Level = 42, Location = 54,}, //Cobalion @ Mistralton Cave
new EncounterStatic { Species = 639, Level = 42, Location = 40,}, //Terrakion @ Victory Road
@ -181,22 +529,18 @@ namespace PKHeX.Core
new EncounterStatic { Species = 644, Level = 50, Location = 39, Shiny = false, Version = GameVersion.W, }, //Zekrom @ Dragonspiral Tower
new EncounterStatic { Species = 645, Level = 70, Location = 70,}, //Landorus @ Abundant Shrine
new EncounterStatic { Species = 646, Level = 75, Location = 61,}, //Kyurem @ Giant Chasm
//Event
new EncounterStatic { Species = 494, Level = 15, Location = 62, Shiny = false}, // Victini @ Liberty Garden
new EncounterStatic { Species = 570, Level = 10, Location = 32, Gender = 0, Gift = true, }, // Zorua @ Castelia City
new EncounterStatic { Species = 570, Level = 10, Location = 32, Gender = 0, }, // Zorua @ Castelia City
new EncounterStatic { Species = 571, Level = 25, Location = 72, Gender = 1, }, // Zoroark @ Lostlorn Forest
};
internal static readonly EncounterStatic[] Encounter_BW = Encounter_BW_Roam.SelectMany(e => e.Clone(Roaming_MetLocation_BW)).Concat(Encounter_BW_Regular).ToArray();
internal static readonly EncounterStatic[] Encounter_B2W2 =
internal static readonly EncounterStatic[] Encounter_B2W2_Regular =
{
//Starters @ Aspertia City
new EncounterStatic { Gift = true, Species = 495, Level = 5, Location = 117, }, // Snivy
new EncounterStatic { Gift = true, Species = 498, Level = 5, Location = 117, }, // Tepig
new EncounterStatic { Gift = true, Species = 501, Level = 5, Location = 117, }, // Oshawott
//Fossil @ Nacrene City
new EncounterStatic { Gift = true, Species = 138, Level = 25, Location = 7, }, // Omanyte
new EncounterStatic { Gift = true, Species = 140, Level = 25, Location = 7, }, // Kabuto
@ -207,7 +551,6 @@ namespace PKHeX.Core
new EncounterStatic { Gift = true, Species = 410, Level = 25, Location = 7, }, // Shieldon
new EncounterStatic { Gift = true, Species = 564, Level = 25, Location = 7, }, // Tirtouga
new EncounterStatic { Gift = true, Species = 566, Level = 25, Location = 7, }, // Archen
//Gift
new EncounterStatic { Gift = true, Species = 133, Level = 10, Ability = 4, Location = 8, }, //HA Eevee @ Castelia City
new EncounterStatic { Gift = true, Species = 585, Level = 30, Ability = 4, Location = 19, Form = 0, }, //HA Deerling @ Route 6
@ -218,7 +561,6 @@ namespace PKHeX.Core
new EncounterStatic { Gift = true, Species = 147, Level = 01, Shiny = true, Location = 122, Gender = 0, Version = GameVersion.W2, }, //Shiny Dratini @ Floccesy Town
new EncounterStatic { Gift = true, Species = 129, Level = 05, Location = 68, }, // Magikarp @ Marvelous Bridge
new EncounterStatic { Gift = true, Species = 440, Level = 01, Ability = 1, EggLocation = 60003, }, // Happiny Egg from PKMN Breeder
//Stationary
new EncounterStatic { Species = 590, Level = 29, Location = 19, }, // Foongus @ Route 6
new EncounterStatic { Species = 591, Level = 47, Location = 24, }, // Amoonguss @ Route 11
@ -230,7 +572,6 @@ namespace PKHeX.Core
new EncounterStatic { Species = 637, Level = 65, Location = 35, }, // Volcarona @ Relic Castle
new EncounterStatic { Species = 558, Level = 42, Location = 141, }, // Crustle @ Seaside Cave
new EncounterStatic { Species = 612, Level = 60, Location = 147, Shiny = true}, // Haxorus @ Nature Preserve
//Stationary Lengerdary
new EncounterStatic { Species = 377, Level = 65, Location = 150,}, //Regirock @ Rock Peak Chamber
new EncounterStatic { Species = 378, Level = 65, Location = 151,}, //Regice @ Iceberg Chamber
@ -253,7 +594,26 @@ namespace PKHeX.Core
new EncounterStatic { Species = 643, Level = 70, Location = 039, Shiny = false, Version = GameVersion.W2, }, // Reshiram @ Dragonspiral Tower
new EncounterStatic { Species = 644, Level = 70, Location = 039, Shiny = false, Version = GameVersion.B2, }, // Zekrom @ Dragonspiral Tower
new EncounterStatic { Species = 646, Level = 70, Location = 061, Form = 0}, // Kyurem @ Giant Chasm
//N's Pokemon
new EncounterStatic { Species = 509, Level = 07, Location = 15, NSparkle = true, Ability = 2, Nature = Nature.Timid }, //Purloin @ Route 2
new EncounterStatic { Species = 519, Level = 13, Location = 33, NSparkle = true, Ability = 2, Nature = Nature.Sassy }, //Pidove @ Pinwheel Forest
new EncounterStatic { Species = 532, Level = 13, Location = 33, NSparkle = true, Ability = 1, Nature = Nature.Rash }, //Timburr @ Pinwheel Forest
new EncounterStatic { Species = 535, Level = 13, Location = 33, NSparkle = true, Ability = 2, Nature = Nature.Modest }, //Tympole @ Pinwheel Forest
new EncounterStatic { Species = 527, Level = 55, Location = 53, NSparkle = true, Ability = 1, Nature = Nature.Timid }, //Woobat @ Wellspring Cave
new EncounterStatic { Species = 551, Level = 22, Location = 34, NSparkle = true, Ability = 2, Nature = Nature.Docile }, //Sandile @ Desert Resort
new EncounterStatic { Species = 554, Level = 22, Location = 34, NSparkle = true, Ability = 1, Nature = Nature.Naive }, //Darumaka @ Desert Resort
new EncounterStatic { Species = 555, Level = 35, Location = 34, NSparkle = true, Ability = 4, Nature = Nature.Calm }, //Darmanitan @ Desert Resort
new EncounterStatic { Species = 559, Level = 22, Location = 34, NSparkle = true, Ability = 1, Nature = Nature.Lax }, //Scaggy @ Desert Resort
new EncounterStatic { Species = 561, Level = 22, Location = 34, NSparkle = true, Ability = 2, Nature = Nature.Gentle }, //Sigilyph @ Desert Resort
new EncounterStatic { Species = 525, Level = 28, Location = 37, NSparkle = true, Ability = 1, Nature = Nature.Naive }, //Boldore @ Chargestone Cave
new EncounterStatic { Species = 595, Level = 28, Location = 37, NSparkle = true, Ability = 2, Nature = Nature.Docile }, //Joltik @ Chargestone Cave
new EncounterStatic { Species = 597, Level = 28, Location = 37, NSparkle = true, Ability = 1, Nature = Nature.Bashful }, //Ferroseed @ Chargestone Cave
new EncounterStatic { Species = 599, Level = 28, Location = 37, NSparkle = true, Ability = 1, Nature = Nature.Rash }, //Klink @ Chargestone Cave
new EncounterStatic { Species = 570, Level = 25, Location = 10, NSparkle = true, Ability = 1, Nature = Nature.Hasty, Gift = true} //N's Zorua @ Driftveil City
};
internal static readonly EncounterStatic[] Encounter_B2W2 = Encounter_DreamRadar.SelectMany(e => e.DreamRadarClone()).Concat(Encounter_B2W2_Regular).ToArray();
#endregion
#region Trade Tables
internal static readonly EncounterTrade[] TradeGift_BW =
{
new EncounterTrade { Species = 548, Level = 15, Ability = 1, TID = 39922, SID = 00000, OTGender = 1, Gender = 1, IVs = new[] {20,20,20,31,20,20}, Nature = Nature.Modest, Version = GameVersion.B, }, // Petilil
@ -299,9 +659,8 @@ namespace PKHeX.Core
new EncounterTrade { Species = 231, Level = 50, Ability = 4, TID = 54118, SID = 00000, OTGender = 0,},
new EncounterTrade { Species = 327, Level = 50, Ability = 4, TID = 54118, SID = 00000, OTGender = 0,},
new EncounterTrade { Species = 175, Level = 50, Ability = 4, TID = 54118, SID = 00000, OTGender = 0,},
// Gift
new EncounterTrade { Species = 570, Level = 25, Ability = 1, TID = 00002, SID = 00000, OTGender = 0, Gender = 0, IVs = new[] {30,30,30,30,30,30}, Nature = Nature.Hasty, Location = 10} //N's Zorua @ Driftveil City
};
#endregion
#region Alt Slots
private static readonly EncounterArea[] SlotsBW_Swarm =
{
@ -457,7 +816,7 @@ namespace PKHeX.Core
new EncounterSlot{Species = 196, LevelMin = 10, LevelMax = 60, },
new EncounterSlot{Species = 197, LevelMin = 10, LevelMax = 60, },
new EncounterSlot{Species = 470, LevelMin = 10, LevelMax = 60, },
new EncounterSlot{Species = 471, LevelMin = 10, LevelMax = 60, },
new EncounterSlot{Species = 471, LevelMin = 10, LevelMax = 60, },
};
private static readonly EncounterArea[] SlotsB2_HiddenGrotto =
{
@ -481,7 +840,6 @@ namespace PKHeX.Core
}).ToArray(),
}
};
#endregion
internal static readonly int[] ValidMet_BW =
@ -492,7 +850,7 @@ namespace PKHeX.Core
061, 062, 063, 064, 065, 066, 067, 068, 069, 070, 071, 072, 073, 074, 075, 076, 077, 078, 079, 080,
081, 082, 083, 084, 085, 086, 087, 088, 089, 090, 091, 092, 093, 094, 095, 096, 097, 098, 099, 100,
101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
};
internal static readonly int[] ValidMet_B2W2 =
{

View file

@ -18,42 +18,24 @@ namespace PKHeX.Core
private static readonly int[][] VivillonCountryTable =
{
//missing ID 051,068,102,127,160,186
// 0-Icy Snow
new[] { 018, 076, 096, 100, 107 },
// 1-Polar
new[] { 010, 018, 020, 049, 076, 096, 100, 107 },
// 2-Tundra
new[] { 001, 081, 096, },
// 3-Continental
new[] { 010, 067, 073, 074, 075, 077, 078, 084, 087, 094, 096, 097, 100, 107, 136},
// 4-Garden
new[] { 065, 082, 095, 097, 101, 110, 125},
// 5-Elegant
new[] { 001 },
// 6-Meadow
new[] { 066, 077, 078, 083, 086, 088, 105, 108, 122},
// 7-Modern
new[] { 018, 049},
// 8-Marine
new[] { 020, 064, 066, 070, 071, 073, 077, 078, 079, 080, 083, 089, 090, 091, 098, 099, 103, 105, 123, 124, 126, 184, 185},
// 9-Archipelago
new[] { 008, 009, 011, 012, 013, 017, 021, 023, 024, 028, 029, 032, 034, 035, 036, 037, 038, 043, 044, 045, 047, 048, 049, 052, 085, 104,},
// 10-High-Plains
new[] { 018, 036, 049, 100, 113},
// 11-Sandstorm
new[] { 072, 109, 118, 119, 120, 121, 168, 174},
// 12-River
new[] { 065, 069, 085, 093, 104, 105, 114, 115, 116, 117},
// 13-Monsoon
new[] { 001, 128, 144, 169},
// 14-Savanna
new[] { 010, 015, 016, 041, 042, 050},
// 15-Sun
new[] { 036, 014, 019, 026, 030, 033, 036, 039, 065, 092, 106, 111, 112},
// 16-Ocean
new[] { 049, 077},
// 17-Jungle
new[] { 016, 021, 022, 025, 027, 031, 040, 046, 052, 169, 153, 156},
/* 0 Icy Snow */ new[] { 018, 076, 096, 100, 107 },
/* 1 Polar */ new[] { 010, 018, 020, 049, 076, 096, 100, 107 },
/* 2 Tundra */ new[] { 001, 081, 096, },
/* 3 Continental */ new[] { 010, 067, 073, 074, 075, 077, 078, 084, 087, 094, 096, 097, 100, 107, 136},
/* 4 Garden */ new[] { 065, 082, 095, 097, 101, 110, 125},
/* 5 Elegant */ new[] { 001 },
/* 6 Meadow */ new[] { 066, 077, 078, 083, 086, 088, 105, 108, 122},
/* 7 Modern */ new[] { 018, 049},
/* 8 Marine */ new[] { 020, 064, 066, 070, 071, 073, 077, 078, 079, 080, 083, 089, 090, 091, 098, 099, 103, 105, 123, 124, 126, 184, 185},
/* 9 Archipelago */ new[] { 008, 009, 011, 012, 013, 017, 021, 023, 024, 028, 029, 032, 034, 035, 036, 037, 038, 043, 044, 045, 047, 048, 049, 052, 085, 104,},
/*10 High Plains */ new[] { 018, 036, 049, 100, 113},
/*11 Sandstorm */ new[] { 072, 109, 118, 119, 120, 121, 168, 174},
/*12 River */ new[] { 065, 069, 085, 093, 104, 105, 114, 115, 116, 117},
/*13 Monsoon */ new[] { 001, 128, 144, 169},
/*14-Savanna */ new[] { 010, 015, 016, 041, 042, 050},
/*15 Sun */ new[] { 036, 014, 019, 026, 030, 033, 036, 039, 065, 092, 106, 111, 112},
/*16 Ocean */ new[] { 049, 077},
/*17 Jungle */ new[] { 016, 021, 022, 025, 027, 031, 040, 046, 052, 169, 153, 156},
};
private static readonly CountryTable[] RegionFormTable =
{
@ -81,7 +63,7 @@ namespace PKHeX.Core
mainform = 01, // Polar
otherforms = new[]
{
new FormSubregionTable { form = 01, region = new[] {12,13,14} },
new FormSubregionTable { form = 00, region = new[] {12,13,14} },
new FormSubregionTable { form = 07, region = new[] {05} },
new FormSubregionTable { form = 10, region = new[] {04} },
}
@ -262,21 +244,16 @@ namespace PKHeX.Core
public static bool CheckVivillonPattern(int form, int pkmcountry, int pkmregion)
{
if (VivillonCountryTable[form].Contains(pkmcountry))
{
if (RegionFormTable.Any(ct => ct.countryID == pkmcountry))
{
CountryTable ct = RegionFormTable.Where(t => t.countryID == pkmcountry).ToArray()[0];
if (ct.mainform == form)
return !(ct.otherforms.SelectMany(e => e.region).Contains(pkmregion)); //true if Mainform not in other specific region
else
return ct.otherforms.Any(e => e.form == form && e.region.Contains(pkmregion));
}
else
return true; // No subregion
}
else
if (!VivillonCountryTable[form].Contains(pkmcountry))
return false; // Country mismatch
if (RegionFormTable.All(c => c.countryID != pkmcountry))
return true; // No subregion table
CountryTable ct = RegionFormTable.Where(t => t.countryID == pkmcountry).ToArray()[0];
if (ct.mainform == form)
return !ct.otherforms.SelectMany(e => e.region).Contains(pkmregion); //true if Mainform not in other specific region
return ct.otherforms.Any(e => e.form == form && e.region.Contains(pkmregion));
}
}
}

View file

@ -72,7 +72,7 @@ namespace PKHeX.Core
}
}
public override int Species { get { return Gift.Species; } set { Gift.Species = value; } }
public override int Species { get { return Gift.IsManaphyEgg ? 490 : Gift.Species; } set { Gift.Species = value; } }
public override int[] Moves { get { return Gift.Moves; } set { Gift.Moves = value; } }
public override int HeldItem { get { return Gift.HeldItem; } set { Gift.HeldItem = value; } }
public override bool IsShiny => Gift.IsShiny;
@ -192,7 +192,7 @@ namespace PKHeX.Core
public override bool IsItem { get { return PGTGiftType == GiftType.Item; } set { if (value) PGTGiftType = GiftType.Item; } }
public override bool IsPokémon { get { return PGTGiftType == GiftType.Pokémon || PGTGiftType == GiftType.PokémonEgg || PGTGiftType == GiftType.ManaphyEgg; } set { } }
public override int Species { get { return PK.Species; } set { PK.Species = value; } }
public override int Species { get { return IsManaphyEgg ? 490 : PK.Species; } set { PK.Species = value; } }
public override int[] Moves { get { return PK.Moves; } set { PK.Moves = value; } }
public override int HeldItem { get { return PK.HeldItem; } set { PK.HeldItem = value; } }
public override bool IsShiny => PK.IsShiny;
@ -209,6 +209,7 @@ namespace PKHeX.Core
pk4.TID = SAV.TID;
pk4.SID = SAV.SID;
pk4.OT_Gender = SAV.Gender;
pk4.Language = SAV.Language;
}
if (IsManaphyEgg)
{
@ -218,6 +219,7 @@ namespace PKHeX.Core
pk4.Move1 = 294;
pk4.Move2 = 145;
pk4.Move3 = 346;
pk4.Ability = pk4.PersonalInfo.Abilities[0];
pk4.FatefulEncounter = true;
pk4.Ball = 4;
pk4.Version = 10; // Diamond
@ -228,7 +230,7 @@ namespace PKHeX.Core
// Generate IV
uint seed = Util.rnd32();
if (pk4.PID == 1 || IsManaphyEgg) // Create Nonshiny
if (pk4.PID == 1) // Create Nonshiny
{
uint pid1 = PKX.LCRNG(ref seed) >> 16;
uint pid2 = PKX.LCRNG(ref seed) >> 16;
@ -255,7 +257,7 @@ namespace PKHeX.Core
}
// Generate Met Info
if (!IsEgg)
if (!IsEgg && !IsManaphyEgg)
{
pk4.Met_Location = pk4.Egg_Location + 3000;
pk4.Egg_Location = 0;
@ -264,15 +266,25 @@ namespace PKHeX.Core
}
else
{
pk4.Egg_Location = pk4.Egg_Location + 3000;
pk4.MetDate = DateTime.Now;
pk4.IsEgg = false;
// Met Location is modified when transferred to pk5; don't worry about it.
if (SAV.Generation == 4)
{
pk4.IsEgg = true;
pk4.Met_Location = pk4.Egg_Location + 3000;
pk4.Egg_Location = 0;
pk4.IsNicknamed = true;
pk4.Nickname = PKX.getSpeciesName(0, pk4.Language).ToUpper();
pk4.MetDate = DateTime.Now;
}
else
{
pk4.IsEgg = false;
// Met Location is modified when transferred to pk5; don't worry about it.
pk4.Egg_Location = pk4.Egg_Location + 3000;
pk4.EggMetDate = DateTime.Now;
}
}
if (pk4.Species == 201) // Never will be true; Unown was never distributed.
pk4.AltForm = PKX.getUnownForm(pk4.PID);
if (IsEgg || IsManaphyEgg)
pk4.IsEgg = true;
pk4.RefreshChecksum();
return pk4;

View file

@ -152,7 +152,7 @@
<Compile Include="Game\GameVersion.cs" />
<Compile Include="Legality\Analysis.cs" />
<Compile Include="Legality\Checks.cs" />
<Compile Include="Legality\CheckStrings.cs" />
<Compile Include="Legality\LegalityCheckStrings.cs" />
<Compile Include="Legality\Core.cs" />
<Compile Include="Legality\Data.cs" />
<Compile Include="Legality\Structures\DexLevel.cs" />
@ -3521,8 +3521,8 @@
<ItemGroup>
<Content Include="Resources\img\misc\horohoro.png" />
<Content Include="Resources\img\misc\vc.png" />
<None Include="Resources\text\en\legality_en.txt" />
<None Include="Resources\text\zh\legality_zh.txt" />
<None Include="Resources\text\en\LegalityCheckStrings_en.txt" />
<None Include="Resources\text\zh\LegalityCheckStrings_zh.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View file

@ -403,24 +403,6 @@ namespace PKHeX.Core
}
// Methods
public override bool getGenderIsValid()
{
int gv = PersonalTable.HGSS[Species].Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 0;
if (gv == 0)
return Gender == 1;
if (gv <= (PID & 0xFF))
return Gender == 0;
if ((PID & 0xFF) < gv)
return Gender == 1;
return false;
}
protected override ushort CalculateChecksum()
{
ushort chk = 0;

View file

@ -36,7 +36,7 @@ namespace PKHeX.Core
public override int Gender { get { return PKX.getGender(Species, PID); } set { } }
public override int Characteristic => -1;
public override int CurrentFriendship { get { return OT_Friendship; } set { OT_Friendship = value; } }
public override int Ability { get { int[] abils = PersonalTable.RS.getAbilities(Species, 0); return abils[abils[1] == 0 ? 0 : AbilityNumber]; } set { } }
public override int Ability { get { int[] abils = PersonalTable.RS.getAbilities(Species, 0); return abils[abils[1] == 0 ? 0 : AbilityNumber >> 1]; } set { } }
public override int CurrentHandler { get { return 0; } set { } }
public override int Egg_Location { get { return 0; } set { } }
@ -167,7 +167,7 @@ namespace PKHeX.Core
public override int PKRS_Strain { get { return Data[0xCA] & 0xF; } set { Data[0xCA] = (byte)(value & 0xF); } }
public override bool IsEgg { get { return Data[0xCB] == 1; } set { Data[0xCB] = (byte)(value ? 1 : 0); } }
public override int AbilityNumber { get { return Data[0xCC]; } set { Data[0xCC] = (byte)(value & 1); } }
public override int AbilityNumber { get { return 1 << Data[0xCC]; } set { Data[0xCC] = (byte)((value >> 1) & 1); } }
public override bool Valid { get { return Data[0xCD] == 0; } set { if (value) Data[0xCD] = 0; } }
// 0xCE unknown
public override int MarkValue { get { return Data[0xCF]; } protected set { Data[0xCF] = (byte)value; } }
@ -187,22 +187,5 @@ namespace PKHeX.Core
{
return (byte[])Data.Clone();
}
public override bool getGenderIsValid()
{
int gv = PersonalTable.RS[Species].Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 0;
if (gv == 0)
return Gender == 1;
if (gv <= (PID & 0xFF))
return Gender == 0;
if ((PID & 0xFF) < gv)
return Gender == 1;
return false;
}
}
}

View file

@ -33,7 +33,7 @@ namespace PKHeX.Core
public override int Gender { get { return PKX.getGender(Species, PID); } set { } }
public override int Characteristic => -1;
public override int CurrentFriendship { get { return OT_Friendship; } set { OT_Friendship = value; } }
public override int Ability { get { int[] abils = PersonalInfo.Abilities; return abils[abils[1] == 0 ? 0 : AbilityNumber]; } set { } }
public override int Ability { get { int[] abils = PersonalInfo.Abilities; return abils[abils[1] == 0 ? 0 : AbilityNumber >> 1]; } set { } }
public override int CurrentHandler { get { return 0; } set { } }
public override int Egg_Location { get { return 0; } set { } }
@ -120,7 +120,7 @@ namespace PKHeX.Core
public override int IV_SPA { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } }
public override int IV_SPD { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } }
public override bool IsEgg { get { return ((IV32 >> 30) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } }
public override int AbilityNumber { get { return (int)((IV32 >> 31) & 1); } set { IV32 = (IV32 & 0x7FFFFFFF) | (value == 1 ? 0x80000000 : 0); } }
public override int AbilityNumber { get { return 1 << (int)((IV32 >> 31) & 1); } set { IV32 = (IV32 & 0x7FFFFFFF) | (value > 1 ? 0x80000000 : 0); } }
private uint RIB0 { get { return BitConverter.ToUInt32(Data, 0x4C); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x4C); } }
public int RibbonCountG3Cool { get { return (int)(RIB0 >> 00) & 7; } set { RIB0 = (uint)((RIB0 & ~(7 << 00)) | (uint)(value & 7) << 00); } }
@ -169,24 +169,6 @@ namespace PKHeX.Core
{
return PKX.encryptArray3(Data);
}
public override bool getGenderIsValid()
{
int gv = PersonalInfo.Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 1;
if (gv == 0)
return Gender == 0;
if ((PID & 0xFF) <= gv)
return Gender == 1;
if (gv < (PID & 0xFF))
return Gender == 0;
return false;
}
public PK4 convertToPK4()
{
DateTime moment = DateTime.Now;

View file

@ -29,6 +29,7 @@ namespace PKHeX.Core
public override int Nature { get { return (int)(PID%25); } set { } }
public override int CurrentFriendship { get { return OT_Friendship; } set { OT_Friendship = value; } }
public override int CurrentHandler { get { return 0; } set { } }
public override int AbilityNumber { get { return 1 << PIDAbility; } set { } }
// Structure
public override uint PID { get { return BitConverter.ToUInt32(Data, 0x00); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); } }
@ -310,7 +311,7 @@ namespace PKHeX.Core
else if ((value < 2000 && value > 111) || (value < 3000 && value > 2010))
{
// Met location not in DP, set to Mystery Zone (0, illegal) as opposed to Faraway Place
BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x46);
BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x46);
BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x80);
}
else
@ -384,23 +385,6 @@ namespace PKHeX.Core
}
// Methods
public override bool getGenderIsValid()
{
int gv = PersonalInfo.Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 1;
if (gv == 0)
return Gender == 0;
if ((PID & 0xFF) <= gv)
return Gender == 1;
if (gv < (PID & 0xFF))
return Gender == 0;
return false;
}
public override byte[] Encrypt()
{
RefreshChecksum();

View file

@ -29,6 +29,7 @@ namespace PKHeX.Core
public override uint EncryptionConstant { get { return PID; } set { } }
public override int CurrentFriendship { get { return OT_Friendship; } set { OT_Friendship = value; } }
public override int CurrentHandler { get { return 0; } set { } }
public override int AbilityNumber { get { return HiddenAbility ? 4 : 1 << PIDAbility; } set { } }
// Structure
public override uint PID { get { return BitConverter.ToUInt32(Data, 0x00); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); } }
@ -300,23 +301,6 @@ namespace PKHeX.Core
}
// Methods
public override bool getGenderIsValid()
{
int gv = PersonalInfo.Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 1;
if (gv == 0)
return Gender == 0;
if ((PID & 0xFF) <= gv)
return Gender == 1;
if (gv < (PID & 0xFF))
return Gender == 0;
return false;
}
public override byte[] Encrypt()
{
RefreshChecksum();

View file

@ -411,18 +411,6 @@ namespace PKHeX.Core
Checksum = CalculateChecksum();
return PKX.encryptArray(Data);
}
public override bool getGenderIsValid()
{
int gv = PersonalInfo.Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 1;
if (gv == 0)
return Gender == 0;
return true;
}
// General User-error Fixes
public void FixRelearn()

View file

@ -445,18 +445,6 @@ namespace PKHeX.Core
Checksum = CalculateChecksum();
return PKX.encryptArray(Data);
}
public override bool getGenderIsValid()
{
int gv = PersonalInfo.Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 1;
if (gv == 0)
return Gender == 0;
return true;
}
// General User-error Fixes
public void FixRelearn()

View file

@ -360,9 +360,10 @@ namespace PKHeX.Core
{
if (GenNumber > 5 || Format > 5)
return -1;
if (GenNumber == 5)
return (int)((PID >> 16) & 1);
return (int)(PID & 1);
if (Version == (int) GameVersion.CXD)
return Array.IndexOf(PersonalInfo.Abilities, Ability);
return (int)((GenNumber == 5 ? PID >> 16 : PID) & 1);
}
}
@ -422,10 +423,9 @@ namespace PKHeX.Core
{
get
{
if (Format > 2 && HasOriginalMetLocation)
return Egg_Location > 0;
return _WasEgg;
} set { _WasEgg = value; }
return Egg_Location > 0 || _WasEgg;
}
set { _WasEgg = value; }
}
public virtual bool WasEvent => Met_Location > 40000 && Met_Location < 50000 || FatefulEncounter;
public virtual bool WasEventEgg => ((Egg_Location > 40000 && Egg_Location < 50000) || (FatefulEncounter && Egg_Location > 0)) && Met_Level == 1;
@ -512,7 +512,26 @@ namespace PKHeX.Core
/// Checks if the current <see cref="Gender"/> is valid.
/// </summary>
/// <returns>True if valid, False if invalid.</returns>
public abstract bool getGenderIsValid();
public virtual bool getGenderIsValid()
{
int gv = PersonalInfo.Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 1;
if (gv == 0)
return Gender == 0;
if (GenNumber >= 6)
return true;
if ((PID & 0xFF) < gv)
return Gender == 1;
if (gv <= (PID & 0xFF))
return Gender == 0;
return false;
}
/// <summary>
/// Updates the checksum of the <see cref="PKM"/>.

View file

@ -34,7 +34,7 @@ namespace PKHeX.Core
public override int Gender { get { return PKX.getGender(Species, PID); } set { } }
public override int Characteristic => -1;
public override int CurrentFriendship { get { return OT_Friendship; } set { OT_Friendship = value; } }
public override int Ability { get { int[] abils = PersonalTable.RS.getAbilities(Species, 0); return abils[abils[1] == 0 ? 0 : AbilityNumber]; } set { } }
public override int Ability { get { int[] abils = PersonalTable.RS.getAbilities(Species, 0); return abils[abils[1] == 0 ? 0 : AbilityNumber >> 1]; } set { } }
public override int CurrentHandler { get { return 0; } set { } }
public override int Egg_Location { get { return 0; } set { } }
@ -66,7 +66,7 @@ namespace PKHeX.Core
public bool UnusedFlag3 { get { return (XDPKMFLAGS & (1 << 3)) == 1 << 3; } set { XDPKMFLAGS = XDPKMFLAGS & ~(1 << 3) | (value ? 1 << 3 : 0); } }
public bool BlockTrades { get { return (XDPKMFLAGS & (1 << 4)) == 1 << 4; } set { XDPKMFLAGS = XDPKMFLAGS & ~(1 << 4) | (value ? 1 << 4 : 0); } }
public override bool Valid { get { return (XDPKMFLAGS & (1 << 5)) == 0; } set { XDPKMFLAGS = XDPKMFLAGS & ~(1 << 5) | (value ? 0 : 1 << 5); } } // invalid flag
public override int AbilityNumber { get { return (XDPKMFLAGS >> 6) & 1; } set { XDPKMFLAGS = XDPKMFLAGS & ~(1 << 6) | (value << 6); } }
public override int AbilityNumber { get { return 1 << ((XDPKMFLAGS >> 6) & 1); }set { XDPKMFLAGS = XDPKMFLAGS & ~(1 << 6) | (((value >> 1) & 1) << 6); } }
public override bool IsEgg { get { return (XDPKMFLAGS & (1 << 7)) == 1 << 7; } set { XDPKMFLAGS = XDPKMFLAGS & ~(1 << 7) | (value ? 1 << 7 : 0); } }
// 0x1E-0x1F Unknown
public override uint EXP { get { return BigEndian.ToUInt32(Data, 0x20); } set { BigEndian.GetBytes(value).CopyTo(Data, 0x20); } }
@ -193,22 +193,5 @@ namespace PKHeX.Core
{
return (byte[])Data.Clone();
}
public override bool getGenderIsValid()
{
int gv = PersonalTable.RS[Species].Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 0;
if (gv == 0)
return Gender == 1;
if (gv <= (PID & 0xFF))
return Gender == 0;
if ((PID & 0xFF) < gv)
return Gender == 1;
return false;
}
}
}

View file

@ -18156,47 +18156,45 @@ namespace PKHeX.Core.Properties {
///V201 = Encryption Constant is not set.
///V204 = H [rest of string was truncated]&quot;;.
/// </summary>
public static string legality_en {
public static string LegalityCheckStrings_en {
get {
return ResourceManager.GetString("legality_en", resourceCulture);
return ResourceManager.GetString("LegalityCheckStrings_en", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to V = 有效.
///V193 = 合法!
///V190 = 内部错误.
///V189 = 无法对该宝可梦分析.
///V196 = {0}: {1}
///V191 = {0} 招式 {1}: {2}
///V192 = {0} 回忆招式 {1}: {2}
///V195 = 相遇方式: {0}
///V205 = 初训家
///V206 = 持有人
///V167 = 空招式.
///V171 = 遗传招式.
///V172 = 可回忆招式.
///V173 = 通过TM/HM学习.
///V174 = 通过招式教学学习.
///V175 = 特殊不可回忆招式.
///V177 = 升级招式.
///V203 = 无性别宝可梦不能没有性别.
///V201 = 未设置加密常数.
///V204 = 持有物未解禁.
///V187 = 种类在原始版本中不存在.
///V188 = 没有匹配的命中注定遇见. 神秘礼物数据有被共享吗?
///V194 = 太阳月亮游戏内交换功能尚未开发.
///V207 = 未设置PID.
///V208 = 加密常数与PID一致.
///V209 = 定点闪光不匹配.
///V210 = 刺尾虫进化形态与加密常数不一致.
///V211 = 加密常数 与 异色xor PID 匹配.
///V212 = 刺尾虫进化形态: {0}
///V213 [rest of string was truncated]&quot;;.
/// Looks up a localized string similar to V = 有效。
///V193 = 合法。
///V190 = 内部错误。
///V189 = 无法对该宝可梦分析。
///V196 = {0}: {1}
///V191 = {0} 招式 {1}: {2}
///V192 = {0} 回忆招式 {1}: {2}
///V195 = 相遇方式: {0}
///V205 = 初训家
///V206 = 持有人
///V167 = 空招式。
///V171 = 遗传招式。
///V172 = 可回忆招式。
///V173 = 通过TM/HM习得。
///V174 = 通过招式教学习得。
///V175 = 特殊不可回忆招式。
///V177 = 通过升级习得。
///V203 = 无性别宝可梦不能有性别。
///V201 = 未设置加密常数。
///V204 = 持有物未解禁。
///V187 = 该种宝可梦在原始版本中不存在。
///V188 = 没有匹配的“命中注定遇见”的数据。 该神秘礼物有被共享吗?
///V194 = 太阳月亮游戏内交换宝可梦的功能尚未开发。
///V207 = 未设置PID。
///V208 = 加密常数与PID一致。
///V209 = 定点相遇闪光条件不匹配。
///V210 = 刺尾虫进化形态与加密常数不一致。
///V211 = 加密 [rest of string was truncated]&quot;;.
/// </summary>
public static string legality_zh {
public static string LegalityCheckStrings_zh {
get {
return ResourceManager.GetString("legality_zh", resourceCulture);
return ResourceManager.GetString("LegalityCheckStrings_zh", resourceCulture);
}
}
@ -27650,10 +27648,10 @@ namespace PKHeX.Core.Properties {
///
///
///Go
///
///藍色[INT]/綠色[JP]
///藍色[JP]
///黃色.
///
///蓝[国际]/绿[日]
///蓝[日]
///.
/// </summary>
public static string text_games_zh {
get {

View file

@ -7561,10 +7561,10 @@
<data name="pgf" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\pgf.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="legality_en" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\text\en\legality_en.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
<data name="LegalityCheckStrings_en" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\text\en\LegalityCheckStrings_en.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
</data>
<data name="legality_zh" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\text\zh\legality_zh.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
<data name="LegalityCheckStrings_zh" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\text\zh\LegalityCheckStrings_zh.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
</root>

View file

@ -145,7 +145,6 @@ V111 = 非帮手宝可梦拥有隐藏特性。
V300 = 在非群战/朋友原野区获得隐藏特性。
V112 = 隐藏特性不可获得。
V217 = 隐藏洞穴捕获的宝可梦必定为隐藏特性。
V218 = 在野外普通相遇不可能有隐藏特性。
V115 = 特性与特性值一致。
V113 = 特性与PID不一致。
V114 = 特性与特性值不一致。

View file

@ -1,11 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace PKHeX.Core
{
public partial class Util
{
private const string TranslationSplitter = " = ";
#region String Lists
@ -127,7 +129,93 @@ namespace PKHeX.Core
}
catch { return null; }
}
#region Non-Form Translation
/// <summary>
/// Gets the names of the properties defined in the given input
/// </summary>
/// <param name="input">Enumerable of translation definitions in the form "Property = Value".</param>
/// <returns></returns>
private static string[] getProps(IEnumerable<string> input)
{
return input.Select(l => l.Substring(0, l.IndexOf(TranslationSplitter, StringComparison.Ordinal))).ToArray();
}
private static IEnumerable<string> DumpStrings(Type t)
{
var props = ReflectUtil.getPropertiesStartWithPrefix(t, "V");
return props.Select(p => $"{p}{TranslationSplitter}{ReflectUtil.GetValue(t, p).ToString()}");
}
/// <summary>
/// Gets the current localization in a static class containing language-specific strings
/// </summary>
public static string[] getLocalization(Type t, string[] existingLines = null)
{
existingLines = existingLines ?? new string[0];
var currentLines = DumpStrings(t).ToArray();
var existing = getProps(existingLines);
var current = getProps(currentLines);
var result = new string[currentLines.Length];
for (int i = 0; i < current.Length; i++)
{
int index = Array.IndexOf(existing, current[i]);
result[i] = index < 0 ? currentLines[i] : existingLines[index];
}
return result;
}
/// <summary>
/// Applies localization to a static class containing language-specific strings.
/// </summary>
/// <param name="t">Type of the static class containing the desired strings.</param>
/// <param name="lines">Lines containing the localized strings</param>
private static void setLocalization(Type t, IEnumerable<string> lines)
{
if (lines == null)
return;
foreach (var line in lines.Where(l => l != null))
{
var index = line.IndexOf(TranslationSplitter, StringComparison.Ordinal);
if (index < 0)
continue;
var prop = line.Substring(0, index);
var value = line.Substring(index + TranslationSplitter.Length);
try
{
ReflectUtil.SetValue(t, prop.ToUpper(), value);
}
catch
{
Console.WriteLine($"Property not present: {prop} || Value written: {value}");
}
}
}
/// <summary>
/// Applies localization to a static class containing language-specific strings.
/// </summary>
/// <param name="t">Type of the static class containing the desired strings.</param>
/// <param name="languageFilePrefix">Prefix of the language file to use. Example: if the target is legality_en.txt, <paramref name="languageFilePrefix"/> should be "legality".</param>
private static void setLocalization(Type t, string languageFilePrefix)
{
setLocalization(t, getStringList($"{languageFilePrefix}_{Thread.CurrentThread.CurrentCulture.Name.Substring(0, 2)}"));
}
/// <summary>
/// Applies localization to a static class containing language-specific strings.
/// </summary>
/// <param name="t">Type of the static class containing the desired strings.</param>
/// <remarks>The values used to translate the given static class are retrieved from [TypeName]_[CurrentLangCode2].txt in the resource manager of PKHeX.Core.</remarks>
public static void setLocalization(Type t)
{
setLocalization(t, t.Name);
}
#endregion
#region DataSource Providing
public static List<ComboItem> getCBList(string textfile, string lang)
{