Skip to content

Commit 47754fa

Browse files
committed
implement new rounds system, reroll every ante variant
1 parent f99eb2c commit 47754fa

File tree

2 files changed

+154
-2
lines changed

2 files changed

+154
-2
lines changed

src/randomJokersEveryAnte.lua

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
local patched = false
2+
local roundsPlayed = 0
3+
4+
resetRoundsOnRestart = function()
5+
roundsPlayed = 0
6+
end
7+
8+
advanceRound = function()
9+
roundsPlayed = roundsPlayed + 1
10+
end
11+
12+
rollJoker = function()
13+
if roundsPlayed > 1 then
14+
for i = 1,5,1
15+
do
16+
G.E_MANAGER:add_event(Event({trigger = 'after', delay = 0.4, func = function()
17+
play_sound('timpani')
18+
local card = create_card('Joker', G.jokers)
19+
card:add_to_deck()
20+
G.jokers:emplace(card)
21+
return true end }))
22+
delay(0.6)
23+
end
24+
end
25+
end
26+
27+
destroyJokers = function()
28+
for _, joker in ipairs(G.jokers.cards) do
29+
joker:start_dissolve(nil, (k ~= 1))
30+
end
31+
end
32+
33+
local randomJokersEveryAnte = {
34+
mod_id = "randomJokersEveryAnte",
35+
name = "Random Jokers Every Ante",
36+
version = "1.0",
37+
author = "gdemerald",
38+
description = {
39+
"On each Ante, destroy all jokers and roll 5 new ones"
40+
},
41+
enabled = true,
42+
on_enable = function()
43+
44+
local patch = [[
45+
if not reset then
46+
bossBlinds = {
47+
'The Hook',
48+
'The Ox',
49+
'The House',
50+
'The Wall',
51+
'The Wheel',
52+
'The Arm',
53+
'The Club',
54+
'The Fish',
55+
'The Psychic',
56+
'The Goad',
57+
'The Water',
58+
'The Window',
59+
'The Manacle',
60+
'The Eye',
61+
'The Mouth',
62+
'The Plant',
63+
'The Serpent',
64+
'The Pillar',
65+
'The Needle',
66+
'The Head',
67+
'The Tooth',
68+
'The Flint',
69+
'The Mark',
70+
'Amber Acorn',
71+
'Verdant Leaf',
72+
'Violet Vessel',
73+
'Crimson Heart',
74+
'Cerulean Bell'
75+
}
76+
77+
for i, blindName in ipairs(bossBlinds) do
78+
if self.name == blindName then
79+
destroyJokers()
80+
end
81+
end
82+
end
83+
]]
84+
injectTail("blind.lua", "Blind:defeat", patch)
85+
86+
local startPatch = [[
87+
if not reset then
88+
advanceBlinds = {
89+
'Small Blind',
90+
'Big Blind',
91+
'The Hook',
92+
'The Ox',
93+
'The House',
94+
'The Wall',
95+
'The Wheel',
96+
'The Arm',
97+
'The Club',
98+
'The Fish',
99+
'The Psychic',
100+
'The Goad',
101+
'The Water',
102+
'The Window',
103+
'The Manacle',
104+
'The Eye',
105+
'The Mouth',
106+
'The Plant',
107+
'The Serpent',
108+
'The Pillar',
109+
'The Needle',
110+
'The Head',
111+
'The Tooth',
112+
'The Flint',
113+
'The Mark',
114+
'Amber Acorn',
115+
'Verdant Leaf',
116+
'Violet Vessel',
117+
'Crimson Heart',
118+
'Cerulean Bell'
119+
}
120+
for i, blind in ipairs(advanceBlinds) do
121+
if self.name == blind then
122+
advanceRound()
123+
end
124+
end
125+
if self.name == "Small Blind" then
126+
destroyJokers()
127+
rollJoker()
128+
end
129+
end
130+
]]
131+
injectTail('blind.lua', "Blind:set_blind", startPatch)
132+
133+
local patch = [[
134+
resetRoundsOnRestart()
135+
]]
136+
injectTail('game.lua', "Game:start_run", patch)
137+
end,
138+
139+
on_post_update = function()
140+
if not patched then
141+
init_localization()
142+
patched = true
143+
end
144+
end
145+
}
146+
147+
table.insert(mods, randomJokersEveryAnte)

src/randomJokers.lua renamed to src/randomJokersEveryBlind.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ resetRoundsOnRestart = function()
99
roundsPlayed = 0
1010
end
1111

12+
--advance the round count when a blind is selected
13+
advanceRound = function()
14+
roundsPlayed = roundsPlayed + 1
15+
end
16+
1217
--called upon blind select, generates 5 new jokers
1318
rollJoker = function()
14-
roundsPlayed = roundsPlayed + 1
1519
if roundsPlayed > 1 then
1620
for i = 1,5,1
1721
do
@@ -37,7 +41,7 @@ end
3741
local randomJokersMod = {
3842
mod_id = "randomJokersOnBlindSelect",
3943
name = "Random Jokers",
40-
version = "1.0",
44+
version = "1.1",
4145
author = "gdemerald",
4246
description = {
4347
"On blind select, destroy all jokers and create 5 random ones (first blind excluded)"
@@ -84,6 +88,7 @@ local randomJokersMod = {
8488
8589
for i, blindName in ipairs(blindsToReroll) do
8690
if self.name == blindName then
91+
advanceRound()
8792
destroyJokers()
8893
rollJoker()
8994
end

0 commit comments

Comments
 (0)