2020-08-21 23:35:49 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
2020-11-27 19:51:02 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Generation 7 Static Encounter
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <inheritdoc cref="EncounterStatic"/>
|
2020-12-24 04:40:59 +00:00
|
|
|
|
public sealed record EncounterStatic7 : EncounterStatic, IRelearn
|
2020-08-21 23:35:49 +00:00
|
|
|
|
{
|
2020-08-30 23:10:24 +00:00
|
|
|
|
public override int Generation => 7;
|
2020-12-22 07:37:07 +00:00
|
|
|
|
public IReadOnlyList<int> Relearn { get; init; } = Array.Empty<int>();
|
2020-08-21 23:35:49 +00:00
|
|
|
|
|
2021-04-17 20:24:57 +00:00
|
|
|
|
public bool IsTotem => FormInfo.IsTotemForm(Species, Form);
|
|
|
|
|
|
2021-01-04 00:49:49 +00:00
|
|
|
|
public EncounterStatic7(GameVersion game) : base(game) { }
|
|
|
|
|
|
2020-08-21 23:35:49 +00:00
|
|
|
|
protected override bool IsMatchLocation(PKM pkm)
|
|
|
|
|
{
|
|
|
|
|
if (EggLocation == Locations.Daycare5 && Relearn.Count == 0 && pkm.RelearnMove1 != 0) // Gift Eevee edge case
|
|
|
|
|
return false;
|
|
|
|
|
return base.IsMatchLocation(pkm);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool IsMatchForm(PKM pkm, DexLevel evo)
|
|
|
|
|
{
|
|
|
|
|
if (SkipFormCheck)
|
|
|
|
|
return true;
|
|
|
|
|
|
2021-04-17 20:24:57 +00:00
|
|
|
|
if (IsTotem)
|
2020-08-21 23:35:49 +00:00
|
|
|
|
{
|
2020-12-11 04:42:30 +00:00
|
|
|
|
var expectForm = pkm.Format == 7 ? Form : FormInfo.GetTotemBaseForm(Species, Form);
|
2020-08-21 23:35:49 +00:00
|
|
|
|
return expectForm == evo.Form;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-11 04:42:30 +00:00
|
|
|
|
return Form == evo.Form || FormInfo.IsFormChangeable(Species, Form, pkm.Form, pkm.Format);
|
2020-08-21 23:35:49 +00:00
|
|
|
|
}
|
2020-09-05 19:11:43 +00:00
|
|
|
|
|
2020-09-13 21:40:10 +00:00
|
|
|
|
protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk)
|
|
|
|
|
{
|
|
|
|
|
base.ApplyDetails(sav, criteria, pk);
|
|
|
|
|
if (Species == (int)Core.Species.Magearna && pk is IRibbonSetEvent4 e4)
|
|
|
|
|
e4.RibbonWishing = true;
|
2021-02-14 20:27:14 +00:00
|
|
|
|
pk.SetRandomEC();
|
2020-09-13 21:40:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-09-05 19:33:00 +00:00
|
|
|
|
internal static EncounterStatic7 GetVC1(int species, int metLevel)
|
2020-09-05 19:11:43 +00:00
|
|
|
|
{
|
|
|
|
|
bool mew = species == (int)Core.Species.Mew;
|
2021-01-04 00:49:49 +00:00
|
|
|
|
return new EncounterStatic7(GameVersion.RBY)
|
2020-09-05 19:11:43 +00:00
|
|
|
|
{
|
|
|
|
|
Species = species,
|
|
|
|
|
Gift = true, // Forces Poké Ball
|
2021-01-02 08:46:09 +00:00
|
|
|
|
Ability = Legal.TransferSpeciesDefaultAbilityGen1(species) ? 1 : 4, // Hidden by default, else first
|
2020-09-05 19:11:43 +00:00
|
|
|
|
Shiny = mew ? Shiny.Never : Shiny.Random,
|
|
|
|
|
Fateful = mew,
|
|
|
|
|
Location = Locations.Transfer1,
|
|
|
|
|
Level = metLevel,
|
|
|
|
|
FlawlessIVCount = mew ? 5 : 3,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-05 19:33:00 +00:00
|
|
|
|
internal static EncounterStatic7 GetVC2(int species, int metLevel)
|
2020-09-05 19:11:43 +00:00
|
|
|
|
{
|
|
|
|
|
bool mew = species == (int)Core.Species.Mew;
|
|
|
|
|
bool fateful = mew || species == (int)Core.Species.Celebi;
|
2021-01-04 00:49:49 +00:00
|
|
|
|
return new EncounterStatic7(GameVersion.GSC)
|
2020-09-05 19:11:43 +00:00
|
|
|
|
{
|
|
|
|
|
Species = species,
|
|
|
|
|
Gift = true, // Forces Poké Ball
|
2021-01-02 08:46:09 +00:00
|
|
|
|
Ability = Legal.TransferSpeciesDefaultAbilityGen2(species) ? 1 : 4, // Hidden by default, else first
|
2020-09-05 19:11:43 +00:00
|
|
|
|
Shiny = mew ? Shiny.Never : Shiny.Random,
|
|
|
|
|
Fateful = fateful,
|
|
|
|
|
Location = Locations.Transfer2,
|
|
|
|
|
Level = metLevel,
|
|
|
|
|
FlawlessIVCount = fateful ? 5 : 3
|
|
|
|
|
};
|
|
|
|
|
}
|
2020-08-21 23:35:49 +00:00
|
|
|
|
}
|
2020-09-05 19:11:43 +00:00
|
|
|
|
}
|