mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-09 12:35:20 -05:00
parent
ea9076ad4c
commit
3686ee9ec4
|
|
@ -1,6 +1,6 @@
|
|||
namespace PKHeX.Core
|
||||
{
|
||||
public sealed class EncounterSlot4 : EncounterSlot, IMagnetStatic, INumberedSlot
|
||||
public sealed class EncounterSlot4 : EncounterSlot, IMagnetStatic, INumberedSlot, IEncounterTypeTile
|
||||
{
|
||||
public override int Generation => 4;
|
||||
public EncounterType TypeEncounter => ((EncounterArea4)Area).TypeEncounter;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
namespace PKHeX.Core
|
||||
{
|
||||
public interface IEncounterTypeTile
|
||||
{
|
||||
EncounterType TypeEncounter { get; }
|
||||
}
|
||||
|
||||
public static class EncounterTypeTileExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets if the resulting <see cref="PKM"/> will still have a value depending on the current <see cref="format"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Generation 6 no longer stores this value.</remarks>
|
||||
public static bool HasTypeEncounter(this IEncounterTypeTile _, int format) => format == 4 || format == 5;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
public sealed class EncounterStaticTyped : EncounterStatic4
|
||||
public sealed class EncounterStaticTyped : EncounterStatic4, IEncounterTypeTile
|
||||
{
|
||||
public bool Roaming { get; set; }
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ protected override void SetMetData(PKM pk, int level, DateTime today)
|
|||
pk.MetDate = today;
|
||||
}
|
||||
|
||||
private int[] GetRoamLocations(int species, int type)
|
||||
private static int[] GetRoamLocations(int species, int type)
|
||||
{
|
||||
switch (species)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -241,5 +241,7 @@ public EncounterSuggestionData(PKM pkm, int met, int lvl)
|
|||
public int LevelMax { get; }
|
||||
|
||||
public int GetSuggestedMetLevel(PKM pkm) => EncounterSuggestion.GetSuggestedMetLevel(pkm, LevelMin);
|
||||
public int GetSuggestedEncounterType() => Encounter is IEncounterTypeTile t ? t.TypeEncounter.GetIndex() : 0;
|
||||
public bool HasEncounterType(int format) => Encounter is IEncounterTypeTile t && t.HasTypeEncounter(format);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -792,7 +792,10 @@ private bool SetSuggestedMetLocation(bool silent = false)
|
|||
minlvl = level;
|
||||
|
||||
if (Entity.CurrentLevel >= minlvl && Entity.Met_Level == level && Entity.Met_Location == location)
|
||||
return false;
|
||||
{
|
||||
if (!encounter.HasEncounterType(Entity.Format) || WinFormsUtil.GetIndex(CB_EncounterType) == encounter.GetSuggestedEncounterType())
|
||||
return false;
|
||||
}
|
||||
if (minlvl < level)
|
||||
minlvl = level;
|
||||
|
||||
|
|
@ -813,6 +816,9 @@ private bool SetSuggestedMetLocation(bool silent = false)
|
|||
TB_MetLevel.Text = encounter.GetSuggestedMetLevel(Entity).ToString();
|
||||
CB_MetLocation.SelectedValue = location;
|
||||
|
||||
if (encounter.HasEncounterType(Entity.Format))
|
||||
CB_EncounterType.SelectedValue = encounter.GetSuggestedEncounterType();
|
||||
|
||||
if (Entity.Gen6 && Entity.WasEgg && ModifyPKM)
|
||||
Entity.SetHatchMemory6();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user