mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-07 23:08:47 -05:00
Add magearna
Add fallthrough for events that do not match (fateful/event location) so that magearna can be caught in the static encounter check Add fateful/wishing ribbon checks for Static Encounters Add Gen7 WC6DB beginnings
This commit is contained in:
@@ -348,12 +348,12 @@ private CheckResult verifyEncounter()
|
||||
? new CheckResult(Severity.Invalid, "Invalid Link Gift: should not be Fateful Encounter.", CheckIdentifier.Encounter)
|
||||
: new CheckResult(Severity.Valid, "Valid Link gift.", CheckIdentifier.Encounter);
|
||||
}
|
||||
|
||||
if (pkm.WasEvent || pkm.WasEventEgg)
|
||||
{
|
||||
MysteryGift MatchedGift = EncounterMatch as MysteryGift;
|
||||
return MatchedGift == null
|
||||
? new CheckResult(Severity.Invalid, "Unable to match to a Mystery Gift in the database.", CheckIdentifier.Encounter)
|
||||
: new CheckResult(Severity.Valid, $"Matches #{MatchedGift.CardID.ToString("0000")} ({MatchedGift.CardTitle})", CheckIdentifier.Encounter);
|
||||
if (MatchedGift != null)
|
||||
return new CheckResult(Severity.Valid, $"Matches #{MatchedGift.CardID.ToString("0000")} ({MatchedGift.CardTitle})", CheckIdentifier.Encounter);
|
||||
}
|
||||
|
||||
EncounterMatch = Legal.getValidStaticEncounter(pkm);
|
||||
@@ -463,9 +463,10 @@ private CheckResult verifyEncounter()
|
||||
}
|
||||
EncounterMatch = Legal.getValidIngameTrade(pkm);
|
||||
if (EncounterMatch != null)
|
||||
{
|
||||
return new CheckResult(Severity.Valid, "Valid ingame trade.", CheckIdentifier.Encounter);
|
||||
}
|
||||
|
||||
if (pkm.WasEvent || pkm.WasEventEgg)
|
||||
return new CheckResult(Severity.Invalid, "Unable to match to a Mystery Gift in the database.", CheckIdentifier.Encounter);
|
||||
return new CheckResult(Severity.Invalid, "Not a valid encounter.", CheckIdentifier.Encounter);
|
||||
}
|
||||
private void verifyLevel()
|
||||
@@ -578,6 +579,22 @@ private void verifyRibbons()
|
||||
if (classic ^ ((EncounterLink)EncounterMatch).Classic)
|
||||
(classic ? invalidRibbons : missingRibbons).Add(EventRibName[4]);
|
||||
}
|
||||
else if (EncounterType == typeof(EncounterStatic))
|
||||
{
|
||||
// No Event Ribbons except Wishing (which is only for Magearna)
|
||||
for (int i = 0; i < EventRib.Length; i++)
|
||||
{
|
||||
if (i == 10)
|
||||
continue;
|
||||
|
||||
if (ReflectUtil.getBooleanState(pkm, EventRib[i]) == true)
|
||||
invalidRibbons.Add(EventRibName[i]);
|
||||
}
|
||||
|
||||
bool wishing = ReflectUtil.getBooleanState(pkm, EventRib[10]) == true;
|
||||
if (wishing ^ ((EncounterStatic)EncounterMatch).RibbonWishing)
|
||||
(wishing ? invalidRibbons : missingRibbons).Add(EventRibName[10]);
|
||||
}
|
||||
else // No ribbons
|
||||
{
|
||||
for (int i = 0; i < EventRib.Length; i++)
|
||||
@@ -1351,13 +1368,17 @@ private void verifyMisc()
|
||||
|
||||
if (Encounter.Valid && EncounterIsMysteryGift ^ pkm.FatefulEncounter)
|
||||
{
|
||||
if (pkm.AO && EncounterType == typeof(EncounterStatic) && pkm.Species == 386) // Deoxys Matched @ Sky Pillar
|
||||
{ AddLine(Severity.Valid, "Sky Pillar Deoxys matched Fateful Encounter.", CheckIdentifier.Fateful); return; }
|
||||
else
|
||||
{ AddLine(Severity.Invalid, "Fateful Encounter should " + (pkm.FatefulEncounter ? "not " : "") + "be checked.", CheckIdentifier.Fateful); return; }
|
||||
if (EncounterType == typeof (EncounterStatic))
|
||||
{
|
||||
var enc = EncounterMatch as EncounterStatic;
|
||||
if (enc.Fateful)
|
||||
AddLine(Severity.Valid, "Special ingame Fateful Encounter.", CheckIdentifier.Fateful);
|
||||
return;
|
||||
}
|
||||
AddLine(Severity.Invalid, "Fateful Encounter should " + (pkm.FatefulEncounter ? "not " : "") + "be checked.", CheckIdentifier.Fateful);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{ AddLine(Severity.Valid, "Fateful Encounter is Valid.", CheckIdentifier.Fateful); return; }
|
||||
AddLine(Severity.Valid, "Fateful Encounter is Valid.", CheckIdentifier.Fateful);
|
||||
}
|
||||
private CheckResult[] verifyMoves()
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PKHeX
|
||||
public static partial class Legal
|
||||
{
|
||||
// Event Database(s)
|
||||
internal static WC6[] WC6DB;
|
||||
internal static MysteryGift[] MGDB_G6, MGDB_G7 = new MysteryGift[0];
|
||||
|
||||
// Gen 6
|
||||
private static readonly EggMoves[] EggMovesXY = EggMoves6.getArray(Data.unpackMini(Properties.Resources.eggmove_xy, "xy"));
|
||||
@@ -349,17 +349,19 @@ internal static IEnumerable<MysteryGift> getValidGifts(PKM pkm)
|
||||
switch (pkm.GenNumber)
|
||||
{
|
||||
case 6:
|
||||
return getMatchingWC6(pkm);
|
||||
return getMatchingWC6(pkm, MGDB_G6);
|
||||
|
||||
default:
|
||||
return null;
|
||||
return getMatchingWC6(pkm, MGDB_G7);
|
||||
}
|
||||
}
|
||||
private static IEnumerable<MysteryGift> getMatchingWC6(PKM pkm)
|
||||
private static IEnumerable<MysteryGift> getMatchingWC6(PKM pkm, IEnumerable<MysteryGift> DB)
|
||||
{
|
||||
List<MysteryGift> validWC6 = new List<MysteryGift>();
|
||||
if (DB == null)
|
||||
return validWC6;
|
||||
var vs = getValidPreEvolutions(pkm).ToArray();
|
||||
foreach (WC6 wc in WC6DB.Where(wc => vs.Any(dl => dl.Species == wc.Species)))
|
||||
foreach (WC6 wc in DB.OfType<WC6>().Where(wc => vs.Any(dl => dl.Species == wc.Species)))
|
||||
{
|
||||
if (pkm.Egg_Location == 0) // Not Egg
|
||||
{
|
||||
|
||||
@@ -20,5 +20,8 @@ public class EncounterStatic
|
||||
public bool IV3;
|
||||
public int[] Contest = { 0, 0, 0, 0, 0, 0 };
|
||||
public int HeldItem { get; set; }
|
||||
|
||||
public bool Fateful = false;
|
||||
public bool RibbonWishing = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ public static partial class Legal
|
||||
new EncounterStatic { Species = 382, Level = 45, Location = 296, Version = GameVersion.AS, Shiny = false, IV3 = true }, // Kyogre
|
||||
new EncounterStatic { Species = 383, Level = 45, Location = 296, Version = GameVersion.OR, Shiny = false, IV3 = true }, // Groudon
|
||||
new EncounterStatic { Species = 384, Level = 70, Location = 316, Shiny = false, IV3 = true }, // Rayquaza
|
||||
new EncounterStatic { Species = 386, Level = 80, Location = 316, Shiny = false, IV3 = true }, // Deoxys
|
||||
new EncounterStatic { Species = 386, Level = 80, Location = 316, Shiny = false, IV3 = true, Fateful = true }, // Deoxys
|
||||
|
||||
new EncounterStatic { Species = 377, Level = 40, Location = 278, IV3 = true }, // Regirock
|
||||
new EncounterStatic { Species = 378, Level = 40, Location = 306, IV3 = true }, // Regice
|
||||
|
||||
@@ -102,7 +102,7 @@ public static partial class Legal
|
||||
#region Encounters
|
||||
private static readonly EncounterStatic[] Encounter_SM = // @ a\1\5\5
|
||||
{
|
||||
// Gfits - 0.bin
|
||||
// Gifts - 0.bin
|
||||
new EncounterStatic { Gift = true, Species = 722, Level = 5, Location = 24, }, // Rowlet
|
||||
new EncounterStatic { Gift = true, Species = 725, Level = 5, Location = 24, }, // Litten
|
||||
new EncounterStatic { Gift = true, Species = 728, Level = 5, Location = 24, }, // Popplio
|
||||
@@ -120,11 +120,16 @@ public static partial class Legal
|
||||
new EncounterStatic { Gift = true, Species = 133, Level = 1, EggLocation = 60002, }, // Eevee
|
||||
new EncounterStatic { Gift = true, Species = 137, Level = 30, Location = -1, }, // Porygon
|
||||
new EncounterStatic { Gift = true, Species = 772, Level = 40, Location = 188, IV3 = true, }, // Type: Null
|
||||
new EncounterStatic { Gift = true, Species = 801, Level = 50, Location = 40001, Shiny = false, IV3 = true, }, // Magearna (Bottle Cap) 00 FF
|
||||
new EncounterStatic { Gift = true, Species = 789, Level = 5, Location = 142, Shiny = false, IV3 = true, Version = GameVersion.SN}, // Cosmog 00 FF
|
||||
new EncounterStatic { Gift = true, Species = 789, Level = 5, Location = 144, Shiny = false, IV3 = true, Version = GameVersion.MN}, // Cosmog 00 FF
|
||||
new EncounterStatic { Gift = true, Species = 142, Level = 40, Location = -1, }, // Aerodactyl
|
||||
|
||||
new EncounterStatic // Magearna (Bottle Cap) 00 FF
|
||||
{
|
||||
Gift = true, Species = 801, Level = 50, Location = 40001, Shiny = false, IV3 = true,
|
||||
Fateful = true, RibbonWishing = true, Relearn = new [] {705, 430, 381, 270}, Ball = 0x10, // Cherish
|
||||
},
|
||||
|
||||
// Static Encounters - 1.bin
|
||||
new EncounterStatic { Species = 731, Form = 0, Level = 03, Relearn = new[]{000, 000, 000, 000}, Shiny = false, Ability = 1, Location = -1, }, // Pikipek
|
||||
// new EncounterStatic { Species = 793, Form = 0, Level = 27, Relearn = new[]{000, 000, 000, 000}, Shiny = false, Ability = 1, IVs = new[] {31, 01, 31, 01, 31, 31}, Location = -1, IV3 = true, }, // Nihilego
|
||||
|
||||
@@ -1223,7 +1223,7 @@ private static void refreshWC6DB()
|
||||
where new[] {".wc6full", ".wc6"}.Contains(fi.Extension) && new[] {WC6.Size, WC6.SizeFull}.Contains((int)fi.Length)
|
||||
select new WC6(File.ReadAllBytes(file)));
|
||||
|
||||
Legal.WC6DB = wc6db.Distinct().ToArray();
|
||||
Legal.MGDB_G6 = wc6db.Distinct().ToArray();
|
||||
}
|
||||
|
||||
// Language Translation
|
||||
|
||||
@@ -74,7 +74,8 @@ public SAV_MysteryGiftDB(Main f1)
|
||||
|
||||
// Load Data
|
||||
RawDB = new List<MysteryGift>();
|
||||
RawDB.AddRange(Legal.WC6DB);
|
||||
RawDB.AddRange(Legal.MGDB_G6);
|
||||
RawDB.AddRange(Legal.MGDB_G7);
|
||||
|
||||
if (Directory.Exists(DatabasePath))
|
||||
foreach (string file in Directory.GetFiles(DatabasePath, "*", SearchOption.AllDirectories))
|
||||
|
||||
Reference in New Issue
Block a user