adds walkie-talkie, fibonnaci, banner, mystic summit, blackboard
This commit is contained in:
@@ -82,4 +82,6 @@ int get_played_top(void);
|
|||||||
JokerObject** get_jokers(void);
|
JokerObject** get_jokers(void);
|
||||||
int get_jokers_top(void);
|
int get_jokers_top(void);
|
||||||
|
|
||||||
|
int get_num_discards_remaining(void);
|
||||||
|
|
||||||
#endif // GAME_H
|
#endif // GAME_H
|
||||||
@@ -239,6 +239,35 @@ static const Rect SHOP_REROLL_RECT = {88, 96, UNDEFINED, UNDEFI
|
|||||||
#define PITCH_STEP_UNDISCARD_SFX 2*PITCH_STEP_DRAW_SFX
|
#define PITCH_STEP_UNDISCARD_SFX 2*PITCH_STEP_DRAW_SFX
|
||||||
// Naming the stage where cards return from the discard pile to the deck "undiscard"
|
// Naming the stage where cards return from the discard pile to the deck "undiscard"
|
||||||
|
|
||||||
|
// get-functions, for other files to view game state (mainly for jokers)
|
||||||
|
CardObject **get_hand_array(void) {
|
||||||
|
return hand;
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_hand_top(void) {
|
||||||
|
return hand_top;
|
||||||
|
}
|
||||||
|
|
||||||
|
CardObject **get_played_array(void) {
|
||||||
|
return played;
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_played_top(void) {
|
||||||
|
return played_top;
|
||||||
|
}
|
||||||
|
|
||||||
|
JokerObject **get_jokers(void) {
|
||||||
|
return jokers;
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_jokers_top(void) {
|
||||||
|
return jokers_top;
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_num_discards_remaining(void) {
|
||||||
|
return discards;
|
||||||
|
}
|
||||||
|
|
||||||
// General functions
|
// General functions
|
||||||
void set_seed(int seed)
|
void set_seed(int seed)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -215,6 +215,78 @@ static JokerEffect misprint_joker_effect(Joker *joker, Card *scored_card) {
|
|||||||
return effect;
|
return effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static JokerEffect walkie_talkie_joker_effect(Joker *joker, Card *scored_card) {
|
||||||
|
JokerEffect effect = {0};
|
||||||
|
if (scored_card == NULL)
|
||||||
|
return effect;
|
||||||
|
|
||||||
|
if (scored_card->rank == TEN || scored_card->rank == FOUR) {
|
||||||
|
effect.chips = 10;
|
||||||
|
effect.mult = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
return effect;
|
||||||
|
}
|
||||||
|
|
||||||
|
static JokerEffect fibonnaci_joker_effect(Joker *joker, Card *scored_card) {
|
||||||
|
JokerEffect effect = {0};
|
||||||
|
if (scored_card == NULL)
|
||||||
|
return effect;
|
||||||
|
|
||||||
|
switch (scored_card->rank) {
|
||||||
|
case ACE: case TWO: case THREE: case FIVE: case EIGHT:
|
||||||
|
effect.mult = 8;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return effect;
|
||||||
|
}
|
||||||
|
|
||||||
|
static JokerEffect banner_joker_effect(Joker *joker, Card *scored_card) {
|
||||||
|
JokerEffect effect = {0};
|
||||||
|
if (scored_card != NULL)
|
||||||
|
return effect; // if card != null, we are not at the end-phase of scoring yet
|
||||||
|
|
||||||
|
effect.chips = 30 * get_num_discards_remaining();
|
||||||
|
|
||||||
|
return effect;
|
||||||
|
}
|
||||||
|
|
||||||
|
static JokerEffect mystic_summit_joker_effect(Joker *joker, Card *scored_card) {
|
||||||
|
JokerEffect effect = {0};
|
||||||
|
if (scored_card != NULL)
|
||||||
|
return effect; // if card != null, we are not at the end-phase of scoring yet
|
||||||
|
|
||||||
|
if (get_num_discards_remaining() == 0)
|
||||||
|
effect.mult = 15;
|
||||||
|
|
||||||
|
return effect;
|
||||||
|
}
|
||||||
|
|
||||||
|
static JokerEffect blackboard_joker_effect(Joker *joker, Card *scored_card) {
|
||||||
|
JokerEffect effect = {0};
|
||||||
|
if (scored_card != NULL)
|
||||||
|
return effect; // if card != null, we are not at the end-phase of scoring yet
|
||||||
|
|
||||||
|
bool all_cards_are_spades_or_clubs = true;
|
||||||
|
CardObject** hand = get_hand_array();
|
||||||
|
int hand_top = get_hand_top();
|
||||||
|
for (int i = 0; i < hand_top; i++ )
|
||||||
|
{
|
||||||
|
u8 suit = hand[i]->card->suit;
|
||||||
|
if (suit == HEARTS || suit == DIAMONDS) {
|
||||||
|
all_cards_are_spades_or_clubs = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (all_cards_are_spades_or_clubs)
|
||||||
|
effect.xmult = 3;
|
||||||
|
|
||||||
|
return effect;
|
||||||
|
}
|
||||||
|
|
||||||
const JokerInfo joker_registry[] = {
|
const JokerInfo joker_registry[] = {
|
||||||
{ COMMON_JOKER, 2, default_joker_effect }, // DEFAULT_JOKER_ID = 0
|
{ COMMON_JOKER, 2, default_joker_effect }, // DEFAULT_JOKER_ID = 0
|
||||||
{ COMMON_JOKER, 5, greedy_joker_effect }, // GREEDY_JOKER_ID = 1
|
{ COMMON_JOKER, 5, greedy_joker_effect }, // GREEDY_JOKER_ID = 1
|
||||||
@@ -234,6 +306,11 @@ const JokerInfo joker_registry[] = {
|
|||||||
{ COMMON_JOKER, 5, half_joker_effect },
|
{ COMMON_JOKER, 5, half_joker_effect },
|
||||||
{ UNCOMMON_JOKER, 8, joker_stencil_effect },
|
{ UNCOMMON_JOKER, 8, joker_stencil_effect },
|
||||||
{ COMMON_JOKER, 4, misprint_joker_effect },
|
{ COMMON_JOKER, 4, misprint_joker_effect },
|
||||||
|
{ COMMON_JOKER, 4, walkie_talkie_joker_effect },
|
||||||
|
{ UNCOMMON_JOKER, 8, fibonnaci_joker_effect },
|
||||||
|
{ COMMON_JOKER, 5, banner_joker_effect },
|
||||||
|
{ COMMON_JOKER, 5, mystic_summit_joker_effect },
|
||||||
|
{ UNCOMMON_JOKER, 6, blackboard_joker_effect },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const size_t joker_registry_size = NUM_ELEM_IN_ARR(joker_registry);
|
static const size_t joker_registry_size = NUM_ELEM_IN_ARR(joker_registry);
|
||||||
|
|||||||
Reference in New Issue
Block a user