/// <summary> /// Returns the CMC Contribution of this thing /// </summary> /// <returns></returns> public int Convert() { var attrib = ManaAttribute.GetManaAttribute(Color); if (attrib == null) { return(Amount); } return(attrib.CMC * Amount); }
private static ManaColor?FromString(string str) { foreach (var color in (IEnumerable <ManaColor>)Enum.GetValues(typeof(ManaColor))) { var attrib = ManaAttribute.GetManaAttribute(color); if (attrib != null) { if (attrib.AsString == str) { return(color); } } } return(null); }
public override string ToString() { if (Amount == 0) { return("{0}"); } if (Color == ManaColor.Generic) { return($"{{{Amount}}}"); } else { var attrib = ManaAttribute.GetManaAttribute(Color); var sb = new StringBuilder(); for (int i = 0; i < Amount; i++) { sb.Append(attrib.AsString); } return(sb.ToString()); } }