Skip to content

Commit 2ba8884

Browse files
authored
fix bugs
1 parent 8b83050 commit 2ba8884

File tree

2 files changed

+71
-110
lines changed

2 files changed

+71
-110
lines changed

lovely.toml

Lines changed: 29 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ function Card:calculate_dollar_bonus(blueprintnum)
4343
'''
4444
match_indent = true
4545

46+
# be careful!
47+
[[patches]]
48+
[patches.pattern]
49+
target = "card.lua"
50+
pattern = '''if other_joker_ret then'''
51+
position = "before"
52+
payload = '''
53+
if other_joker_ret and other_joker_ret == true then
54+
return other_joker_ret
55+
end
56+
'''
57+
match_indent = true
4658

4759

4860

@@ -150,7 +162,7 @@ function Card:soft_add_to_deck()
150162
if self.ability.name == "Pareidolia" then
151163
exb_pareiupd()
152164
end
153-
if self.ability.name == 'Credit Card' then
165+
if self.ability.name == 'Credit Card' and true then
154166
G.GAME.bankrupt_at = G.GAME.bankrupt_at - self.ability.extra
155167
end
156168
--[[ yeah don't do this one
@@ -209,7 +221,7 @@ function Card:soft_remove_from_deck()
209221
if self.ability.name == "Pareidolia" then
210222
exb_pareiupd()
211223
end
212-
if self.ability.name == 'Credit Card' then
224+
if self.ability.name == 'Credit Card' and true then
213225
G.GAME.bankrupt_at = G.GAME.bankrupt_at + self.ability.extra
214226
end
215227
if self.ability.name == 'Chaos the Clown' then
@@ -482,47 +494,38 @@ match_indent = true
482494

483495

484496

485-
# remove sixth sense breaking loop, gives one speccy per copy
497+
# sixth sense
486498
[[patches]]
487499
[patches.pattern]
488-
target = "functions/state_events.lua"
489-
pattern = '''if destroyed then break end'''
500+
target = "card.lua"
501+
pattern = '''elseif context.destroying_card and not context.blueprint then'''
490502
position = "at"
491503
payload = '''
492-
if destroyed then _destroyed = true end
493-
'''
494-
match_indent = true
495-
496-
# this is scuffed
497-
[[patches]]
498-
[patches.pattern]
499-
target = "functions/state_events.lua"
500-
pattern = '''local destroyed = nil'''
501-
position = "after"
502-
payload = '''
503-
local _destroyed = nil
504+
elseif context.destroying_card then
504505
'''
505506
match_indent = true
506507

507-
# juggling practice
508+
# don't break loop
508509
[[patches]]
509510
[patches.pattern]
510-
target = "functions/state_events.lua"
511-
pattern = '''if scoring_hand[i].will_shatter then destroyed = true end'''
512-
position = "before"
511+
target = '''=[SMODS _ "src/utils.lua"]'''
512+
pattern = '''
513+
if should_break then break end'''
514+
position = "at"
513515
payload = '''
514-
if _destroyed then destroyed = true end
515516
'''
516517
match_indent = true
517518

518-
# make sixth sense compatible with blueprint
519+
# again
519520
[[patches]]
520521
[patches.pattern]
521-
target = "card.lua"
522-
pattern = '''elseif context.destroying_card and not context.blueprint then'''
522+
target = '''=[SMODS _ "src/utils.lua"]'''
523+
pattern = '''
524+
should_break = true
525+
break'''
523526
position = "at"
524527
payload = '''
525-
elseif context.destroying_card then
528+
should_break = true
526529
'''
527530
match_indent = true
528531

@@ -598,88 +601,6 @@ match_indent = true
598601

599602

600603

601-
# splash might get messy
602-
# we switch the generic "score all" into the same mechanism as stone cards
603-
# while the original is fast, it's not flexible. this allows us to easily find cards that aren't part of the poker hand
604-
[[patches]]
605-
[patches.pattern]
606-
target = "functions/state_events.lua"
607-
pattern = '''scoring_hand[i] = G.play.cards[i]'''
608-
position = "at"
609-
payload = '''
610-
local inside = false
611-
for j=1, #scoring_hand do
612-
if scoring_hand[j] == G.play.cards[i] then
613-
inside = true
614-
end
615-
end
616-
if not inside then table.insert(pures, G.play.cards[i]) end
617-
'''
618-
match_indent = true
619-
620-
# define a local function to check if it's in pures
621-
[[patches]]
622-
[patches.pattern]
623-
target = "functions/state_events.lua"
624-
pattern = '''local percent_delta = 0.08'''
625-
position = "after"
626-
payload = '''
627-
local function exb_check_unscoring(_ccard, _ppures)
628-
local inside = false
629-
for i = 1, #_ppures do
630-
if _ccard == _ppures[i] then inside = true end
631-
end
632-
return inside
633-
end
634-
'''
635-
match_indent = true
636-
637-
# terrifying overwrite
638-
[[patches]]
639-
[patches.pattern]
640-
target = "functions/state_events.lua"
641-
pattern = '''local eval = eval_card(G.jokers.cards[j], {cardarea = G.play, full_hand = G.play.cards, scoring_hand = scoring_hand, scoring_name = text, poker_hands = poker_hands, other_card = scoring_hand[i], repetition = true, callback = function(card, ret) eval = {jokers = ret}'''
642-
position = "at"
643-
payload = '''
644-
local eval = eval_card(G.jokers.cards[j], {cardarea = G.play, full_hand = G.play.cards, scoring_hand = scoring_hand, scoring_name = text, poker_hands = poker_hands, other_card = scoring_hand[i], orig_unscoring = exb_check_unscoring(scoring_hand[i], pures), repetition = true, callback = function(card, ret) eval = {jokers = ret}
645-
'''
646-
match_indent = true
647-
648-
# splash calculate, it sucks a little bit but it should be fine
649-
[[patches]]
650-
[patches.pattern]
651-
target = "card.lua"
652-
pattern = '''if self.ability.name == 'Hack' and ('''
653-
position = "before"
654-
payload = '''
655-
if self.ability.name == 'Splash' and context.orig_unscoring then
656-
local initial = false
657-
if not context.blueprint then
658-
-- check if self is the leftmost splash. the leftmost splash will be used to score the cards originally
659-
-- don't do this for bloopies
660-
for i = 1, #G.jokers.cards do
661-
if G.jokers.cards[i].ability.name == 'Splash' and G.jokers.cards[i] ~= self then
662-
break
663-
elseif G.jokers.cards[i] == self then
664-
initial = true
665-
break
666-
end
667-
end
668-
end
669-
if not initial then
670-
return {
671-
message = localize('k_again_ex'),
672-
repetitions = 1,
673-
card = self
674-
}
675-
end
676-
end
677-
'''
678-
match_indent = true
679-
680-
681-
682-
683604
# pareidolia stacking, this is dumb
684605
[[patches]]
685606
[patches.pattern]

main.lua

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
--- MOD_DESCRIPTION: Increases blueprint compatibility
77
--- BADGE_COLOUR: 4b68ce
88
--- DEPENDENCIES: [Steamodded>=1.0.0~ALPHA-1216c]
9-
--- VERSION: 0.3.1
9+
--- VERSION: 0.3.2
1010

1111
----------------------------------------------
1212
------------MOD CODE -------------------------
@@ -185,7 +185,47 @@ function exb_jokerlock()
185185
return exb.config.lock and (G.GAME and G.GAME.STOP_USE and G.GAME.STOP_USE > 0 and (G.STATE == G.STATES.HAND_PLAYED or G.STATE == G.STATES.NEW_ROUND or G.STATE == G.STATES.ROUND_EVAL))
186186
end
187187

188-
188+
SMODS.Joker:take_ownership('j_splash', {
189+
no_mod_badges = true,
190+
calculate = function(self, card, context)
191+
if context.repetition and context.full_hand and context.full_hand[1] then
192+
local poker_hands = evaluate_poker_hand(context.full_hand)
193+
local top = nil
194+
for _, v in ipairs(G.handlist) do
195+
if next(poker_hands[v]) then
196+
text = v
197+
top = poker_hands[v][1]
198+
break
199+
end
200+
end
201+
local inside = false
202+
for i = 1, #top do
203+
204+
if context.other_card == top[i] then inside = true end
205+
end
206+
local initial = false
207+
if not context.blueprint then
208+
-- check if self is the leftmost splash. the leftmost splash will be used to score the cards originally
209+
-- don't do this for bloopies
210+
for i = 1, #G.jokers.cards do
211+
if G.jokers.cards[i].ability.name == 'Splash' and G.jokers.cards[i] ~= card then
212+
break
213+
elseif G.jokers.cards[i] == card then
214+
initial = true
215+
break
216+
end
217+
end
218+
end
219+
if (not initial) and (not inside) then
220+
return {
221+
message = localize('k_again_ex'),
222+
repetitions = 1,
223+
card = card
224+
}
225+
end
226+
end
227+
end
228+
})
189229

190230

191231

0 commit comments

Comments
 (0)