mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-15 08:31:21 -05:00
Move trade->pkm edge case handling to derived classes
This commit is contained in:
parent
934316d68d
commit
bb68dcc3cb
|
|
@ -132,8 +132,6 @@ protected virtual void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria
|
|||
if (EggLocation != 0)
|
||||
SetEggMetData(pk, time);
|
||||
|
||||
UpdateEdgeCase(pk);
|
||||
|
||||
if (pk.Format < 6)
|
||||
return;
|
||||
|
||||
|
|
@ -189,38 +187,6 @@ private static void SetMetData(PKM pk, int level, int location, DateTime time)
|
|||
pk.MetDate = time;
|
||||
}
|
||||
|
||||
private void UpdateEdgeCase(PKM pkm)
|
||||
{
|
||||
switch (Generation)
|
||||
{
|
||||
case 3 when Species == (int)Core.Species.Jynx && pkm.Version == (int) GameVersion.LG && pkm.Language == (int) LanguageID.Italian:
|
||||
// Italian LG Jynx untranslated from English name
|
||||
pkm.OT_Name = GetOT((int)LanguageID.English);
|
||||
pkm.SetNickname(GetNickname((int)LanguageID.English));
|
||||
break;
|
||||
|
||||
case 4 when Version == GameVersion.DPPt && Species == (int)Core.Species.Magikarp: // Meister Magikarp
|
||||
// Has German Language ID for all except German origin, which is English
|
||||
pkm.Language = (int)(pkm.Language == (int)LanguageID.German ? LanguageID.English : LanguageID.German);
|
||||
break;
|
||||
|
||||
case 4 when Version == GameVersion.DPPt && (pkm.Version is (int)GameVersion.D or (int)GameVersion.P):
|
||||
// DP English origin are Japanese lang
|
||||
pkm.Language = (int)LanguageID.Japanese;
|
||||
break;
|
||||
|
||||
case 4 when Version == GameVersion.HGSS && Species == (int)Core.Species.Pikachu: // Pikachu
|
||||
// Has English Language ID for all except English origin, which is French
|
||||
pkm.Language = (int)(pkm.Language == (int)LanguageID.English ? LanguageID.French : LanguageID.English);
|
||||
break;
|
||||
|
||||
case 5 when Version == GameVersion.BW && pkm.Language == (int)LanguageID.Japanese:
|
||||
// Trades for JPN games have language ID of 0, not 1.
|
||||
pkm.Language = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool IsMatch(PKM pkm, DexLevel evo)
|
||||
{
|
||||
if (IVs.Count != 0)
|
||||
|
|
|
|||
|
|
@ -53,6 +53,15 @@ public override bool IsMatch(PKM pkm, DexLevel evo)
|
|||
protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk)
|
||||
{
|
||||
base.ApplyDetails(sav, criteria, pk);
|
||||
var pk3 = (PK3) pk;
|
||||
|
||||
// Italian LG Jynx untranslated from English name
|
||||
if (Species == (int)Core.Species.Jynx && pk3.Version == (int)GameVersion.LG && pk3.Language == (int)LanguageID.Italian)
|
||||
{
|
||||
pk3.OT_Name = GetOT((int)LanguageID.English);
|
||||
pk3.SetNickname(GetNickname((int)LanguageID.English));
|
||||
}
|
||||
|
||||
this.CopyContestStatsTo((PK3)pk);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,24 @@ public override bool IsMatch(PKM pkm, DexLevel evo)
|
|||
protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk)
|
||||
{
|
||||
base.ApplyDetails(sav, criteria, pk);
|
||||
var pkm = (PK4) pk;
|
||||
|
||||
if (Version == GameVersion.DPPt)
|
||||
{
|
||||
// Has German Language ID for all except German origin, which is English
|
||||
if (Species == (int)Core.Species.Magikarp)
|
||||
pkm.Language = (int)(pkm.Language == (int)LanguageID.German ? LanguageID.English : LanguageID.German);
|
||||
// All other trades received: English games have a Japanese language ID instead of English.
|
||||
else if (pkm.Language == (int)LanguageID.English)
|
||||
pkm.Language = (int)LanguageID.Japanese;
|
||||
}
|
||||
else // HGSS
|
||||
{
|
||||
// Has English Language ID for all except English origin, which is French
|
||||
if (Species == (int)Core.Species.Pikachu)
|
||||
pkm.Language = (int)(pkm.Language == (int)LanguageID.English ? LanguageID.French : LanguageID.English);
|
||||
}
|
||||
|
||||
this.CopyContestStatsTo((PK4)pk);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,15 @@ public EncounterTrade5PID(uint pid)
|
|||
Shiny = Shiny.FixedValue;
|
||||
}
|
||||
|
||||
protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk)
|
||||
{
|
||||
base.ApplyDetails(sav, criteria, pk);
|
||||
|
||||
// Trades for JPN games have language ID of 0, not 1.
|
||||
if (pk.Language == (int) LanguageID.Japanese)
|
||||
pk.Language = 0;
|
||||
}
|
||||
|
||||
protected override void SetPINGA(PKM pk, EncounterCriteria criteria)
|
||||
{
|
||||
var pi = pk.PersonalInfo;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user