public static bool IsInstant(this PotionType type) { var attrib = type.GetAttribute <PotionTypeInfoAttribute>(); var effect = attrib.Effect; var et = PotionEffectType.GetById(effect); return(et == null || et.IsInstant()); }
private static PotionEffectType GetEffectType <TKey, TValue>(Dictionary <TKey, TValue> map) { int type = GetInt(map, TYPE); PotionEffectType effect = PotionEffectType.GetById(type); if (effect != null) { return(effect); } throw new Exception(map + " does not contain " + TYPE); }
public static PotionType GetByEffect(PotionEffectType effect) { if (effect == null) { return(PotionType.Water); } var vals = Enum.GetValues(typeof(PotionType)); foreach (PotionType t in vals) { var attrib = t.GetAttribute <PotionTypeInfoAttribute>(); if (PotionEffectType.GetById(attrib.Effect).Equals(effect)) { return(t); } } return(PotionType.Water); }
public PotionEffectType GetEffectType() { return(PotionEffectType.GetById(this.Id)); }