private EffectInfo(Type type) { if (!typeof(CustomEffect).IsAssignableFrom(type)) { throw new ArgumentException($"The specified {nameof(type)} is not a {nameof(CustomEffect)}.", nameof(type)); } EffectNameAttribute attr = type.GetCustomAttributes <EffectNameAttribute>().FirstOrDefault(); Name = attr?.Name ?? type.Name; EffectParametersAttribute parsAttr = type.GetCustomAttributes <EffectParametersAttribute>().FirstOrDefault(); if (parsAttr is null) { RogueFramework.LogWarning($"Type {type} does not have a {nameof(EffectParametersAttribute)}!"); } Limitations = parsAttr?.Limitations ?? EffectLimitations.RemoveOnDeath; RemoveOnDeath = (Limitations & EffectLimitations.RemoveOnDeath) != 0; RemoveOnKnockOut = (Limitations & EffectLimitations.RemoveOnKnockOut) != 0; RemoveOnNextLevel = (Limitations & EffectLimitations.RemoveOnNextLevel) != 0; }