Ejemplo n.º 1
0
 /// <summary>
 /// Hats modify the stats of the Entity it's equipped to, but you must call the Equip method to actually apply
 /// the modifications
 /// </summary>
 /// <param name="texture">The Hat's texture</param>
 /// <param name="maxHealth">Any modification to the equipped Entity's maximum health</param>
 /// <param name="def">Any modification to the equipped Entity's defense</param>
 /// <param name="atk">Any modification to the equipped Entity's attack</param>
 /// <param name="maxMana">If the Entity's a player, this modifies their maximum mana</param>
 public Hat(string name, string description, Texture2D texture, Color color, HatRarity rarity, Ability ability = null, int maxHealth = 0, int def = 0, int atk = 0, int maxMana = 0)
 {
     this.texture     = texture;
     this.maxHealth   = maxHealth;
     this.def         = def;
     this.atk         = atk;
     this.maxMana     = maxMana;
     this.name        = name;
     this.description = description;
     this.rarity      = rarity;
     this.ability     = ability;
     this.color       = color;
     r = new Random(5);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns a random hat of the given rarity. Used by the public GetRandomHat methods
        /// </summary>
        /// <param name="rarity">Rarity of the hat to get</param>
        private static Hat GetRandomHat(HatRarity rarity)
        {
            #region Get a random hat of the given rarity
            //Find that beginning and end index of _hats that contains hats of the given rarity
            int startIndex = 0;
            int endIndex   = 0;
            for (int k = 0; k < (int)rarity; k++)
            {
                startIndex += hatQuantities[k];
            }
            endIndex = startIndex + hatQuantities[(int)rarity];

            //Occurs when there are no hats of the given rarity in _hats
            if (endIndex == startIndex)
            {
                return(GetRandomHat(rarity - 1));
            }
            //Returns a hat of the given rarity
            else
            {
                return(_hats[random.Next(startIndex, endIndex)]);
            }
            #endregion
        }
Ejemplo n.º 3
0
 /// <summary>
 /// A test hat
 /// </summary>
 /// <param name="name"></param>
 /// <param name="description"></param>
 /// <param name="texture"></param>
 /// <param name="rarity"></param>
 /// <param name="ability"></param>
 /// <param name="maxHealth"></param>
 /// <param name="def"></param>
 /// <param name="atk"></param>
 /// <param name="maxMana"></param>
 public EventTestingHat(string name, string description, Texture2D texture, HatRarity rarity, Ability ability = null, int maxHealth = 0, int def = 0, int atk = 0, int maxMana = 0) :
     base(name, description, texture, Color.White, rarity, ability, maxHealth, def, atk, maxMana)
 {
 }