diff --git a/PKHeX.Core/Editing/CommonEdits.cs b/PKHeX.Core/Editing/CommonEdits.cs index de0f8a0be..f015bab34 100644 --- a/PKHeX.Core/Editing/CommonEdits.cs +++ b/PKHeX.Core/Editing/CommonEdits.cs @@ -234,7 +234,7 @@ namespace PKHeX.Core if (pk is IGigantamax c) c.CanGigantamax = Set.CanGigantamax; if (pk is IDynamaxLevel d) - d.DynamaxLevel = d.CanHaveDynamaxLevel(pk) ? (byte)10 : (byte)0; + d.DynamaxLevel = d.GetSuggestedDynamaxLevel(pk); if (pk is ITechRecord8 t) { @@ -376,7 +376,7 @@ namespace PKHeX.Core pk.OT_Friendship = 1; else pk.CurrentFriendship = byte.MaxValue; - if (pk is PB7 pb) + if (pk is ICombatPower pb) pb.ResetCP(); } @@ -389,7 +389,7 @@ namespace PKHeX.Core if (pk.IsEgg) return; pk.CurrentLevel = 100; - if (pk is PB7 pb) + if (pk is ICombatPower pb) pb.ResetCP(); } diff --git a/PKHeX.Core/Editing/Saves/BoxManip/BoxManipBase.cs b/PKHeX.Core/Editing/Saves/BoxManip/BoxManipBase.cs index 4db37a528..bb64d6717 100644 --- a/PKHeX.Core/Editing/Saves/BoxManip/BoxManipBase.cs +++ b/PKHeX.Core/Editing/Saves/BoxManip/BoxManipBase.cs @@ -31,7 +31,7 @@ namespace PKHeX.Core new BoxManipSort(BoxManipType.SortLevelReverse, EntitySorting.OrderByDescendingLevel), new BoxManipSort(BoxManipType.SortDate, EntitySorting.OrderByDateObtained, s => s.Generation >= 4), new BoxManipSort(BoxManipType.SortName, list => list.OrderBySpeciesName(GameInfo.Strings.Species)), - new BoxManipSort(BoxManipType.SortFavorite, list => list.OrderByCustom(pk => pk is PB7 {Favorite: true}), s => s.BlankPKM is IFavorite), + new BoxManipSort(BoxManipType.SortFavorite, list => list.OrderByCustom(pk => pk is IFavorite {Favorite: true}), s => s.BlankPKM is IFavorite), new BoxManipSortComplex(BoxManipType.SortParty, (list, sav, start) => list.BubbleUp(sav, i => ((SAV7b)sav).Blocks.Storage.IsParty(i), start), s => s is SAV7b), new BoxManipSort(BoxManipType.SortShiny, list => list.OrderByCustom(pk => !pk.IsShiny)), new BoxManipSort(BoxManipType.SortRandom, list => list.OrderByCustom(_ => Util.Rand32())), diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot8.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot8.cs index 7e75f204c..3332c737c 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot8.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot8.cs @@ -64,7 +64,7 @@ namespace PKHeX.Core if (((EncounterArea8)Area).PermitCrossover) return MustHave; // symbol walking overworld - bool curry = pk is IRibbonSetMark8 {RibbonMarkCurry: true} || (pk.Species == (int)Core.Species.Shedinja && pk is PK8 {AffixedRibbon:(int)RibbonIndex.MarkCurry}); + bool curry = pk is IRibbonSetMark8 {RibbonMarkCurry: true} || (pk.Species == (int)Core.Species.Shedinja && pk is IRibbonSetAffixed { AffixedRibbon:(int)RibbonIndex.MarkCurry}); if (curry) return MustNotHave; diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8Nest.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8Nest.cs index 012ddfaa6..7666ae880 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8Nest.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8Nest.cs @@ -35,7 +35,7 @@ namespace PKHeX.Core if (pkm is IRibbonSetMark8 m8 && m8.HasMark()) return false; - if (pkm.Species == (int)Core.Species.Shedinja && pkm is PK8 { AffixedRibbon: >= (int)RibbonIndex.MarkLunchtime }) + if (pkm.Species == (int)Core.Species.Shedinja && pkm is IRibbonSetAffixed { AffixedRibbon: >= (int)RibbonIndex.MarkLunchtime }) return false; return base.IsMatchExact(pkm, evo); diff --git a/PKHeX.Core/Legality/Moves/MoveTutor.cs b/PKHeX.Core/Legality/Moves/MoveTutor.cs index 65153003b..e9eea2699 100644 --- a/PKHeX.Core/Legality/Moves/MoveTutor.cs +++ b/PKHeX.Core/Legality/Moves/MoveTutor.cs @@ -164,7 +164,7 @@ namespace PKHeX.Core return NONE; } - if (pkm.BDSP) + if (pkm is PB8) { var pi = (PersonalInfoBDSP)PersonalTable.BDSP.GetFormEntry(species, form); if (!pi.IsPresentInGame) diff --git a/PKHeX.Core/Legality/Restrictions/Memories/MemoryContext8.cs b/PKHeX.Core/Legality/Restrictions/Memories/MemoryContext8.cs index 3ac452137..cd1de5510 100644 --- a/PKHeX.Core/Legality/Restrictions/Memories/MemoryContext8.cs +++ b/PKHeX.Core/Legality/Restrictions/Memories/MemoryContext8.cs @@ -104,7 +104,7 @@ namespace PKHeX.Core return false; if (pk is IRibbonSetMark8 { RibbonMarkCurry: true }) return false; - if (pk.Species == (int)Species.Shedinja && pk is PK8 { AffixedRibbon: (int)RibbonIndex.MarkCurry }) + if (pk.Species == (int)Species.Shedinja && pk is IRibbonSetAffixed { AffixedRibbon: (int)RibbonIndex.MarkCurry }) return false; return true; } diff --git a/PKHeX.Core/PKM/Interfaces/IDynamaxLevel.cs b/PKHeX.Core/PKM/Interfaces/IDynamaxLevel.cs index 2071b97b4..4d1c5f14c 100644 --- a/PKHeX.Core/PKM/Interfaces/IDynamaxLevel.cs +++ b/PKHeX.Core/PKM/Interfaces/IDynamaxLevel.cs @@ -15,13 +15,15 @@ namespace PKHeX.Core /// /// Checks if the species is allowed to have a non-zero value for . /// - public static bool CanHaveDynamaxLevel(this IDynamaxLevel _, PKM pkm) + public static bool CanHaveDynamaxLevel(this IDynamaxLevel _, PKM pk) { - if (pkm.IsEgg) + if (pk.IsEgg) return false; - return pkm is PK8 && CanHaveDynamaxLevel(pkm.Species); + return pk is PK8 && CanHaveDynamaxLevel(pk.Species); } + public static byte GetSuggestedDynamaxLevel(this IDynamaxLevel _, PKM pk) => _.CanHaveDynamaxLevel(pk) ? (byte)10 : (byte)0; + /// /// Checks if the species is prevented from gaining any via candy in . /// diff --git a/PKHeX.Core/PKM/Interfaces/IHyperTrain.cs b/PKHeX.Core/PKM/Interfaces/IHyperTrain.cs index 4199c24ed..a450c5385 100644 --- a/PKHeX.Core/PKM/Interfaces/IHyperTrain.cs +++ b/PKHeX.Core/PKM/Interfaces/IHyperTrain.cs @@ -79,7 +79,7 @@ namespace PKHeX.Core t.HT_SPE = IVs[3] != 31 && IVs[3] > 2 && (IVs[3] > 17 || t.HT_HP || t.HT_ATK || t.HT_DEF || t.HT_SPA || t.HT_SPD); - if (pkm is PB7 pb) + if (pkm is ICombatPower pb) pb.ResetCP(); } diff --git a/PKHeX.WinForms/Controls/PKM Editor/SizeCP.cs b/PKHeX.WinForms/Controls/PKM Editor/SizeCP.cs index 3d094fed0..9aec6a61d 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/SizeCP.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/SizeCP.cs @@ -143,7 +143,7 @@ namespace PKHeX.WinForms.Controls public void ToggleVisibility(PKM pk) { - bool isCP = pk is PB7; + bool isCP = pk is ICombatPower; bool isAbsolute = pk is IScaledSizeValue; MT_CP.Visible = L_CP.Visible = isCP; TB_HeightAbs.Visible = TB_WeightAbs.Visible = isAbsolute;