Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/sounds/xscore.ogg
Binary file not shown.
43 changes: 43 additions & 0 deletions localization/en-us.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,46 @@ return {
"card {C:attention}#1#{} #2#",
},
},
card_score = {
text = {
"{C:purple}#1#{} Score",
},
},
card_h_score = {
text = {
"{C:purple}#1#{} Score when held",
},
},
card_x_score = {
text = {
"{X:purple,C:white}X#1#{} Score",
},
},
card_h_x_score = {
text = {
"{X:purple,C:white}X#1#{} Score when held",
},
},
card_extra_score = {
text = {
"{C:purple}#1#{} extra Score",
},
},
card_extra_h_score = {
text = {
"{C:purple}#1#{} extra Score when held",
},
},
card_extra_x_score = {
text = {
"{X:purple,C:white}X#1#{} extra Score",
},
},
card_extra_h_x_score = {
text = {
"{X:purple,C:white}X#1#{} extra Score when held",
},
},
artist = {
text = {
"{C:inactive}Artist",
Expand Down Expand Up @@ -295,6 +335,9 @@ return {
cashout_hidden = '...and #1# more',
a_xchips = "X#1# Chips",
a_xchips_minus = "-X#1# Chips",
a_score="#1# Score",
a_score_x="X#1# Score",
a_score_x_minus="-X#1# Score",
smods_version_mismatch = {
"Your Steamodded version has changed",
"since this run was started!",
Expand Down
17 changes: 17 additions & 0 deletions lovely/better_calc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ if context.cardarea == G.play and context.main_scoring then
ret.playing_card.x_chips = x_chips
end

local add_score = card:get_bonus_add_score()
if add_score ~= 0 then
ret.playing_card.add_score = add_score
end
local x_score = card:get_bonus_x_score()
if x_score ~= 1 then
ret.playing_card.x_score = x_score
end
-- TARGET: main scoring on played cards
end
if context.end_of_round and context.cardarea == G.hand and context.playing_card_end_of_round then
Expand Down Expand Up @@ -168,6 +176,15 @@ if context.cardarea == G.hand and context.main_scoring then
ret.playing_card.x_chips = h_x_chips
end

local h_add_score = card:get_bonus_h_add_score()
if h_add_score ~= 0 then
ret.playing_card.add_score = h_add_score
end
local h_x_score = card:get_bonus_h_x_score()
if h_x_score ~= 1 then
ret.playing_card.h_x_score = h_x_score
end

-- TARGET: main scoring on held cards
"""

Expand Down
36 changes: 36 additions & 0 deletions lovely/perma_bonus.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ bonus_h_x_mult = self.ability.perma_h_x_mult ~= 0 and (self.ability.perma_h_x_mu
bonus_p_dollars = self.ability.perma_p_dollars ~= 0 and self.ability.perma_p_dollars or nil,
bonus_h_dollars = self.ability.perma_h_dollars ~= 0 and self.ability.perma_h_dollars or nil,
total_h_dollars = total_h_dollars ~= 0 and total_h_dollars or nil,
perma_score = self.ability.perma_score ~= 0 and (self.ability.perma_score) or nil,
perma_h_score = self.ability.perma_h_score ~= 0 and (self.ability.perma_h_score) or nil,
perma_x_score = self.ability.perma_x_score ~= 1 and (self.ability.perma_x_score) or nil,
perma_h_x_score = self.ability.perma_h_x_score ~= 1 and (self.ability.perma_h_x_score) or nil,
bonus_chips = bonus_chips ~= 0 and bonus_chips or nil,
bonus_repetitions = self.ability.perma_repetitions ~= 0 and self.ability.perma_repetitions or nil,'''
match_indent = true
Expand Down Expand Up @@ -140,6 +144,10 @@ perma_h_dollars = self.ability and self.ability.perma_h_dollars or 0,
perma_repetitions = self.ability and self.ability.perma_repetitions or 0,
card_limit = self.ability and self.ability.card_limit or 0,
extra_slots_used = self.ability and self.ability.extra_slots_used or 0,
perma_score = self.ability and self.ability.perma_score or 0,
perma_h_score = self.ability and self.ability.perma_h_score or 0,
perma_x_score = self.ability and self.ability.perma_x_score or 1,
perma_h_x_score = self.ability and self.ability.perma_h_x_score or 1,
'''
match_indent = true
overwrite = false
Expand Down Expand Up @@ -257,6 +265,34 @@ function Card:get_h_dollars()
-- TARGET: get_h_dollars
return ret
end

function Card:get_bonus_add_score()
if self.debuff then return 0 end
local ret = (self.ability.perma_add_score or 0)
-- TARGET: get_bonus_add_score
return ret
end

function Card:get_bonus_x_score()
if self.debuff then return 1 end
local ret = (self.ability.perma_x_score or 1)
-- TARGET: get_bonus_x_score
return ret
end

function Card:get_bonus_h_add_score()
if self.debuff then return 0 end
local ret = (self.ability.perma_h_add_score or 0)
-- TARGET: get_bonus_h_add_score
return ret
end

function Card:get_bonus_h_x_score()
if self.debuff then return 1 end
local ret = (self.ability.perma_h_x_score or 1)
-- TARGET: get_bonus_h_x_score
return ret
end
'''

# Card:get_p_dollars
Expand Down
72 changes: 72 additions & 0 deletions lovely/score_mod.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
[manifest]
version = "1.0.0"
dump_lua = true
priority = -10

# Score Modification!


[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = """ if extra.edition then """
position = "before"
payload = """
if extra.sound_override then
sound = extra.sound_override
end
if extra.update_score then
G.CARD_EVAL_TRIGGERED = nil
update_score = true
end
"""
overwrite = true
match_indent = true



[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = """ local trigger = 'before'"""
position = "before"
payload = """
local update_score = nil
"""
overwrite = true
match_indent = true



[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = """play_sound(sound, 0.8+percent*0.2, volume)"""
position = "before"
payload = """
if update_score then
G.SCORE_DISPLAY_QUEUE = G.SCORE_DISPLAY_QUEUE or {}
table.remove(G.SCORE_DISPLAY_QUEUE, 1)
G.HUD:get_UIE_by_ID('chip_UI_count'):juice_up(0.3, 0.3)
end
"""
overwrite = true
match_indent = true


[[patches]]
[patches.pattern]
target = 'functions/button_callbacks.lua'
pattern = """ local new_chips_text = number_format(G.GAME.chips)"""
position = "after"
payload = """if G.SCORE_DISPLAY_QUEUE and G.SCORE_DISPLAY_QUEUE[1] then
new_chips_text = number_format(G.SCORE_DISPLAY_QUEUE[1])
if G.GAME.chips_text ~= new_chips_text then
e.config.scale = math.min(0.8, scale_number(G.SCORE_DISPLAY_QUEUE[1], 1.1))
G.GAME.chips_text = new_chips_text
end
return
end
"""
overwrite = true
match_indent = true
11 changes: 10 additions & 1 deletion lsp_def/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -768,4 +768,13 @@ function SMODS.challenge_is_unlocked(challenge, k) end
--- a custom `func` to modify the values in specific ways. `hands` and `parameters` can
--- be limited to specific ones, or default to using all of `G.GAME.hands` and `SMODS.Scoring_Parameters`.
--- Use `level_up` to control whether the level of the hand is upgraded.
function SMODS.upgrade_poker_hands(args) end
function SMODS.upgrade_poker_hands(args) end

---Check if `challenge` is unlocked.
---@param mod_score Score_Mod_Parameter Score modification parameter
function SMODS.mod_score(mod_score) end

---@class Score_Mod_Parameter
---@field add? number Add score by this number
---@field mult? number Multiply score by this number
---@field card? Card Card responsible for score modification action, crucial for score display to work properly
1 change: 1 addition & 0 deletions src/game_object.lua
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ Set `prefix_config.key = false` on your object instead.]]):format(obj.key), obj.
end

SMODS.Sound{ key = 'xchips', path = 'xchips.ogg'}
SMODS.Sound{ key = 'xscore', path = 'xscore.ogg'}

-------------------------------------------------------------------------------------------------
------- API CODE GameObject.Gradient
Expand Down
60 changes: 60 additions & 0 deletions src/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,16 @@ SMODS.calculate_individual_effect = function(effect, scored_card, key, amount, f
})
return true
end
if (key == 'xscore' or key == 'h_xscore' or key == 'x_score' or key == 'h_x_score') and amount ~= 1 then
if effect.card and effect.card ~= scored_card then juice_card(effect.card) end
SMODS.mod_score({ mult = amount, card = effect.message_card or effect.juice_card or scored_card or effect.card or effect.focus })
return true
end
if (key == 'score' or key == 'h_score' or key == 'add_score' or key == 'h_add_score') and amount ~= 0 then
if effect.card and effect.card ~= scored_card then juice_card(effect.card) end
SMODS.mod_score({ add = amount, card = effect.message_card or effect.juice_card or scored_card or effect.card or effect.focus })
return true
end

if key == 'message' and not SMODS.no_resolve then
if effect.card and effect.card ~= scored_card then juice_card(effect.card) end
Expand Down Expand Up @@ -1448,6 +1458,8 @@ SMODS.scoring_parameter_keys = {
}
SMODS.other_calculation_keys = {
'p_dollars', 'dollars', 'h_dollars',
'score', 'add_score', 'h_score', 'h_add_score',
'xscore', 'x_score', 'h_x_score', 'h_xscore',
'swap', 'balance',
'saved', 'effect', 'remove',
'debuff', 'prevent_debuff', 'debuff_text',
Expand Down Expand Up @@ -3038,6 +3050,18 @@ function SMODS.localize_perma_bonuses(specific_vars, desc_nodes)
if specific_vars and specific_vars.bonus_h_dollars then
localize{type = 'other', key = 'card_extra_h_dollars', nodes = desc_nodes, vars = {SMODS.signed_dollars(specific_vars.bonus_h_dollars)}}
end
if specific_vars and specific_vars.perma_score then
localize{type = 'other', key = 'card_extra_score', nodes = desc_nodes, vars = {SMODS.signed(specific_vars.perma_score)}}
end
if specific_vars and specific_vars.perma_h_score then
localize{type = 'other', key = 'card_extra_h_score', nodes = desc_nodes, vars = {SMODS.signed(specific_vars.perma_h_score)}}
end
if specific_vars and specific_vars.perma_x_score then
localize{type = 'other', key = 'card_extra_x_score', nodes = desc_nodes, vars = {(specific_vars.perma_x_score)}}
end
if specific_vars and specific_vars.perma_h_x_score then
localize{type = 'other', key = 'card_extra_h_x_score', nodes = desc_nodes, vars = {(specific_vars.perma_h_x_score)}}
end
if specific_vars and specific_vars.bonus_repetitions then
localize{type = 'other', key = 'card_extra_repetitions', nodes = desc_nodes, vars = {specific_vars.bonus_repetitions, localize(specific_vars.bonus_repetitions > 1 and 'b_retrigger_plural' or 'b_retrigger_single')}}
end
Expand Down Expand Up @@ -3409,4 +3433,40 @@ function SMODS.log_crash_info(info, defined)
else
return string.format("\n\nError exists in %s at line %d\r\n", info.source, line)
end
end

-- function to modify score: normally accepts add and mult argument and additionally card argument
SMODS.mod_score = function(score_mod)
score_mod = score_mod or {}
local score_fx = {}
local score_cal = score_mod.set or G.GAME.chips
local old = G.GAME.chips
G.SCORE_DISPLAY_QUEUE = G.SCORE_DISPLAY_QUEUE or {}
-- TARGET: higher priority score operation
if score_mod.mult then
local absoluted = math.abs(score_mod.mult)
score_cal = score_cal * score_mod.mult
table.insert(G.SCORE_DISPLAY_QUEUE, old)
table.insert(score_fx, {score_mod.mult < 0 and "a_score_x_minus" or "a_score_x", absoluted, "xscore"})
end
if score_mod.add and score_mod.add ~= 0 then
local absoluted = math.abs(score_mod.add)
score_cal = score_cal + score_mod.add
table.insert(G.SCORE_DISPLAY_QUEUE, old)
table.insert(score_fx, {"a_score", score_mod.add, "gong"})
end
-- TARGET: lower priority score operation
G.GAME.chips = score_cal
if score_mod.card then
for _, values in ipairs(score_fx) do
card_eval_status_text(score_mod.card, 'jokers', nil, percent, nil, {message = localize{type='variable',key= values[1],vars={values[2]}}, update_score = true, volume = 0.5, sound_override = values[3], colour = G.C.PURPLE})
-- this check is in case some skip animation mods is there, may be removed in the future
if G.CARD_EVAL_TRIGGERED then
G.SCORE_DISPLAY_QUEUE = nil
end
end
else
G.SCORE_DISPLAY_QUEUE = nil
end
delay(0.2)
end