Пример #1
0
        private void UpdateChecks()
        {
            PIDEC.Verify(this);
            Nickname.Verify(this);
            Language.Verify(this);
            Trainer.Verify(this);
            IndividualValues.Verify(this);
            EffortValues.Verify(this);
            Level.Verify(this);
            Ribbon.Verify(this);
            Ability.Verify(this);
            Ball.Verify(this);
            Form.Verify(this);
            Misc.Verify(this);
            Gender.Verify(this);
            Item.Verify(this);
            if (pkm.Format <= 6 && pkm.Format >= 4)
            {
                EncounterType.Verify(this); // Gen 6->7 transfer deletes encounter type data
            }
            if (pkm.Format < 6)
            {
                return;
            }

            Memory.Verify(this);
            Medal.Verify(this);
            ConsoleRegion.Verify(this);

            if (pkm.Format >= 7)
            {
                HyperTraining.Verify(this);
                Misc.VerifyVersionEvolution(this);
            }
        }
Пример #2
0
        public static ModifyResult SetEVs(PKM pk)
        {
            Span <int> evs = stackalloc int[6];

            EffortValues.SetMax(evs, pk);
            pk.SetEVs(evs);
            return(ModifyResult.Modified);
        }
Пример #3
0
 internal void ToBytes(List <byte> bytes)
 {
     bytes.Add(Id);
     bytes.AddRange(BitConverter.GetBytes((uint)OriginalSpecies));
     PBEUtils.StringToBytes(bytes, Nickname);
     bytes.Add(Level);
     bytes.Add(Friendship);
     bytes.Add((byte)(Shiny ? 1 : 0));
     bytes.Add((byte)OriginalAbility);
     bytes.Add((byte)Nature);
     bytes.Add((byte)Gender);
     bytes.AddRange(BitConverter.GetBytes((ushort)OriginalItem));
     EffortValues.ToBytes(bytes);
     IndividualValues.ToBytes(bytes);
     OriginalMoveset.ToBytes(bytes);
 }
Пример #4
0
 internal void ToBytes(EndianBinaryWriter w)
 {
     w.Write(Id);
     w.Write(Species);
     w.Write(Form);
     w.Write(Nickname, true);
     w.Write(Level);
     w.Write(Friendship);
     w.Write(Shiny);
     w.Write(Ability);
     w.Write(Nature);
     w.Write(Gender);
     w.Write(Item);
     EffortValues.ToBytes(w);
     IndividualValues.ToBytes(w);
     Moveset.ToBytes(w);
 }
Пример #5
0
    public static List <int> CalculateStats(BasePokemon Pokemon)
    {
        List <int> CalculatedStats = new List <int>();

        P_BaseStats       BaseStats = PokemonData.GetData(Pokemon.Monster).BaseStats;
        DeterminantValues DValues   = Pokemon.DValues;
        EffortValues      EValues   = Pokemon.EValues;
        P_Nature          Nature    = Pokemon.Nature;
        int Level = Pokemon.Level;

        int Base = 0;
        int DV   = 0;
        int EV   = 0;

        foreach (P_Stats_All Stat in Stats)
        {
            switch (Stat)
            {
            case P_Stats_All.HP:
                Base = BaseStats.HP;
                DV   = DValues.HP;
                EV   = EValues.HP;
                break;

            case P_Stats_All.Attack:
                Base = BaseStats.Attack;
                DV   = DValues.Attack;
                EV   = EValues.Attack;
                break;

            case P_Stats_All.Defense:
                Base = BaseStats.Defense;
                DV   = DValues.Defense;
                EV   = EValues.Defense;
                break;

            case P_Stats_All.SpecialAttack:
                Base = BaseStats.SpecialAttack;
                DV   = DValues.SpecialAttack;
                EV   = EValues.SpecialAttack;
                break;

            case P_Stats_All.SpecialDefense:
                Base = BaseStats.SpecialDefense;
                DV   = DValues.SpecialDefense;
                EV   = EValues.SpecialDefense;
                break;

            case P_Stats_All.Speed:
                Base = BaseStats.Speed;
                DV   = DValues.Speed;
                EV   = EValues.Speed;
                break;

            default:
                Logger.Error(MethodBase.GetCurrentMethod().DeclaringType, "'" + Stat + "' is not a valid Input for Stat Calculation!");
                break;
            }

            CalculatedStats.Add(CalculateStat(Stat, Base, DV, EV, Level, Nature));
        }
        ;

        return(CalculatedStats);
    }