mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
cleanup
no functional change
This commit is contained in:
parent
ecb4212ab1
commit
18fb42e86d
11 changed files with 31 additions and 37 deletions
|
@ -1284,7 +1284,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
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)
|
||||
return null;
|
||||
|
||||
|
@ -1374,7 +1374,7 @@ namespace PKHeX.Core
|
|||
if (!valid)
|
||||
AddLine(Severity.Invalid, V111, CheckIdentifier.Ability);
|
||||
}
|
||||
else if(EncounterIsMysteryGift)
|
||||
else if (EncounterIsMysteryGift)
|
||||
verifyAbilityMG456(abilities, ((WC7)EncounterMatch).AbilityType);
|
||||
else if (Legal.Ban_NoHidden7.Contains(pkm.SpecForm) && pkm.AbilityNumber == 4)
|
||||
AddLine(Severity.Invalid, V112, CheckIdentifier.Ability);
|
||||
|
@ -2285,12 +2285,12 @@ namespace PKHeX.Core
|
|||
{ AddLine(Severity.Invalid, V319, CheckIdentifier.Misc); }
|
||||
if (pkm.CNTs.Any(stat => stat > 0))
|
||||
{ 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); }
|
||||
var HatchCycles = (EncounterMatch as EncounterStatic)?.EggCycles;
|
||||
if (HatchCycles == 0)
|
||||
HatchCycles = pkm.PersonalInfo.HatchCycles;
|
||||
if( pkm.CurrentFriendship > HatchCycles)
|
||||
if (pkm.CurrentFriendship > HatchCycles)
|
||||
{ AddLine(Severity.Invalid, V374, CheckIdentifier.Misc); }
|
||||
}
|
||||
|
||||
|
@ -2641,7 +2641,6 @@ namespace PKHeX.Core
|
|||
Games = new[] { GameVersion.B2W2 };
|
||||
break;
|
||||
}
|
||||
int splitctr = Legal.SplitBreed.Contains(pkm.Species) ? 1 : 0;
|
||||
var issplitbreed = Legal.SplitBreed.Contains(pkm.Species);
|
||||
foreach (var ver in Games)
|
||||
{
|
||||
|
@ -2649,7 +2648,7 @@ namespace PKHeX.Core
|
|||
var BaseLvlMoves = 489 <= pkm.Species && pkm.Species <= 490 ? 1 : 100;
|
||||
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
|
||||
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);
|
||||
|
||||
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 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
|
||||
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[] SpecialMoves = (EncounterMatch as IMoveset)?.Moves ?? new int[0];
|
||||
|
@ -2767,7 +2766,7 @@ namespace PKHeX.Core
|
|||
var LvlupEggMovesSplitLearned = new List<int>[egg.Length];
|
||||
var EggMovesSplitLearned = new List<int>[egg.Length];
|
||||
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>();
|
||||
EggMovesSplitLearned[i] = new List<int>();
|
||||
|
@ -2855,7 +2854,7 @@ namespace PKHeX.Core
|
|||
else
|
||||
res[m] = new CheckResult(Severity.Valid, V345, CheckIdentifier.Move);
|
||||
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
|
||||
if (lvlupegg[0].Contains(moves[m]) && !lvlupegg[1].Contains(moves[m]))
|
||||
|
@ -2936,7 +2935,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
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);
|
||||
else if (LvlupEggMovesLearned.Contains(m))
|
||||
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())
|
||||
{
|
||||
var species = specieslist;
|
||||
var splitbreedspecies0 = species[Legal.getBaseEggSpecies(pkm, 0)];
|
||||
var splitbreedspecies0 = species[Legal.getBaseEggSpecies(pkm)]; // 0
|
||||
var splitbreedspecies1 = species[Legal.getBaseEggSpecies(pkm, 1)];
|
||||
foreach (int m in EggMovesSplitLearned[0])
|
||||
// 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);
|
||||
}
|
||||
|
||||
if(splitbreedinvalid)
|
||||
if (splitbreedinvalid)
|
||||
{
|
||||
var species = specieslist;
|
||||
var splitbreedspecies0 = species[Legal.getBaseEggSpecies(pkm, skipOption)];
|
||||
|
|
|
@ -1063,7 +1063,7 @@ namespace PKHeX.Core
|
|||
var preevomoves = new List<int>();
|
||||
var evomoves = new List<int>();
|
||||
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 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:
|
||||
info = PersonalTable.AO[species];
|
||||
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);
|
||||
for (int i = 0; i < Tutors_AO.Length; i++)
|
||||
|
|
|
@ -168,7 +168,7 @@ namespace PKHeX.Core
|
|||
public IEnumerable<DexLevel> getValidPreEvolutions(PKM pkm, int lvl, int maxSpeciesOrigin =-1 ,bool skipChecks = false)
|
||||
{
|
||||
int index = getIndex(pkm);
|
||||
if(maxSpeciesOrigin <= 0)
|
||||
if (maxSpeciesOrigin <= 0)
|
||||
maxSpeciesOrigin = Legal.getMaxSpeciesOrigin(pkm);
|
||||
return Lineage[index].getExplicitLineage(pkm, lvl, skipChecks, MaxSpeciesTree, maxSpeciesOrigin);
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ namespace PKHeX.Core
|
|||
for (int j = 0; j < 5; j++)
|
||||
{
|
||||
EvolutionMethod m = getMethod(data, offset);
|
||||
if(m!=null)
|
||||
if (m != null)
|
||||
m_list.Add(m);
|
||||
else
|
||||
break;
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
|
@ -35,6 +31,7 @@ namespace PKHeX.Core
|
|||
Type = GBEncounterType.EggEncounter;
|
||||
Level = 5;
|
||||
WasEgg = true;
|
||||
Species = species;
|
||||
}
|
||||
|
||||
public GBEncounterData(PKM pkm, int gen, object enc)
|
||||
|
@ -42,7 +39,7 @@ namespace PKHeX.Core
|
|||
Generation = gen;
|
||||
Encounter = enc;
|
||||
WasEgg = false;
|
||||
if (Encounter as EncounterTrade != null)
|
||||
if (Encounter is EncounterTrade)
|
||||
{
|
||||
var trade = (EncounterTrade)Encounter;
|
||||
Species = trade.Species;
|
||||
|
@ -50,12 +47,12 @@ namespace PKHeX.Core
|
|||
Level = pkm.Met_Level; // Crystal
|
||||
else
|
||||
Level = trade.Level;
|
||||
if ( Generation == 2)
|
||||
if (Generation == 2)
|
||||
Type = GBEncounterType.TradeEncounterG2;
|
||||
else
|
||||
Type = GBEncounterType.TradeEncounterG1;
|
||||
}
|
||||
else if (Encounter as EncounterStatic != null)
|
||||
else if (Encounter is EncounterStatic)
|
||||
{
|
||||
var statc = (EncounterStatic)Encounter;
|
||||
Species = statc.Species;
|
||||
|
@ -65,7 +62,7 @@ namespace PKHeX.Core
|
|||
else
|
||||
Type = GBEncounterType.StaticEncounter;
|
||||
}
|
||||
else if (Encounter as EncounterSlot1 != null)
|
||||
else if (Encounter is EncounterSlot1)
|
||||
{
|
||||
var slot = (EncounterSlot1)Encounter;
|
||||
Species = slot.Species;
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace PKHeX.Core
|
|||
/// <returns>Array of Move IDs</returns>
|
||||
public int[] getMoves(int maxLevel, int minLevel = 0)
|
||||
{
|
||||
if (minLevel <=1 && maxLevel >= 100)
|
||||
if (minLevel <= 1 && maxLevel >= 100)
|
||||
return Moves;
|
||||
int start = Array.FindIndex(Levels, z => z >= minLevel);
|
||||
if (start < 0)
|
||||
|
|
|
@ -993,7 +993,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static readonly EncounterArea SlotsD_HoneyTree =
|
||||
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
|
||||
}).ToArray()
|
||||
|
|
|
@ -165,7 +165,7 @@
|
|||
<Compile Include="Legality\Structures\EncounterStatic.cs" />
|
||||
<Compile Include="Legality\Structures\EncounterTrade.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\Learnset.cs" />
|
||||
<Compile Include="Legality\Structures\Nature.cs" />
|
||||
|
|
|
@ -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_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 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); } }
|
||||
public int RibbonCountG3Cool { get { return (int)(RIB0 >> 00) & 7; } set { RIB0 = (uint)((RIB0 & ~(7 << 00)) | (uint)(value & 7) << 00); } }
|
||||
|
|
|
@ -251,7 +251,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
get
|
||||
{
|
||||
if(EntryCOLO > -1 && EntrySelected == EntryCOLO)
|
||||
if (EntryCOLO > -1 && EntrySelected == EntryCOLO)
|
||||
return GameVersion.COLO;
|
||||
if (EntryXD > -1 && EntrySelected == EntryXD)
|
||||
return GameVersion.XD;
|
||||
|
|
|
@ -1142,7 +1142,7 @@ namespace PKHeX.Core
|
|||
get
|
||||
{
|
||||
byte[] ret = new byte[120]; // 2bit*24px*20px
|
||||
int ofs = 0;
|
||||
int ofs;
|
||||
switch (Version)
|
||||
{
|
||||
case GameVersion.DP: ofs = 0x1176; break;
|
||||
|
@ -1155,14 +1155,14 @@ namespace PKHeX.Core
|
|||
}
|
||||
set
|
||||
{
|
||||
int ofs = 0;
|
||||
int ofs;
|
||||
switch (Version)
|
||||
{
|
||||
case GameVersion.DP: ofs = 0x1176; break;
|
||||
default: return;
|
||||
}
|
||||
ofs += GBO;
|
||||
for(int i = 0; i < 120; i++)
|
||||
for (int i = 0; i < 120; i++)
|
||||
Data[ofs + i] = value[i];
|
||||
Data[ofs - 0x2A] |= 0x04; // 0x114C "Touch!"
|
||||
}
|
||||
|
|
|
@ -276,7 +276,7 @@ namespace PKHeX.Core
|
|||
// Check the intro bytes for each save slot
|
||||
byte[] slotintroXD = { 0x01, 0x01, 0x01, 0x00 };
|
||||
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;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
|
@ -284,9 +284,7 @@ namespace PKHeX.Core
|
|||
if (ident.SequenceEqual(slotintroXD))
|
||||
valid = true;
|
||||
}
|
||||
if(!valid)
|
||||
return GameVersion.Invalid;
|
||||
return GameVersion.XD;
|
||||
return valid ? GameVersion.XD : GameVersion.Invalid;
|
||||
}
|
||||
/// <summary>Determines the type of 4th gen save</summary>
|
||||
/// <param name="data">Save data of which to determine the type</param>
|
||||
|
|
Loading…
Reference in a new issue