mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-23 04:38:15 -05:00
Final touches on GO changes
This commit is contained in:
@@ -60,9 +60,24 @@ public bool IsBallValid(Ball ball, ushort currentSpecies, PKM pk)
|
||||
return ball == Ball.Poke;
|
||||
if (ball == Ball.Master && pk.MetDate < new DateOnly(2023, 5, 21))
|
||||
return false;
|
||||
if (ball == Ball.Strange && Type == PogoType.SpecialResearch && SpeciesCategory.IsSpecialPokemon(currentSpecies))
|
||||
return false;
|
||||
if (ball == Ball.Strange && !IsValidWildAreaDate(pk.MetDate))
|
||||
return false;
|
||||
return BallRestrict.IsValidBall(ball, Type, Flags);
|
||||
}
|
||||
|
||||
private static bool IsValidWildAreaDate(DateOnly? date) => date?.DayNumber switch
|
||||
{
|
||||
>= 739204 and <= 739207 => true, // Pokémon GO Wild Area 2024: Fukuoka
|
||||
>= 739211 and <= 739214 => true, // Pokémon GO Wild Area 2024: Global
|
||||
>= 739560 and <= 739564 => true, // Pokémon GO Wild Area 2025: Nagasaki
|
||||
>= 739568 and <= 739571 => true, // Pokémon GO Wild Area 2025: Global
|
||||
>= 739924 and <= 739928 => true, // Pokémon GO Wild Area 2026: Sendai • Tohoku / Mexico City
|
||||
>= 739932 and <= 739935 => true, // Pokémon GO Wild Area 2026: Global
|
||||
_ => false,
|
||||
};
|
||||
|
||||
private PKM GetBlank() => OriginFormat switch
|
||||
{
|
||||
PogoImportFormat.PK7 => new PK8(),
|
||||
|
||||
@@ -76,6 +76,11 @@ or PogoType.RaidUltraBeast
|
||||
or PogoType.RaidShadow
|
||||
or PogoType.RaidShadowMythical
|
||||
or PogoType.RaidShadowUltraBeast;
|
||||
|
||||
public bool IsMaxBattle => type is PogoType.MaxBattle
|
||||
or PogoType.MaxBattleMythical
|
||||
or PogoType.MaxBattleUltraBeast
|
||||
or PogoType.MaxBattleGigantamax;
|
||||
}
|
||||
|
||||
extension(PogoBallRestriction ball)
|
||||
@@ -94,7 +99,7 @@ public bool IsValidBall(Ball current, PogoType type, PogoFlags flags)
|
||||
if (current is Master)
|
||||
return ball.IsMasterBallUsable(type);
|
||||
if (current is TransferSafariBall)
|
||||
return ball.IsSafariBallUsable(flags);
|
||||
return ball.IsSafariBallUsable(type, flags);
|
||||
|
||||
return ball switch
|
||||
{
|
||||
@@ -108,8 +113,24 @@ public bool IsValidBall(Ball current, PogoType type, PogoFlags flags)
|
||||
};
|
||||
}
|
||||
|
||||
public bool IsMasterBallUsable(PogoType type) => ball is PogoBallRestriction.StandardMaster || type.IsRaid;
|
||||
public bool IsSafariBallUsable(PogoFlags flags) => ball is PogoBallRestriction.OnlySafari || flags.HasFlag(PogoFlags.FeaturedWildArea);
|
||||
public bool IsMasterBallUsable(PogoType type) => ball is not (PogoBallRestriction.Standard or PogoBallRestriction.OnlyPoke or PogoBallRestriction.OnlyBeast);
|
||||
|
||||
public bool IsSafariBallUsable(PogoType type, PogoFlags flags)
|
||||
{
|
||||
if (ball is PogoBallRestriction.OnlySafari)
|
||||
return true;
|
||||
if (!flags.HasFlag(PogoFlags.FeaturedWildArea) && (type.IsRaid || type.IsMaxBattle))
|
||||
return false;
|
||||
|
||||
return type switch
|
||||
{
|
||||
PogoType.Egg or PogoType.Egg12km => false,
|
||||
PogoType.ResearchBreakthrough or PogoType.VivillonCollector or PogoType.ReferralBonus => false,
|
||||
PogoType.GBL or PogoType.GBLMythical or PogoType.GBLEvent => false,
|
||||
PogoType.Shadow or PogoType.ShadowMythical or PogoType.ShadowUltraBeast => false,
|
||||
_ => true,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user