Example #1
0
        internal Pokemon(Controller controller, int id, Player owner, IPokemonData custom)
        {
            Controller = controller;
            Id         = id;
            Owner      = owner;
            TeamId     = owner.TeamId;

            Form         = custom.Form;
            Name         = custom.Name;
            Happiness    = custom.Happiness;
            Gender       = custom.Gender;
            Lv           = custom.Lv;
            Nature       = custom.Nature;
            AbilityIndex = custom.AbilityIndex;
            Moves        = new Move[custom.Moves.Count()];
            int i = 0;

            foreach (var m in custom.Moves)
            {
                Moves[i++] = new Move(m.Move, m.PP);
            }
            _item = custom.Item;
            Iv    = new ReadOnly6D(custom.Iv);
            Ev    = new ReadOnly6D(custom.Ev);
            _hp   = MaxHp = GetMaxHp;
        }
Example #2
0
 private static IEnumerable <int> Get6D(I6D stat)
 {
     for (int i = 0; i < PO_STATS.Length; i++)
     {
         yield return(stat.GetStat(PO_STATS[i]));
     }
 }
Example #3
0
 public ReadOnly6D(I6D values)
 {
     _hp    = values.Hp;
     _atk   = values.Atk;
     _def   = values.Def;
     _spAtk = values.SpAtk;
     _spDef = values.SpDef;
     _speed = values.Speed;
 }
Example #4
0
        public static BattleType HiddenPower(I6D iv)
        {
            int pI = iv.Hp & 1;

            pI |= (iv.Atk & 1) << 1;
            pI |= (iv.Def & 1) << 2;
            pI |= (iv.Speed & 1) << 3;
            pI |= (iv.SpAtk & 1) << 4;
            pI |= (iv.SpDef & 1) << 5;
            return((BattleType)(pI * 15 / 63 + 2));
        }
        internal SimPokemon(int id, SimPlayer owner, IPokemonData custom)
        {
            Id     = id;
            Owner  = owner;
            TeamId = owner.Team;

            Gender       = custom.Gender;
            Lv           = custom.Lv;
            nature       = custom.Nature;
            abilityIndex = custom.AbilityIndex;
            Moves        = custom.Moves.Select((m) => new Move(m.Move, m.PP)).ToArray();
            Item         = custom.Item;
            iv           = new ReadOnly6D(custom.Iv);
            ev           = new ReadOnly6D(custom.Ev);
            _hp          = new PairValue(GameHelper.GetHp(custom.Form.Data.Base.Hp, (byte)iv.Hp, (byte)ev.Hp, (byte)Lv));

            Form       = custom.Form;
            originForm = Form;
            Name       = custom.Name ?? GameString.Current.Pokemon(_form.Species.Number);
        }
Example #6
0
        internal SimPokemon(int id, SimPlayer owner, IPokemonData custom)
        {
            Id     = id;
            Owner  = owner;
            TeamId = owner.Team;

            Gender       = custom.Gender;
            Lv           = custom.Lv;
            nature       = custom.Nature;
            abilityIndex = custom.AbilityIndex;
            Moves        = custom.Moves.Select((m) => new Move(m.Move, m.PP)).ToArray();

            Item      = custom.Item;
            Happiness = custom.Happiness;

            iv  = new ReadOnly6D(custom.Iv);
            ev  = new ReadOnly6D(custom.Ev);
            _hp = new PairValue(GameHelper.GetHp(custom.Form.Data.Base.Hp, (byte)iv.Hp, (byte)ev.Hp, (byte)Lv));

            Form       = custom.Form;
            originForm = Form;
            Name       = custom.Name ?? GameString.Current.Pokemon(_form.Species.Number);

            HiddenPower = GameHelper.HiddenPower(iv);
            for (int i = 0; i < Moves.Length; ++i)
            {
                if (Moves[i].Type.Id == Ms.HIDDEN_POWER)
                {
                    Moves[i] = new Move(new MoveType(Moves[i].Type.Id, HiddenPower, Moves[i].Type.Category, Moves[i].Type.Power, Moves[i].Type.Accuracy, Moves[i].Type.PP, Moves[i].Type.Range), Moves[i].PP.Value);
                }
                if (Moves[i].Type.Id == Ms.NATURAL_GIFT)
                {
                    Moves[i] = new Move(new MoveType(Moves[i].Type.Id, GameHelper.NatureGift(Item), Moves[i].Type.Category, Moves[i].Type.Power, Moves[i].Type.Accuracy, Moves[i].Type.PP, Moves[i].Type.Range), Moves[i].PP.Value);
                }
            }
        }
 private static bool CanChangeEv(I6D sender, int oldValue, int newValue)
 {
     return(0 <= newValue && newValue <= 252 && sender.Sum() + newValue - oldValue <= 510);
 }
 private static bool CanChangeIv(I6D sender, int oldValue, int newValue)
 {
     return(0 <= newValue && newValue < 32);
 }
Example #9
0
 public static bool ValueEquals(this I6D a, I6D b)
 {
     return(a.Hp == b.Hp && a.Atk == b.Atk && a.Def == b.Def && a.SpAtk == b.SpAtk && a.SpDef == b.SpDef && a.Speed == b.Speed);
 }
Example #10
0
 public static int Sum(this I6D ev)
 {
     return(ev.Hp + ev.Atk + ev.Def + ev.SpAtk + ev.SpDef + ev.Speed);
 }
Example #11
0
 public Observable6D(I6D obj)
     : this(obj.Hp, obj.Atk, obj.Def, obj.SpAtk, obj.SpDef, obj.Speed)
 {
 }
Example #12
0
 public static bool ValidateEv(this I6D ev)
 {
     throw new NotImplementedException();
 }
Example #13
0
 /// <summary>
 /// all but Hp
 /// </summary>
 public void Set5D(I6D values)
 {
     Set5D(values.Atk, values.Def, values.SpAtk, values.SpDef, values.Speed);
 }
Example #14
0
 public void Set6D(I6D values)
 {
     Hp = values.Hp;
     Set5D(values);
 }
Example #15
0
 public Simple6D(I6D values)
 {
     Set6D(values);
 }