Fix merging and The Improbable, reformat

This commit is contained in:
Emik 2025-04-04 21:59:44 +02:00
parent b222530dd6
commit 3e1317ec08
Signed by untrusted user who does not match committer: emik
GPG key ID: 09CDFF9E5703688D
6 changed files with 229 additions and 47 deletions

171
.editorconfig Normal file
View file

@ -0,0 +1,171 @@
# see https://github.com/CppCXY/EmmyLuaCodeStyle
[*.lua]
# [basic]
# optional space/tab
indent_style = space
# if indent_style is space, this is valid
indent_size = 4
# if indent_style is tab, this is valid
tab_width = 4
# none/single/double
quote_style = double
continuation_indent = 4
## extend option
# continuation_indent.before_block = 4
# continuation_indent.in_expr = 4
# continuation_indent.in_table = 4
# this mean utf8 length , if this is 'unset' then the line width is no longer checked
# this option decides when to chopdown the code
max_line_length = lf
# optional crlf/lf/cr/auto, if it is 'auto', in windows it is crlf other platforms are lf
# in neovim the value 'auto' is not a valid option, please use 'unset'
end_of_line = auto
# none/ comma / semicolon / only_kv_colon
table_separator_style = none
#optional keep/never/always/smart
trailing_table_separator = smart
# keep/remove/remove_table_only/remove_string_only
call_arg_parentheses = keep
detect_end_of_line = false
# this will check text end with new line
insert_final_newline = true
# [space]
space_around_table_field_list = false
space_before_attribute = false
space_before_function_open_parenthesis = false
space_before_function_call_open_parenthesis = false
space_before_closure_open_parenthesis = false
# optional always/only_string/only_table/none
# or true/false
space_before_function_call_single_arg = always
## extend option
## always/keep/none
# space_before_function_call_single_arg.table = always
## always/keep/none
# space_before_function_call_single_arg.string = always
space_before_open_square_bracket = false
space_inside_function_call_parentheses = false
space_inside_function_param_list_parentheses = false
space_inside_square_brackets = false
# like t[#t+1] = 1
space_around_table_append_operator = false
ignore_spaces_inside_function_call = false
# detail number or 'keep'
space_before_inline_comment = 1
# convert '---' to '--- ' or '--' to '-- '
space_after_comment_dash = false
# [operator space]
space_around_math_operator = true
# space_around_math_operator.exponent = false
space_after_comma = true
space_after_comma_in_for_statement = true
# true/false or none/always/no_space_asym
space_around_concat_operator = true
space_around_logical_operator = true
# true/false or none/always/no_space_asym
space_around_assign_operator = true
# [align]
align_call_args = false
align_function_params = true
# true/false or always
align_continuous_assign_statement = true
align_continuous_rect_table_field = true
align_continuous_line_space = 2
align_if_branch = false
# option none / always / contain_curly/
align_array_table = true
align_continuous_similar_call_args = false
align_continuous_inline_comment = true
# option none / always / only_call_stmt
align_chain_expr = none
# [indent]
never_indent_before_if_condition = false
never_indent_comment_on_if_branch = false
keep_indents_on_empty_lines = false
allow_non_indented_comments = false
# [line space]
# The following configuration supports four expressions
# keep
# fixed(n)
# min(n)
# max(n)
# for eg. min(2)
line_space_after_if_statement = fixed(2)
line_space_after_do_statement = fixed(2)
line_space_after_while_statement = fixed(2)
line_space_after_repeat_statement = fixed(2)
line_space_after_for_statement = fixed(2)
line_space_after_local_or_assign_statement = max(2)
line_space_after_function_statement = fixed(2)
line_space_after_expression_statement = max(2)
line_space_after_comment = fixed(1)
line_space_around_block = fixed(1)
# [line break]
break_all_list_when_line_exceed = false
auto_collapse_lines = false
break_before_braces = false
# [preference]
ignore_space_after_colon = false
remove_call_expression_list_finish_comma = true
# keep / always / same_line / replace_with_newline / never
end_statement_with_semicolon = replace_with_newline

View file

@ -3,8 +3,10 @@
"id": "Roland",
"name": "Roland",
"prefix": "Roland",
"author": ["Emik"],
"version": "1.2.6",
"author": [
"Emik"
],
"version": "1.2.7",
"badge_colour": "8BE9FD",
"main_file": "src/main.lua",
"badge_text_colour": "44475A",
@ -16,5 +18,5 @@
"Steamodded (>=1.*)",
"Lovely (>=0.6)",
"Bakery (>=1.3.2~*)"
]
]
}

View file

@ -32,16 +32,16 @@ function Game:update(dt)
orig_update(self, dt)
local orig = G.GAME.probabilities
if not G.GAME.improbable or not getmetatable(orig) then
if not G.GAME.improbable or getmetatable(orig) then
return
end
local mt = {
orig = orig,
__index = function (_, k)
__index = function(_, k)
return k == "normal" and 0 or orig[k]
end,
__newindex = function (_, k, v)
__newindex = function(_, k, v)
if k ~= "normal" or v ~= 0 then
orig[k] = v
end
@ -68,7 +68,7 @@ SMODS.Blind {
end,
}
SMODS.Blind {
SMODS.Blind {
key = "nimble",
boss = {min = 1, max = 10},
boss_colour = HEX("0291fb"),

View file

@ -4,7 +4,7 @@ local balanced_jokers = {banned_cards = {}}
SMODS.Challenge {
key = "Jokerful",
rules = {custom = {{id = "Roland_Jokerful"}}},
restrictions = jokerful
restrictions = jokerful,
}
local deck = {}
@ -44,19 +44,19 @@ G.E_MANAGER:add_event(Event {
F.foreach(
F.filter(
G.P_CENTERS,
function (v) return v.set == "Joker" end
function(v) return v.set == "Joker" end
),
function (v) table.insert(jokerful.banned_cards, {id = v.key}) end
function(v) table.insert(jokerful.banned_cards, {id = v.key}) end
)
F.foreach(
F.filter(
jokerful.banned_cards,
function (v) return v.id:sub(1, 6) == "j_cry_" or v.id:sub(1, 6) == "j_jen_" end
function(v) return v.id:sub(1, 6) == "j_cry_" or v.id:sub(1, 6) == "j_jen_" end
),
function (v) table.insert(balanced_jokers.banned_cards, {id = v.key}) end
function(v) table.insert(balanced_jokers.banned_cards, {id = v.key}) end
)
return true
end
end,
})

View file

@ -1,7 +1,7 @@
local function can_use()
return not ((G.play and #G.play.cards > 0 or
G.CONTROLLER.locked or
(G.GAME.STOP_USE and G.GAME.STOP_USE > 0)) and
G.CONTROLLER.locked or
(G.GAME.STOP_USE and G.GAME.STOP_USE > 0)) and
G.STATE ~= G.STATES.HAND_PLAYED and
G.STATE ~= G.STATES.DRAW_TO_HAND and
G.STATE ~= G.STATES.PLAY_TAROT)
@ -11,7 +11,7 @@ local function common_hand()
return (G.GAME or {}).current_round and F.reduce(
G.GAME.hands,
{name = "High Card", order = -1 / 0, played = 0},
function (a, v, k)
function(a, v, k)
return (a.played < v.played or (a.played == v.played) and (a.order > v.order)) and
{name = k, order = v.order, played = v.played} or a
end,
@ -24,9 +24,9 @@ local function destructible(card)
end
local function is_mergeable_with(it)
return function (card)
return function(card)
return it.rank ~= card.rank and
card.label == 'j_Roland_Escapey' and not
card.key == "j_Roland_Escapey" and not
(card.ability or {}).eternal
end
end
@ -53,26 +53,35 @@ SMODS.Joker {
loc_vars = function(_, _, card)
local loc_self = G.localization.descriptions.Joker.j_Roland_escapey
local quotes = loc_self.quotes
local merge = G.jokers and F.count(F.filter(G.jokers.cards, is_mergeable_with(card))) > 1 and loc_self.merge or {}
local normal = (merge[1] or (Jen or Jane or {}).sinister) and {} or pseudorandom_element(quotes.normal, pseudoseed("EscapeyQuotes")) or {}
local scared = (merge[1] or not (Jen or Jane or {}).sinister) and {} or pseudorandom_element(quotes.scared, pseudoseed("EscapeyQuotes")) or {}
return {vars = {
card.ability.extra.level_up_by,
localize(common_hand(), "poker_hands"),
merge[1] or "",
normal[1] or "",
scared[1] or "",
merge[2] or "",
merge[3] and loc_self.name or "",
merge[3] or "",
normal[2] or "",
scared[2] or "",
}}
local merge = G.jokers
and F.count(F.filter(G.jokers.cards, is_mergeable_with(card))) > 1
and loc_self.merge or {}
local normal = (merge[1] or (Jen or Jane or {}).sinister) and {} or
pseudorandom_element(quotes.normal, pseudoseed("EscapeyQuotes")) or {}
local scared = (merge[1] or not (Jen or Jane or {}).sinister) and {} or
pseudorandom_element(quotes.scared, pseudoseed("EscapeyQuotes")) or {}
return {
vars = {
card.ability.extra.level_up_by,
localize(common_hand(), "poker_hands"),
merge[1] or "",
normal[1] or "",
scared[1] or "",
merge[2] or "",
merge[3] and loc_self.name or "",
merge[3] or "",
normal[2] or "",
scared[2] or "",
},
}
end,
calculate = function (_, _, context)
calculate = function(_, _, context)
if type(G.escapey_debugger) == "function" then
G.escapey_debugger(F.reduce(context, "", function (acc, _, next) return acc .. ", " .. next end, pairs):sub(2))
G.escapey_debugger(F.reduce(context, "", function(acc, _, next) return acc .. ", " .. next end, pairs):sub(2))
end
end,
Bakery_can_use = function(_, card)
@ -96,7 +105,7 @@ SMODS.Joker {
F.foreach(
F.filter(G.jokers.cards, is_mergeable_with(card)),
function (v)
function(v)
sum = sum + v.ability.extra.level_up_by * (v.getEvalQty and v:getEvalQty() or 1)
v:start_dissolve({HEX("57ecab")}, nil, 1.6)
end
@ -110,18 +119,18 @@ SMODS.Joker {
sound = type(snd) == "string" and snd or type(snd) == "nil" and "button",
volume = vol or 0.7,
pitch = pit or 0.8,
delay = de or 0.3
delay = de or 0.3,
}, {
handname = name or "????",
chips = chip or "?",
level = lv or "?",
mult = mul or "?",
StatusText = notif
StatusText = notif,
})
end
local function fast_delete(v)
return function ()
return function()
attention_text({
scale = 0.7,
align = "cm",
@ -152,14 +161,14 @@ SMODS.Joker {
F.foreach(
F.filter(G.consumeables.cards, destructible),
function (v)
function(v)
v:start_dissolve({HEX("57ecab")}, nil, 1.6)
end
)
F.foreach(
G.GAME.tags,
function (v)
function(v)
G.E_MANAGER:add_event(Event({trigger = "immediate", func = fast_delete(v)}))
end
)

View file

@ -2,8 +2,8 @@ SMODS.Sound({key = "void", path = "void.ogg"})
local function can_use()
return not ((G.play and #G.play.cards > 0 or
G.CONTROLLER.locked or
(G.GAME.STOP_USE and G.GAME.STOP_USE > 0)) and
G.CONTROLLER.locked or
(G.GAME.STOP_USE and G.GAME.STOP_USE > 0)) and
G.STATE ~= G.STATES.HAND_PLAYED and
G.STATE ~= G.STATES.DRAW_TO_HAND and
G.STATE ~= G.STATES.PLAY_TAROT)
@ -13,7 +13,7 @@ SMODS.Atlas {
px = 71,
py = 95,
key = "void",
path = "void.png"
path = "void.png",
}
SMODS.Consumable {
@ -79,7 +79,7 @@ SMODS.Consumable {
delay = 0.27,
timer = "REAL",
trigger = "after",
func = void
func = void,
}))
end
}
end,
}