mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-01 22:58:16 -05:00
Add more gen2 hypothetical handling
won't be active until VC2 release
This commit is contained in:
@@ -256,8 +256,13 @@ private void updateTradebackG12()
|
||||
}
|
||||
private void updateTypeInfo()
|
||||
{
|
||||
if (pkm.VC && pkm.Format == 7)
|
||||
info.EncounterMatch = EncounterGenerator.getRBYStaticTransfer(pkm.Species);
|
||||
if (pkm.Format >= 7)
|
||||
{
|
||||
if (pkm.VC1)
|
||||
info.EncounterMatch = EncounterGenerator.getRBYStaticTransfer(pkm.Species);
|
||||
else if (pkm.VC2)
|
||||
info.EncounterMatch = EncounterGenerator.getGSStaticTransfer(pkm.Species);
|
||||
}
|
||||
|
||||
if (pkm.GenNumber <= 2 && pkm.TradebackStatus == TradebackType.Any && (EncounterMatch as GBEncounterData)?.Generation != pkm.GenNumber)
|
||||
// Example: GSC Pokemon with only possible encounters in RBY, like the legendary birds
|
||||
|
||||
@@ -1171,6 +1171,21 @@ internal static EncounterStatic getRBYStaticTransfer(int species)
|
||||
Version = GameVersion.RBY
|
||||
};
|
||||
}
|
||||
internal static EncounterStatic getGSStaticTransfer(int species)
|
||||
{
|
||||
return new EncounterStatic
|
||||
{
|
||||
Species = species,
|
||||
Gift = true, // Forces Poké Ball
|
||||
Ability = TransferSpeciesDefaultAbility_2.Contains(species) ? 1 : 4, // Hidden by default, else first
|
||||
Shiny = species == 151 || species == 251 ? (bool?)false : null,
|
||||
Fateful = species == 151 || species == 251,
|
||||
Location = 30004, // todo
|
||||
EggLocation = 0,
|
||||
IV3 = true,
|
||||
Version = GameVersion.GS
|
||||
};
|
||||
}
|
||||
internal static bool getEncounterTrade1Valid(PKM pkm)
|
||||
{
|
||||
string ot = pkm.OT_Name;
|
||||
|
||||
@@ -151,5 +151,6 @@ public static partial class Legal
|
||||
// todo
|
||||
};
|
||||
internal static readonly bool[] ReleasedHeldItems_2 = Enumerable.Range(0, MaxItemID_2+1).Select(i => HeldItems_GSC.Contains((ushort)i) && !UnreleasedItems_2.Contains(i)).ToArray();
|
||||
internal static readonly int[] TransferSpeciesDefaultAbility_2 = {92, 93, 94, 109, 110, 151, 200, 201, 247, 251}; // todo VC2: 247 (pupitar)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,6 +365,88 @@ public PK1 convertToPK1()
|
||||
|
||||
return pk1;
|
||||
}
|
||||
|
||||
public PK7 convertToPK7()
|
||||
{
|
||||
var pk7 = new PK7
|
||||
{
|
||||
EncryptionConstant = Util.rnd32(),
|
||||
Species = Species,
|
||||
TID = TID,
|
||||
CurrentLevel = CurrentLevel,
|
||||
EXP = EXP,
|
||||
Met_Level = CurrentLevel,
|
||||
Nature = (int)(EXP % 25),
|
||||
PID = Util.rnd32(),
|
||||
Ball = 4,
|
||||
MetDate = DateTime.Now,
|
||||
Version = (int)GameVersion.S,
|
||||
Move1 = Move1,
|
||||
Move2 = Move2,
|
||||
Move3 = Move3,
|
||||
Move4 = Move4,
|
||||
Move1_PPUps = Move1_PPUps,
|
||||
Move2_PPUps = Move2_PPUps,
|
||||
Move3_PPUps = Move3_PPUps,
|
||||
Move4_PPUps = Move4_PPUps,
|
||||
Move1_PP = Move1_PP,
|
||||
Move2_PP = Move2_PP,
|
||||
Move3_PP = Move3_PP,
|
||||
Move4_PP = Move4_PP,
|
||||
Met_Location = 30004,
|
||||
Gender = PersonalTable.SM[Species].RandomGender,
|
||||
OT_Name = PKX.getG1ConvertedString(otname, Japanese),
|
||||
IsNicknamed = false,
|
||||
|
||||
Country = PKMConverter.Country,
|
||||
Region = PKMConverter.Region,
|
||||
ConsoleRegion = PKMConverter.ConsoleRegion,
|
||||
CurrentHandler = 1,
|
||||
HT_Name = PKMConverter.OT_Name,
|
||||
HT_Gender = PKMConverter.OT_Gender,
|
||||
Language = PKMConverter.Language,
|
||||
Geo1_Country = PKMConverter.Country,
|
||||
Geo1_Region = PKMConverter.Region
|
||||
};
|
||||
pk7.Nickname = PKX.getSpeciesNameGeneration(pk7.Species, pk7.Language, pk7.Format);
|
||||
if (otname[0] == 0x5D) // Ingame Trade
|
||||
{
|
||||
var s = PKX.getG1Char(0x5D, Japanese);
|
||||
pk7.OT_Name = s.Substring(0, 1) + s.Substring(1).ToLower();
|
||||
}
|
||||
pk7.OT_Friendship = pk7.HT_Friendship = PersonalTable.SM[Species].BaseFriendship;
|
||||
|
||||
// IVs
|
||||
var special = Species == 151 || Species == 251;
|
||||
var new_ivs = new int[6];
|
||||
int flawless = special ? 5 : 3;
|
||||
for (var i = 0; i < new_ivs.Length; i++) new_ivs[i] = (int)(Util.rnd32() & 31);
|
||||
for (var i = 0; i < flawless; i++) new_ivs[i] = 31;
|
||||
Util.Shuffle(new_ivs);
|
||||
pk7.IVs = new_ivs;
|
||||
|
||||
// Really? :(
|
||||
if (IsShiny)
|
||||
pk7.setShinyPID();
|
||||
|
||||
int abil = 2; // Hidden
|
||||
if (Legal.TransferSpeciesDefaultAbility_2.Contains(Species))
|
||||
abil = 0; // Reset
|
||||
pk7.RefreshAbility(abil); // 0/1/2 (not 1/2/4)
|
||||
|
||||
if (special)
|
||||
pk7.FatefulEncounter = true;
|
||||
else if (IsNicknamed)
|
||||
{
|
||||
pk7.IsNicknamed = true;
|
||||
pk7.Nickname = PKX.getG1ConvertedString(nick, Japanese);
|
||||
}
|
||||
|
||||
pk7.TradeMemory(Bank: true); // oh no, memories on gen7 pkm
|
||||
|
||||
pk7.RefreshChecksum();
|
||||
return pk7;
|
||||
}
|
||||
}
|
||||
|
||||
public class PokemonList2
|
||||
|
||||
Reference in New Issue
Block a user