mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 06:20:25 +00:00
Handle unavailable hidden abilities for bdsp
EncounterSlots now expose Ability, so no need for manual checks there.
This commit is contained in:
parent
66c00e4f8a
commit
936a0e927a
2 changed files with 34 additions and 8 deletions
|
@ -148,5 +148,25 @@ namespace PKHeX.Core
|
||||||
// Species that cannot be bred with a Hidden Ability originating in <see cref="GameVersion.Gen8"/>
|
// Species that cannot be bred with a Hidden Ability originating in <see cref="GameVersion.Gen8"/>
|
||||||
// </summary>
|
// </summary>
|
||||||
// internal static readonly HashSet<int> BanHidden8 = new(); // none as of DLC 1!
|
// internal static readonly HashSet<int> BanHidden8 = new(); // none as of DLC 1!
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Species that cannot be bred with a Hidden Ability originating in <see cref="GameVersion.Gen7"/>
|
||||||
|
/// </summary>
|
||||||
|
internal static readonly HashSet<int> BanHidden8b = new()
|
||||||
|
{
|
||||||
|
(int)Rotom,
|
||||||
|
(int)Rotom + (1 << 11),
|
||||||
|
(int)Rotom + (2 << 11),
|
||||||
|
(int)Rotom + (3 << 11),
|
||||||
|
(int)Rotom + (4 << 11),
|
||||||
|
(int)Rotom + (5 << 11),
|
||||||
|
|
||||||
|
(int)Baltoy,
|
||||||
|
(int)Claydol,
|
||||||
|
(int)Solrock,
|
||||||
|
(int)Lunatone,
|
||||||
|
|
||||||
|
(int)Phione,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,6 +127,7 @@ namespace PKHeX.Core
|
||||||
5 => VerifyAbility5(data, enc, abilities),
|
5 => VerifyAbility5(data, enc, abilities),
|
||||||
6 => VerifyAbility6(data, enc),
|
6 => VerifyAbility6(data, enc),
|
||||||
7 => VerifyAbility7(data, enc),
|
7 => VerifyAbility7(data, enc),
|
||||||
|
8 when data.pkm.BDSP => VerifyAbility8BDSP(data, enc),
|
||||||
>=8 => VALID,
|
>=8 => VALID,
|
||||||
_ => CheckMatch(data.pkm, abilities, gen, AbilityState.CanMismatch, enc),
|
_ => CheckMatch(data.pkm, abilities, gen, AbilityState.CanMismatch, enc),
|
||||||
};
|
};
|
||||||
|
@ -340,7 +341,6 @@ namespace PKHeX.Core
|
||||||
// Eggs and Encounter Slots are not yet checked for Hidden Ability potential.
|
// Eggs and Encounter Slots are not yet checked for Hidden Ability potential.
|
||||||
return enc switch
|
return enc switch
|
||||||
{
|
{
|
||||||
EncounterSlot5 w when pkm.AbilityNumber == 4 != w.IsHiddenGrotto => GetInvalid(w.IsHiddenGrotto ? LAbilityMismatchGrotto : LAbilityHiddenFail),
|
|
||||||
EncounterEgg e when pkm.AbilityNumber == 4 && AbilityBreedLegality.BanHidden5.Contains(e.Species) => GetInvalid(LAbilityHiddenUnavailable),
|
EncounterEgg e when pkm.AbilityNumber == 4 && AbilityBreedLegality.BanHidden5.Contains(e.Species) => GetInvalid(LAbilityHiddenUnavailable),
|
||||||
_ => CheckMatch(data.pkm, abilities, 5, pkm.Format == 5 ? AbilityState.MustMatch : AbilityState.CanMismatch, enc),
|
_ => CheckMatch(data.pkm, abilities, 5, pkm.Format == 5 ? AbilityState.MustMatch : AbilityState.CanMismatch, enc),
|
||||||
};
|
};
|
||||||
|
@ -355,12 +355,6 @@ namespace PKHeX.Core
|
||||||
// Eggs and Encounter Slots are not yet checked for Hidden Ability potential.
|
// Eggs and Encounter Slots are not yet checked for Hidden Ability potential.
|
||||||
return enc switch
|
return enc switch
|
||||||
{
|
{
|
||||||
EncounterSlot6XY {IsFriendSafari: true} => VALID,
|
|
||||||
EncounterSlot6XY {IsHorde: true} => VALID,
|
|
||||||
EncounterSlot6AO {IsHorde: true} => VALID,
|
|
||||||
EncounterSlot6AO {CanDexNav: true} => VALID,
|
|
||||||
EncounterSlot => GetInvalid(LAbilityMismatchHordeSafari),
|
|
||||||
|
|
||||||
EncounterEgg egg when AbilityBreedLegality.BanHidden6.Contains(egg.Species | (egg.Form << 11)) => GetInvalid(LAbilityHiddenUnavailable),
|
EncounterEgg egg when AbilityBreedLegality.BanHidden6.Contains(egg.Species | (egg.Form << 11)) => GetInvalid(LAbilityHiddenUnavailable),
|
||||||
_ => VALID,
|
_ => VALID,
|
||||||
};
|
};
|
||||||
|
@ -374,12 +368,24 @@ namespace PKHeX.Core
|
||||||
|
|
||||||
return enc switch
|
return enc switch
|
||||||
{
|
{
|
||||||
EncounterSlot7 {IsSOS: false} => GetInvalid(LAbilityMismatchSOS),
|
|
||||||
EncounterEgg egg when AbilityBreedLegality.BanHidden7.Contains(egg.Species | (egg.Form << 11)) => GetInvalid(LAbilityHiddenUnavailable),
|
EncounterEgg egg when AbilityBreedLegality.BanHidden7.Contains(egg.Species | (egg.Form << 11)) => GetInvalid(LAbilityHiddenUnavailable),
|
||||||
_ => VALID,
|
_ => VALID,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CheckResult VerifyAbility8BDSP(LegalityAnalysis data, IEncounterable enc)
|
||||||
|
{
|
||||||
|
var pkm = data.pkm;
|
||||||
|
if (pkm.AbilityNumber != 4)
|
||||||
|
return VALID;
|
||||||
|
|
||||||
|
return enc switch
|
||||||
|
{
|
||||||
|
EncounterEgg egg when AbilityBreedLegality.BanHidden8b.Contains(egg.Species | (egg.Form << 11)) => GetInvalid(LAbilityHiddenUnavailable),
|
||||||
|
_ => VALID,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Final checks assuming nothing else has flagged the ability.
|
/// Final checks assuming nothing else has flagged the ability.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in a new issue