mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 14:44:24 +00:00
Misc tweaks
This commit is contained in:
parent
209d295f58
commit
75a438ca44
3 changed files with 29 additions and 8 deletions
|
@ -18,7 +18,7 @@ namespace PKHeX.Core
|
|||
public int EggLocation => Locations.GetDaycareLocation(Generation, Version);
|
||||
public Ball FixedBall => BallBreedLegality.GetDefaultBall(Version, Species);
|
||||
public Shiny Shiny => Shiny.Random;
|
||||
public int Ability => 0;
|
||||
public int Ability => -1;
|
||||
|
||||
public bool CanHaveVoltTackle => Species is (int)Core.Species.Pichu && (Generation > 3 || Version is GameVersion.E);
|
||||
|
||||
|
|
|
@ -171,9 +171,8 @@ namespace PKHeX.Core
|
|||
}
|
||||
if (nickname.Length > Legal.GetMaxLengthNickname(data.Info.Generation, (LanguageID)pkm.Language))
|
||||
{
|
||||
var severe = pkm.Format >= 8 || (data.EncounterOriginal.EggEncounter && pkm.WasTradedEgg && nickname.Length <= Legal.GetMaxLengthNickname(data.Info.Generation, English))
|
||||
? Severity.Fishy
|
||||
: Severity.Invalid;
|
||||
int length = GetForeignNicknameLength(pkm, data.Info.EncounterOriginal, data.Info.Generation);
|
||||
var severe = (length != 0 && nickname.Length <= length) ? Severity.Fishy : Severity.Invalid;
|
||||
data.AddLine(Get(LNickLengthLong, severe));
|
||||
return true;
|
||||
}
|
||||
|
@ -194,6 +193,25 @@ namespace PKHeX.Core
|
|||
return false;
|
||||
}
|
||||
|
||||
private static int GetForeignNicknameLength(PKM pkm, IEncounterTemplate match, int origin)
|
||||
{
|
||||
// HOME gifts already verified prior to reaching here.
|
||||
System.Diagnostics.Debug.Assert(match is not WC8 {IsHOMEGift:true});
|
||||
|
||||
int length = 0;
|
||||
if (origin is 4 or 5 && match.EggEncounter && pkm.WasTradedEgg)
|
||||
length = Legal.GetMaxLengthNickname(origin, English);
|
||||
|
||||
if (pkm.FatefulEncounter)
|
||||
return length;
|
||||
|
||||
if (pkm.Format < 8 || pkm.BDSP)
|
||||
return length;
|
||||
|
||||
// Can only nickname if the language matches.
|
||||
return Legal.GetMaxLengthNickname(pkm.Format, (LanguageID)pkm.Language);
|
||||
}
|
||||
|
||||
private static bool IsNicknameValid(PKM pkm, IEncounterTemplate enc, string nickname)
|
||||
{
|
||||
int species = pkm.Species;
|
||||
|
|
|
@ -53,12 +53,15 @@ namespace PKHeX.Core
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if any player (human) was the original OT.
|
||||
/// </summary>
|
||||
internal static bool IsPlayerOriginalTrainer(IEncounterable enc) => enc switch
|
||||
{
|
||||
EncounterTrade { HasTrainerName: true } => true,
|
||||
MysteryGift { IsEgg: false } => true,
|
||||
EncounterStatic5N => true,
|
||||
_ => false,
|
||||
EncounterTrade { HasTrainerName: true } => false,
|
||||
MysteryGift { IsEgg: false } => false,
|
||||
EncounterStatic5N => false,
|
||||
_ => true,
|
||||
};
|
||||
|
||||
public static bool IsEdgeCaseLength(PKM pkm, IEncounterTemplate e, string ot)
|
||||
|
|
Loading…
Reference in a new issue