public static void CheckAttribute(this MagicEffectType effect, AttributeType attribute) { if (!effect.AffectsAttribute() && attribute != AttributeType.None) { throw new InvalidOperationException($"This effect does not affect an Attribute: {effect}"); } if (attribute == AttributeType.None && effect.AffectsAttribute()) { throw new InvalidOperationException($"Affected attribute required for this effect: {effect}"); } }
public static int IntConvertToAttributeId(this MagicEffectType effect, AttributeType attribute) { return(effect.AffectsAttribute() ? (int)attribute : INT_AFFECTED_ITEM_NONE); }
public static AttributeType IntConvertToAttribute(this MagicEffectType effect, int id) { return(effect.AffectsAttribute() ? (AttributeType)id : AttributeType.None); }
public static byte ByteConvertToAttributeId(this MagicEffectType effect, AttributeType attribute) { return(effect.AffectsAttribute() ? (byte)attribute : BYTE_AFFECTED_ITEM_NONE); }