mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 22:54:14 +00:00
Implement placeholder pk7 conversion
For all generations that can transfer; pk1->7 is still disabled but the framework is set up for when that information arrives.
This commit is contained in:
parent
0fec576831
commit
bbee007429
2 changed files with 37 additions and 1 deletions
|
@ -560,6 +560,27 @@ namespace PKHeX
|
|||
pk.RefreshChecksum();
|
||||
return pk;
|
||||
}
|
||||
|
||||
public PKM convertPK1toPK7()
|
||||
{
|
||||
if (Format != 1)
|
||||
return null;
|
||||
if (Species > 151)
|
||||
return null;
|
||||
|
||||
var pk = new PK7();
|
||||
TransferPropertiesWithReflection(this, pk);
|
||||
pk.EVs = new int[6];
|
||||
pk.Nature = IVs.Sum() % 25;
|
||||
pk.IVs = new[] {31,31,31,31,31,31};
|
||||
pk.RefreshChecksum();
|
||||
if (!IsNicknamed)
|
||||
pk.Nickname = Nickname.ToLower();
|
||||
pk.Version = -1;
|
||||
pk.Ability = PersonalTable.SM[Species].Abilities[0];
|
||||
do PID = PKX.getRandomPID(Species, Gender, Version, Nature, AltForm, PID); while (!IsShiny);
|
||||
return pk;
|
||||
}
|
||||
protected void TransferPropertiesWithReflection(PKM Source, PKM Destination)
|
||||
{
|
||||
var SourceProperties = ReflectUtil.getPropertiesCanWritePublic(Source.GetType());
|
||||
|
|
|
@ -150,7 +150,13 @@ namespace PKHeX
|
|||
switch (fromType.Name)
|
||||
{
|
||||
case "PK1":
|
||||
pkm = (PKMType == typeof (PK2)) ? ((PK1) pk).convertToPK2() : null;
|
||||
if (toFormat == 2)
|
||||
{
|
||||
pkm = PKMType == typeof (PK2) ? ((PK1) pk).convertToPK2() : null;
|
||||
break;
|
||||
}
|
||||
if (toFormat == 7)
|
||||
pkm = null; // pkm.convertPK1toPK7();
|
||||
break;
|
||||
case "PK2":
|
||||
if (PKMType == typeof (PK1))
|
||||
|
@ -197,6 +203,9 @@ namespace PKHeX
|
|||
if (toFormat == 5)
|
||||
break;
|
||||
pkm = ((PK5)pkm).convertToPK6();
|
||||
if (toFormat == 6)
|
||||
break;
|
||||
pkm = new PK7(pkm.Data, pkm.Identifier);
|
||||
break;
|
||||
case "PK4":
|
||||
if (PKMType == typeof(BK4))
|
||||
|
@ -208,6 +217,9 @@ namespace PKHeX
|
|||
if (toFormat == 5)
|
||||
break;
|
||||
pkm = ((PK5)pkm).convertToPK6();
|
||||
if (toFormat == 6)
|
||||
break;
|
||||
pkm = new PK7(pkm.Data, pkm.Identifier);
|
||||
break;
|
||||
case "BK4":
|
||||
pkm = ((BK4)pkm).convertToPK4();
|
||||
|
@ -217,6 +229,9 @@ namespace PKHeX
|
|||
if (toFormat == 5)
|
||||
break;
|
||||
pkm = ((PK5)pkm).convertToPK6();
|
||||
if (toFormat == 6)
|
||||
break;
|
||||
pkm = new PK7(pkm.Data, pkm.Identifier);
|
||||
break;
|
||||
case "PK5":
|
||||
pkm = ((PK5)pkm).convertToPK6();
|
||||
|
|
Loading…
Reference in a new issue