private static bool GetPokewalkerMatch(PKM pk, uint oldpid, out PIDIV pidiv) { // check surface compatibility var mid = oldpid & 0x00FFFF00; if (mid != 0 && mid != 0x00FFFF00) // not expected bits { return(GetNonMatch(out pidiv)); } var nature = oldpid % 25; if (nature == 24) // impossible nature { return(GetNonMatch(out pidiv)); } var gender = pk.Gender; uint pid = PIDGenerator.GetPokeWalkerPID(pk.TID, pk.SID, nature, gender, pk.PersonalInfo.Gender); if (pid != oldpid) { if (!(gender == 0 && IsAzurillEdgeCaseM(pk, nature, oldpid))) { return(GetNonMatch(out pidiv)); } } pidiv = new PIDIV { NoSeed = true, RNG = RNG.LCRNG, Type = PIDType.Pokewalker }; return(true); }
protected virtual void SetPINGA(PKM pk, EncounterCriteria criteria) { var pi = pk.PersonalInfo; int gender = criteria.GetGender(Gender, pi); int nature = (int)criteria.GetNature(Nature); int ability = criteria.GetAbilityFromNumber(Ability, pi); var pidtype = GetPIDType(); PIDGenerator.SetRandomWildPID(pk, pk.Format, nature, ability, gender, pidtype); SetIVs(pk); pk.StatNature = pk.Nature; }
private static bool GetG5MGShinyMatch(PKM pk, uint pid, out PIDIV pidiv) { var low = pid & 0xFFFF; // generation 5 shiny PIDs if (low <= 0xFF) { var av = (pid >> 16) & 1; var genPID = PIDGenerator.GetMG5ShinyPID(low, av, pk.TID, pk.SID); if (genPID == pid) { pidiv = PIDIV.G5MGShiny; return(true); } } return(GetNonMatch(out pidiv)); }
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); }