mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-25 08:15:22 -05:00
Add checks for fishing mark
This commit is contained in:
@@ -61,6 +61,14 @@ public override EncounterMatchRating GetMatchRating(PKM pkm)
|
||||
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 @@ public override EncounterMatchRating GetMatchRating(PKM pkm)
|
||||
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 @@ public static bool IsMarkValid(RibbonIndex mark, PKM pk, IEncounterable enc)
|
||||
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 @@ public static bool IsMarkValid(RibbonIndex mark, PKM pk, IEncounterable enc)
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user