PKHeX/PKHeX.Core/Legality/Structures/EncounterSlot.cs
javierhimura 461fb70f90 Generation 1/2 Legal improvements (#1310)
* Added location to encounter slot to make verification againts the location of the encounter when the pokemon has lost met location, like generation 2 heabutt tree, jhoto surfing in route 45 and in the future generation 4 munchlax tree

Added version to generation 1 and 2 encounter locations to filter by catch rate based of the version of the encounter and check initial moves of the encounter only for the game that match the encounter

Filter generation 2 pokemon for crystal who have met location based of the time of day when it was captured

Completed version to static and traded encounters for gen 1 pokemon, to avoid check a red encounter with yellow initial moves, if an encounter is possible in both games with diferent moves it is duplicated (like eevee), if it is possible in both games with the same moves is left as RBY, the encounter will only use red/blue moveset

Verify some invalid gen 2 encounters. Crystall heabutt encounters based on the TID, using the tree selection algorithm of the game to determine if the encounter is possible for the TID (implemented base on https://bulbapedia.bulbagarden.net/wiki/Headbutt_tree#Mechanics). Coordinates of Crystal trees obtained with the programa G2Map

Added checks for fishing encounters for unreacheable water tiles in gen 2, route 14, national park and the beta safari zone.

* Fix gen 1 static encounters and trade encounters filter by version

* Missing strings
2017-07-06 16:03:41 -07:00

76 lines
2.5 KiB
C#

namespace PKHeX.Core
{
public class EncounterSlotPermissions
{
public bool Static { get; set; }
public bool MagnetPull { get; set; }
public int StaticCount { get; set; }
public int MagnetPullCount { get; set; }
public bool AllowDexNav { get; set; }
public bool Pressure { get; set; }
public bool DexNav { get; set; }
public bool WhiteFlute { get; set; }
public bool BlackFlute { get; set; }
public bool IsNormalLead => !(WhiteFlute || BlackFlute || DexNav);
}
public class EncounterSlot : IEncounterable, IGeneration
{
public int Location { get; set; } = -1;
public int Species { get; set; }
public int Form { get; set; }
public int LevelMin { get; set; }
public int LevelMax { get; set; }
public SlotType Type { get; set; } = SlotType.Any;
public EncounterType TypeEncounter { get; set; } = EncounterType.None;
public int SlotNumber { get; set; }
public bool EggEncounter => false;
public int Generation { get; set; } = -1;
internal EncounterSlotPermissions _perm;
public EncounterSlotPermissions Permissions => _perm ?? (_perm = new EncounterSlotPermissions());
public virtual EncounterSlot Clone()
{
return new EncounterSlot
{
Species = Species,
LevelMax = LevelMax,
LevelMin = LevelMin,
Type = Type,
SlotNumber = SlotNumber,
_perm = _perm
};
}
public string Name
{
get
{
const string wild = "Wild Encounter";
if (Type == SlotType.Any)
return wild;
return wild + " " + $"{Type.ToString().Replace("_", " ")}";
}
}
}
public class EncounterSlot1 : EncounterSlot
{
public int Rate;
public EncounterTime Time = EncounterTime.Any;
public GameVersion Version = GameVersion.Any;
public override EncounterSlot Clone()
{
return new EncounterSlot1
{
Species = Species,
LevelMax = LevelMax,
LevelMin = LevelMin,
Type = Type,
SlotNumber = SlotNumber,
_perm = _perm,
Rate = Rate,
Time = Time,
Generation = Generation,
};
}
}
}