mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-16 21:38:40 +00:00
Misc tweaks
Check HT move memories in Gen9 appropriately for deferral cases Add missing ID32 set for GO8->PKM Slight pre-work for Mightiest Mark Mew method signatures
This commit is contained in:
parent
910415ea8d
commit
f7d66db7e2
6 changed files with 26 additions and 14 deletions
|
@ -45,7 +45,8 @@ public static class EncounterFinder
|
|||
|
||||
// Looks like we might have a good enough match. Check if this is really a good match.
|
||||
info.EncounterMatch = enc;
|
||||
info.Parse.Add(e);
|
||||
if (e.Comment.Length > 0)
|
||||
info.Parse.Add(e);
|
||||
if (!VerifySecondaryChecks(pk, info, encounter))
|
||||
continue;
|
||||
|
||||
|
@ -117,14 +118,20 @@ public static class EncounterFinder
|
|||
if (m is IMemoryOT o && MemoryPermissions.IsMemoryOfKnownMove(o.OT_Memory))
|
||||
{
|
||||
var mem = MemoryVariableSet.Read(m, 0);
|
||||
if (!MemoryPermissions.CanKnowMove(pk, mem, info.EncounterMatch.Context, info))
|
||||
bool valid = MemoryPermissions.CanKnowMove(pk, mem, info.EncounterMatch.Context, info);
|
||||
if (!valid && iterator.PeekIsNext())
|
||||
return false;
|
||||
}
|
||||
if (m is IMemoryHT h && MemoryPermissions.IsMemoryOfKnownMove(h.HT_Memory) && !pk.HasMove(h.HT_TextVar))
|
||||
{
|
||||
var mem = MemoryVariableSet.Read(m, 1);
|
||||
var context = Memories.GetContextHandler(pk.Context);
|
||||
if (!MemoryPermissions.CanKnowMove(pk, mem, context, info))
|
||||
|
||||
var sources = MemoryRules.GetPossibleSources(info.EvoChainsAllGens);
|
||||
sources = MemoryRules.ReviseSourcesHandler(pk, sources, info.EncounterOriginal);
|
||||
|
||||
bool valid = (sources.HasFlag(MemorySource.Gen6) && MemoryPermissions.CanKnowMove(pk, mem, EntityContext.Gen6, info))
|
||||
|| (sources.HasFlag(MemorySource.Gen8) && MemoryPermissions.CanKnowMove(pk, mem, EntityContext.Gen8, info));
|
||||
if (!valid && iterator.PeekIsNext())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,6 +129,7 @@ public sealed record EncounterSlot8GO(int StartDate, int EndDate, ushort Species
|
|||
pk.MetDate = this.GetRandomValidDate();
|
||||
|
||||
pk.OT_Name = tr.OT;
|
||||
pk.ID32 = tr.ID32;
|
||||
pk.OT_Gender = tr.Gender;
|
||||
pk.HT_Name = "PKHeX";
|
||||
pk.CurrentHandler = 1;
|
||||
|
|
|
@ -33,14 +33,6 @@ public static class Memories
|
|||
return (MemoryArgType)type;
|
||||
}
|
||||
|
||||
public static EntityContext GetContextHandler(EntityContext current) => current switch
|
||||
{
|
||||
EntityContext.Gen7 => EntityContext.Gen6,
|
||||
EntityContext.Gen8a => EntityContext.Gen8,
|
||||
EntityContext.Gen8b => EntityContext.Gen8,
|
||||
_ => current,
|
||||
};
|
||||
|
||||
public static MemoryContext GetContext(EntityContext context) => context.Generation() switch
|
||||
{
|
||||
<=7 => MemoryContext6.Instance,
|
||||
|
|
|
@ -70,7 +70,7 @@ public sealed class MemoryVerifier : Verifier
|
|||
if (ValidSet(results, start))
|
||||
return;
|
||||
}
|
||||
if (sources.HasFlag(MemorySource.Deleted) )
|
||||
if (sources.HasFlag(MemorySource.Deleted))
|
||||
{
|
||||
results.RemoveRange(start, results.Count - start);
|
||||
VerifyHTMemoryNone(data, (ITrainerMemories)data.Entity);
|
||||
|
|
|
@ -185,6 +185,18 @@ public static class MarkRules
|
|||
return enc is EncounterMight9 { Stars: 7 };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the input's <see cref="IRibbonSetMark9.RibbonMarkMightiest"/> mark state is valid.
|
||||
/// </summary>
|
||||
public static bool IsMarkValidMightiest(IEncounterTemplate enc, bool hasMark, EvolutionHistory evos)
|
||||
{
|
||||
if (IsMarkPresentMightiest(enc))
|
||||
return hasMark;
|
||||
//if (enc.Species == (int)Species.Mew && evos.HasVisitedGen9)
|
||||
// return true; // Can be awarded the mark for battling Mewtwo.
|
||||
return !hasMark;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the input should have the <see cref="IRibbonSetMark9.RibbonMarkTitan"/> mark.
|
||||
/// </summary>
|
||||
|
|
|
@ -17,7 +17,7 @@ public static class RibbonVerifierMark9
|
|||
list.Add(MarkItemfinder);
|
||||
if (r.RibbonMarkJumbo && !MarkRules.IsMarkAllowedJumbo(args.History, args.Entity))
|
||||
list.Add(MarkJumbo);
|
||||
if (r.RibbonMarkMightiest != MarkRules.IsMarkPresentMightiest(args.Encounter))
|
||||
if (!MarkRules.IsMarkValidMightiest(args.Encounter, r.RibbonMarkMightiest, args.History))
|
||||
list.Add(MarkMightiest, !r.RibbonMarkMightiest);
|
||||
if (r.RibbonMarkMini && !MarkRules.IsMarkAllowedMini(args.History, args.Entity))
|
||||
list.Add(MarkMini);
|
||||
|
|
Loading…
Add table
Reference in a new issue