Disallow BD/SP Tower Master ribbon w/mythicals

Thanks TFSthegreat !
https://projectpokemon.org/home/forums/topic/57375-pkhex-new-update-legality-errors-contribution-page/?do=findComment&comment=278427
This commit is contained in:
Kurt 2022-08-03 20:27:13 -07:00
parent 19b4a26cd7
commit 87e45b14c8

View file

@ -429,16 +429,11 @@ public sealed class RibbonVerifier : Verifier
private static IEnumerable<RibbonResult> GetInvalidRibbons8Any(PKM pk, IRibbonSetCommon8 s8, IEncounterTemplate enc, EvolutionHistory evos)
{
bool swsh = evos.HasVisitedSWSH;
bool bdsp = evos.HasVisitedBDSP;
bool pla = evos.HasVisitedPLA;
if (!swsh && !bdsp)
if (!CanObtainTowerMaster(evos) && s8.RibbonTowerMaster)
{
if (s8.RibbonTowerMaster)
yield return new RibbonResult(nameof(s8.RibbonTowerMaster));
yield return new RibbonResult(nameof(s8.RibbonTowerMaster));
}
if (!swsh)
if (!evos.HasVisitedSWSH)
{
if (s8.RibbonChampionGalar)
yield return new RibbonResult(nameof(s8.RibbonChampionGalar));
@ -473,18 +468,29 @@ public sealed class RibbonVerifier : Verifier
}
}
if (s8.RibbonTwinklingStar && (!bdsp || pk is IRibbonSetCommon6 {RibbonContestStar:false}))
if (s8.RibbonTwinklingStar && (!evos.HasVisitedBDSP || pk is IRibbonSetCommon6 {RibbonContestStar:false}))
{
yield return new RibbonResult(nameof(s8.RibbonTwinklingStar));
}
// received when capturing photos with Pokémon in the Photography Studio
if (s8.RibbonPioneer && !pla)
if (!evos.HasVisitedPLA && s8.RibbonPioneer)
{
yield return new RibbonResult(nameof(s8.RibbonPioneer));
}
}
private static bool CanObtainTowerMaster(EvolutionHistory evos)
{
if (evos.HasVisitedSWSH)
return true; // Anything in SW/SH can be used in battle tower.
if (!evos.HasVisitedBDSP)
return false;
// Mythicals cannot be used in BD/SP's Battle Tower
return !Legal.Mythicals.Contains(evos.Gen8b[0].Species);
}
private static bool CanParticipateInRankedSWSH(PKM pk, IEncounterTemplate enc, EvolutionHistory evos)
{
bool exist = enc.Generation switch