Add gen2 encounter static/trades

This commit is contained in:
Kurt 2017-03-04 21:45:08 -08:00
parent 19600263bd
commit 9bb799367d
3 changed files with 95 additions and 20 deletions

View file

@ -430,7 +430,7 @@ namespace PKHeX.Core
switch (gameSource)
{
case GameVersion.RBY:
return getValidEncounterTradeVC1(pkm, p);
return getValidEncounterTradeVC1(pkm, p, TradeGift_RBY);
case GameVersion.GSC:
return getValidEncounterTradeVC2(pkm, p);
default:
@ -439,24 +439,36 @@ namespace PKHeX.Core
}
private static EncounterTrade getValidEncounterTradeVC2(PKM pkm, DexLevel[] p)
{
var z = TradeGift_GSC.FirstOrDefault(f => p.Any(r => r.Species == f.Species));
if (z == null)
return null;
// Check RBY trades with loosened level criteria.
var z = getValidEncounterTradeVC1(pkm, p, TradeGift_RBY_2);
if (z != null)
return z;
// Check GSC trades. Reuse generic table fetch-match
z = getValidEncounterTradeVC1(pkm, p, TradeGift_GSC);
// Filter Criteria
for (int i = 0; i < 6; i++)
if (z.IVs[i] != -1 && z.IVs[i] != pkm.IVs[i])
return null;
if (z?.Gender != pkm.Gender)
return null;
if (z.TID != pkm.TID)
return null;
if (!z.IVs.SequenceEqual(pkm.IVs))
return null;
if (pkm.Met_Location != 0 && pkm.Format == 2 && pkm.Met_Location != z.Location)
return null;
int index = Array.IndexOf(TradeGift_GSC, z);
if (TradeGift_GSC_OTs[index].All(ot => ot != pkm.OT_Name))
return null;
return z;
}
private static EncounterTrade getValidEncounterTradeVC1(PKM pkm, DexLevel[] p)
private static EncounterTrade getValidEncounterTradeVC1(PKM pkm, DexLevel[] p, EncounterTrade[] table)
{
var z = TradeGift_RBY.FirstOrDefault(f => p.Any(r => r.Species == f.Species));
if (z?.Level > pkm.CurrentLevel) // minimum required level
var z = table.FirstOrDefault(f => p.Any(r => r.Species == f.Species));
if (z == null)
return null;
if (z.Level > pkm.CurrentLevel) // minimum required level
return null;
return z;
}

View file

@ -148,8 +148,8 @@ namespace PKHeX.Core
new EncounterTrade { Species = 124, Level = 10 }, // Jynx - Fish Poliwhirl (RBY: 15)
//new EncounterTrade { Species = 083, Level = 02 }, // Farfetchd - Wild Spearow
//new EncounterTrade { Species = 101, Level = 03 }, // Electrode - Wild Raichu
new EncounterTrade { Species = 114, Level = 13 }, // Tangela - Wild Venonat (RBY: 5)
new EncounterTrade { Species = 086, Level = 06 }, // Seel - Wild Ponyta (RBY: 28)
new EncounterTrade { Species = 114, Level = 05 }, // Tangela - Wild Venonat (RBY: 13)
new EncounterTrade { Species = 086, Level = 05 }, // Seel - Egg Ponyta (RBY: 28)
//new EncounterTrade { Species = 122, Level = 03 }, // Mr. Mime - Wild Jigglypuff
//new EncounterTrade { Species = 060, Level = 02 }, // Poliwag - Wild Rattata
@ -159,15 +159,15 @@ namespace PKHeX.Core
//new EncounterTrade { Species = 083, Level = 02 }, // Farfetchd - Wild Pidgey
new EncounterTrade { Species = 075, Level = 15 }, // Graveler - Evolve Kadabra (RBY: 16)
//new EncounterTrade { Species = 079, Level = 22 }, // Slowpoke - Wild Seel
new EncounterTrade { Species = 098, Level = 05 }, // Krabby - Wild Growlithe (RBY: 15)
new EncounterTrade { Species = 098, Level = 05 }, // Krabby - Egg Growlithe (RBY: 15)
//new EncounterTrade { Species = 122, Level = 08 }, // Mr. Mime - Wild Clefairy (RBY: 6)
new EncounterTrade { Species = 067, Level = 10 }, // Machoke - Wild Cubone (RBY: 20)
new EncounterTrade { Species = 067, Level = 05 }, // Machoke - Egg Cubone (RBY: 20)
//new EncounterTrade { Species = 051, Level = 15 }, // Dugtrio - Trade Lickitung
//new EncounterTrade { Species = 047, Level = 13 }, // Parasect - Trade Tangela
new EncounterTrade { Species = 112, Level = 10 }, // Rhydon - Surf Golduck (RBY: 15)
new EncounterTrade { Species = 087, Level = 05 }, // Dewgong - Wild Growlithe (RBY: 15)
new EncounterTrade { Species = 089, Level = 14 }, // Muk - Wild Kangaskhan (RBY: 25)
new EncounterTrade { Species = 087, Level = 05 }, // Dewgong - Egg Growlithe (RBY: 15)
new EncounterTrade { Species = 089, Level = 05 }, // Muk - Egg Kangaskhan (RBY: 25)
};
internal static readonly EncounterArea FishOldGood_RBY = new EncounterArea { Location = -1, Slots = new EncounterSlot[]
{

View file

@ -53,11 +53,74 @@ namespace PKHeX.Core
};
internal static readonly EncounterStatic[] Encounter_GSC =
{
// todo
new EncounterStatic { Species = 152, Level = 05, Version = GameVersion.GSC }, // Chikorita @ New Bark Town
new EncounterStatic { Species = 155, Level = 05, Version = GameVersion.GSC }, // Cyndaquil @ New Bark Town
new EncounterStatic { Species = 158, Level = 05, Version = GameVersion.GSC }, // Totodile @ New Bark Town
new EncounterStatic { Species = 175, Level = 05, Version = GameVersion.GSC }, // Togepi
new EncounterStatic { Species = 131, Level = 20, Version = GameVersion.GSC }, // Lapras @ Union Cave
new EncounterStatic { Species = 133, Level = 20, Version = GameVersion.GSC }, // Eevee @ Goldenrod City
new EncounterStatic { Species = 185, Level = 20, Version = GameVersion.GSC }, // Sudowoodo @ Route 36
new EncounterStatic { Species = 213, Level = 15, Version = GameVersion.GSC }, // Shuckle @ Cianwood City
new EncounterStatic { Species = 236, Level = 10, Version = GameVersion.GSC }, // Tyrogue @ Mt. Mortar
new EncounterStatic { Species = 130, Level = 30, Version = GameVersion.GSC, Shiny = true, }, // Gyarados @ Lake of Rage
new EncounterStatic { Species = 074, Level = 21, Version = GameVersion.GSC }, // Geodude @ Rocket Hideout
new EncounterStatic { Species = 109, Level = 21, Version = GameVersion.GSC }, // Koffing @ Rocket Hideout
new EncounterStatic { Species = 100, Level = 23, Version = GameVersion.GSC }, // Voltorb @ Rocket Hideout
new EncounterStatic { Species = 101, Level = 23, Version = GameVersion.GSC }, // Electrode @ Rocket Hideout
new EncounterStatic { Species = 143, Level = 50, Version = GameVersion.GSC }, // Snorlax @ Vermillion City
new EncounterStatic { Species = 243, Level = 40, Version = GameVersion.GSC }, // Raikou
new EncounterStatic { Species = 244, Level = 40, Version = GameVersion.GSC }, // Entei
new EncounterStatic { Species = 245, Level = 40, Version = GameVersion.GS }, // Suicune
new EncounterStatic { Species = 245, Level = 40, Version = GameVersion.C }, // Suicune @ Tin Tower
new EncounterStatic { Species = 172, Level = 05, Version = GameVersion.C, Moves = new [] {146} }, // Pichu Dizzy Punch
new EncounterStatic { Species = 173, Level = 05, Version = GameVersion.C, Moves = new [] {146} }, // Cleffa Dizzy Punch
new EncounterStatic { Species = 174, Level = 05, Version = GameVersion.C, Moves = new [] {146} }, // Igglybuff Dizzy Punch
new EncounterStatic { Species = 236, Level = 05, Version = GameVersion.C, Moves = new [] {146} }, // Tyrogue Dizzy Punch
new EncounterStatic { Species = 238, Level = 05, Version = GameVersion.C, Moves = new [] {146} }, // Smoochum Dizzy Punch
new EncounterStatic { Species = 239, Level = 05, Version = GameVersion.C, Moves = new [] {146} }, // Elekid Dizzy Punch
new EncounterStatic { Species = 240, Level = 05, Version = GameVersion.C, Moves = new [] {146} }, // Magby Dizzy Punch
new EncounterStatic { Species = 147, Level = 40, Version = GameVersion.C, Moves = new [] {245} }, // Dratini ExtremeSpeed
new EncounterStatic { Species = 249, Level = 70, Version = GameVersion.GD }, // Lugia @ Whirl Islands
new EncounterStatic { Species = 249, Level = 40, Version = GameVersion.SV }, // Lugia @ Whirl Islands
new EncounterStatic { Species = 249, Level = 60, Version = GameVersion.C }, // Lugia @ Whirl Islands
new EncounterStatic { Species = 250, Level = 40, Version = GameVersion.GD }, // Ho-Oh @ Tin Tower
new EncounterStatic { Species = 250, Level = 70, Version = GameVersion.SV }, // Ho-Oh @ Tin Tower
new EncounterStatic { Species = 250, Level = 60, Version = GameVersion.C }, // Ho-Oh @ Tin Tower
new EncounterStatic { Species = 251, Level = 30, Version = GameVersion.SPECIAL }, // Celebi @ Ilex Forest
};
internal static readonly EncounterTrade[] TradeGift_GSC =
{
// todo
new EncounterTrade { Species = 095, Level = 03, Gender = 0, Location = 06, TID = 48926, IVs = new[] {08, 09, 06, 06, 06} }, // Onix @ Violet City for Bellsprout [wild]
new EncounterTrade { Species = 066, Level = 05, Gender = 1, Location = 16, TID = 37460, IVs = new[] {12, 03, 07, 06, 06} }, // Machop @ Goldenrod City for Drowzee [wild 9, hatched egg 5]
new EncounterTrade { Species = 100, Level = 05, Gender = 2, Location = 27, TID = 29189, IVs = new[] {08, 09, 08, 08, 08} }, // Voltorb @ Olivine City for Krabby [egg]
new EncounterTrade { Species = 112, Level = 30, Gender = 1, Location = 41, TID = 00283, IVs = new[] {12, 07, 07, 06, 06} }, // Rhydon @ Blackthorn City for Dragonair [blue jp game corner]
new EncounterTrade { Species = 142, Level = 05, Gender = 0, Location = 76, TID = 26491, IVs = new[] {08, 09, 06, 06, 06} }, // Aerodactyl @ Route 14 for Chansey [egg]
new EncounterTrade { Species = 078, Level = 14, Gender = 0, Location = 51, TID = 15616, IVs = new[] {08, 09, 06, 06, 06} }, // Rapidash @ Pewter City for Gloom [wild]
new EncounterTrade { Species = 085, Level = 30, Gender = 1, Location = 41, TID = 00283, IVs = new[] {12, 07, 07, 06, 06} }, // Dodrio @ Blackthorn City for Dragonair [blue jp game corner]
new EncounterTrade { Species = 178, Level = 15, Gender = 0, Location = 51, TID = 15616, IVs = new[] {08, 09, 06, 08, 06} }, // Xatu @ Pewter City for Haunter [wild]
new EncounterTrade { Species = 082, Level = 16, Gender = 2, Location = 68, TID = 50082, IVs = new[] {08, 09, 06, 06, 06} }, // Magneton @ Power Plant for Dugtrio [wild]
};
internal static readonly string[][] TradeGift_GSC_OTs =
{
new[] { "コンタ", "KYLE" },
new[] { "ナオキ", "MIKE" },
new[] { "ゲン", "TIM" },
new[] { "ミサコ", "EMY" },
new[] { "キヨミ", "KIM" },
new[] { "デンジ", "CHRIS" },
new[] { "ミサコ", "EMY" },
new[] { "デンジ", "CHRIS" },
new[] { "モリオ", "FOREST" },
};
internal static readonly int[] UnreleasedItems_2 =
{