Add gender changed azurill evo pokewalker edge case

Closes #2311 , thanks @SpiredMoth !
This commit is contained in:
Kurt
2019-05-15 17:14:48 -07:00
parent 25985f11e6
commit 73b61e5bf0
3 changed files with 34 additions and 3 deletions

View File

@@ -337,7 +337,17 @@ public bool IsMatch(PKM pkm, int lvl)
}
if (Gender != -1 && Gender != pkm.Gender)
return false;
{
if (Species == (int)Core.Species.Azurill && Generation == 4 && Location == 233 && pkm.Gender == 0)
{
if (PKX.GetGenderFromPIDAndRatio(pkm.PID, 0xBF) != 1)
return false;
}
else
{
return false;
}
}
if (Form != pkm.AltForm && !SkipFormCheck && !Legal.IsFormChangeable(pkm, Species))
return false;
if (EggLocation == Locations.Daycare5 && Relearn.Length == 0 && pkm.RelearnMoves.Any(z => z != 0)) // gen7 eevee edge case

View File

@@ -460,14 +460,35 @@ private static bool GetPokewalkerMatch(PKM pk, uint oldpid, out PIDIV pidiv)
if (nature == 24) // impossible nature
return GetNonMatch(out pidiv);
uint pid = PIDGenerator.GetPokeWalkerPID(pk.TID, pk.SID, nature, pk.Gender, pk.PersonalInfo.Gender);
var gender = pk.Gender;
uint pid = PIDGenerator.GetPokeWalkerPID(pk.TID, pk.SID, nature, gender, pk.PersonalInfo.Gender);
if (pid != oldpid)
return GetNonMatch(out pidiv);
{
if (!(gender == 0 && IsAzurillEdgeCaseM(pk, nature, oldpid)))
return GetNonMatch(out pidiv);
}
pidiv = new PIDIV {NoSeed = true, RNG = RNG.LCRNG, Type = PIDType.Pokewalker};
return true;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool IsAzurillEdgeCaseM(PKM pk, uint nature, uint oldpid)
{
// check for Azurill evolution edge case... 75% F-M is now 50% F-M; was this a F->M bend?
int spec = pk.Species;
if (spec != (int)Species.Marill && spec != (int)Species.Azumarill)
return false;
const int AzurillGenderRatio = 0xBF;
var gender = PKX.GetGenderFromPIDAndRatio(pk.PID, AzurillGenderRatio);
if (gender != 1)
return false;
var pid = PIDGenerator.GetPokeWalkerPID(pk.TID, pk.SID, nature, 1, AzurillGenderRatio);
return pid == oldpid;
}
private static bool GetColoStarterMatch(PKM pk, uint top, uint bot, uint[] IVs, out PIDIV pidiv)
{
if (pk.Version != 15 || (pk.Species != 196 && pk.Species != 197))