Skip to content

Commit 79dc8ee

Browse files
Adds tracking for hands played per ante (#1091)
1 parent 93a1fe2 commit 79dc8ee

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

lovely/poker_hand.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,25 @@ payload = '''
103103
if SMODS.is_poker_hand_visible(k) then _poker_hands[#_poker_hands+1] = k end
104104
'''
105105
match_indent = true
106+
107+
# G.FUNCS.evaluate_play()
108+
[[patches]]
109+
[patches.pattern]
110+
target = "functions/state_events.lua"
111+
pattern = '''G.GAME.hands[text].played_this_round = G.GAME.hands[text].played_this_round + 1'''
112+
position = "after"
113+
payload = '''G.GAME.hands[text].played_this_ante = G.GAME.hands[text].played_this_ante + 1'''
114+
match_indent = true
115+
times = 1
116+
117+
# end_round()
118+
[[patches]]
119+
[patches.pattern]
120+
target = "functions/state_events.lua"
121+
pattern = '''G.GAME.voucher_restock = nil'''
122+
position = "after"
123+
payload = '''for k, v in pairs(G.GAME.hands) do
124+
v.played_this_ante = 0
125+
end'''
126+
match_indent = true
127+
times = 1

src/game_object.lua

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ Set `prefix_config.key = false` on your object instead.]]):format(obj.key), obj.
276276
-------------------------------------------------------------------------------------------------
277277
----- API CODE GameObject.Font
278278
-------------------------------------------------------------------------------------------------
279-
280279
SMODS.Fonts = {}
281280
SMODS.Font = SMODS.GameObject:extend {
282281
obj_table = SMODS.Fonts,
@@ -311,15 +310,13 @@ Set `prefix_config.key = false` on your object instead.]]):format(obj.key), obj.
311310
('Failed to collect file data for Font %s'):format(self.key))
312311
self.FONT = assert(love.graphics.newFont(file_data, self.render_scale or G.TILESIZE),
313312
('Failed to initialize font data for Font %s'):format(self.key))
314-
315313
end,
316314
process_loc_text = function() end,
317315
}
318316

319317
-------------------------------------------------------------------------------------------------
320318
----- API CODE GameObject.DynaTextEffect
321319
-------------------------------------------------------------------------------------------------
322-
323320
SMODS.DynaTextEffects = {}
324321
SMODS.DynaTextEffect = SMODS.GameObject:extend {
325322
obj_table = SMODS.DynaTextEffects,
@@ -1176,7 +1173,6 @@ Set `prefix_config.key = false` on your object instead.]]):format(obj.key), obj.
11761173
end
11771174

11781175
localize(target)
1179-
11801176
if res.main_end then
11811177
desc_nodes[#desc_nodes + 1] = res.main_end
11821178
end
@@ -2042,7 +2038,6 @@ Set `prefix_config.key = false` on your object instead.]]):format(obj.key), obj.
20422038
else
20432039
table.insert(self.obj_buffer, self.key)
20442040
end
2045-
20462041
end
20472042
end,
20482043
process_loc_text = function(self)
@@ -2708,6 +2703,7 @@ Set `prefix_config.key = false` on your object instead.]]):format(obj.key), obj.
27082703
visible = true,
27092704
played = 0,
27102705
played_this_round = 0,
2706+
played_this_ante = 0,
27112707
level = 1,
27122708
set = 'PokerHand',
27132709
process_loc_text = function(self)
@@ -2722,6 +2718,7 @@ Set `prefix_config.key = false` on your object instead.]]):format(obj.key), obj.
27222718
self.level = self.level
27232719
self.played = self.played
27242720
self.played_this_round = self.played_this_round
2721+
self.played_this_ante = self.played_this_ante
27252722
self.obj_table[self.key] = self
27262723
self.obj_buffer[#self.obj_buffer + 1] = self.key
27272724
end

0 commit comments

Comments
 (0)