Exemple #1
0
 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}");
     }
 }
Exemple #2
0
 public static int IntConvertToAttributeId(this MagicEffectType effect, AttributeType attribute)
 {
     return(effect.AffectsAttribute() ? (int)attribute : INT_AFFECTED_ITEM_NONE);
 }
Exemple #3
0
 public static AttributeType IntConvertToAttribute(this MagicEffectType effect, int id)
 {
     return(effect.AffectsAttribute() ? (AttributeType)id : AttributeType.None);
 }
Exemple #4
0
 public static byte ByteConvertToAttributeId(this MagicEffectType effect, AttributeType attribute)
 {
     return(effect.AffectsAttribute() ? (byte)attribute : BYTE_AFFECTED_ITEM_NONE);
 }