#include <stdbool.h>

#include "field_multiplier.h"
#include "card.h"

static FieldMultiplier small_field = { "Small Field", 1 };
static FieldMultiplier large_field = { "Large Field", 2 };
static FieldMultiplier grand_field = { "Grand Field", 4 };

FieldMultiplier *calculate_field_multiplier(Hand *h) {
  bool large = false;
  for (int i = 0; i < h->count; i++) {
    Card *c = h->cards[i];
    if (c->index == CRANE_INDEX || c->index == CURTAIN_INDEX || c->index == MOON_INDEX)
      large = true;
    else if (c->index == RAINY_MAN_INDEX || c->index == PHOENIX_INDEX)
      return &grand_field;
  }

  return large ? &large_field : &small_field;
}
