Ejemplo n.º 1
0
        public static Potion FromDamage(int damage)
        {
            PotionType type = PotionTypeHelper.GetByDamageValue(damage & POTION_BIT);
            Potion     potion;

            if (type == null || (type == PotionType.Water && damage != 0))
            {
                potion = new Potion(damage & NAME_BIT);
            }
            else
            {
                int level = (damage & TIER_BIT) >> TIER_SHIFT;
                level++;
                potion = new Potion(type, level);
            }
            if ((damage & SPLASH_BIT) > 0)
            {
                potion = potion.Splash();
            }
            if ((damage & EXTENDED_BIT) > 0)
            {
                potion = potion.Extend();
            }
            return(potion);
        }
Ejemplo n.º 2
0
 public Potion(int name)
     : this(PotionTypeHelper.GetByDamageValue(name & POTION_BIT))
 {
     this.name = name & NAME_BIT;
     if ((name & POTION_BIT) == 0)
     {
         this.type = default(PotionType);
     }
 }