class CwCardUtils::CurveCalculator
def calculate_curve
def calculate_curve @deck.each do |card| cmc = card.cmc # If CMC is nil, and it is a land, skip it, otherwise add it to the curve in the # zero cost bucket. (Handles X to cast cards.) if cmc.nil? || cmc == 0 if card.type.include?("Land") next else bucket = 0 end else bucket = cmc.ceil end @raw_curve[bucket] ||= 0 @raw_curve[bucket] += card.count end end