PKHeX/PKHeX.Core/Legality/Structures/EncounterTime.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

32 lines
No EOL
860 B
C#

namespace PKHeX.Core
{
public enum EncounterTime
{
Any = -1,
MorningDay = -2,
Morning = 1,
Day = 2,
Night = 3
}
public static class EncounterTimeExtension
{
public static bool Contains(this EncounterTime t1, int t2)
{
return t1.Contains((EncounterTime)t2);
}
private static bool Contains(this EncounterTime t1, EncounterTime t2)
{
if (t1 == t2 || t1 == EncounterTime.Any || t2 == EncounterTime.Any)
return true;
if (t1 == EncounterTime.MorningDay)
return (t2 == EncounterTime.Morning || t2 == EncounterTime.Day);
if (t2 == EncounterTime.MorningDay)
return (t1 == EncounterTime.Morning || t1 == EncounterTime.Day);
return false;
}
}
}