Skip to content

Commit 0db3213

Browse files
authored
Merge pull request #2 from Toneblock/Toneblock-0.5.0
0.5.0
2 parents 6bd2fdf + 93b6b46 commit 0db3213

File tree

3 files changed

+62
-45
lines changed

3 files changed

+62
-45
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# NotJustYet
2-
(Steamodded 1.0) Prevents scoring from ending the round early
2+
**(Steamodded 1.0)** Prevents scoring from ending the round early
33

4-
Default keybind is 'LShift'. This is customizable via the main.lua, although I'm not exactly sure what keys work
4+
# Info
55

6-
Holding the keybind during the end of a scoring hand will mimic vanilla behavior, useful in cases where you do not want to draw extra cards
6+
This mod contains a slightly customisable **keybind** and **colour**. To change them, you can open the mod's **main.lua** and edit the variables directly. They are defaulted to '**lshift**' and '**GREEN**'
7+
8+
Holding the keybind while scoring a winning hand will mimic vanilla behaviour, useful in cases where you want to avoid drawing more cards
79

810
# Installation
911

@@ -13,4 +15,4 @@ Install [Lovely](https://github.com/ethangreen-dev/lovely-injector)
1315
Install [Steamodded](https://github.com/Steamopollys/Steamodded) (must be **1.0.0 or higher**)
1416

1517

16-
Download the newest release ([linked here](https://github.com/Toneblock/balatro-NotJustYet/releases/tag/v0.4.2)), extract the .zip, and place it into your Mods folder
18+
Download the newest release ([linked here](https://github.com/Toneblock/balatro-NotJustYet/releases/latest)), extract the .zip, and place it into your Mods folder
Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ if not to_big then
1414
function to_big(x) return x end
1515
end
1616
if (G.GAME.current_round.hands_left <= 0 and to_big(self.GAME.chips) < to_big(self.GAME.blind.chips)) or (GLOBAL_njy_vanilla_override and to_big(self.GAME.chips) >= to_big(self.GAME.blind.chips)) then
17+
stop_use()
1718
'''
1819
match_indent = true
1920

@@ -28,6 +29,7 @@ if not to_big then
2829
function to_big(x) return x end
2930
end
3031
if (G.GAME.current_round.hands_left <= 0 and to_big(self.GAME.chips) < to_big(self.GAME.blind.chips)) or (GLOBAL_njy_vanilla_override and to_big(self.GAME.chips) >= to_big(self.GAME.blind.chips)) then
32+
stop_use()
3133
'''
3234
match_indent = true
3335

@@ -42,6 +44,7 @@ if not to_big then
4244
function to_big(x) return x end
4345
end
4446
if (G.GAME.current_round.hands_left <= 0 and to_big(self.GAME.chips) < to_big(self.GAME.blind.chips)) or (GLOBAL_njy_vanilla_override and to_big(self.GAME.chips) >= to_big(self.GAME.blind.chips)) then
47+
stop_use()
4548
'''
4649
match_indent = true
4750

@@ -50,52 +53,64 @@ match_indent = true
5053
[patches.pattern]
5154
target = "game.lua"
5255
pattern = "if #G.hand.cards < 1 and #G.deck.cards < 1 and #G.play.cards < 1 then"
53-
position = "after"
56+
position = "at"
5457
payload = '''
55-
end
56-
if this_should_never_run_vg3dcw2vgubhijonbi then
58+
if not true then
5759
'''
5860
match_indent = true
5961

60-
# add ugly end round button
62+
# add slightly less ugly end round button
6163
[[patches]]
6264
[patches.pattern]
6365
target = "functions/UI_definitions.lua"
64-
pattern = '''G.SETTINGS.play_button_pos == 1 and play_button or discard_button,'''
65-
position = "after"
66+
pattern = '''G.SETTINGS.play_button_pos == 1 and discard_button or play_button,'''
67+
position = "before"
6668
payload = '''
67-
{n=G.UIT.R, config={id = 'njy_endround_button',align = "tm", padding = 0.3, r = 0.1, minw = 2.5, minh = button_height, hover = true, colour = G.C.GREEN, button = "njy_endround", one_press = true, shadow = true, func = 'njy_can_endround'}, nodes={
69+
{n=G.UIT.C, config={id = 'njy_end_button',align = "tm", padding = 0.3, r = 0.1, minw = 1.3, minh = button_height, hover = true, colour = G.C.GREEN, button = "njy_attempt_endround", one_press = true, shadow = true, func = 'njy_can_endround'}, nodes={
6870
{n=G.UIT.R, config={align = "cm", padding = 0}, nodes={
69-
{n=G.UIT.T, config={text = "End Round", scale = text_scale, colour = G.C.UI.TEXT_LIGHT, focus_args = {button = 'y', orientation = 'bm'}, func = 'set_button_pip'}}
71+
{n=G.UIT.T, config={text = "End", scale = text_scale, colour = G.C.UI.TEXT_LIGHT, focus_args = {button = 'y', orientation = 'bm'}, func = 'set_button_pip'}}
7072
}}
71-
}}
73+
}},
7274
'''
7375
match_indent = true
7476

75-
# REALLY dumb code to swap colour, updates every frame (lmfao)
77+
# move buttons to correct position
78+
[[patches]]
79+
[patches.pattern]
80+
target = "game.lua"
81+
pattern = '''config = {align="bm", offset = {x=0,y=0.3},major = G.hand, bond = 'Weak'}'''
82+
position = "at"
83+
payload = '''
84+
config = {align="bm", offset = {x=-0.65,y=0.3},major = G.hand, bond = 'Weak'}
85+
'''
86+
match_indent = true
87+
88+
# i TRIED to change this but nothing works??????????????????? code looks bad but genuinely, just doing "self.C.CHIPS_REQUIRED = {0.2941,0.76,0.5725,1}" doesn't work, pls explain
7689
[[patches]]
7790
[patches.pattern]
7891
target = "game.lua"
7992
pattern = "self.C.DARK_EDITION[2] = math.min(self.C.DARK_EDITION[3], self.C.DARK_EDITION[1])"
8093
position = "after"
8194
payload = '''
95+
local njy_red = self.C.RED
96+
local njy_green = self.C[G.njy_colour]
8297
if self.GAME and self.GAME.chips and self.GAME.blind and self.GAME.blind.chips then
8398
if not to_big then
8499
function to_big(x) return x end
85100
end
86101
if to_big(self.GAME.chips) >= to_big(self.GAME.blind.chips) then
87-
self.C.CHIPS_REQUIRED[1] = 0.2941
88-
self.C.CHIPS_REQUIRED[2] = 0.76
89-
self.C.CHIPS_REQUIRED[3] = 0.5725
102+
self.C.CHIPS_REQUIRED[1] = njy_green[1]
103+
self.C.CHIPS_REQUIRED[2] = njy_green[2]
104+
self.C.CHIPS_REQUIRED[3] = njy_green[3]
90105
else
91-
self.C.CHIPS_REQUIRED[1] = 1
92-
self.C.CHIPS_REQUIRED[2] = 0.3725
93-
self.C.CHIPS_REQUIRED[3] = 0.3333
106+
self.C.CHIPS_REQUIRED[1] = njy_red[1]
107+
self.C.CHIPS_REQUIRED[2] = njy_red[2]
108+
self.C.CHIPS_REQUIRED[3] = njy_red[3]
94109
end
95110
else
96-
self.C.CHIPS_REQUIRED[1] = 1
97-
self.C.CHIPS_REQUIRED[2] = 0.3725
98-
self.C.CHIPS_REQUIRED[3] = 0.3333
111+
self.C.CHIPS_REQUIRED[1] = njy_red[1]
112+
self.C.CHIPS_REQUIRED[2] = njy_red[2]
113+
self.C.CHIPS_REQUIRED[3] = njy_red[3]
99114
end
100115
'''
101116
match_indent = true
@@ -118,18 +133,18 @@ target = "functions/common_events.lua"
118133
pattern = "{n=G.UIT.T, config={text = G.GAME.blind.chip_text, scale = scale_number(G.GAME.blind.chips, scale, 100000), colour = G.C.RED, shadow = true}}"
119134
position = "at"
120135
payload = '''
121-
{n=G.UIT.T, config={text = G.GAME.blind.chip_text, scale = scale_number(G.GAME.blind.chips, scale, 100000), colour = G.C.GREEN, shadow = true}}
136+
{n=G.UIT.T, config={text = G.GAME.blind.chip_text, scale = scale_number(G.GAME.blind.chips, scale, 100000), colour = G.C[G.njy_colour], shadow = true}}
122137
'''
123138
match_indent = true
124139

125140
# insert new colour into globals.lua
126141
[[patches]]
127142
[patches.pattern]
128143
target = "globals.lua"
129-
pattern = "RED = HEX('FE5F55'),"
144+
pattern = "self.keybind_mapping = {{"
130145
position = "before"
131146
payload = '''
132-
CHIPS_REQUIRED = {0,0,0,1},
147+
self.C.CHIPS_REQUIRED = {0, 0, 0, 1}
133148
'''
134149
match_indent = true
135150

@@ -147,9 +162,7 @@ if key == G.njy_keybind then
147162
function to_big(x) return x end
148163
end
149164
if to_big(G.GAME.chips) >= to_big(G.GAME.blind.chips) then
150-
stop_use()
151-
G.STATE = G.STATES.NEW_ROUND
152-
end_round()
165+
G.FUNCS.njy_attempt_endround() -- idk what to put in this function man
153166
end
154167
end
155168
end
@@ -191,14 +204,15 @@ if G.GAME.current_round.hands_left <= 0 or #G.hand.highlighted <= (G.GAME.blind
191204
'''
192205
match_indent = true
193206

194-
# bugfix to make running out of cards properly end round (prevents double-end attempts)
207+
# prevents double-end attempts
195208
[[patches]]
196209
[patches.pattern]
197210
target = "game.lua"
198211
pattern = '''if #G.hand.cards < 1 and #G.deck.cards < 1 then'''
199212
position = "after"
200213
payload = '''
201-
stop_use()
202-
G.STATE = G.STATES.NEW_ROUND
214+
G.FUNCS.njy_attempt_endround()
215+
end
216+
if not true then
203217
'''
204-
match_indent = true
218+
match_indent = true

main.lua

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
--- PREFIX: njy
55
--- MOD_AUTHOR: [toneblock]
66
--- MOD_DESCRIPTION: Prevents scoring from ending the round early
7-
--- PRIORITY: 0
8-
--- DISPLAY_NAME: NotJustYet
97
--- BADGE_COLOUR: ffffff
10-
--- VERSION: 0.4.2
8+
--- DEPENDENCIES: [Steamodded>=1.0.0~ALPHA-1103a]
9+
--- VERSION: 0.5.0
1110

1211
----------------------------------------------
1312
------------MOD CODE -------------------------
@@ -16,30 +15,33 @@
1615

1716
G.njy_keybind = 'lshift'
1817

18+
-- The variable below defines the colour used in most places, as long as it's defined in the global colour table. Good examples are 'GOLD', 'IMPORTANT', 'TAROT', and 'DARK_EDITION'
1919

20+
G.njy_colour = 'GREEN'
2021

2122

2223

2324

2425

25-
26-
G.FUNCS.njy_can_endround = function(e) -- wtf is this talisman check? [[Fixed it! -Math]]
26+
G.FUNCS.njy_can_endround = function(e) -- wtf is this talisman check? [[Fixed it! -Math]] ty for fix
2727
if not to_big then
2828
function to_big(x) return x end
2929
end
3030
if to_big(G.GAME.chips) >= to_big(G.GAME.blind.chips) then
31-
e.config.colour = G.C.GREEN
32-
e.config.button = 'njy_endround'
31+
e.config.colour = G.C[G.njy_colour]
32+
e.config.button = 'njy_attempt_endround'
3333
else
3434
e.config.colour = G.C.UI.BACKGROUND_INACTIVE
3535
e.config.button = nil
3636
end
3737
end
3838

39-
G.FUNCS.njy_endround = function(e)
40-
stop_use()
41-
G.STATE = G.STATES.NEW_ROUND
42-
end_round()
39+
G.FUNCS.njy_attempt_endround = function(e)
40+
if G.STATE ~= G.STATES.NEW_ROUND then
41+
stop_use()
42+
G.STATE = G.STATES.NEW_ROUND
43+
end_round()
44+
end
4345
end
4446

4547
SMODS.Atlas({
@@ -49,6 +51,5 @@ SMODS.Atlas({
4951
py = 34
5052
}):register()
5153

52-
5354
----------------------------------------------
5455
------------MOD CODE END----------------------

0 commit comments

Comments
 (0)