mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 14:30:56 +00:00
7fc8001806
EncounterTrade: don't init Location to -1; keep as default 0 and use that as the pivot for default met location. Move Fateful property to the sub-type that uses it (EncounterTrade4, for Ranch). Move some EncounterStatic->PKM logic that is per-type to the associated type overloaded methods. Rearrange order of properties to be more consistent with interfaces Gen3: Initialize some classes without using post-constructor setters. The `init` setter functionality coming in c#9 won't be usable as the net46 runtime/netstandard2 doesn't support it on current previews. Do it this way so we can explicity initialize some required properties rather than apply version on a second iteration.
47 lines
No EOL
1.4 KiB
C#
47 lines
No EOL
1.4 KiB
C#
namespace PKHeX.Core
|
|
{
|
|
internal sealed class EncounterStatic5N : EncounterStatic5
|
|
{
|
|
public readonly uint PID;
|
|
public override Shiny Shiny { get; set; } = Shiny.FixedValue;
|
|
public const bool NSparkle = true;
|
|
|
|
internal EncounterStatic5N(uint pid) => PID = pid;
|
|
|
|
protected override void SetPINGA(PKM pk, EncounterCriteria criteria)
|
|
{
|
|
int gender = criteria.GetGender(PKX.GetGenderFromPID(Species, PID), pk.PersonalInfo);
|
|
int nature = (int)Nature;
|
|
int ability = Ability;
|
|
|
|
pk.PID = PID;
|
|
pk.Gender = gender;
|
|
SetIVs(pk);
|
|
|
|
pk.Nature = nature;
|
|
pk.RefreshAbility(ability >> 1);
|
|
}
|
|
|
|
public override bool IsMatch(PKM pkm, DexLevel evo)
|
|
{
|
|
if (PID != pkm.PID)
|
|
return false;
|
|
return base.IsMatch(pkm, evo);
|
|
}
|
|
|
|
protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk)
|
|
{
|
|
base.ApplyDetails(sav, criteria, pk);
|
|
SetNPokemonData((PK5)pk, pk.Language);
|
|
}
|
|
|
|
private static void SetNPokemonData(PK5 pk5, int lang)
|
|
{
|
|
pk5.IV_HP = pk5.IV_ATK = pk5.IV_DEF = pk5.IV_SPA = pk5.IV_SPD = pk5.IV_SPE = 30;
|
|
pk5.NPokémon = NSparkle;
|
|
pk5.OT_Name = Legal.GetG5OT_NSparkle(lang);
|
|
pk5.TID = 00002;
|
|
pk5.SID = 00000;
|
|
}
|
|
}
|
|
} |