2022-06-18 18:04:24 +00:00
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Generation 4 Pokéwalker Encounter
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <inheritdoc cref="EncounterStatic"/>
|
|
|
|
|
public sealed record EncounterStatic4Pokewalker : EncounterStatic
|
2020-12-22 01:04:09 +00:00
|
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
|
public override int Generation => 4;
|
|
|
|
|
|
|
|
|
|
public EncounterStatic4Pokewalker(ushort species, sbyte gender, byte level) : base(GameVersion.HGSS)
|
|
|
|
|
{
|
|
|
|
|
Species = species;
|
|
|
|
|
Gender = gender;
|
|
|
|
|
Level = level;
|
|
|
|
|
Gift = true;
|
|
|
|
|
Location = Locations.PokeWalker4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool IsMatchLocation(PKM pk)
|
2020-12-22 01:04:09 +00:00
|
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
|
if (pk.Format == 4)
|
|
|
|
|
return Location == pk.Met_Location;
|
|
|
|
|
return true; // transfer location verified later
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool IsMatchLevel(PKM pk, EvoCriteria evo)
|
|
|
|
|
{
|
|
|
|
|
if (pk.Format != 4) // Met Level lost on PK4=>PK5
|
|
|
|
|
return Level <= evo.LevelMax;
|
|
|
|
|
|
|
|
|
|
return pk.Met_Level == Level;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool IsMatchPartial(PKM pk)
|
|
|
|
|
{
|
|
|
|
|
if (Gift && pk.Ball != Ball)
|
|
|
|
|
return true;
|
|
|
|
|
return base.IsMatchPartial(pk);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void SetPINGA(PKM pk, EncounterCriteria criteria)
|
|
|
|
|
{
|
|
|
|
|
var pi = pk.PersonalInfo;
|
|
|
|
|
int gender = criteria.GetGender(Gender, pi);
|
|
|
|
|
int nature = (int)criteria.GetNature(Nature.Random);
|
|
|
|
|
|
|
|
|
|
// Cannot force an ability; nature-gender-trainerID only yield fixed PIDs.
|
|
|
|
|
// int ability = criteria.GetAbilityFromNumber(Ability, pi);
|
|
|
|
|
|
|
|
|
|
PIDGenerator.SetRandomPIDPokewalker(pk, nature, gender);
|
|
|
|
|
criteria.SetRandomIVs(pk);
|
2020-12-22 01:04:09 +00:00
|
|
|
|
}
|
|
|
|
|
}
|