Update Ho-Oh mattle check

More languages than Italian have a rule-breaking name. Rework checks a
bit
Flag eggs more accurately
Update force hatch to move Link Trade met location to Egg Location

fix Ho-oh -> Ho-Oh text strings (correctness is key!)
This commit is contained in:
Kurt 2018-10-27 16:06:06 -07:00
parent a3e7c4837e
commit ed3699fbb4
11 changed files with 56 additions and 32 deletions

View file

@ -572,6 +572,8 @@ namespace PKHeX.Core
pkm.IsEgg = false;
pkm.SetNickname();
pkm.CurrentFriendship = pkm.PersonalInfo.BaseFriendship;
if (pkm.IsTradedEgg)
pkm.Egg_Location = pkm.Met_Location;
var loc = EncounterSuggestion.GetSuggestedEggMetLocation(pkm);
if (loc >= 0)
pkm.Met_Location = loc;

View file

@ -877,7 +877,17 @@ namespace PKHeX.Core
return 2000;
}
public static int GetNicknameOTMaxLength(int gen, LanguageID lang)
public static int GetMaxLengthOT(int gen, LanguageID lang)
{
switch (lang)
{
case LanguageID.Korean:
case LanguageID.Japanese: return gen >= 6 ? 6 : 5;
default: return gen >= 6 ? 12 : 7;
}
}
public static int GetMaxLengthNickname(int gen, LanguageID lang)
{
switch (lang)
{

View file

@ -305,7 +305,7 @@ namespace PKHeX.Core
new EncounterStatic { Species = 486, Level = 50, Location = 306, IV3 = true }, // Regigigas
new EncounterStatic { Species = 249, Level = 50, Location = 304, Version = GameVersion.AS, IV3 = true }, // Lugia
new EncounterStatic { Species = 250, Level = 50, Location = 304, Version = GameVersion.OR, IV3 = true }, // Ho-oh
new EncounterStatic { Species = 250, Level = 50, Location = 304, Version = GameVersion.OR, IV3 = true }, // Ho-Oh
new EncounterStatic { Species = 483, Level = 50, Location = 348, Version = GameVersion.AS, IV3 = true }, // Dialga
new EncounterStatic { Species = 484, Level = 50, Location = 348, Version = GameVersion.OR, IV3 = true }, // Palkia

View file

@ -22,14 +22,12 @@ namespace PKHeX.Core
new WC3 { Species = 025, Level = 10, TID = 31121, OT_Gender = 0, OT_Name = "COLOS", CardTitle = "Colosseum Pikachu", Method = PIDType.CXD, Shiny = Shiny.Never, Language = (int)LanguageID.English, NotDistributed = true },
};
internal const string ColoHoOhItalian = "MONTE LOTT";
private static IEnumerable<WC3> GetIngameCXDData()
{
var langs = new[]{LanguageID.Japanese, LanguageID.English, LanguageID.French, LanguageID.Italian, LanguageID.German, LanguageID.Spanish};
var h = new[] {null, "ダニー", "HORDEL", "VOLKER", "ODINO", "HORAZ", null, "HORDEL"};
var d = new[] {null, "ギンザル", "DUKING", "DOKING", "RODRIGO", "GRAND", null, "GERMÁN"};
var m = new[] {null, "バトルやま", "MATTLE", "MT BATA", ColoHoOhItalian, "DUELLBE", null, "ERNESTO"};
var m = new[] {null, "バトルやま", "MATTLE", "MT BATAILL", "MONTE LOTT", "DUELLBERG", null, "ERNESTO"}; // truncated on ck3->pk3 transfer
return langs.SelectMany(l => GetIngame((int)l));
IEnumerable<WC3> GetIngame(int l)
@ -42,7 +40,7 @@ namespace PKHeX.Core
new WC3 { Species = 213, Level = 20, Language = l, Location = 116, TID = 37149, SID = -1, OT_Gender = 0, OT_Name = d[l], Version = GameVersion.XD, CardTitle = $"Trade Surskit ({id})", Method = PIDType.CXD, Shiny = Shiny.Never, Moves = new[] { 092, 164, 188, 277 }, Fateful = true }, // Shuckle @ Pyrite Town
new WC3 { Species = 246, Level = 20, Language = l, Location = 116, TID = 37149, SID = -1, OT_Gender = 0, OT_Name = d[l], Version = GameVersion.XD, CardTitle = $"Trade Wooper ({id})", Method = PIDType.CXD, Shiny = Shiny.Never, Moves = new[] { 201, 349, 044, 200 }, Fateful = true }, // Larvitar @ Pyrite Town
new WC3 { Species = 311, Level = 13, Language = l, Location = 254, TID = 37149, SID = 0, OT_Gender = 0, OT_Name = d[l], Version = GameVersion.COLO, CardTitle = $"Special Gift ({id})", Method = PIDType.CXD, Shiny = Shiny.Never, Moves = new[] { 045, 086, 098, 270 } }, // Plusle @ Ingame Trade
new WC3 { Species = 250, Level = 70, Language = l, Location = 255, TID = 10048, SID = 0, OT_Gender = 0, OT_Name = m[l], Version = GameVersion.S, CardTitle = $"Mt. Battle Ho-oh ({id})", Method = PIDType.CXD, Shiny = Shiny.Never, Moves = new[] { 105, 126, 241, 129 } }, // Ho-oh @ Mt. Battle
new WC3 { Species = 250, Level = 70, Language = l, Location = 255, TID = 10048, SID = 0, OT_Gender = 0, OT_Name = m[l], Version = GameVersion.S, CardTitle = $"Mt. Battle Ho-Oh ({id})", Method = PIDType.CXD, Shiny = Shiny.Never, Moves = new[] { 105, 126, 241, 129 } }, // Ho-oh @ Mt. Battle
};
}
}

View file

@ -161,7 +161,7 @@ namespace PKHeX.Core
yield return z;
}
private static bool GetIsValidOTItalianMattleHoOh(string wc, string ot, bool ck3)
private static bool GetIsValidOTMattleHoOh(string wc, string ot, bool ck3)
{
if (ck3 && ot.Length == 10)
return wc == ot;
@ -180,14 +180,15 @@ namespace PKHeX.Core
if (wc.SID != -1 && wc.SID != pkm.SID) return false;
if (wc.TID != -1 && wc.TID != pkm.TID) return false;
if (wc.OT_Gender < 3 && wc.OT_Gender != pkm.OT_Gender) return false;
if (wc.OT_Name != null)
var wcOT = wc.OT_Name;
if (wcOT != null)
{
if (ReferenceEquals(EncountersWC3.ColoHoOhItalian, wc.OT_Name))
if (wcOT.Length > 7) // Colosseum Mattle Ho-Oh
{
if (!GetIsValidOTItalianMattleHoOh(wc.OT_Name, pkm.OT_Name, pkm is CK3))
if (!GetIsValidOTMattleHoOh(wcOT, pkm.OT_Name, pkm is CK3))
return false;
}
else if (wc.OT_Name != pkm.OT_Name)
else if (wcOT != pkm.OT_Name)
{
return false;
}

View file

@ -80,7 +80,7 @@ namespace PKHeX.Core
data.AddLine(GetInvalid(LNickInvalidChar));
return true;
}
if (nickname.Length > Legal.GetNicknameOTMaxLength(data.Info.Generation, (LanguageID)pkm.Language))
if (nickname.Length > Legal.GetMaxLengthNickname(data.Info.Generation, (LanguageID)pkm.Language))
{
data.AddLine(Get(LNickLengthLong, data.EncounterOriginal.EggEncounter ? Severity.Fishy : Severity.Invalid));
return true;

View file

@ -60,10 +60,10 @@ namespace PKHeX.Core
{
VerifyOTG1(data);
}
else if (ot.Length > Legal.GetNicknameOTMaxLength(data.Info.Generation, (LanguageID)pkm.Language))
else if (ot.Length > Legal.GetMaxLengthOT(data.Info.Generation, (LanguageID)pkm.Language))
{
if (!pkm.IsEgg) // ignore eggs, on trade, OT is not updated if language is
data.AddLine(Get(LOTLong, data.EncounterOriginal.EggEncounter ? Severity.Fishy : Severity.Invalid));
if (!IsEdgeCaseLength(pkm, data.EncounterOriginal, ot))
data.AddLine(Get(LOTLong, Severity.Invalid));
}
if (ParseSettings.CheckWordFilter)
@ -77,6 +77,22 @@ namespace PKHeX.Core
}
}
public static bool IsEdgeCaseLength(PKM pkm, IEncounterable e, string ot)
{
if (e.EggEncounter)
{
bool eggEdge = pkm.IsEgg ? pkm.IsTradedEgg : pkm.WasTradedEgg;
if (!eggEdge)
return false;
var len = Legal.GetMaxLengthOT(pkm.GenNumber, LanguageID.English); // max case
return ot.Length <= len;
}
if (e is MysteryGift mg && mg.OT_Name.Length == ot.Length)
return true; // Mattle Ho-Oh
return false;
}
public void VerifyOTG1(LegalityAnalysis data)
{
var pkm = data.pkm;

View file

@ -519,19 +519,16 @@ namespace PKHeX.Core
public virtual bool WasEvent => (Met_Location > 40000 && Met_Location < 50000) || FatefulEncounter;
public virtual bool WasEventEgg => Gen4 ? WasEgg && Species == 490 : ((Egg_Location > 40000 && Egg_Location < 50000) || (FatefulEncounter && Egg_Location > 0)) && Met_Level == 1;
public bool WasTradedEgg
public bool WasTradedEgg => Egg_Location == GetTradedEggLocation();
public bool IsTradedEgg => Met_Location == GetTradedEggLocation();
private int GetTradedEggLocation()
{
get
switch (GenNumber)
{
switch (GenNumber)
{
case 4:
return Egg_Location == 2002;
case 5:
return Egg_Location == 30003;
default:
return Egg_Location == 30002;
}
case 4: return 2002;
case 5: return 30003;
default: return 30002;
}
}

View file

@ -23,7 +23,7 @@
0x1B0 Old Sea Map Used
0x091 Lugia Captured
0x092 Ho-oh Captured
0x092 Ho-Oh Captured
0x1AD Deoxys Captured
0x1BB Regirock Captured
0x1BC Regice Captured
@ -41,7 +41,7 @@
0x30E Kyogre Overworld Hidden
0x30F Groundon Overworld Hidden
0x320 Lugia Overworld Hidden
0x321 Ho-oh Overworld Hidden
0x321 Ho-Oh Overworld Hidden
0x3A7 Regirock Overworld Hidden
0x3A8 Regice Overworld Hidden
0x3A9 Registeel Overworld Hidden

View file

@ -19,16 +19,16 @@
0x081 Mewtwo Captured
0x082 Articuno Captured
0x09B Lugia Overworld
0x09C Ho-oh Overworld
0x09C Ho-Oh Overworld
0x2E4 Deoxys Captured
0x2F2 Lugia Captured
0x2F3 Ho-oh Captured
0x2F3 Ho-Oh Captured
0x2BD Moltres Defeated
0x2BE Articuno Defeated
0x2BF Zapdos Defeated
0x2F5 Lugia Defeated
0x2F6 Ho-oh Defeated
0x2F6 Ho-Oh Defeated
0x2F7 Deoxys Defeated
0x09A Deoxys Triangle Hidden
0x085 VOLTORB Defeated 1

View file

@ -158,7 +158,7 @@ namespace PKHeX.Core
public override int MaxEV => 255;
public override int Generation => 3;
protected override int GiftCountMax => 1;
public override int OTLength => 10; // as evident by Mattle Ho-oh (Italian)
public override int OTLength => 10; // as evident by Mattle Ho-Oh
public override int NickLength => 10;
public override int MaxMoney => 999999;