Ejemplo n.º 1
0
        public static void Put(Materia orb)
        {
            int i = 0;

            while (_materiatory[i] != null) i++;

            _materiatory[i] = orb;
        }
Ejemplo n.º 2
0
        public static void Sort()
        {
            Array.Sort<Materia>(_materiatory, Materia.CompareByType);

            // sort magic
            int a = 0;
            while (_materiatory[a].Type == MateriaType.Magic) a++;
            Materia[] tempMagic = new Materia[a];
            Array.Copy(_materiatory, 0, tempMagic, 0, a);
            Array.Sort<Materia>(tempMagic, Materia.CompareByOrder);
            Array.Copy(tempMagic, 0, _materiatory, 0, a);

            // sort support
            int b = a;
            while (_materiatory[b].Type == MateriaType.Support) b++;
            Materia[] tempSupport = new Materia[b - a];
            Array.Copy(_materiatory, a, tempSupport, 0, b - a);
            Array.Sort<Materia>(tempSupport, Materia.CompareByOrder);
            Array.Copy(tempSupport, 0, _materiatory, a, b - a);

            // sort command
            int c = b;
            while (_materiatory[c].Type == MateriaType.Command) c++;
            Materia[] tempCommand = new Materia[c - b];
            Array.Copy(_materiatory, b, tempCommand, 0, c - b);
            Array.Sort<Materia>(tempCommand, Materia.CompareByOrder);
            Array.Copy(tempCommand, 0, _materiatory, b, c - b);

            // sort independent
            int d = c;
            while (_materiatory[d].Type == MateriaType.Independent) d++;
            Materia[] tempIndependent = new Materia[d - c];
            Array.Copy(_materiatory, c, tempIndependent, 0, d - c);
            Array.Sort<Materia>(tempIndependent, Materia.CompareByOrder);
            Array.Copy(tempIndependent, 0, _materiatory, c, d - c);

            // sort summon
            int e = d;
            while (e < MATERIATORY_SIZE && _materiatory[e] != null) e++;
            Materia[] tempSummon = new Materia[e - d];
            Array.Copy(_materiatory, d, tempSummon, 0, e - d);
            Array.Sort<Materia>(tempSummon, Materia.CompareByOrder);
            Array.Copy(tempSummon, 0, _materiatory, d, e - d);
        }
Ejemplo n.º 3
0
 public void AttachMateria(Materia orb, int slot)
 {
     if (slot >= _slots.Length)
         throw new GameImplementationException("Tried to attach materia to a slot not on this Armor");
     _slots[slot] = orb;
 }
Ejemplo n.º 4
0
 public static void Put(Materia orb, int slot)
 {
     _materiatory[slot] = orb;
 }
Ejemplo n.º 5
0
 private static void AddMaster(Materia m)
 {
     _masterTable.Add(m.Name, m);
 }
Ejemplo n.º 6
0
 public static int CompareByType(Materia left, Materia right)
 {
     if (left == null && right == null)
         return 0;
     else if (left == null) return 1;
     else if (right == null) return -1;
     else return left.TypeOrder.CompareTo(right.TypeOrder);
 }
Ejemplo n.º 7
0
 public static int CompareByOrder(Materia left, Materia right)
 {
     if (left == null && right == null)
     {
         return 0;
     }
     else if (left == null)
     {
         return 1;
     }
     else if (right == null)
     {
         return -1;
     }
     else
     {
         int comp = left._order.CompareTo(right._order);
         if (comp == 0)
         {
             return 0 - left.AP.CompareTo(right.AP);
         }
         else
         {
             return comp;
         }
     }
 }
Ejemplo n.º 8
0
        public static void Sort()
        {
            Array.Sort <Materia>(_materiatory, Materia.CompareByType);

            // sort magic
            int a = 0;

            while (_materiatory[a].Type == MateriaType.Magic)
            {
                a++;
            }
            Materia[] tempMagic = new Materia[a];
            Array.Copy(_materiatory, 0, tempMagic, 0, a);
            Array.Sort <Materia>(tempMagic, Materia.CompareByOrder);
            Array.Copy(tempMagic, 0, _materiatory, 0, a);


            // sort support
            int b = a;

            while (_materiatory[b].Type == MateriaType.Support)
            {
                b++;
            }
            Materia[] tempSupport = new Materia[b - a];
            Array.Copy(_materiatory, a, tempSupport, 0, b - a);
            Array.Sort <Materia>(tempSupport, Materia.CompareByOrder);
            Array.Copy(tempSupport, 0, _materiatory, a, b - a);

            // sort command
            int c = b;

            while (_materiatory[c].Type == MateriaType.Command)
            {
                c++;
            }
            Materia[] tempCommand = new Materia[c - b];
            Array.Copy(_materiatory, b, tempCommand, 0, c - b);
            Array.Sort <Materia>(tempCommand, Materia.CompareByOrder);
            Array.Copy(tempCommand, 0, _materiatory, b, c - b);

            // sort independent
            int d = c;

            while (_materiatory[d].Type == MateriaType.Independent)
            {
                d++;
            }
            Materia[] tempIndependent = new Materia[d - c];
            Array.Copy(_materiatory, c, tempIndependent, 0, d - c);
            Array.Sort <Materia>(tempIndependent, Materia.CompareByOrder);
            Array.Copy(tempIndependent, 0, _materiatory, c, d - c);

            // sort summon
            int e = d;

            while (e < MATERIATORY_SIZE && _materiatory[e] != null)
            {
                e++;
            }
            Materia[] tempSummon = new Materia[e - d];
            Array.Copy(_materiatory, d, tempSummon, 0, e - d);
            Array.Sort <Materia>(tempSummon, Materia.CompareByOrder);
            Array.Copy(tempSummon, 0, _materiatory, d, e - d);
        }
Ejemplo n.º 9
0
 public static void Put(Materia orb, int slot)
 {
     _materiatory[slot] = orb;
 }