no functional change
This commit is contained in:
Kurt 2017-04-14 19:55:40 -07:00
parent ecb4212ab1
commit 18fb42e86d
11 changed files with 31 additions and 37 deletions

View file

@ -1284,7 +1284,7 @@ namespace PKHeX.Core
} }
private bool? verifyAbilityPreCapsule(int[] abilities, int abilval) private bool? verifyAbilityPreCapsule(int[] abilities, int abilval)
{ {
// Shadow Colosseum pokemon could habe any PID without maching PID // CXD pokemon could have any ability without maching PID
if (pkm.Version == (int)GameVersion.CXD && pkm.Format == 3) if (pkm.Version == (int)GameVersion.CXD && pkm.Format == 3)
return null; return null;
@ -1374,7 +1374,7 @@ namespace PKHeX.Core
if (!valid) if (!valid)
AddLine(Severity.Invalid, V111, CheckIdentifier.Ability); AddLine(Severity.Invalid, V111, CheckIdentifier.Ability);
} }
else if(EncounterIsMysteryGift) else if (EncounterIsMysteryGift)
verifyAbilityMG456(abilities, ((WC7)EncounterMatch).AbilityType); verifyAbilityMG456(abilities, ((WC7)EncounterMatch).AbilityType);
else if (Legal.Ban_NoHidden7.Contains(pkm.SpecForm) && pkm.AbilityNumber == 4) else if (Legal.Ban_NoHidden7.Contains(pkm.SpecForm) && pkm.AbilityNumber == 4)
AddLine(Severity.Invalid, V112, CheckIdentifier.Ability); AddLine(Severity.Invalid, V112, CheckIdentifier.Ability);
@ -2285,12 +2285,12 @@ namespace PKHeX.Core
{ AddLine(Severity.Invalid, V319, CheckIdentifier.Misc); } { AddLine(Severity.Invalid, V319, CheckIdentifier.Misc); }
if (pkm.CNTs.Any(stat => stat > 0)) if (pkm.CNTs.Any(stat => stat > 0))
{ AddLine(Severity.Invalid, V320, CheckIdentifier.Misc); } { AddLine(Severity.Invalid, V320, CheckIdentifier.Misc); }
if( pkm.Format == 2 && (pkm.PKRS_Cured || pkm.PKRS_Infected)) if (pkm.Format == 2 && (pkm.PKRS_Cured || pkm.PKRS_Infected))
{ AddLine(Severity.Invalid, V368, CheckIdentifier.Misc); } { AddLine(Severity.Invalid, V368, CheckIdentifier.Misc); }
var HatchCycles = (EncounterMatch as EncounterStatic)?.EggCycles; var HatchCycles = (EncounterMatch as EncounterStatic)?.EggCycles;
if (HatchCycles == 0) if (HatchCycles == 0)
HatchCycles = pkm.PersonalInfo.HatchCycles; HatchCycles = pkm.PersonalInfo.HatchCycles;
if( pkm.CurrentFriendship > HatchCycles) if (pkm.CurrentFriendship > HatchCycles)
{ AddLine(Severity.Invalid, V374, CheckIdentifier.Misc); } { AddLine(Severity.Invalid, V374, CheckIdentifier.Misc); }
} }
@ -2641,7 +2641,6 @@ namespace PKHeX.Core
Games = new[] { GameVersion.B2W2 }; Games = new[] { GameVersion.B2W2 };
break; break;
} }
int splitctr = Legal.SplitBreed.Contains(pkm.Species) ? 1 : 0;
var issplitbreed = Legal.SplitBreed.Contains(pkm.Species); var issplitbreed = Legal.SplitBreed.Contains(pkm.Species);
foreach (var ver in Games) foreach (var ver in Games)
{ {
@ -2649,7 +2648,7 @@ namespace PKHeX.Core
var BaseLvlMoves = 489 <= pkm.Species && pkm.Species <= 490 ? 1 : 100; var BaseLvlMoves = 489 <= pkm.Species && pkm.Species <= 490 ? 1 : 100;
var LvlupEggMoves = Legal.getBaseEggMoves(pkm, ver, BaseLvlMoves); var LvlupEggMoves = Legal.getBaseEggMoves(pkm, ver, BaseLvlMoves);
// Level up, TMHM or tutor moves exclusive to the incense egg species, like Azurill, incompatible with the non-incense species egg moves // Level up, TMHM or tutor moves exclusive to the incense egg species, like Azurill, incompatible with the non-incense species egg moves
var ExclusiveIncenseMoves = issplitbreed ? Legal.getExclusiveEvolutionMoves(pkm,Legal.getBaseEggSpecies(pkm,0), EvoChainsAllGens, ver) : null; var ExclusiveIncenseMoves = issplitbreed ? Legal.getExclusiveEvolutionMoves(pkm, Legal.getBaseEggSpecies(pkm), EvoChainsAllGens, ver) : null;
var EggMoves = Legal.getEggMoves(pkm, ver); var EggMoves = Legal.getEggMoves(pkm, ver);
bool volt = (gen > 3 || ver == GameVersion.E) && Legal.LightBall.Contains(pkm.Species); bool volt = (gen > 3 || ver == GameVersion.E) && Legal.LightBall.Contains(pkm.Species);
@ -2742,7 +2741,7 @@ namespace PKHeX.Core
var issplitbreed = pkm.WasEgg && Legal.SplitBreed.Contains(pkm.Species); var issplitbreed = pkm.WasEgg && Legal.SplitBreed.Contains(pkm.Species);
var EggMoves = pkm.WasEgg? Legal.getEggMoves(pkm, game): emptyegg; var EggMoves = pkm.WasEgg? Legal.getEggMoves(pkm, game): emptyegg;
// Level up, TMHM or tutor moves exclusive to the incense egg species, like Azurill, incompatible with the non-incense species egg moves // Level up, TMHM or tutor moves exclusive to the incense egg species, like Azurill, incompatible with the non-incense species egg moves
var ExclusiveIncenseMoves = issplitbreed ? Legal.getExclusiveEvolutionMoves(pkm, Legal.getBaseEggSpecies(pkm, 0), EvoChainsAllGens, game) : empty; var ExclusiveIncenseMoves = issplitbreed ? Legal.getExclusiveEvolutionMoves(pkm, Legal.getBaseEggSpecies(pkm), EvoChainsAllGens, game) : empty;
int[] RelearnMoves = pkm.RelearnMoves; int[] RelearnMoves = pkm.RelearnMoves;
int[] SpecialMoves = (EncounterMatch as IMoveset)?.Moves ?? new int[0]; int[] SpecialMoves = (EncounterMatch as IMoveset)?.Moves ?? new int[0];
@ -2767,7 +2766,7 @@ namespace PKHeX.Core
var LvlupEggMovesSplitLearned = new List<int>[egg.Length]; var LvlupEggMovesSplitLearned = new List<int>[egg.Length];
var EggMovesSplitLearned = new List<int>[egg.Length]; var EggMovesSplitLearned = new List<int>[egg.Length];
var IncenseMovesLearned = new List<int>(); var IncenseMovesLearned = new List<int>();
for (int i=0;i < egg.Length; i++ ) for (int i= 0; i < egg.Length; i++)
{ {
LvlupEggMovesSplitLearned[i] = new List<int>(); LvlupEggMovesSplitLearned[i] = new List<int>();
EggMovesSplitLearned[i] = new List<int>(); EggMovesSplitLearned[i] = new List<int>();
@ -2855,7 +2854,7 @@ namespace PKHeX.Core
else else
res[m] = new CheckResult(Severity.Valid, V345, CheckIdentifier.Move); res[m] = new CheckResult(Severity.Valid, V345, CheckIdentifier.Move);
LvlupEggMovesLearned.Add(m); LvlupEggMovesLearned.Add(m);
if(issplitbreed) if (issplitbreed)
{ {
// Only add to split breed lists learned moves that can be from one of the egg species, ignore common moves // Only add to split breed lists learned moves that can be from one of the egg species, ignore common moves
if (lvlupegg[0].Contains(moves[m]) && !lvlupegg[1].Contains(moves[m])) if (lvlupegg[0].Contains(moves[m]) && !lvlupegg[1].Contains(moves[m]))
@ -2936,7 +2935,7 @@ namespace PKHeX.Core
{ {
foreach (int m in RegularEggMovesLearned) foreach (int m in RegularEggMovesLearned)
{ {
if(EggMovesLearned.Contains(m)) if (EggMovesLearned.Contains(m))
res[m] = new CheckResult(Severity.Invalid, pkm.WasGiftEgg ? V377 : V341, CheckIdentifier.Move); res[m] = new CheckResult(Severity.Invalid, pkm.WasGiftEgg ? V377 : V341, CheckIdentifier.Move);
else if (LvlupEggMovesLearned.Contains(m)) else if (LvlupEggMovesLearned.Contains(m))
res[m] = new CheckResult(Severity.Invalid, pkm.WasGiftEgg ? V378 : V347, CheckIdentifier.Move); res[m] = new CheckResult(Severity.Invalid, pkm.WasGiftEgg ? V378 : V347, CheckIdentifier.Move);
@ -2948,7 +2947,7 @@ namespace PKHeX.Core
if ((EggMovesSplitLearned[0].Any() || IncenseMovesLearned.Any()) && EggMovesSplitLearned[1].Any()) if ((EggMovesSplitLearned[0].Any() || IncenseMovesLearned.Any()) && EggMovesSplitLearned[1].Any())
{ {
var species = specieslist; var species = specieslist;
var splitbreedspecies0 = species[Legal.getBaseEggSpecies(pkm, 0)]; var splitbreedspecies0 = species[Legal.getBaseEggSpecies(pkm)]; // 0
var splitbreedspecies1 = species[Legal.getBaseEggSpecies(pkm, 1)]; var splitbreedspecies1 = species[Legal.getBaseEggSpecies(pkm, 1)];
foreach (int m in EggMovesSplitLearned[0]) foreach (int m in EggMovesSplitLearned[0])
// Example: Azurill Egg move, incompatible with Marill egg moves // Example: Azurill Egg move, incompatible with Marill egg moves
@ -3340,7 +3339,7 @@ namespace PKHeX.Core
res[i] = new CheckResult(Severity.Invalid, V182, CheckIdentifier.RelearnMove); res[i] = new CheckResult(Severity.Invalid, V182, CheckIdentifier.RelearnMove);
} }
if(splitbreedinvalid) if (splitbreedinvalid)
{ {
var species = specieslist; var species = specieslist;
var splitbreedspecies0 = species[Legal.getBaseEggSpecies(pkm, skipOption)]; var splitbreedspecies0 = species[Legal.getBaseEggSpecies(pkm, skipOption)];

View file

@ -1063,7 +1063,7 @@ namespace PKHeX.Core
var preevomoves = new List<int>(); var preevomoves = new List<int>();
var evomoves = new List<int>(); var evomoves = new List<int>();
var index = Array.FindIndex(evoChain, e => e.Species == Species); var index = Array.FindIndex(evoChain, e => e.Species == Species);
for(int i =0; i < evoChain.Length; i++) for (int i = 0; i < evoChain.Length; i++)
{ {
var evo = evoChain[i]; var evo = evoChain[i];
var moves = getMoves(pkm, evo.Species, 1, evo.Level, pkm.AltForm, moveTutor: true, Version: Version, LVL: true, specialTutors: true, Machine: true, MoveReminder: false, RemoveTransferHM: false, Generation: Generation); var moves = getMoves(pkm, evo.Species, 1, evo.Level, pkm.AltForm, moveTutor: true, Version: Version, LVL: true, specialTutors: true, Machine: true, MoveReminder: false, RemoveTransferHM: false, Generation: Generation);
@ -3414,7 +3414,7 @@ namespace PKHeX.Core
case 6: case 6:
info = PersonalTable.AO[species]; info = PersonalTable.AO[species];
moves.AddRange(TypeTutor6.Where((t, i) => info.TypeTutors[i])); moves.AddRange(TypeTutor6.Where((t, i) => info.TypeTutors[i]));
if ( pkm.InhabitedGeneration(6) && specialTutors && (pkm.AO || !pkm.IsUntraded)) if (pkm.InhabitedGeneration(6) && specialTutors && (pkm.AO || !pkm.IsUntraded))
{ {
PersonalInfo pi = PersonalTable.AO.getFormeEntry(species, form); PersonalInfo pi = PersonalTable.AO.getFormeEntry(species, form);
for (int i = 0; i < Tutors_AO.Length; i++) for (int i = 0; i < Tutors_AO.Length; i++)

View file

@ -168,7 +168,7 @@ namespace PKHeX.Core
public IEnumerable<DexLevel> getValidPreEvolutions(PKM pkm, int lvl, int maxSpeciesOrigin =-1 ,bool skipChecks = false) public IEnumerable<DexLevel> getValidPreEvolutions(PKM pkm, int lvl, int maxSpeciesOrigin =-1 ,bool skipChecks = false)
{ {
int index = getIndex(pkm); int index = getIndex(pkm);
if(maxSpeciesOrigin <= 0) if (maxSpeciesOrigin <= 0)
maxSpeciesOrigin = Legal.getMaxSpeciesOrigin(pkm); maxSpeciesOrigin = Legal.getMaxSpeciesOrigin(pkm);
return Lineage[index].getExplicitLineage(pkm, lvl, skipChecks, MaxSpeciesTree, maxSpeciesOrigin); return Lineage[index].getExplicitLineage(pkm, lvl, skipChecks, MaxSpeciesTree, maxSpeciesOrigin);
} }
@ -314,7 +314,7 @@ namespace PKHeX.Core
for (int j = 0; j < 5; j++) for (int j = 0; j < 5; j++)
{ {
EvolutionMethod m = getMethod(data, offset); EvolutionMethod m = getMethod(data, offset);
if(m!=null) if (m != null)
m_list.Add(m); m_list.Add(m);
else else
break; break;

View file

@ -1,8 +1,4 @@
using System; using System.Linq;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PKHeX.Core namespace PKHeX.Core
{ {
@ -35,6 +31,7 @@ namespace PKHeX.Core
Type = GBEncounterType.EggEncounter; Type = GBEncounterType.EggEncounter;
Level = 5; Level = 5;
WasEgg = true; WasEgg = true;
Species = species;
} }
public GBEncounterData(PKM pkm, int gen, object enc) public GBEncounterData(PKM pkm, int gen, object enc)
@ -42,7 +39,7 @@ namespace PKHeX.Core
Generation = gen; Generation = gen;
Encounter = enc; Encounter = enc;
WasEgg = false; WasEgg = false;
if (Encounter as EncounterTrade != null) if (Encounter is EncounterTrade)
{ {
var trade = (EncounterTrade)Encounter; var trade = (EncounterTrade)Encounter;
Species = trade.Species; Species = trade.Species;
@ -50,12 +47,12 @@ namespace PKHeX.Core
Level = pkm.Met_Level; // Crystal Level = pkm.Met_Level; // Crystal
else else
Level = trade.Level; Level = trade.Level;
if ( Generation == 2) if (Generation == 2)
Type = GBEncounterType.TradeEncounterG2; Type = GBEncounterType.TradeEncounterG2;
else else
Type = GBEncounterType.TradeEncounterG1; Type = GBEncounterType.TradeEncounterG1;
} }
else if (Encounter as EncounterStatic != null) else if (Encounter is EncounterStatic)
{ {
var statc = (EncounterStatic)Encounter; var statc = (EncounterStatic)Encounter;
Species = statc.Species; Species = statc.Species;
@ -65,7 +62,7 @@ namespace PKHeX.Core
else else
Type = GBEncounterType.StaticEncounter; Type = GBEncounterType.StaticEncounter;
} }
else if (Encounter as EncounterSlot1 != null) else if (Encounter is EncounterSlot1)
{ {
var slot = (EncounterSlot1)Encounter; var slot = (EncounterSlot1)Encounter;
Species = slot.Species; Species = slot.Species;

View file

@ -18,7 +18,7 @@ namespace PKHeX.Core
/// <returns>Array of Move IDs</returns> /// <returns>Array of Move IDs</returns>
public int[] getMoves(int maxLevel, int minLevel = 0) public int[] getMoves(int maxLevel, int minLevel = 0)
{ {
if (minLevel <=1 && maxLevel >= 100) if (minLevel <= 1 && maxLevel >= 100)
return Moves; return Moves;
int start = Array.FindIndex(Levels, z => z >= minLevel); int start = Array.FindIndex(Levels, z => z >= minLevel);
if (start < 0) if (start < 0)

View file

@ -993,7 +993,7 @@ namespace PKHeX.Core
private static readonly EncounterArea SlotsD_HoneyTree = private static readonly EncounterArea SlotsD_HoneyTree =
new EncounterArea { new EncounterArea {
Slots = SlotsPt_HoneyTree.Slots.Concat( new[] Slots = SlotsPt_HoneyTree.Slots.Concat(new[]
{ {
new EncounterSlot { Species = 266, LevelMin = 5, LevelMax = 15, Type = SlotType.HoneyTree }, // Silcoon new EncounterSlot { Species = 266, LevelMin = 5, LevelMax = 15, Type = SlotType.HoneyTree }, // Silcoon
}).ToArray() }).ToArray()

View file

@ -165,7 +165,7 @@
<Compile Include="Legality\Structures\EncounterStatic.cs" /> <Compile Include="Legality\Structures\EncounterStatic.cs" />
<Compile Include="Legality\Structures\EncounterTrade.cs" /> <Compile Include="Legality\Structures\EncounterTrade.cs" />
<Compile Include="Legality\Structures\EvolutionTree.cs" /> <Compile Include="Legality\Structures\EvolutionTree.cs" />
<Compile Include="Legality\Structures\iGeneration.cs" /> <Compile Include="Legality\Structures\IGeneration.cs" />
<Compile Include="Legality\Structures\IMoveset.cs" /> <Compile Include="Legality\Structures\IMoveset.cs" />
<Compile Include="Legality\Structures\Learnset.cs" /> <Compile Include="Legality\Structures\Learnset.cs" />
<Compile Include="Legality\Structures\Nature.cs" /> <Compile Include="Legality\Structures\Nature.cs" />

View file

@ -116,7 +116,7 @@ namespace PKHeX.Core
public override int IV_SPA { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } } public override int IV_SPA { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } }
public override int IV_SPD { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } } public override int IV_SPD { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } }
public override bool IsEgg { get { return ((IV32 >> 30) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } } public override bool IsEgg { get { return ((IV32 >> 30) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } }
public bool AbilityBit { get { return (IV32 >> 31) == 1; } set { IV32 = (IV32 & 0x7FFFFFFF) | (uint)(value ? 1 << 31 : 0 ); } } public bool AbilityBit { get { return (IV32 >> 31) == 1; } set { IV32 = (IV32 & 0x7FFFFFFF) | (uint)(value ? 1 << 31 : 0); } }
private uint RIB0 { get { return BitConverter.ToUInt32(Data, 0x4C); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x4C); } } private uint RIB0 { get { return BitConverter.ToUInt32(Data, 0x4C); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x4C); } }
public int RibbonCountG3Cool { get { return (int)(RIB0 >> 00) & 7; } set { RIB0 = (uint)((RIB0 & ~(7 << 00)) | (uint)(value & 7) << 00); } } public int RibbonCountG3Cool { get { return (int)(RIB0 >> 00) & 7; } set { RIB0 = (uint)((RIB0 & ~(7 << 00)) | (uint)(value & 7) << 00); } }

View file

@ -251,7 +251,7 @@ namespace PKHeX.Core
{ {
get get
{ {
if(EntryCOLO > -1 && EntrySelected == EntryCOLO) if (EntryCOLO > -1 && EntrySelected == EntryCOLO)
return GameVersion.COLO; return GameVersion.COLO;
if (EntryXD > -1 && EntrySelected == EntryXD) if (EntryXD > -1 && EntrySelected == EntryXD)
return GameVersion.XD; return GameVersion.XD;

View file

@ -1142,7 +1142,7 @@ namespace PKHeX.Core
get get
{ {
byte[] ret = new byte[120]; // 2bit*24px*20px byte[] ret = new byte[120]; // 2bit*24px*20px
int ofs = 0; int ofs;
switch (Version) switch (Version)
{ {
case GameVersion.DP: ofs = 0x1176; break; case GameVersion.DP: ofs = 0x1176; break;
@ -1155,14 +1155,14 @@ namespace PKHeX.Core
} }
set set
{ {
int ofs = 0; int ofs;
switch (Version) switch (Version)
{ {
case GameVersion.DP: ofs = 0x1176; break; case GameVersion.DP: ofs = 0x1176; break;
default: return; default: return;
} }
ofs += GBO; ofs += GBO;
for(int i = 0; i < 120; i++) for (int i = 0; i < 120; i++)
Data[ofs + i] = value[i]; Data[ofs + i] = value[i];
Data[ofs - 0x2A] |= 0x04; // 0x114C "Touch!" Data[ofs - 0x2A] |= 0x04; // 0x114C "Touch!"
} }

View file

@ -276,7 +276,7 @@ namespace PKHeX.Core
// Check the intro bytes for each save slot // Check the intro bytes for each save slot
byte[] slotintroXD = { 0x01, 0x01, 0x01, 0x00 }; byte[] slotintroXD = { 0x01, 0x01, 0x01, 0x00 };
int offset = data.Length - SIZE_G3XD; int offset = data.Length - SIZE_G3XD;
// For XD savegames inside a memory card only the firs sequence is equal to slotintroXD // For XD savegames inside a memory card only the first sequence is equal to slotintroXD
bool valid = false; bool valid = false;
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
@ -284,9 +284,7 @@ namespace PKHeX.Core
if (ident.SequenceEqual(slotintroXD)) if (ident.SequenceEqual(slotintroXD))
valid = true; valid = true;
} }
if(!valid) return valid ? GameVersion.XD : GameVersion.Invalid;
return GameVersion.Invalid;
return GameVersion.XD;
} }
/// <summary>Determines the type of 4th gen save</summary> /// <summary>Determines the type of 4th gen save</summary>
/// <param name="data">Save data of which to determine the type</param> /// <param name="data">Save data of which to determine the type</param>