hanafuda/field_multiplier.c

18 lines
479 B
C

#include <stdbool.h>
#include "field_multiplier.h"
#include "card.h"
const 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;
}