Skip to content

Commit cd6f061

Browse files
authored
Merge branch 'main' into draw
2 parents 6110cbd + a33c48e commit cd6f061

File tree

8 files changed

+405
-43
lines changed

8 files changed

+405
-43
lines changed

lovely/better_calc.toml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,18 @@ match_indent = true
11271127
payload = '''
11281128
SMODS.calculate_context({buying_card = true, card = c1})
11291129
'''
1130-
1130+
# context.starting_shop
1131+
[[patches]]
1132+
[patches.pattern]
1133+
target = 'game.lua'
1134+
pattern = '''
1135+
G.CONTROLLER:snap_to({node = G.shop:get_UIE_by_ID('next_round_button')})
1136+
'''
1137+
position = 'before'
1138+
match_indent = true
1139+
payload = '''
1140+
if not nosave_shop then SMODS.calculate_context({starting_shop = true}) end
1141+
'''
11311142
# context.ending_shop
11321143
[[patches]]
11331144
[patches.pattern]

lovely/blind.toml

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,43 @@ dump_lua = true
44
priority = -10
55

66
### Blind API
7+
## elseif-ify some if chains
8+
[[patches]]
9+
[patches.regex]
10+
target = 'blind.lua'
11+
pattern = "end\n(?<indent>[\t ]*)if self.name == ['\"](?<ability>.*?)['\"]"
12+
position = 'at'
13+
payload = "elseif self.name == '$ability'"
14+
15+
# revert the change for The Pillar
16+
[[patches]]
17+
[patches.regex]
18+
target = 'blind.lua'
19+
pattern = "(?<indent>[\t ]*)elseif self.name == 'The Pillar' and card.ability.played_this_ante then"
20+
position = 'at'
21+
line_prepend = '$indent'
22+
payload = '''end
23+
if self.name == 'The Pillar' and card.ability.played_this_ante then'''
24+
25+
# revert the change for The Eye in debuff_hand
26+
[[patches]]
27+
[patches.regex]
28+
target = 'blind.lua'
29+
pattern = "(?<indent>[\t ]*)elseif self.name == 'The Eye' then"
30+
position = 'at'
31+
line_prepend = '$indent'
32+
payload = '''end
33+
if self.name == 'The Eye' then'''
34+
35+
# revert the change for The Arm in debuff_hand
36+
[[patches]]
37+
[patches.regex]
38+
target = 'blind.lua'
39+
pattern = "(?<indent>[\t ]*)elseif self.name == 'The Arm' then"
40+
position = 'at'
41+
line_prepend = '$indent'
42+
payload = '''end
43+
if self.name == 'The Arm' then'''
744

845
## Set debuffed_by_blind, use it for Matador behavior
946
## Blind:debuff_card()
@@ -52,16 +89,17 @@ self.children.animatedSprite.atlas = G.ANIMATION_ATLAS[obj.atlas] or G.ANIMATION
5289
[[patches]]
5390
[patches.pattern]
5491
target = 'blind.lua'
55-
pattern = '--add new debuffs'
56-
position = 'before'
57-
match_indent = true
92+
pattern = "if self.name == 'The Eye' and not reset then"
93+
position = 'at'
5894
payload = '''
59-
if not reset then
60-
local obj = self.config.blind
61-
if obj.set_blind and type(obj.set_blind) == 'function' then
62-
obj:set_blind()
63-
end
64-
end'''
95+
if blind then
96+
self.in_blind = true
97+
end
98+
local obj = self.config.blind
99+
if obj.set_blind and type(obj.set_blind) == 'function' then
100+
obj:set_blind()
101+
elseif self.name == 'The Eye' and not reset then'''
102+
match_indent = true
65103

66104
# Blind:disable()
67105
[[patches]]
@@ -99,7 +137,7 @@ match_indent = true
99137
payload = '''
100138
local obj = self.config.blind
101139
if not self.disabled and obj.recalc_debuff and type(obj.recalc_debuff) == 'function' then
102-
if obj:recalc_debuff(card, from_blind) then
140+
if obj:recalc_debuff(card, from_blind) then
103141
card:set_debuff(true)
104142
if card.debuff then card.debuffed_by_blind = true end
105143
else
@@ -108,7 +146,7 @@ if not self.disabled and obj.recalc_debuff and type(obj.recalc_debuff) == 'funct
108146
return
109147
elseif not self.disabled and obj.debuff_card and type(obj.debuff_card) == 'function' then
110148
sendWarnMessage(("Blind object %s has debuff_card function, recalc_debuff is preferred"):format(obj.key), obj.set)
111-
if obj:debuff_card(card, from_blind) then
149+
if obj:debuff_card(card, from_blind) then
112150
card:set_debuff(true)
113151
if card.debuff then card.debuffed_by_blind = true end
114152
else
@@ -141,7 +179,8 @@ payload = '''
141179
local obj = self.config.blind
142180
if obj.drawn_to_hand and type(obj.drawn_to_hand) == 'function' then
143181
obj:drawn_to_hand()
144-
end'''
182+
end
183+
'''
145184

146185
# Blind:debuff_hand()
147186
[[patches]]

lovely/booster.toml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,37 @@ priority = -10
77

88
# Card:open
99
[[patches]]
10-
[patches.regex]
10+
[patches.pattern]
1111
target = "card.lua"
12-
pattern = '''(?<indent>[\t ]*)if self\.ability\.name:find\('Arcana'\) then \n[\s\S]{12}G\.STATE'''
13-
position = "before"
14-
payload = '''
12+
pattern = '''
13+
if self.ability.name:find('Arcana') then
14+
G.STATE = G.STATES.TAROT_PACK
15+
G.GAME.pack_size = self.ability.extra
16+
elseif self.ability.name:find('Celestial') then
17+
G.STATE = G.STATES.PLANET_PACK
18+
G.GAME.pack_size = self.ability.extra
19+
elseif self.ability.name:find('Spectral') then
20+
G.STATE = G.STATES.SPECTRAL_PACK
21+
G.GAME.pack_size = self.ability.extra
22+
elseif self.ability.name:find('Standard') then
23+
G.STATE = G.STATES.STANDARD_PACK
24+
G.GAME.pack_size = self.ability.extra
25+
elseif self.ability.name:find('Buffoon') then
26+
G.STATE = G.STATES.BUFFOON_PACK
27+
G.GAME.pack_size = self.ability.extra
28+
end
29+
30+
G.GAME.pack_choices = self.config.center.config.choose or 1'''
31+
match_indent = true
32+
position = "at"
33+
payload = """
1534
booster_obj = self.config.center
1635
if booster_obj and SMODS.Centers[booster_obj.key] then
1736
G.STATE = G.STATES.SMODS_BOOSTER_OPENED
1837
SMODS.OPENED_BOOSTER = self
19-
end'''
20-
line_prepend = '$indent'
38+
end
39+
G.GAME.pack_choices = self.ability.choose or self.config.center.config.choose or 1
40+
"""
2141

2242
# Card:open
2343
[[patches]]

lovely/fixes.toml

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pattern = "if G.SAVED_GAME ~= nil then G.SAVED_GAME = STR_UNPACK(G.SAVED_GAME) e
3535
position = 'after'
3636
match_indent = true
3737
payload = """
38-
if G.SAVED_GAME == nil then
38+
if G.SAVED_GAME == nil then
3939
e.config.colour = G.C.UI.BACKGROUND_INACTIVE
4040
e.config.button = nil
4141
return _can_continue
@@ -168,7 +168,7 @@ if self.added_to_deck and old_center and not self.debuff then
168168
self:remove_from_deck()
169169
self.added_to_deck = true
170170
end
171-
if type(center) == 'string' then
171+
if type(center) == 'string' then
172172
assert(G.P_CENTERS[center])
173173
center = G.P_CENTERS[center]
174174
end
@@ -351,7 +351,7 @@ payload = ""
351351
#
352352

353353
## create_UIBox_HUD
354-
[[patches]]
354+
[[patches]]
355355
[patches.regex]
356356
target = "functions/UI_definitions.lua"
357357
pattern = '''
@@ -364,7 +364,7 @@ payload = '''
364364
end,'''
365365

366366
## DynaText:update_text
367-
[[patches]]
367+
[[patches]]
368368
[patches.pattern]
369369
target = "engine/text.lua"
370370
pattern = 'self.config.H = 0'
@@ -401,18 +401,6 @@ pattern = 'if G\.GAME\.blind then'
401401
position = "at"
402402
payload = "if G.GAME.blind and G.GAME.blind.in_blind then"
403403

404-
# Blind:set_blind
405-
[[patches]]
406-
[patches.pattern]
407-
target = "blind.lua"
408-
match_indent = true
409-
pattern = "if not reset then"
410-
position = "after"
411-
payload = '''
412-
if blind then
413-
self.in_blind = true
414-
end'''
415-
416404
# end_round()
417405
[[patches]]
418406
[patches.pattern]
@@ -575,6 +563,19 @@ pattern = '''and \(G\.hand\.cards\[1\] or \(G\.hand\.config\.card_limit <= 0\)\)
575563
position = "at"
576564
payload = ''' '''
577565

566+
# Fix prng calls on collection advancing seeds
567+
# Keep vanilla behaviour for to-do list
568+
[[patches]]
569+
[patches.pattern]
570+
target = "functions/misc_functions.lua"
571+
pattern = "if key == 'seed' then return math.random() end"
572+
position = "after"
573+
payload = """
574+
if G.SETTINGS.paused and key ~= 'to_do' then return math.random() end
575+
"""
576+
overwrite = true
577+
match_indent = true
578+
578579
# Fixes Steam API not loading on unix
579580
[[patches]]
580581
[patches.pattern]
@@ -584,7 +585,7 @@ position = 'after'
584585
pattern = '--To control when steam communication happens, make sure to send updates to steam as little as possible'
585586
payload = '''local cwd = NFS.getWorkingDirectory()
586587
NFS.setWorkingDirectory(love.filesystem.getSourceBaseDirectory())
587-
'''
588+
'''
588589

589590
[[patches]]
590591
[patches.pattern]
@@ -593,7 +594,7 @@ match_indent = true
593594
position = 'before'
594595
pattern = '--Set up the render window and the stage for the splash screen, then enter the gameloop with :update'
595596
payload = '''NFS.setWorkingDirectory(cwd)
596-
'''
597+
'''
597598

598599
[[patches]]
599600
[patches.pattern]

0 commit comments

Comments
 (0)