mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-22 20:13:06 +00:00
Revise more PB7/PK8->Interface type checks
This commit is contained in:
parent
1b70fb7053
commit
893b5d5293
9 changed files with 15 additions and 13 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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())),
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -15,13 +15,15 @@ namespace PKHeX.Core
|
|||
/// <summary>
|
||||
/// Checks if the species is allowed to have a non-zero value for <see cref="IDynamaxLevel.DynamaxLevel"/>.
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the species is prevented from gaining any <see cref="IDynamaxLevel.DynamaxLevel"/> via candy in <see cref="GameVersion.SWSH"/>.
|
||||
/// </summary>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue