This commit is contained in:
Michael Scire
2016-11-11 02:01:02 -08:00
6 changed files with 136 additions and 125 deletions

View File

@@ -250,6 +250,7 @@ public string[] getItemStrings(int generation, GameVersion game)
// DataSource providing
public static List<ComboItem> MoveDataSource, ItemDataSource, SpeciesDataSource, BallDataSource, NatureDataSource, AbilityDataSource, VersionDataSource;
public static List<ComboItem> HaXMoveDataSource;
private static List<ComboItem> metGen2, metGen3, metGen3CXD, metGen4, metGen5, metGen6, metGen7;
public static void InitializeDataSources(GameStrings s)
{
@@ -261,7 +262,8 @@ public static void InitializeDataSources(GameStrings s)
AbilityDataSource = Util.getCBList(s.abilitylist, null);
VersionDataSource = Util.getCBList(s.gamelist, Legal.Games_7sm, Legal.Games_6oras, Legal.Games_6xy, Legal.Games_5, Legal.Games_4, Legal.Games_4e, Legal.Games_4r, Legal.Games_3, Legal.Games_3e, Legal.Games_3r, Legal.Games_3s);
MoveDataSource = Util.getCBList(s.movelist, null);
HaXMoveDataSource = Util.getCBList(s.movelist, null);
MoveDataSource = HaXMoveDataSource.Where(m => !Legal.Z_Moves.Contains(m.Value)).ToList();
#region Met Locations
// Gen 2
{

View File

@@ -689,28 +689,6 @@ private void verifyBall()
return;
}
if (pkm.Ball == 0x04) // Poké Ball
{
AddLine(Severity.Valid, "Standard Poké Ball.", CheckIdentifier.Ball);
return;
}
if (pkm.Ball == 26) // Beast Ball
{
if (pkm.Species >= 793 && pkm.Species <= 800) // UB
AddLine(Severity.Valid, "Correct ball on UB.", CheckIdentifier.Ball);
else
AddLine(Severity.Invalid, "Species cannot be obtained with Ball.", CheckIdentifier.Ball);
return;
}
if (pkm.Species >= 793 && pkm.Species <= 800) // UB
{
AddLine(Severity.Invalid, "Species cannot be obtained with Ball.", CheckIdentifier.Ball);
return;
}
if (EncounterType == typeof(EncounterStatic))
{
EncounterStatic enc = EncounterMatch as EncounterStatic;
@@ -755,108 +733,132 @@ private void verifyBall()
if (pkm.Ball == 0x10) // Cherish Ball
{ AddLine(Severity.Invalid, "Cherish Ball on non-event.", CheckIdentifier.Ball); return; }
if (pkm.Gender == 2) // Genderless
switch (pkm.GenNumber)
{
if (pkm.Ball != 0x04) // Must be Pokéball as ball can only pass via mother (not Ditto!)
AddLine(Severity.Invalid, "Non-Pokéball on genderless egg.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Pokéball on genderless egg.", CheckIdentifier.Ball);
return;
}
if (Legal.BreedMaleOnly.Contains(pkm.Species))
{
if (pkm.Ball != 0x04) // Must be Pokéball as ball can only pass via mother (not Ditto!)
AddLine(Severity.Invalid, "Non-Pokéball on Male-Only egg.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Pokéball on Male-Only egg.", CheckIdentifier.Ball);
return;
}
if (pkm.Ball == 0x05) // Safari Ball
{
if (Legal.getLineage(pkm).All(e => !Legal.Inherit_Safari.Contains(e)))
AddLine(Severity.Invalid, "Safari Ball not possible for species.", CheckIdentifier.Ball);
else if (pkm.AbilityNumber == 4)
AddLine(Severity.Invalid, "Safari Ball with Hidden Ability.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Safari Ball possible for species.", CheckIdentifier.Ball);
return;
}
if (0x10 < pkm.Ball && pkm.Ball < 0x18) // Apricorn Ball
{
if (Legal.getLineage(pkm).All(e => !Legal.Inherit_Apricorn.Contains(e)))
AddLine(Severity.Invalid, "Apricorn Ball not possible for species.", CheckIdentifier.Ball);
if (pkm.AbilityNumber == 4)
AddLine(Severity.Invalid, "Apricorn Ball with Hidden Ability.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Apricorn Ball possible for species.", CheckIdentifier.Ball);
return;
}
if (pkm.Ball == 0x18) // Sport Ball
{
if (Legal.getLineage(pkm).All(e => !Legal.Inherit_Sport.Contains(e)))
AddLine(Severity.Invalid, "Sport Ball not possible for species.", CheckIdentifier.Ball);
else if (pkm.AbilityNumber == 4)
AddLine(Severity.Invalid, "Sport Ball with Hidden Ability.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Sport Ball possible for species.", CheckIdentifier.Ball);
return;
}
if (pkm.Ball == 0x19) // Dream Ball
{
if (Legal.getLineage(pkm).All(e => !Legal.Inherit_Dream.Contains(e)))
AddLine(Severity.Invalid, "Dream Ball not possible for species.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Dream Ball possible for species.", CheckIdentifier.Ball);
return;
}
if (0x0D <= pkm.Ball && pkm.Ball <= 0x0F)
{
if (Legal.Ban_Gen4Ball.Contains(pkm.Species))
AddLine(Severity.Invalid, "Unobtainable capture for Gen4 Ball.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Obtainable capture for Gen4 Ball.", CheckIdentifier.Ball);
return;
}
if (0x02 <= pkm.Ball && pkm.Ball <= 0x0C) // Don't worry, Ball # 0x05 was already checked.
{
if (Legal.Ban_Gen3Ball.Contains(pkm.Species))
AddLine(Severity.Invalid, "Unobtainable capture for Gen4 Ball.", CheckIdentifier.Ball);
else if (pkm.AbilityNumber == 4 && 152 <= pkm.Species && pkm.Species <= 160)
AddLine(Severity.Invalid, "Ball not possible for species with hidden ability.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Obtainable capture for Gen4 Ball.", CheckIdentifier.Ball);
return;
}
if (pkm.Format == 6 && pkm.Species > 650 && pkm.Species != 700) // Sylveon
{
if (!Legal.getWildBalls(pkm).Contains(pkm.Ball))
AddLine(Severity.Invalid, "Unobtainable ball for Kalos origin.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Obtainable ball for Kalos origin.", CheckIdentifier.Ball);
return;
}
if (pkm.Format == 7 && pkm.Species > 721)
{
if (!Legal.getWildBalls(pkm).Contains(pkm.Ball))
AddLine(Severity.Invalid, "Unobtainable ball for Alola origin.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Obtainable ball for Alola origin.", CheckIdentifier.Ball);
return;
case 6: // Gen6 Inheritance Rules
verifyEggBallGen6();
return;
case 7: // Gen7 Inheritance Rules
verifyEggBallGen7();
return;
}
}
if (pkm.Ball == 0x04) // Poké Ball
{
AddLine(Severity.Valid, "Standard Poké Ball.", CheckIdentifier.Ball);
return;
}
AddLine(Severity.Invalid, "No ball check satisfied, assuming illegal.", CheckIdentifier.Ball);
}
private void verifyEggBallGen6()
{
if (pkm.Gender == 2) // Genderless
{
if (pkm.Ball != 0x04) // Must be Pokéball as ball can only pass via mother (not Ditto!)
AddLine(Severity.Invalid, "Non-Pokéball on genderless egg.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Pokéball on genderless egg.", CheckIdentifier.Ball);
return;
}
if (Legal.BreedMaleOnly.Contains(pkm.Species))
{
if (pkm.Ball != 0x04) // Must be Pokéball as ball can only pass via mother (not Ditto!)
AddLine(Severity.Invalid, "Non-Pokéball on Male-Only egg.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Pokéball on Male-Only egg.", CheckIdentifier.Ball);
return;
}
if (pkm.Ball == 0x05) // Safari Ball
{
if (Legal.getLineage(pkm).All(e => !Legal.Inherit_Safari.Contains(e)))
AddLine(Severity.Invalid, "Safari Ball not possible for species.", CheckIdentifier.Ball);
else if (pkm.AbilityNumber == 4)
AddLine(Severity.Invalid, "Safari Ball with Hidden Ability.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Safari Ball possible for species.", CheckIdentifier.Ball);
return;
}
if (0x10 < pkm.Ball && pkm.Ball < 0x18) // Apricorn Ball
{
if (Legal.getLineage(pkm).All(e => !Legal.Inherit_Apricorn.Contains(e)))
AddLine(Severity.Invalid, "Apricorn Ball not possible for species.", CheckIdentifier.Ball);
if (pkm.AbilityNumber == 4)
AddLine(Severity.Invalid, "Apricorn Ball with Hidden Ability.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Apricorn Ball possible for species.", CheckIdentifier.Ball);
return;
}
if (pkm.Ball == 0x18) // Sport Ball
{
if (Legal.getLineage(pkm).All(e => !Legal.Inherit_Sport.Contains(e)))
AddLine(Severity.Invalid, "Sport Ball not possible for species.", CheckIdentifier.Ball);
else if (pkm.AbilityNumber == 4)
AddLine(Severity.Invalid, "Sport Ball with Hidden Ability.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Sport Ball possible for species.", CheckIdentifier.Ball);
return;
}
if (pkm.Ball == 0x19) // Dream Ball
{
if (Legal.getLineage(pkm).All(e => !Legal.Inherit_Dream.Contains(e)))
AddLine(Severity.Invalid, "Dream Ball not possible for species.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Dream Ball possible for species.", CheckIdentifier.Ball);
return;
}
if (0x0D <= pkm.Ball && pkm.Ball <= 0x0F)
{
if (Legal.Ban_Gen4Ball.Contains(pkm.Species))
AddLine(Severity.Invalid, "Unobtainable capture for Gen4 Ball.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Obtainable capture for Gen4 Ball.", CheckIdentifier.Ball);
return;
}
if (0x02 <= pkm.Ball && pkm.Ball <= 0x0C) // Don't worry, Ball # 0x05 was already checked.
{
if (Legal.Ban_Gen3Ball.Contains(pkm.Species))
AddLine(Severity.Invalid, "Unobtainable capture for Gen4 Ball.", CheckIdentifier.Ball);
else if (pkm.AbilityNumber == 4 && 152 <= pkm.Species && pkm.Species <= 160)
AddLine(Severity.Invalid, "Ball not possible for species with hidden ability.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Obtainable capture for Gen4 Ball.", CheckIdentifier.Ball);
return;
}
if (pkm.Species > 650 && pkm.Species != 700) // Sylveon
{
if (!Legal.getWildBalls(pkm).Contains(pkm.Ball))
AddLine(Severity.Invalid, "Unobtainable ball for Kalos origin.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Obtainable ball for Kalos origin.", CheckIdentifier.Ball);
return;
}
AddLine(Severity.Invalid, "No ball check satisfied, assuming illegal.", CheckIdentifier.Ball);
}
private void verifyEggBallGen7()
{
if (pkm.Format == 7 && pkm.Species > 721)
{
if (!Legal.getWildBalls(pkm).Contains(pkm.Ball))
AddLine(Severity.Invalid, "Unobtainable ball for Alola origin.", CheckIdentifier.Ball);
else
AddLine(Severity.Valid, "Obtainable ball for Alola origin.", CheckIdentifier.Ball);
return;
}
AddLine(Severity.Invalid, "No ball check satisfied, assuming illegal. -- This check is not well researched at this time. Do not report feedback.", CheckIdentifier.Ball);
}
private CheckResult verifyHistory()
{
if (!Encounter.Valid)
@@ -925,7 +927,7 @@ private CheckResult verifyHistory()
{
if (pkm.OT_Memory == 0 ^ !pkm.Gen6)
return new CheckResult(Severity.Invalid, "Memory -- missing Original Trainer Memory.", CheckIdentifier.History);
if (!pkm.Gen6 && pkm.OT_Affection != 0)
if (pkm.GenNumber < 6 && pkm.OT_Affection != 0)
return new CheckResult(Severity.Invalid, "OT Affection should be zero.", CheckIdentifier.History);
}
// Unimplemented: Ingame Trade Memories

View File

@@ -191,6 +191,13 @@ public static partial class Legal
};
internal static readonly int[] BattlePrimals = { 382, 383 };
internal static readonly int[] Z_Moves =
{
622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658,
695, 696, 697, 698, 699, 700, 701, 702, 703,
719,
};
#region Games
internal static readonly int[] Games_7sm = { 30, 31 };

View File

@@ -83,7 +83,7 @@ public static partial class Legal
internal static readonly ushort[] HeldItems_SM = new ushort[1].Concat(Pouch_Items_SM).Concat(Pouch_Berries_SM).Concat(Pouch_Medicine_SM).Concat(Pouch_ZCrystalHeld_SM).ToArray();
#region Encounters
private static readonly EncounterStatic[] Encounter_SM = // @ moon a\1\5\5
private static readonly EncounterStatic[] Encounter_SM = // @ a\1\5\5
{
// Gfits - 0.bin
new EncounterStatic { Gift = true, Species = 722, Level = 5, Location = 24, }, // Rowlet
@@ -246,11 +246,11 @@ public static partial class Legal
new EncounterStatic { Species = 785, Form = 0, Level = 60, Relearn = new[]{000, 000, 000, 000}, Shiny = false, Ability = 1, Location = -1, }, // Tapu Koko
new EncounterStatic { Species = 542, Form = 0, Level = 57, Relearn = new[]{382, 437, 014, 494}, Location = -1, }, // Leavanny
// Trades - 4.bin
};
internal static EncounterTrade[] TradeGift_SM =
private static readonly EncounterTrade[] TradeGift_SM = // @ a\1\5\5
{
// Trades - 4.bin
new EncounterTrade { Species = 066, Form = 0, Level = 09, Ability = 2, TID = 00410, SID = 00000, OTGender = 1, Gender = 0, Nature = Nature.Brave, }, // Machop
new EncounterTrade { Species = 761, Form = 0, Level = 16, Ability = 1, TID = 20683, SID = 00009, OTGender = 0, Gender = 1, Nature = Nature.Adamant, }, // Bounsweet
new EncounterTrade { Species = 061, Form = 0, Level = 22, Ability = 2, TID = 01092, SID = 00009, OTGender = 1, Gender = 1, Nature = Nature.Naughty, }, // Poliwhirl

View File

@@ -1308,7 +1308,7 @@ private void populateFilteredDataSources()
CB_GameOrigin.DataSource = new BindingSource(GameInfo.VersionDataSource.Where(g => g.Value <= SAV.MaxGameID || SAV.Generation >= 3 && g.Value == 15).ToList(), null);
// Set the Move ComboBoxes too..
var moves = GameInfo.MoveDataSource.Where(m => m.Value <= SAV.MaxMoveID).ToList();
var moves = (HaX ? GameInfo.HaXMoveDataSource : GameInfo.MoveDataSource).Where(m => m.Value <= SAV.MaxMoveID).ToList(); // Filter Z-Moves if appropriate
foreach (ComboBox cb in new[] { CB_Move1, CB_Move2, CB_Move3, CB_Move4, CB_RelearnMove1, CB_RelearnMove2, CB_RelearnMove3, CB_RelearnMove4 })
{
cb.DisplayMember = "Text"; cb.ValueMember = "Value";

View File

@@ -526,7 +526,7 @@ public void FixMemories()
if (IsUntraded)
HT_Friendship = HT_Affection = HT_TextVar = HT_Memory = HT_Intensity = HT_Feeling = 0;
if (!Gen6)
if (GenNumber < 6)
OT_Affection = OT_TextVar = OT_Memory = OT_Intensity = OT_Feeling = 0;
Geo1_Region = Geo1_Country > 0 ? Geo1_Region : 0;