private static void AddCostToTotal(ManaCostModel manaCostModel, ManaColors manaColor, char manaOperationPart) { switch (manaColor) { case ManaColors.Colorless: var colorlessCount = manaOperationPart.GetColorlessCount(); manaCostModel.Costs[manaColor] = manaCostModel.Costs[manaColor] + colorlessCount; break; default: manaCostModel.Costs[manaColor] = manaCostModel.Costs[manaColor] + 1; break; } }
private static void AppendCost(ManaCostModel manaCostModel, ManaColors manaColor, char manaOperationPart) { switch (manaColor) { case ManaColors.Colorless: var colorlessCount = manaOperationPart.GetColorlessCount(); manaCostModel.Costs.Add(manaColor, colorlessCount); break; default: manaCostModel.Costs.Add(manaColor, 1); break; } }
private static void HandleManaColor(ManaCostModel manaCostModel, char manaOperationPart) { var manaColor = manaOperationPart.GetManaColor(); if (manaCostModel.Costs.ContainsKey(manaColor)) { AddCostToTotal(manaCostModel, manaColor, manaOperationPart); } else { AppendCost(manaCostModel, manaColor, manaOperationPart); } }
private static void HandleManaColors(ManaCostModel manaCostModel, char manaOperationPartLeft, char manaOperationPartRight) { var manaColorLeft = manaOperationPartLeft.GetManaColor(); var manaColorRight = manaOperationPartRight.GetManaColor(); var comboColor = manaColorLeft | manaColorRight; if (manaCostModel.Costs.ContainsKey(comboColor)) { AddCostToTotal(manaCostModel, comboColor, ManaSymbols.Close); } else { AppendCost(manaCostModel, comboColor, ManaSymbols.Close); } }