From b61000eb095a6ed261cf23084a5bb584f2365500 Mon Sep 17 00:00:00 2001 From: peterhouse7 Date: Tue, 5 May 2026 15:41:45 -0400 Subject: [PATCH 1/2] grey out sell joker --- overrides/game.lua | 20 +++++++++++++++++++- ui/game/functions.lua | 20 ++++++++++++++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/overrides/game.lua b/overrides/game.lua index 47fbe745..4c230a86 100644 --- a/overrides/game.lua +++ b/overrides/game.lua @@ -14,15 +14,30 @@ end local sell_card_ref = Card.sell_card function Card:sell_card() + if self.mp_end_game_display then + return + end + if self.ability and self.ability.name then sendTraceMessage( string.format("Client sent message: action:soldCard,card:%s", self.ability.name), "MULTIPLAYER" ) end + return sell_card_ref(self) end + +local can_sell_ref = Card.can_sell +function Card:can_sell(...) + if self.mp_end_game_display then + return false + end + + return can_sell_ref(self, ...) +end + local reroll_shop_ref = G.FUNCS.reroll_shop function G.FUNCS.reroll_shop(e) sendTraceMessage( @@ -30,7 +45,6 @@ function G.FUNCS.reroll_shop(e) "MULTIPLAYER" ) - -- Update reroll stats if in a multiplayer game if MP.LOBBY.code and MP.GAME.stats then MP.GAME.stats.reroll_count = MP.GAME.stats.reroll_count + 1 MP.GAME.stats.reroll_cost_total = MP.GAME.stats.reroll_cost_total + G.GAME.current_round.reroll_cost @@ -42,12 +56,14 @@ end local buy_from_shop_ref = G.FUNCS.buy_from_shop function G.FUNCS.buy_from_shop(e) local c1 = e.config.ref_table + if c1 and c1:is(Card) then sendTraceMessage( string.format("Client sent message: action:boughtCardFromShop,card:%s,cost:%s", c1.ability.name, c1.cost), "MULTIPLAYER" ) end + return buy_from_shop_ref(e) end @@ -59,6 +75,7 @@ function G.FUNCS.use_card(e, mute, nosave) "MULTIPLAYER" ) end + return use_card_ref(e, mute, nosave) end @@ -69,5 +86,6 @@ G.FUNCS.evaluate_round = function() G.after_pvp = nil SMODS.calculate_context({ mp_end_of_pvp = true }) end + evaluate_round_ref() end diff --git a/ui/game/functions.lua b/ui/game/functions.lua index e813f7f2..fcd756a1 100644 --- a/ui/game/functions.lua +++ b/ui/game/functions.lua @@ -97,18 +97,34 @@ function G.FUNCS.toggle_players_jokers() if MP.end_game_jokers_text == localize("k_enemy_jokers") then local your_jokers_save = copy_table(G.jokers:save()) MP.end_game_jokers:load(your_jokers_save) + + if MP.end_game_jokers.cards then + for _, card in pairs(MP.end_game_jokers.cards) do + card.mp_end_game_display = nil + end + end + MP.end_game_jokers_text = localize("k_your_jokers") else if MP.end_game_jokers_received then G.FUNCS.load_end_game_jokers() + + if MP.end_game_jokers.cards then + for _, card in pairs(MP.end_game_jokers.cards) do + card.mp_end_game_display = true + card.added_to_deck = false + end + end else - if MP.end_game_jokers.cards then remove_all(MP.end_game_jokers.cards) end + if MP.end_game_jokers.cards then + remove_all(MP.end_game_jokers.cards) + end MP.end_game_jokers.cards = {} end + MP.end_game_jokers_text = localize("k_enemy_jokers") end end - function G.FUNCS.view_nemesis_deck() G.SETTINGS.paused = true if G.deck_preview then From 9ee9438529f802ab8887e7e603012f85d1a84497 Mon Sep 17 00:00:00 2001 From: peterhouse7 Date: Tue, 5 May 2026 16:06:56 -0400 Subject: [PATCH 2/2] moving over from old issue-277 --- networking/action_handlers.lua | 7 ++++++- overrides/game.lua | 22 +++++++++++++--------- ui/game/functions.lua | 17 +++-------------- ui/game/game_end.lua | 2 +- 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/networking/action_handlers.lua b/networking/action_handlers.lua index 2ce92cc1..c43a0d1f 100644 --- a/networking/action_handlers.lua +++ b/networking/action_handlers.lua @@ -705,11 +705,16 @@ function G.FUNCS.load_end_game_jokers() 0, 5 * G.CARD_W, G.CARD_H, - { card_limit = G.GAME.starting_params.joker_slots, type = "joker", highlight_limit = 1 } + { card_limit = G.GAME.starting_params.joker_slots, type = "joker", highlight_limit = 0 } ) return end + if MP.end_game_jokers.cards then + for _, card in pairs(MP.end_game_jokers.cards) do + card.mp_end_game_display = true + end + end -- Log the jokers if MP.end_game_jokers.cards then local jokers_str = "" diff --git a/overrides/game.lua b/overrides/game.lua index 4c230a86..2e561edb 100644 --- a/overrides/game.lua +++ b/overrides/game.lua @@ -18,24 +18,28 @@ function Card:sell_card() return end - if self.ability and self.ability.name then - sendTraceMessage( - string.format("Client sent message: action:soldCard,card:%s", self.ability.name), - "MULTIPLAYER" - ) - end + if self.mp_end_game_display then + return + end + + if self.ability and self.ability.name then + sendTraceMessage( + string.format("Client sent message: action:soldCard,card:%s", self.ability.name), + "MULTIPLAYER" + ) + end return sell_card_ref(self) end -local can_sell_ref = Card.can_sell -function Card:can_sell(...) +local can_sell_ref = Card.can_sell_card +function Card:can_sell_card(...) if self.mp_end_game_display then return false end - return can_sell_ref(self, ...) + return can_sell_card_ref(self, ...) end local reroll_shop_ref = G.FUNCS.reroll_shop diff --git a/ui/game/functions.lua b/ui/game/functions.lua index fcd756a1..c35c6d7e 100644 --- a/ui/game/functions.lua +++ b/ui/game/functions.lua @@ -98,27 +98,16 @@ function G.FUNCS.toggle_players_jokers() local your_jokers_save = copy_table(G.jokers:save()) MP.end_game_jokers:load(your_jokers_save) - if MP.end_game_jokers.cards then - for _, card in pairs(MP.end_game_jokers.cards) do - card.mp_end_game_display = nil - end + for _, card in pairs(MP.end_game_jokers.cards or {}) do + card.mp_end_game_display = true end MP.end_game_jokers_text = localize("k_your_jokers") else if MP.end_game_jokers_received then G.FUNCS.load_end_game_jokers() - - if MP.end_game_jokers.cards then - for _, card in pairs(MP.end_game_jokers.cards) do - card.mp_end_game_display = true - card.added_to_deck = false - end - end else - if MP.end_game_jokers.cards then - remove_all(MP.end_game_jokers.cards) - end + if MP.end_game_jokers.cards then remove_all(MP.end_game_jokers.cards) end MP.end_game_jokers.cards = {} end diff --git a/ui/game/game_end.lua b/ui/game/game_end.lua index 8b4ba6de..d95290f8 100644 --- a/ui/game/game_end.lua +++ b/ui/game/game_end.lua @@ -4,7 +4,7 @@ function MP.UI.create_UIBox_mp_game_end(has_won) 0, 5 * G.CARD_W, G.CARD_H, - { card_limit = G.GAME.starting_params.joker_slots, type = "joker", highlight_limit = 1 } + { card_limit = G.GAME.starting_params.joker_slots, type = "joker", highlight_limit = 0 } ) if not MP.end_game_jokers_received then MP.ACTIONS.get_end_game_jokers()