示例#1
0
    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 = PIDIV.Pokewalker;
        return(true);
    }
示例#2
0
    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 species = pk.Species;

        if (species is not((int)Species.Marill or(int) Species.Azumarill))
        {
            return(false);
        }

        const int AzurillGenderRatio = 0xBF;
        var       gender             = EntityGender.GetFromPIDAndRatio(pk.PID, AzurillGenderRatio);

        if (gender != 1)
        {
            return(false);
        }

        var pid = PIDGenerator.GetPokeWalkerPID(pk.TID, pk.SID, nature, 1, AzurillGenderRatio);

        return(pid == oldpid);
    }