예제 #1
0
        public static int CompareByOrder(MateriaOrb left, MateriaOrb right)
        {
            int comparison = 0;

            if (left == null)
            {
                if (right != null)
                {
                    comparison = 1;
                }
                // else, still 0
            }
            else
            {
                if (right == null)
                {
                    comparison = -1;
                }

                comparison = left.Order.CompareTo(right.Order);

                if (comparison == 0)
                {
                    comparison = right.AP.CompareTo(left.AP);
                }
            }

            return(comparison);
        }
예제 #2
0
 protected SlotHolder(SlotHolderData data)
     : base(data)
 {
     Slots = new MateriaOrb[data.Slots];
     Links = data.Links;
     Growth = data.Growth;
 }
예제 #3
0
        public static int CompareByType(MateriaOrb left, MateriaOrb right)
        {
            // Why aren't we seeing nulls?

            int comparison;

            if (left == null && right == null)
            {
                comparison = 0;
            }
            else if (left == null)
            {
                comparison = 1;
            }
            else if (right == null)
            {
                comparison = -1;
            }
            else
            {
                comparison = left.TypeOrder.CompareTo(right.TypeOrder);
            }

            return(comparison);
        }
예제 #4
0
        public void AttachMateria(MateriaOrb orb, int slot)
        {
            if (slot >= Slots.Length)
            {
                throw new ImplementationException("Tried to attach materia to a slot not on this Armor");
            }

            Slots[slot] = orb;
        }
예제 #5
0
        public void Put(MateriaOrb orb)
        {
            int i = 0;

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

            _materiatory [i] = orb;
        }
예제 #6
0
        public void AddAbility(MateriaOrb s)
        {
            switch (s.Name)
            {
                case "All":
                    AllCount = s.Level + 1;
                    break;

                case "Quadra Magic":
                    if (s.Name != "Knights of Round")
                    {
                        QMagicCount = s.Level + 1;
                    }
                    break;
            }
        }
예제 #7
0
        public void AddAbility(MateriaOrb s)
        {
            if (s.Type != MateriaType.Support)
            {
                throw new ImplementationException("Used non-support materia '{0}' in a support context.", s.Name);
            }

            //_addedAbilities.Add(s.GetAbility());
            if (s.Name == "All")
            {
                _allCount = Math.Min(s.Level + 1, 5);
            }
            if (s.Name == "Quadra Magic")
            {
                _qmagicCount = Math.Min(s.Level + 1, 5);
            }
            if (s.Name == "MP Turbo")
            {
                _mpTurboFactor = Math.Min(s.Level + 1, 5);
            }
        }
예제 #8
0
        public void Sort()
        {
            Array.Sort<MateriaOrb>(_materiatory, MateriaOrb.CompareByType);

            // HACK. We want nulls at the end, but for some reason they're not
            // getting passed to the comparison.
            int q = 0;
            while (_materiatory[q] == null)
            {
                q++;
            }

            MateriaOrb[] tempNull = new MateriaOrb[q];
            MateriaOrb[] tempNotNull = new MateriaOrb[MATERIATORY_SIZE - q];
            Array.Copy(_materiatory, 0, tempNull, 0, q);
            Array.Copy(_materiatory, q, tempNotNull, 0, MATERIATORY_SIZE - q);
            Array.Copy(tempNull, 0, _materiatory, MATERIATORY_SIZE - q, q);
            Array.Copy(tempNotNull, 0, _materiatory, 0, MATERIATORY_SIZE - q);
            // END HACK

            // sort magic
            int a = 0;
            while (_materiatory[a].Type == MateriaType.Magic)
            {
                a++;
            }

            MateriaOrb[] tempMagic = new MateriaOrb[a];
            Array.Copy(_materiatory, 0, tempMagic, 0, a);
            Array.Sort<MateriaOrb>(tempMagic, MateriaOrb.CompareByOrder);
            Array.Copy(tempMagic, 0, _materiatory, 0, a);

            // sort support
            int b = a;
            while (_materiatory[b].Type == MateriaType.Support)
            {
                b++;
            }

            MateriaOrb[] tempSupport = new MateriaOrb[b - a];
            Array.Copy(_materiatory, a, tempSupport, 0, b - a);
            Array.Sort<MateriaOrb>(tempSupport, MateriaOrb.CompareByOrder);
            Array.Copy(tempSupport, 0, _materiatory, a, b - a);

            // sort command
            int c = b;
            while (_materiatory[c].Type == MateriaType.Command)
            {
                c++;
            }

            MateriaOrb[] tempCommand = new MateriaOrb[c - b];
            Array.Copy(_materiatory, b, tempCommand, 0, c - b);
            Array.Sort<MateriaOrb>(tempCommand, MateriaOrb.CompareByOrder);
            Array.Copy(tempCommand, 0, _materiatory, b, c - b);

            // sort independent
            int d = c;
            while (_materiatory[d].Type == MateriaType.Independent)
            {
                d++;
            }

            MateriaOrb[] tempIndependent = new MateriaOrb[d - c];
            Array.Copy(_materiatory, c, tempIndependent, 0, d - c);
            Array.Sort<MateriaOrb>(tempIndependent, MateriaOrb.CompareByOrder);
            Array.Copy(tempIndependent, 0, _materiatory, c, d - c);

            // sort summon
            int e = d;
            while (e < MATERIATORY_SIZE && _materiatory[e] != null)
            {
                e++;
            }

            MateriaOrb[] tempSummon = new MateriaOrb[e - d];
            Array.Copy(_materiatory, d, tempSummon, 0, e - d);
            Array.Sort<MateriaOrb>(tempSummon, MateriaOrb.CompareByOrder);
            Array.Copy(tempSummon, 0, _materiatory, d, e - d);
        }
예제 #9
0
 public void Put(MateriaOrb orb, int slot)
 {
     _materiatory [slot] = orb;
 }
예제 #10
0
        public static int CompareByType(MateriaOrb left, MateriaOrb right)
        {
            // Why aren't we seeing nulls?

            int comparison;

            if (left == null && right == null)
            {
                comparison = 0;
            }
            else if (left == null)
            {
                comparison =  1;
            }
            else if (right == null)
            {
                comparison =  -1;
            }
            else
            {
                comparison = left.TypeOrder.CompareTo(right.TypeOrder);
            }

            return comparison;
        }
예제 #11
0
        public static int CompareByOrder(MateriaOrb left, MateriaOrb right)
        {
            int comparison = 0;

            if (left == null)
            {
                if (right != null)
                {
                    comparison = 1;
                }
                // else, still 0
            }
            else
            {
                if (right == null)
                {
                    comparison = -1;
                }

                comparison = left.Order.CompareTo(right.Order);

                if (comparison == 0)
                {
                    comparison =  right.AP.CompareTo(left.AP);
                }
            }

            return comparison;
        }
예제 #12
0
        public MateriaOrb GetMateria(string name, int ap)
        {
            MateriaOrb materia = null;

            if (name == EnemySkillMateria.NAME)
            {
                materia = new EnemySkillMateria(ap, this);
            }
            else if (name == "Master Magic")
            {
                materia = new MasterMateria(MateriaType.Magic, this);
            }
            else if (name == "Master Command")
            {
                materia = new MasterMateria(MateriaType.Command, this);
            }
            else if (name == "Master Summon")
            {
                materia = new MasterMateria(MateriaType.Summon, this);
            }
            else
            {
                XmlDocument gamedata = Resource.GetXmlFromResource("data.materia.xml", Assembly);

                XmlNode node = gamedata.SelectSingleNode(String.Format("//materia[name = '{0}']", name));

                if (node == null)
                {
                    throw new GameDataException("Could not find materia with name " + name);
                }

                materia = new MateriaOrb(node, Lua);
                materia.AddAP(ap);
            }

            return materia;
        }