public Connection(Map from, Map to, Direction d, int s)
 {
     toMap = to;
     dir = d;
     shift = s;
     switch (dir)
     {
         case Direction.Up: connRect = new Rectangle(shift, -toMap.height, toMap.width, toMap.height); break;
         case Direction.Down: connRect = new Rectangle(shift, from.height, toMap.width, toMap.height); break;
         case Direction.Left: connRect = new Rectangle(-toMap.width, shift, from.width, from.height); break;
         case Direction.Right: connRect = new Rectangle(from.width, shift, from.width, from.height); break;
     }
 }
Exemple #2
0
        public Pokemon(BaseStats bs, int l = 1, Move[] ms = null, string n = null)
        {
            baseStats = bs;
            personality = (uint)((PRNG.Instance.Next() << 16) + PRNG.Instance.Next());
            nature = (Nature)(personality % 25);
            happiness = baseStats.baseHappiness;
            if (baseStats.abilities.Length == 1) ability = baseStats.abilities[0];
            else ability = baseStats.abilities[personality % 2];

            int iv1 = PRNG.Instance.Next();
            int iv2 = PRNG.Instance.Next();
            hpIV = (byte)(iv1 & 0x1F);
            attackIV = (byte)(iv1 & 0x3E0);
            defenseIV = (byte)(iv1 & 0x7C00);
            specialDefenseIV = (byte)(iv2 & 0x1F);
            specialAttackIV = (byte)(iv2 & 0x3E0);
            speedIV = (byte)(iv2 & 0x7C00);
            nickname = n;

            shiny = ((OTid ^ OTsecretid) ^ ((personality >> 16) ^ (personality & 65535))) < 8 ? true : false;

            for (int i = 0; i < l; i++) LevelUp();
            hp = maxHP;

            metLocation = Player.Instance.currentMap;
            metLevel = Level;

            if (ms == null)
            {
                int i = 0;
                foreach (LearnableMove m in baseStats.learnset)
                {
                    if (Level >= m.level)
                    {
                        moveSet[i] = m.move;
                        PP[i] = m.move.basePP;
                        i = (i == 3) ? 0 : i + 1;
                    }
                    else break;
                }
            }
            else moveSet = ms;
        }