Skip to content

Commit b67ae00

Browse files
authored
Shop Card Editing (#953)
1 parent 446c42d commit b67ae00

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

lovely/shop.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,3 +251,21 @@ card:set_edition(edition)
251251
position = 'at'
252252
match_indent = true
253253
payload = '''card:set_edition(poll_edition('illusion', nil, true, true))'''
254+
255+
256+
# modify_shop_card context for allowing shop cards to be modified (duh)
257+
[[patches]]
258+
[patches.pattern]
259+
target = 'functions/UI_definitions.lua'
260+
pattern = '''
261+
local card = create_card(v.type, area, nil, nil, nil, nil, nil, 'sho')
262+
'''
263+
position = 'at'
264+
payload = '''
265+
local args = {set = v.type, area = area, key_append = 'sho'}
266+
local flags = SMODS.calculate_context({create_shop_card = true, set = v.type})
267+
local create_flags = SMODS.merge_defaults(flags.shop_create_flags or {}, args)
268+
local card = SMODS.create_card(create_flags)
269+
SMODS.calculate_context({modify_shop_card = true, card = card})
270+
'''
271+
match_indent = true

src/utils.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,8 +1363,8 @@ SMODS.calculate_individual_effect = function(effect, scored_card, key, amount, f
13631363
return key
13641364
end
13651365

1366-
if key == 'remove' or key == 'debuff_text' or key == 'cards_to_draw' or key == 'numerator' or key == 'denominator' or key == 'no_destroy' or
1367-
key == 'replace_scoring_name' or key == 'replace_display_name' or key == 'replace_poker_hands' or key == 'modify' then
1366+
if key == 'remove' or key == 'debuff_text' or key == 'cards_to_draw' or key == 'numerator' or key == 'denominator' or key == 'no_destroy' or
1367+
key == 'replace_scoring_name' or key == 'replace_display_name' or key == 'replace_poker_hands' or key == 'modify' or key == 'shop_create_flags' then
13681368
return { [key] = amount }
13691369
end
13701370

@@ -1466,7 +1466,8 @@ SMODS.other_calculation_keys = {
14661466
'modify',
14671467
'no_destroy', 'prevent_trigger',
14681468
'replace_scoring_name', 'replace_display_name', 'replace_poker_hands',
1469-
'extra'
1469+
'shop_create_flags',
1470+
'extra',
14701471
}
14711472
SMODS.silent_calculation = {
14721473
saved = true, effect = true, remove = true,

0 commit comments

Comments
 (0)