Minor tweaks

This commit is contained in:
Kurt 2020-12-30 13:08:15 -08:00
parent 206a05082b
commit 24332b6979
5 changed files with 16 additions and 20 deletions

View file

@ -118,7 +118,7 @@ namespace PKHeX
return;
case (int)Species.Exeggutor when moves.Contains(23) && moves.Any(m => G1Exeggcute_IncompatibleMoves.Contains(moves[m])):
// Exeggutor learns stomp at level 28
// Exeggutor learns Stomp at level 28
// Exeggcute learns Stun Spore at 32, PoisonPowder at 37 and Sleep Powder at 48
incompatible_current = new[] { 23 };
incompatible_previous = G1Exeggcute_IncompatibleMoves;
@ -135,14 +135,14 @@ namespace PKHeX
for (int i = 0; i < ExclusiveMoves[0].Count; i++)
{
// There is a evolution move with a lower level that current eevee move
// There is a evolution move with a lower level that current Eevee move
var el = EeveeLevels[i];
if (EvoLevels.Any(ev => ev < el))
incompatible_previous.Add(ExclusiveMoves[0][i]);
}
for (int i = 0; i < ExclusiveMoves[1].Count; i++)
{
// There is a eevee move with a greather level that current evolution move
// There is an Eevee move with a greater level that current evolution move
var el = EvoLevels[i];
if (EeveeLevels.Any(ev => ev > el))
incompatible_current.Add(ExclusiveMoves[1][i]);

View file

@ -117,7 +117,7 @@ namespace PKHeX.Core
// Starting in Generation 8, hatched language-traded eggs will take the Language from the trainer that hatched it.
// Also in Generation 8, evolving in a foreign language game will retain the original language as the source for the newly evolved species name.
// Transferring from Gen7->Gen8 realigns the Nickname string to the Language, if not nicknamed.
bool canHaveAnyLanguage = pkm.Format <= 7 && (EncounterMatch.Species != species || pkm.WasTradedEgg);
bool canHaveAnyLanguage = format <= 7 && (EncounterMatch.Species != species || pkm.WasTradedEgg);
if (canHaveAnyLanguage && !SpeciesName.IsNicknamedAnyLanguage(species, nickname, format))
return true;
@ -131,7 +131,7 @@ namespace PKHeX.Core
break;
}
if (pkm.Format == 5 && !pkm.IsNative) // transfer
if (format == 5 && !pkm.IsNative) // transfer
{
if (canHaveAnyLanguage)
return !SpeciesName.IsNicknamedAnyLanguage(species, nickname, 4);
@ -145,15 +145,15 @@ namespace PKHeX.Core
{
var Info = data.Info;
var pkm = data.pkm;
var EncounterMatch = Info.EncounterMatch;
switch (pkm.Format)
var format = pkm.Format;
switch (format)
{
case 4:
if (pkm.IsNicknamed) // gen4 doesn't use the nickname flag for eggs
data.AddLine(GetInvalid(LNickFlagEggNo, CheckIdentifier.Egg));
break;
case 7:
if (EncounterMatch is EncounterStatic ^ !pkm.IsNicknamed) // gen7 doesn't use for ingame gifts
if (pkm.IsNicknamed == Info.EncounterMatch is EncounterStatic7) // gen7 doesn't use for ingame gifts
data.AddLine(GetInvalid(pkm.IsNicknamed ? LNickFlagEggNo : LNickFlagEggYes, CheckIdentifier.Egg));
break;
default:
@ -162,9 +162,10 @@ namespace PKHeX.Core
break;
}
if (pkm.Format == 2 && pkm.IsEgg && !SpeciesName.IsNicknamedAnyLanguage(0, pkm.Nickname, 2))
var nick = pkm.Nickname;
if (format == 2 && !SpeciesName.IsNicknamedAnyLanguage(0, nick, 2))
data.AddLine(GetValid(LNickMatchLanguageEgg, CheckIdentifier.Egg));
else if (SpeciesName.GetSpeciesNameGeneration(0, pkm.Language, Info.Generation) != pkm.Nickname)
else if (nick != SpeciesName.GetSpeciesNameGeneration(0, pkm.Language, Info.Generation))
data.AddLine(GetInvalid(LNickMatchLanguageEggFail, CheckIdentifier.Egg));
else
data.AddLine(GetValid(LNickMatchLanguageEgg, CheckIdentifier.Egg));

View file

@ -141,7 +141,7 @@ namespace PKHeX.Core
if (str.Length > 5)
data.AddLine(GetInvalid(LOTLong));
}
else if (!(data.EncounterOriginal is EncounterTrade2)) // OT already verified; SPA Shuckle/Voltorb transferred from French can yield 2 inaccessible chars
else if (data.EncounterOriginal is not EncounterTrade2) // OT already verified; SPA Shuckle/Voltorb transferred from French can yield 2 inaccessible chars
{
data.AddLine(GetInvalid(LG1CharOT));
}

View file

@ -28,7 +28,7 @@
public sealed override bool WasGiftEgg => IsEgg && Met_Location == 253; // Gift Egg, indistinguible from normal eggs after hatch
public sealed override bool WasEventEgg => IsEgg && Met_Location == 255; // Event Egg, indistinguible from normal eggs after hatch
public sealed override int Ability { get { var pi = (PersonalInfoG3)PersonalInfo; return AbilityBit && pi.Ability2 != 0 ? pi.Ability2 : pi.Ability1; } set { } }
public sealed override int Ability { get => ((PersonalInfoG3)PersonalInfo).GetAbility(AbilityBit); set { } }
public sealed override uint EncryptionConstant { get => PID; set { } }
public sealed override int Nature { get => (int)(PID % 25); set { } }
public sealed override int Form { get => Species == (int)Core.Species.Unown ? PKX.GetUnownForm(PID) : 0; set { } }
@ -44,9 +44,7 @@
public sealed override void RefreshAbility(int n)
{
if (n == 1 && !((PersonalInfoG3)PersonalInfo).HasSecondAbility)
n = 0;
base.RefreshAbility(n & 1);
AbilityBit = n == 1 && ((PersonalInfoG3)PersonalInfo).HasSecondAbility;
}
public abstract bool RibbonEarth { get; set; }
@ -105,7 +103,7 @@
/// <returns>New object with transferred properties.</returns>
protected T ConvertTo<T>() where T : G3PKM, new()
{
var pk = new T // Convert away!
return new()
{
Species = Species,
Language = Language,
@ -186,10 +184,6 @@
Unused3 = Unused3,
Unused4 = Unused4,
};
if (pk is CK3 {ShadowID: not 0} ck3)
ck3.Purification = CK3.Purified; // purified
return pk;
}
}
}

View file

@ -70,6 +70,7 @@ namespace PKHeX.Core
}
public sealed override int GetAbilityIndex(int abilityID) => abilityID == Ability1 ? 0 : abilityID == Ability2 ? 1 : -1;
public int GetAbility(bool second) => second && HasSecondAbility ? Ability2 : Ability1;
public bool HasSecondAbility => Ability1 != Ability2;
}