mirror of
https://github.com/cellos51/balatro-gba.git
synced 2026-04-26 01:30:39 -05:00
Add a "is_card_face" function to take into account if Pareidolia is present
This commit is contained in:
parent
74739d87ed
commit
c781ee9666
|
|
@ -86,6 +86,7 @@ typedef struct List List;
|
|||
|
||||
// Utility functions for other files
|
||||
typedef struct CardObject CardObject; // forward declaration, actually declared in card.h
|
||||
typedef struct Card Card;
|
||||
typedef struct JokerObject JokerObject;
|
||||
CardObject** get_hand_array(void);
|
||||
int get_hand_top(void);
|
||||
|
|
@ -93,6 +94,8 @@ int hand_get_size(void);
|
|||
CardObject** get_played_array(void);
|
||||
int get_played_top(void);
|
||||
List* get_jokers(void);
|
||||
bool is_joker_present(int joker_id);
|
||||
bool card_is_face(Card *card);
|
||||
|
||||
int get_deck_top(void);
|
||||
int get_num_discards_remaining(void);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#define DEFAULT_JOKER_ID 0
|
||||
#define GREEDY_JOKER_ID 1 // This is just an example to show the patern of making joker IDs
|
||||
#define JOKER_STENCIL_ID 16
|
||||
#define PAREIDOLIA_JOKER_ID 41
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
|
|||
|
|
@ -161,6 +161,18 @@ List *get_jokers(void) {
|
|||
return jokers;
|
||||
}
|
||||
|
||||
bool is_joker_present(int joker_id) {
|
||||
for (int k = 0; k < list_get_size(jokers); k++)
|
||||
{
|
||||
JokerObject *joker = list_get(jokers, k);
|
||||
if (joker->joker->id == joker_id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void add_joker(JokerObject *joker_object)
|
||||
{
|
||||
list_append(jokers, joker_object);
|
||||
|
|
@ -423,6 +435,17 @@ enum HandType hand_get_type()
|
|||
return res_hand_type; // should be HIGH_CARD
|
||||
}
|
||||
|
||||
// Returns true if the card is *considered* a face card
|
||||
bool card_is_face(Card *card) {
|
||||
// Card is a face card, or Pareidolia is present
|
||||
return (
|
||||
card->rank == JACK ||
|
||||
card->rank == QUEEN ||
|
||||
card->rank == KING ||
|
||||
is_joker_present(PAREIDOLIA_JOKER_ID)
|
||||
);
|
||||
}
|
||||
|
||||
/* Copies the appropriate item into the top left panel (blind/shop icon)
|
||||
* from where it was put outside the screenview
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -358,12 +358,9 @@ static JokerEffect business_card_joker_effect(Joker *joker, Card *scored_card) {
|
|||
if (scored_card == NULL)
|
||||
return effect;
|
||||
|
||||
switch (scored_card->rank) {
|
||||
case KING: case QUEEN: case JACK:
|
||||
if (random() % 2 == 0)
|
||||
effect.money = 2;
|
||||
default:
|
||||
break;
|
||||
if (card_is_face(scored_card)) {
|
||||
if (random() % 2 == 0)
|
||||
effect.money = 2;
|
||||
}
|
||||
|
||||
return effect;
|
||||
|
|
@ -387,11 +384,8 @@ static JokerEffect scary_face_joker_effect(Joker *joker, Card *scored_card) {
|
|||
if (scored_card == NULL)
|
||||
return effect;
|
||||
|
||||
switch (scored_card->rank) {
|
||||
case KING: case QUEEN: case JACK:
|
||||
effect.chips = 30;
|
||||
default:
|
||||
break;
|
||||
if (card_is_face(scored_card)) {
|
||||
effect.chips = 30;
|
||||
}
|
||||
|
||||
return effect;
|
||||
|
|
@ -426,11 +420,8 @@ static JokerEffect smiley_face_joker_effect(Joker *joker, Card *scored_card) {
|
|||
if (scored_card == NULL)
|
||||
return effect;
|
||||
|
||||
switch (scored_card->rank) {
|
||||
case KING: case QUEEN: case JACK:
|
||||
effect.mult = 5;
|
||||
default:
|
||||
break;
|
||||
if (card_is_face(scored_card)) {
|
||||
effect.mult = 5;
|
||||
}
|
||||
|
||||
return effect;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user