Legality edge case fixes

Some incorrect IDs, some additions (unbreedable hidden abilities in
genV)

https://projectpokemon.org/forums/forums/topic/41407-pkhex-legality-errors-on-gen-6-updated/?tab=comments#comment-219459
This commit is contained in:
Kurt
2017-09-05 18:28:38 -07:00
parent c531f9ae5f
commit 47ca69f92b
9 changed files with 49 additions and 10 deletions

View File

@@ -957,6 +957,12 @@ private void VerifyAbility5(int[] abilities)
if (pkm.AbilityNumber == 4 ^ grotto)
AddLine(Severity.Invalid, grotto ? V217 : V108, CheckIdentifier.Ability);
break;
case EncounterEgg e when pkm.AbilityNumber == 4:
// Hidden Abilities for some are unbreedable (male only distribution)
if ((pkm.PersonalInfo.Gender & 0xFF) == 0 || Legal.Ban_BreedHidden.Contains(e.Species))
AddLine(Severity.Invalid, V112, CheckIdentifier.Ability);
break;
}
}
private void VerifyAbility6(int[] abilities)

View File

@@ -710,7 +710,7 @@ private static void MarkG5Slots(ref EncounterArea[] Areas)
new EncounterArea {Location = 27, Slots = new[]{new EncounterSlot {Species = 193},},},// Yanma @ Route 14
new EncounterArea {Location = 28, Slots = new[]{new EncounterSlot {Species = 056},},},// Mankey @ Route 15
new EncounterArea {Location = 29, Slots = new[]{new EncounterSlot {Species = 204},},},// Pineco @ Route 16
new EncounterArea {Location = 30, Slots = new[]{new EncounterSlot {Species = 102},},},// Exeggcutes @ Route 18
new EncounterArea {Location = 31, Slots = new[]{new EncounterSlot {Species = 102},},},// Exeggcutes @ Route 18
};
private static readonly EncounterArea[] SlotsB_Swarm = SlotsBW_Swarm.Concat(new[] {
@@ -824,7 +824,7 @@ private static void MarkG5Slots(ref EncounterArea[] Areas)
new EncounterSlot{ Species = 055, LevelMin = 35, LevelMax = 40, }, // Golduck @ Shrine
new EncounterSlot{ Species = 333, LevelMin = 35, LevelMax = 40, }, // Swablu @ Shrine
new EncounterSlot{ Species = 436, LevelMin = 35, LevelMax = 40, }, // Bronzor @ Near Youngster
new EncounterSlot{ Species = 619, LevelMin = 35, LevelMax = 40, }, // Amoonguss @ Both
new EncounterSlot{ Species = 591, LevelMin = 35, LevelMax = 40, }, // Amoonguss @ Both
// Lostlorn Forest
new EncounterSlot{ Species = 127, LevelMin = 20, LevelMax = 25, }, // Pinsir
new EncounterSlot{ Species = 214, LevelMin = 20, LevelMax = 25, }, // Heracross

View File

@@ -391,7 +391,7 @@ private static IEnumerable<EncounterStatic> GetMatchingStaticEncounters(PKM pkm,
{
if (e.Nature != Nature.Random && pkm.Nature != (int)e.Nature)
continue;
if (pkm.WasEgg ^ e.EggEncounter && pkm.Egg_Location == 0 && pkm.Format > 3)
if (pkm.WasEgg ^ e.EggEncounter && pkm.Egg_Location == 0 && pkm.Format > 3 && pkm.GenNumber > 3)
{
if (!pkm.IsEgg)
continue;

View File

@@ -169,5 +169,27 @@ public static partial class Legal
60002, // Daycare
60003, // Breeder (NPC)
};
/// <summary>
/// Some mixed-gender species were only distributed male-only. Ban hidden abilities on these species when bred in Gen5.
/// </summary>
internal static readonly int[] Ban_BreedHidden =
{
001, // Bulbasaur
004, // Charmander
007, // Squirtle
152, // Chikorita
155, // Cyndaquil
158, // Totodile
252, // Treecko
255, // Torchic
258, // Mudkip
387, // Turtwig
390, // Chimchar
393, // Piplup
511, // Pansage
513, // Pansear
515, // Panpour
};
}
}

View File

@@ -303,7 +303,7 @@ public static partial class Legal
032, // Via Nidoran-F
313, // Via Illumise
440, // Via Chansey
173, // Via Clefairy
239, // Via Electabuzz
240, // Via Magmar
298, // Via Marill
@@ -311,6 +311,7 @@ public static partial class Legal
406, // Via Roselia
433, // Via Chimecho
439, // Via Mr. Mime
440, // Via Chansey
};
internal static readonly int[] Inherit_Dream =
{

View File

@@ -194,7 +194,7 @@ public static partial class Legal
095, 096, 098, 102, 104, 108, 109, 111, 113, 114, 115, 116, 118, 122, 124, 125, 126, 129, 131, 143, 147, 161,
163, 165, 167, 170, 177, 179, 183, 185, 187, 190, 191, 193, 194, 198, 200, 202, 203, 204, 206, 207, 209, 211,
213, 214, 215, 216, 218, 220, 222, 223, 225, 226, 227, 228, 231, 234, 235, 241, 246, 261, 263, 265, 273, 276,
278, 280, 285, 287, 293, 296, 302, 303, 307, 311, 312, 316, 322, 325, 327, 333, 340, 359, 366, 369, 370, 396,
278, 280, 285, 287, 293, 296, 302, 303, 307, 311, 312, 316, 322, 325, 327, 333, 339, 359, 366, 369, 370, 396,
399, 401, 403, 406, 412, 415, 418, 420, 427, 433, 441, 455,
032, // Via Nidoran-F

View File

@@ -571,8 +571,6 @@ public void TradeMemory(bool Bank)
public override bool WasLink => Met_Location == 30011;
public override bool WasEvent => Met_Location > 40000 && Met_Location < 50000 || FatefulEncounter;
public override bool WasEventEgg => GenNumber < 5 ? base.WasEventEgg : ((Egg_Location > 40000 && Egg_Location < 50000) || (FatefulEncounter && Egg_Location == 30002)) && Met_Level == 1;
public override bool WasTradedEgg => Egg_Location == 30002 || GenNumber == 4 && Egg_Location == 2002;
public override bool WasIngameTrade => Met_Location == 30001 || GenNumber == 4 && Egg_Location == 2001;
// Maximums
public override int MaxMoveID => Legal.MaxMoveID_6_AO;

View File

@@ -606,8 +606,6 @@ public void TradeMemory(bool Bank)
public override bool WasLink => Met_Location == 30011;
public override bool WasEvent => Met_Location > 40000 && Met_Location < 50000 || FatefulEncounter;
public override bool WasEventEgg => GenNumber < 5 ? base.WasEventEgg : ((Egg_Location > 40000 && Egg_Location < 50000) || (FatefulEncounter && Egg_Location == 30002)) && Met_Level == 1;
public override bool WasTradedEgg => Egg_Location == 30002 || GenNumber == 4 && Egg_Location == 2002;
public override bool WasIngameTrade => Met_Location == 30001 || GenNumber == 4 && Egg_Location == 2001;
// Maximums
public override int MaxMoveID => Legal.MaxMoveID_7;

View File

@@ -480,7 +480,21 @@ public virtual bool WasGiftEgg
}
public virtual bool WasEvent => Met_Location > 40000 && Met_Location < 50000 || FatefulEncounter;
public virtual bool WasEventEgg => GenNumber == 4 ? WasEgg && Species == 490 : ((Egg_Location > 40000 && Egg_Location < 50000) || (FatefulEncounter && Egg_Location > 0)) && Met_Level == 1;
public virtual bool WasTradedEgg => Egg_Location == 30002 || GenNumber == 4 && Egg_Location == 2002;
public bool WasTradedEgg
{
get
{
switch (GenNumber)
{
case 4:
return Egg_Location == 2002;
case 5:
return Egg_Location == 30003;
default:
return Egg_Location == 30002;
}
}
}
public virtual bool WasIngameTrade => Met_Location == 30001 || GenNumber == 4 && Egg_Location == 2001;
public virtual bool IsUntraded => Format >= 6 && string.IsNullOrWhiteSpace(HT_Name) && GenNumber == Format;
public virtual bool IsNative => GenNumber == Format;