added shop rerolling and edition pricing for jokers

This commit is contained in:
cellos51
2025-07-21 22:05:31 -04:00
parent 95d032f36b
commit e7c5536cc2
3 changed files with 31 additions and 4 deletions
+2
View File
@@ -17,6 +17,8 @@
#define POLY_EDITION 3
#define NEGATIVE_EDITION 4
#define MAX_EDITIONS 5
#define COMMON_JOKER 0
#define UNCOMMON_JOKER 1
#define RARE_JOKER 2
+19 -3
View File
@@ -27,7 +27,7 @@ static uint timer = 0; // This might already exist in libtonc but idk so i'm jus
static int game_speed = 1;
static int background = 0;
static enum GameState game_state = GAME_BLIND_SELECT; // The current game state, this is used to determine what the game is doing at any given time
static enum GameState game_state = GAME_SHOP; // The current game state, this is used to determine what the game is doing at any given time
static enum HandState hand_state = HAND_DRAW;
static enum PlayState play_state = PLAY_PLAYING;
@@ -50,7 +50,7 @@ static int discards = 0;
static int round = 0;
static int ante = 1;
static int money = 4;
static int money = 10;
static int score = 0;
static int temp_score = 0; // This is the score that shows in the same spot as the hand type.
static FIXED lerped_score = 0;
@@ -198,6 +198,7 @@ static const Rect ROUND_END_BLIND_REWARD_RECT = { 168, 96, UNDEFINED, UNDEF
static const Rect ROUND_END_NUM_HANDS_RECT = {88, 116, UNDEFINED, UNDEFINED };
static const Rect HAND_REWARD_RECT = {168, UNDEFINED, UNDEFINED, UNDEFINED };
static const Rect CASHOUT_RECT = {88, 72, UNDEFINED, UNDEFINED };
static const Rect SHOP_REROLL_RECT = {88, 96, UNDEFINED, UNDEFINED };
//TODO: Properly define and use
#define MENU_POP_OUT_ANIM_FRAMES 20
@@ -2082,6 +2083,9 @@ void game_shop()
}
}
const int reroll_base_cost = 5; // Base cost for rerolling the shop items
static int reroll_cost = reroll_base_cost;
// these are for controlling the shop menu
static bool top_row = true;
static ushort selection_x = 0;
@@ -2151,6 +2155,11 @@ void game_shop()
}
case 1: // Shop menu input and selection
{
if (timer == 1)
{
tte_printf("#{P:%d,%d; cx:0xF000}$%d", SHOP_REROLL_RECT.left, SHOP_REROLL_RECT.top, reroll_cost);
}
// Shop input logic
if (key_hit(KEY_UP))
{
@@ -2216,9 +2225,15 @@ void game_shop()
{
memset16(&pal_bg_mem[7], 0xFFFF, 1);
if (key_hit(KEY_A))
if (key_hit(KEY_A) && money >= reroll_cost)
{
money -= reroll_cost;
set_money(money); // Update the money display
game_shop_create_items(shop_jokers, false);
reroll_cost++;
tte_printf("#{P:%d,%d; cx:0xF000}$%d", SHOP_REROLL_RECT.left, SHOP_REROLL_RECT.top, reroll_cost);
}
}
@@ -2301,6 +2316,7 @@ void game_shop()
}
default:
state = 0; // Reset the state
reroll_cost = reroll_base_cost;
selection_x = 0; // Reset the selection
top_row = true; // Reset the top row selection
+10 -1
View File
@@ -14,6 +14,15 @@ const static u8 joker_data_lut[MAX_JOKERS][2] = // Rarity, Value
{COMMON_JOKER, 5}, // Greedy Joker
};
const static u8 edition_price_lut[MAX_EDITIONS] =
{
0, // BASE_EDITION
2, // FOIL_EDITION
3, // HOLO_EDITION
5, // POLY_EDITION
5, // NEGATIVE_EDITION
};
/* So for the card objects, I needed them to be properly sorted
which is why they let you specify the layer index when creating a new card object.
Since the cards would overlap a lot in your hand, If they weren't sorted properly, it would look like a mess.
@@ -35,7 +44,7 @@ Joker *joker_new(u8 id)
joker->id = id; // TODO: Make this random later
joker->modifier = BASE_EDITION; // TODO: Make this random later
joker->value = joker_data_lut[id][1];
joker->value = joker_data_lut[id][1] + edition_price_lut[joker->modifier]; // Base value + edition price
joker->rarity = joker_data_lut[id][0];
joker->proccessed = false;