public short ToDamageValue() { short damage; if (type == PotionType.Water) { return(0); } else if (type == null) { damage = (short)(name == 0 ? 8192 : name); } else { damage = (short)(level - 1); damage <<= TIER_SHIFT; damage |= (short)type.GetDamageValue(); } if (splash) { damage |= (short)SPLASH_BIT; } if (extended) { damage |= (short)EXTENDED_BIT; } return(damage); }
public Potion(PotionType type) { this.type = type; if (type != default(PotionType)) { this.name = type.GetDamageValue(); } if (type == default(PotionType) || type == PotionType.Water) { this.level = 0; } }