mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-14 00:07:15 +00:00
Add checks for fishing mark
This commit is contained in:
parent
90f7de4b27
commit
b82b0da7d9
3 changed files with 36 additions and 3 deletions
|
@ -61,6 +61,14 @@ namespace PKHeX.Core
|
|||
if (rating != EncounterMatchRating.Match)
|
||||
return rating;
|
||||
|
||||
if (pkm is IRibbonSetMark8 m)
|
||||
{
|
||||
if (m.RibbonMarkCurry && (Weather & AreaWeather8.All) == 0)
|
||||
return EncounterMatchRating.Deferred;
|
||||
if (m.RibbonMarkFishing && (Weather & AreaWeather8.Fishing) == 0)
|
||||
return EncounterMatchRating.Deferred;
|
||||
}
|
||||
|
||||
var req = GetRequirement(pkm);
|
||||
return req switch
|
||||
{
|
||||
|
|
|
@ -83,7 +83,8 @@ namespace PKHeX.Core
|
|||
if ((req == MustHave) != correlation)
|
||||
return EncounterMatchRating.Deferred;
|
||||
|
||||
if (pkm is IRibbonSetMark8 {RibbonMarkCurry: true})
|
||||
// Only encounter slots can have these marks; defer for collisions.
|
||||
if (pkm is IRibbonSetMark8 m && (m.RibbonMarkCurry || m.RibbonMarkFishing))
|
||||
return EncounterMatchRating.Deferred;
|
||||
|
||||
return EncounterMatchRating.Match;
|
||||
|
|
|
@ -66,6 +66,7 @@ namespace PKHeX.Core
|
|||
public static bool IsMarkAllowedSpecific(RibbonIndex mark, PKM pk, IEncounterable x) => mark switch
|
||||
{
|
||||
RibbonIndex.MarkCurry when !IsMarkAllowedCurry(pk, x) => false,
|
||||
RibbonIndex.MarkFishing when !IsMarkAllowedFishing(x) => false,
|
||||
RibbonIndex.MarkDestiny => false,
|
||||
_ => true
|
||||
};
|
||||
|
@ -83,15 +84,38 @@ namespace PKHeX.Core
|
|||
|
||||
public static bool IsMarkAllowedCurry(PKM pkm, IEncounterable enc)
|
||||
{
|
||||
if (enc is not EncounterSlot8 s || !((EncounterArea8)s.Area).PermitCrossover)
|
||||
// Curry are only encounter slots, from the hidden table (not symbol). Slots taken from area's current weather(?).
|
||||
if (enc is not EncounterSlot8 s)
|
||||
return false;
|
||||
|
||||
if (!EncounterArea8.IsWildArea(s.Location))
|
||||
var area = (EncounterArea8)s.Area;
|
||||
if (area.PermitCrossover)
|
||||
return false;
|
||||
|
||||
var weather = s.Weather;
|
||||
if ((weather & AreaWeather8.All) == 0)
|
||||
return false;
|
||||
|
||||
if (EncounterArea8.IsWildArea(s.Location))
|
||||
return false;
|
||||
var ball = pkm.Ball;
|
||||
return (uint)(ball - 2) <= 2;
|
||||
}
|
||||
|
||||
public static bool IsMarkAllowedFishing(IEncounterable enc)
|
||||
{
|
||||
// Fishing are only encounter slots, from the hidden table (not symbol).
|
||||
if (enc is not EncounterSlot8 s)
|
||||
return false;
|
||||
|
||||
var area = (EncounterArea8)s.Area;
|
||||
if (area.PermitCrossover)
|
||||
return false;
|
||||
|
||||
var weather = s.Weather;
|
||||
return (weather & AreaWeather8.Fishing) != 0;
|
||||
}
|
||||
|
||||
private void VerifyAffixedRibbonMark(LegalityAnalysis data, IRibbonIndex m)
|
||||
{
|
||||
if (m is not PK8 pk8)
|
||||
|
|
Loading…
Reference in a new issue