Ejemplo n.º 1
0
        private int GetIndex(MonsterProperty monsterProperty)
        {
            Type t = monsterProperty.GetType();

            if (t.Name == "DiffEasy" || t.Name == "RankUnranked")
            {
                return(0);
            }
            if (t.Name == "DiffNormal" || t.Name == "RankMiniboss")
            {
                return(1);
            }
            if (t.Name == "DiffTough" || t.Name == "RankBoss")
            {
                return(2);
            }
            return(0);            // if all else fails
        }
Ejemplo n.º 2
0
        public void AddProperty(MonsterProperty p)
        {
            bool validToAdd = true;

            //validate the property to make sure we're not adding
            //a second instance of a unique property.
            if (p.Unique())
            {
                Type pType = p.GetType();
                Type compareType;
                //make sure we don't already have an instance of p
                foreach (MonsterProperty compare in properties)
                {
                    compareType = compare.GetType();
                    if (compareType == pType)
                    {
                        p.Complain(3);
                        validToAdd = false;
                    }
                }
            }
            if (validToAdd)
            {
                if (p.Prepare(this))
                {
                    if (slotsUsed + p.SlotCost() > slots)
                    {
                        p.Complain(4);
                    }
                    else
                    {
                        properties.Add(p);
                        properties.Sort();
                    }
                }
            }
        }
Ejemplo n.º 3
0
 private int GetIndex(MonsterProperty monsterProperty)
 {
     Type t = monsterProperty.GetType();
     if (t.Name == "DiffEasy" || t.Name == "RankUnranked")
     {
         return 0;
     }
     if (t.Name == "DiffNormal" || t.Name == "RankMiniboss")
     {
         return 1;
     }
     if (t.Name == "DiffTough" || t.Name == "RankBoss")
     {
         return 2;
     }
     return 0; // if all else fails
 }
Ejemplo n.º 4
0
 public void AddProperty(MonsterProperty p)
 {
     bool validToAdd = true;
     //validate the property to make sure we're not adding
     //a second instance of a unique property.
     if (p.Unique())
     {
         Type pType = p.GetType();
         Type compareType;
         //make sure we don't already have an instance of p
         foreach (MonsterProperty compare in properties)
         {
             compareType = compare.GetType();
             if (compareType == pType)
             {
                 p.Complain(3);
                 validToAdd = false;
             }
         }
     }
     if (validToAdd)
     {
         if (p.Prepare(this))
         {
             if (slotsUsed + p.SlotCost() > slots)
             {
                 p.Complain(4);
             }
             else
             {
                 properties.Add(p);
                 properties.Sort();
             }
         }
     }
 }