add fist, parking, business card, scholar, scary face, abstact, bull, smiley, even, odd jokers
This commit is contained in:
+1
-1
@@ -83,7 +83,7 @@ JokerObject** get_jokers(void);
|
|||||||
int get_jokers_top(void);
|
int get_jokers_top(void);
|
||||||
|
|
||||||
int get_deck_top(void);
|
int get_deck_top(void);
|
||||||
|
|
||||||
int get_num_discards_remaining(void);
|
int get_num_discards_remaining(void);
|
||||||
|
int get_money(void);
|
||||||
|
|
||||||
#endif // GAME_H
|
#endif // GAME_H
|
||||||
@@ -272,6 +272,10 @@ int get_num_discards_remaining(void) {
|
|||||||
return discards;
|
return discards;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int get_money(void) {
|
||||||
|
return money;
|
||||||
|
}
|
||||||
|
|
||||||
// General functions
|
// General functions
|
||||||
void set_seed(int seed)
|
void set_seed(int seed)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -291,11 +291,167 @@ static JokerEffect blue_joker_effect(Joker *joker, Card *scored_card) {
|
|||||||
JokerEffect effect = {0};
|
JokerEffect effect = {0};
|
||||||
if (scored_card != NULL)
|
if (scored_card != NULL)
|
||||||
return effect; // if card != null, we are not at the end-phase of scoring yet
|
return effect; // if card != null, we are not at the end-phase of scoring yet
|
||||||
|
|
||||||
effect.chips = (get_deck_top() + 1) * 2;
|
effect.chips = (get_deck_top() + 1) * 2;
|
||||||
|
|
||||||
return effect;
|
return effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static JokerEffect raised_fist_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
|
||||||
|
|
||||||
|
// Find the lowest rank card in hand
|
||||||
|
// Aces are always considered high value, even in an ace-low straight
|
||||||
|
u8 lowest_value = 99;
|
||||||
|
CardObject** hand = get_hand_array();
|
||||||
|
int hand_top = get_hand_top();
|
||||||
|
for (int i = 0; i < hand_top; i++ )
|
||||||
|
{
|
||||||
|
u8 value = card_get_value(hand[i]->card);
|
||||||
|
if (lowest_value > value)
|
||||||
|
lowest_value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lowest_value != 99)
|
||||||
|
effect.mult = lowest_value * 2;
|
||||||
|
|
||||||
|
return effect;
|
||||||
|
}
|
||||||
|
|
||||||
|
static JokerEffect reserved_parking_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
|
||||||
|
|
||||||
|
CardObject** hand = get_hand_array();
|
||||||
|
int hand_top = get_hand_top();
|
||||||
|
for (int i = 0; i < hand_top; i++ )
|
||||||
|
{
|
||||||
|
switch (hand[i]->card->rank) {
|
||||||
|
case KING: case QUEEN: case JACK:
|
||||||
|
if (random() % 2 == 0)
|
||||||
|
effect.money += 1;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return effect;
|
||||||
|
}
|
||||||
|
|
||||||
|
static JokerEffect business_card_joker_effect(Joker *joker, Card *scored_card) {
|
||||||
|
JokerEffect effect = {0};
|
||||||
|
if (scored_card == NULL)
|
||||||
|
return effect;
|
||||||
|
|
||||||
|
switch (scored_card->rank) {
|
||||||
|
case KING: case QUEEN: case JACK:
|
||||||
|
if (random() % 2 == 0)
|
||||||
|
effect.money = 1;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
effect.chips = 1;
|
||||||
|
|
||||||
|
return effect;
|
||||||
|
}
|
||||||
|
|
||||||
|
static JokerEffect scholar_joker_effect(Joker *joker, Card *scored_card) {
|
||||||
|
JokerEffect effect = {0};
|
||||||
|
if (scored_card == NULL)
|
||||||
|
return effect;
|
||||||
|
|
||||||
|
if (scored_card->rank == ACE) {
|
||||||
|
effect.chips = 20;
|
||||||
|
effect.mult = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
return effect;
|
||||||
|
}
|
||||||
|
|
||||||
|
static JokerEffect scary_face_joker_effect(Joker *joker, Card *scored_card) {
|
||||||
|
JokerEffect effect = {0};
|
||||||
|
if (scored_card == NULL)
|
||||||
|
return effect;
|
||||||
|
|
||||||
|
switch (scored_card->rank) {
|
||||||
|
case KING: case QUEEN: case JACK:
|
||||||
|
effect.chips = 30;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return effect;
|
||||||
|
}
|
||||||
|
|
||||||
|
static JokerEffect abstract_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
|
||||||
|
|
||||||
|
// +1 xmult per occupied joker slot
|
||||||
|
int jokers_top = get_jokers_top();
|
||||||
|
effect.mult = (jokers_top + 1) * 3;
|
||||||
|
|
||||||
|
return effect;
|
||||||
|
}
|
||||||
|
|
||||||
|
static JokerEffect bull_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 = get_money() * 2;
|
||||||
|
|
||||||
|
return effect;
|
||||||
|
}
|
||||||
|
|
||||||
|
static JokerEffect smiley_face_joker_effect(Joker *joker, Card *scored_card) {
|
||||||
|
JokerEffect effect = {0};
|
||||||
|
if (scored_card == NULL)
|
||||||
|
return effect;
|
||||||
|
|
||||||
|
switch (scored_card->rank) {
|
||||||
|
case KING: case QUEEN: case JACK:
|
||||||
|
effect.mult = 5;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return effect;
|
||||||
|
}
|
||||||
|
|
||||||
|
static JokerEffect even_steven_joker_effect(Joker *joker, Card *scored_card) {
|
||||||
|
JokerEffect effect = {0};
|
||||||
|
if (scored_card == NULL)
|
||||||
|
return effect;
|
||||||
|
|
||||||
|
if (card_get_value(scored_card) % 2 == 0) {
|
||||||
|
switch (scored_card->rank) {
|
||||||
|
case KING: case QUEEN: case JACK:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
effect.mult = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return effect;
|
||||||
|
}
|
||||||
|
|
||||||
|
static JokerEffect odd_todd_joker_effect(Joker *joker, Card *scored_card) {
|
||||||
|
JokerEffect effect = {0};
|
||||||
|
if (scored_card == NULL)
|
||||||
|
return effect;
|
||||||
|
|
||||||
|
if (card_get_value(scored_card) % 2 == 1) // todo test ace
|
||||||
|
effect.chips = 31;
|
||||||
|
|
||||||
|
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
|
||||||
@@ -321,6 +477,16 @@ const JokerInfo joker_registry[] = {
|
|||||||
{ COMMON_JOKER, 5, mystic_summit_joker_effect },
|
{ COMMON_JOKER, 5, mystic_summit_joker_effect },
|
||||||
{ UNCOMMON_JOKER, 6, blackboard_joker_effect },
|
{ UNCOMMON_JOKER, 6, blackboard_joker_effect },
|
||||||
{ COMMON_JOKER, 5, blue_joker_effect },
|
{ COMMON_JOKER, 5, blue_joker_effect },
|
||||||
|
{ COMMON_JOKER, 5, raised_fist_joker_effect },
|
||||||
|
{ COMMON_JOKER, 6, reserved_parking_joker_effect },
|
||||||
|
{ COMMON_JOKER, 4, business_card_joker_effect },
|
||||||
|
{ COMMON_JOKER, 4, scholar_joker_effect },
|
||||||
|
{ COMMON_JOKER, 4, scary_face_joker_effect },
|
||||||
|
{ COMMON_JOKER, 4, abstract_joker_effect },
|
||||||
|
{ UNCOMMON_JOKER, 6, bull_joker_effect},
|
||||||
|
{ COMMON_JOKER, 4, smiley_face_joker_effect },
|
||||||
|
{ COMMON_JOKER, 4, even_steven_joker_effect },
|
||||||
|
{ COMMON_JOKER, 4, odd_todd_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