コード例 #1
0
 public bool TrySubtractAmount(MTGColor c, int amount)
 {
     switch (c)
     {
         case MTGColor.White: return TrySubtractAmount(amount, ref whiteAmount);
         case MTGColor.Blue: return TrySubtractAmount(amount, ref blueAmount);
         case MTGColor.Black: return TrySubtractAmount(amount, ref blackAmount);
         case MTGColor.Red: return TrySubtractAmount(amount, ref redAmount);
         case MTGColor.Green: return TrySubtractAmount(amount, ref greenAmount);
         case MTGColor.ColorlessMana: return TrySubtractAmount(amount, ref colorlessAmount);
         default: throw new ArgumentException("Invalid color for mana subtract!");
     }
 }
コード例 #2
0
 public int Get(MTGColor c)
 {
     return amount.GetAmount(c);
 }
コード例 #3
0
 public void SetAmount(MTGColor c, int amount)
 {
     switch (c)
     {
         case MTGColor.White: whiteAmount = amount; break;
         case MTGColor.Blue: blueAmount = amount; break;
         case MTGColor.Black: blackAmount = amount; break;
         case MTGColor.Red: redAmount = amount; break;
         case MTGColor.Green: greenAmount = amount; break;
         case MTGColor.ColorlessMana: colorlessAmount = amount; break;
         default: throw new ArgumentException("Invalid color for mana set amount!");
     }
 }
コード例 #4
0
 public int GetAmount(MTGColor c)
 {
     switch (c)
     {
         case MTGColor.White: return whiteAmount;
         case MTGColor.Blue: return blueAmount;
         case MTGColor.Black: return blackAmount;
         case MTGColor.Red: return redAmount;
         case MTGColor.Green: return greenAmount;
         case MTGColor.ColorlessMana: return colorlessAmount;
         default: throw new ArgumentException("Invalid color for mana get!");
     }
 }
コード例 #5
0
 internal static int NumBits(MTGColor color)
 {
     int result = 0;
     foreach(MTGColor testColor in ManaPool.ManaTypesList)
     {
         if ((color & testColor) != 0)
             result++;
     }
     return result;
 }
コード例 #6
0
 internal ManaPaymentPart(MTGColor color, int amount)
 {
     this.color = color;
     this.amount = amount;
 }
コード例 #7
0
 static void AddParsedAmount(Dictionary<MTGColor, int> amounts, MTGColor color, int amount)
 {
     if (!amounts.ContainsKey(color))
         amounts[color] = amount;
     else
         amounts[color] += amount;
 }