Use more intuitive logic for merging jokers

This commit is contained in:
Emik 2025-03-28 16:23:54 +01:00
parent 0cea7728fe
commit 39d429e56d
Signed by untrusted user who does not match committer: emik
GPG key ID: 09CDFF9E5703688D
2 changed files with 21 additions and 8 deletions

View file

@ -12,5 +12,5 @@
"Bakery (>=0.1.26~*)"
],
"conflicts": ["Jen"],
"version": "0.2.1"
"version": "0.2.2"
}

View file

@ -226,6 +226,16 @@ function Game:update(dt)
end
end
local function find_uncorrupted(obj, start)
for i = start, #obj do
if not obj[i].ability.extra.is_corrupted then
return i
end
end
return nil
end
local function hand(name, chip, mul, lv, notif, snd, vol, pit, de)
local config = {
delay = de or 0.3,
@ -329,14 +339,17 @@ function Game:update(dt)
G.P_BLINDS["bl_jane_wee"].mult = 22 / blind
G.P_BLINDS["bl_jane_descending"].mult = math.floor(8 * math.sqrt(blind)) / blind
local honey = SMODS.find_card("j_jane_honey")
while true do
local honey = SMODS.find_card("j_jane_honey")
local first = find_uncorrupted(honey, 1)
local second = find_uncorrupted(honey, first)
for _, v in ipairs(honey) do
if not v.ability.extra.is_corrupted and v ~= honey[#honey] then
v.sell_cost = v.sell_cost + honey[#honey].sell_cost
v.ability.extra.is_corrupted = true
honey[#honey]:start_dissolve()
honey[#honey] = nil
if second then
honey[first].sell_cost = v.sell_cost + honey[second].sell_cost
honey[first].ability.extra.is_corrupted = true
honey[second]:start_dissolve()
else
break
end
end