mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 22:10:21 +00:00
Refine zygarde encounter form checking logic
Closes #2984 ty atrius & matt via discord Co-Authored-By: Atrius97 <39707481+Atrius97@users.noreply.github.com> Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
This commit is contained in:
parent
4b1a9a89da
commit
e125424423
12 changed files with 27 additions and 14 deletions
|
@ -265,14 +265,27 @@ namespace PKHeX.Core
|
||||||
|
|
||||||
/// <summary>Checks if the form may be different than the original encounter detail.</summary>
|
/// <summary>Checks if the form may be different than the original encounter detail.</summary>
|
||||||
/// <param name="species">Original species</param>
|
/// <param name="species">Original species</param>
|
||||||
/// <param name="form">Original form</param>
|
/// <param name="oldForm">Original form</param>
|
||||||
|
/// <param name="newForm">Current form</param>
|
||||||
/// <param name="format">Current format</param>
|
/// <param name="format">Current format</param>
|
||||||
internal static bool IsFormChangeable(int species, int form, int format)
|
internal static bool IsFormChangeable(int species, int oldForm, int newForm, int format)
|
||||||
{
|
{
|
||||||
if (FormChange.Contains(species))
|
if (FormChange.Contains(species))
|
||||||
return true;
|
return true;
|
||||||
if (species == (int)Species.Zygarde && format >= 7 && form == 0)
|
|
||||||
return true;
|
// Zygarde Form Changing
|
||||||
|
// Gen6: Introduced; no form changing.
|
||||||
|
// Gen7: Form changing introduced; can only change to Form 2/3 (Power Construct), never to 0/1 (Aura Break). A form-1 can be boosted to form-0.
|
||||||
|
// Gen8: Form changing improved; can pick any Form & Ability combination.
|
||||||
|
if (species == (int)Species.Zygarde)
|
||||||
|
{
|
||||||
|
return format switch
|
||||||
|
{
|
||||||
|
6 => false,
|
||||||
|
7 => newForm >= 2 || (oldForm == 1 && newForm == 0),
|
||||||
|
_ => true,
|
||||||
|
};
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -255,7 +255,7 @@ namespace PKHeX.Core
|
||||||
{
|
{
|
||||||
if (SkipFormCheck)
|
if (SkipFormCheck)
|
||||||
return true;
|
return true;
|
||||||
return Form == evo.Form || Legal.IsFormChangeable(Species, Form, pkm.Format);
|
return Form == evo.Form || Legal.IsFormChangeable(Species, Form, pkm.AltForm, pkm.Format);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual bool IsMatchEggLocation(PKM pkm)
|
protected virtual bool IsMatchEggLocation(PKM pkm)
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace PKHeX.Core
|
||||||
return expectForm == evo.Form;
|
return expectForm == evo.Form;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Form == evo.Form || Legal.IsFormChangeable(Species, Form, pkm.Format);
|
return Form == evo.Form || Legal.IsFormChangeable(Species, Form, pkm.AltForm, pkm.Format);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk)
|
protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk)
|
||||||
|
|
|
@ -242,7 +242,7 @@ namespace PKHeX.Core
|
||||||
if (CurrentLevel != -1 && CurrentLevel > pkm.CurrentLevel)
|
if (CurrentLevel != -1 && CurrentLevel > pkm.CurrentLevel)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (Form != evo.Form && !Legal.IsFormChangeable(Species, Form, pkm.Format))
|
if (Form != evo.Form && !Legal.IsFormChangeable(Species, Form, pkm.AltForm, pkm.Format))
|
||||||
return false;
|
return false;
|
||||||
if (OTGender != -1 && OTGender != pkm.OT_Gender)
|
if (OTGender != -1 && OTGender != pkm.OT_Gender)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -161,7 +161,7 @@ namespace PKHeX.Core
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wc.AltForm != evo.Form && !Legal.IsFormChangeable(wc.Species, wc.AltForm, pkm.Format))
|
if (wc.AltForm != evo.Form && !Legal.IsFormChangeable(wc.Species, wc.AltForm, pkm.AltForm, pkm.Format))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (wc.Ball != pkm.Ball) return false;
|
if (wc.Ball != pkm.Ball) return false;
|
||||||
|
|
|
@ -369,7 +369,7 @@ namespace PKHeX.Core
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Form != evo.Form && !Legal.IsFormChangeable(Species, Form, pkm.Format))
|
if (Form != evo.Form && !Legal.IsFormChangeable(Species, Form, pkm.AltForm, pkm.Format))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (Level != pkm.Met_Level) return false;
|
if (Level != pkm.Met_Level) return false;
|
||||||
|
|
|
@ -471,7 +471,7 @@ namespace PKHeX.Core
|
||||||
if (EncryptionConstant != 0 && EncryptionConstant != pkm.EncryptionConstant) return false;
|
if (EncryptionConstant != 0 && EncryptionConstant != pkm.EncryptionConstant) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Form != evo.Form && !Legal.IsFormChangeable(Species, Form, pkm.Format))
|
if (Form != evo.Form && !Legal.IsFormChangeable(Species, Form, pkm.AltForm, pkm.Format))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (IsEgg)
|
if (IsEgg)
|
||||||
|
|
|
@ -238,7 +238,7 @@ namespace PKHeX.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Form != evo.Form && !Legal.IsFormChangeable(Species, Form, pkm.Format))
|
if (Form != evo.Form && !Legal.IsFormChangeable(Species, Form, pkm.AltForm, pkm.Format))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (Language != -1 && Language != pkm.Language) return false;
|
if (Language != -1 && Language != pkm.Language) return false;
|
||||||
|
|
|
@ -487,7 +487,7 @@ namespace PKHeX.Core
|
||||||
if (EncryptionConstant != 0 && EncryptionConstant != pkm.EncryptionConstant) return false;
|
if (EncryptionConstant != 0 && EncryptionConstant != pkm.EncryptionConstant) return false;
|
||||||
if (Language != 0 && Language != pkm.Language) return false;
|
if (Language != 0 && Language != pkm.Language) return false;
|
||||||
}
|
}
|
||||||
if (Form != evo.Form && !Legal.IsFormChangeable(Species, Form, pkm.Format))
|
if (Form != evo.Form && !Legal.IsFormChangeable(Species, Form, pkm.AltForm, pkm.Format))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (IsEgg)
|
if (IsEgg)
|
||||||
|
|
|
@ -518,7 +518,7 @@ namespace PKHeX.Core
|
||||||
if (Language != 0 && Language != pkm.Language) return false;
|
if (Language != 0 && Language != pkm.Language) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Form != evo.Form && !Legal.IsFormChangeable(Species, Form, pkm.Format))
|
if (Form != evo.Form && !Legal.IsFormChangeable(Species, Form, pkm.AltForm, pkm.Format))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (IsEgg)
|
if (IsEgg)
|
||||||
|
|
|
@ -557,7 +557,7 @@ namespace PKHeX.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Form != pkm.AltForm && !Legal.IsFormChangeable(Species, Form, pkm.Format))
|
if (Form != pkm.AltForm && !Legal.IsFormChangeable(Species, Form, pkm.AltForm, pkm.Format))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (IsEgg)
|
if (IsEgg)
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue