Completely rewrite Honey
This commit is contained in:
parent
9f5eedb704
commit
a879fa12b2
5 changed files with 167 additions and 87 deletions
|
|
@ -12,5 +12,5 @@
|
|||
"Bakery (>=0.1.26~*)"
|
||||
],
|
||||
"conflicts": ["Jen"],
|
||||
"version": "0.2.5"
|
||||
"version": "0.3.0"
|
||||
}
|
||||
|
|
@ -2,25 +2,6 @@ SMODS.Sound({key = "e_jumbo", path = "e_jumbo.ogg"})
|
|||
SMODS.Shader({key = "polygloss", path = "polygloss.fs"})
|
||||
SMODS.Sound({key = "e_polygloss", path = "e_polygloss.ogg"})
|
||||
|
||||
local function resize(card, mod, force_save)
|
||||
if force_save or not card.origsize then
|
||||
card.origsize = {w = card.T.w, h = card.T.h}
|
||||
end
|
||||
|
||||
card:hard_set_T(card.T.x, card.T.y, card.T.w * mod, card.T.h * mod)
|
||||
remove_all(card.children)
|
||||
card.children = {}
|
||||
card.children.shadow = Moveable(0, 0, 0, 0)
|
||||
card:set_sprites(card.config.center, card.base.id and card.config.card)
|
||||
|
||||
if card.area and
|
||||
((G.shop_jokers and card.area == G.shop_jokers) or
|
||||
(G.shop_booster and card.area == G.shop_booster) or
|
||||
(G.shop_vouchers and card.area == G.shop_vouchers)) then
|
||||
create_shop_card_ui(card)
|
||||
end
|
||||
end
|
||||
|
||||
SMODS.Edition({
|
||||
key = "polygloss",
|
||||
loc_txt = {
|
||||
|
|
@ -101,7 +82,7 @@ SMODS.Edition({
|
|||
blocking = false,
|
||||
blockable = false,
|
||||
func = function()
|
||||
resize(card, Jane.config.wee_sizemod)
|
||||
Jane.resize(card, Jane.config.wee_sizemod)
|
||||
return true
|
||||
end
|
||||
}))
|
||||
|
|
@ -127,7 +108,7 @@ SMODS.Edition({
|
|||
blocking = false,
|
||||
blockable = false,
|
||||
func = function()
|
||||
resize(card, 1 / Jane.config.wee_sizemod)
|
||||
Jane.resize(card, 1 / Jane.config.wee_sizemod)
|
||||
return true
|
||||
end
|
||||
}))
|
||||
|
|
|
|||
163
src/joker.lua
163
src/joker.lua
|
|
@ -157,34 +157,107 @@ SMODS.Joker {
|
|||
end
|
||||
}
|
||||
|
||||
function Jane.update_honey()
|
||||
if not G.GAME then
|
||||
return
|
||||
end
|
||||
|
||||
local honey = SMODS.find_card("j_jane_honey")
|
||||
local mergeable = {}
|
||||
local max = 1
|
||||
|
||||
for _, v in pairs(honey) do
|
||||
local level = tonumber(v.ability.extra.level) or 1
|
||||
max = math.max(max, level)
|
||||
|
||||
if not mergeable[level] then
|
||||
mergeable[level] = v
|
||||
elseif level == 1 then
|
||||
mergeable[0] = v
|
||||
end
|
||||
end
|
||||
|
||||
for i = math.min(max, #Jane.rarity_ids - 2), 1, -1 do
|
||||
if not mergeable[i] then
|
||||
goto continue
|
||||
end
|
||||
|
||||
local skip = true
|
||||
|
||||
for j = i - 1, i == 1 and 0 or 1, -1 do
|
||||
if not mergeable[j] then
|
||||
break
|
||||
end
|
||||
|
||||
skip = j > 1
|
||||
end
|
||||
|
||||
if skip then
|
||||
goto continue
|
||||
end
|
||||
|
||||
for j = i - 1, i == 1 and 0 or 1, -1 do
|
||||
mergeable[i].sell_cost = mergeable[i].sell_cost + mergeable[j].sell_cost
|
||||
mergeable[j].ability.extra.level = "-1"
|
||||
mergeable[j]:start_dissolve()
|
||||
end
|
||||
|
||||
mergeable[i].ability.extra.level = tostring(tonumber(mergeable[i].ability.extra.level) + 1)
|
||||
::continue::
|
||||
end
|
||||
end
|
||||
|
||||
SMODS.Joker {
|
||||
key = "honey",
|
||||
atlas = "janehoney",
|
||||
loc_txt = {
|
||||
name = "Honey{C:dark_edition}#1#",
|
||||
text = {
|
||||
"{C:attention}Common#2#{}#3#",
|
||||
"{C:attention}#2#{}#3#",
|
||||
"#4#cannot appear",
|
||||
"#5#{C:attention}#6#",
|
||||
"{C:dark_edition}#7#{}#8#{C:inactive,s:0.75,E:1}#9#",
|
||||
"{C:inactive,s:0.75,E:1}#10#{C:red,s:1.5,E:1}#11#",
|
||||
}
|
||||
},
|
||||
config = {extra = {is_corrupted = false}},
|
||||
config = {extra = {level = "1"}}, -- Strings do not get mutated by other mods
|
||||
pos = {x = 0, y = 0},
|
||||
sinis = {x = 2, y = 0},
|
||||
soul_pos = {x = 1, y = 0},
|
||||
eternal_compat = false,
|
||||
cost = 8,
|
||||
rarity = 3,
|
||||
loc_vars = function(_, _, card)
|
||||
local is_corrupted = card.ability.extra.is_corrupted
|
||||
local level = tonumber(card.ability.extra.level)
|
||||
|
||||
local function level_name(i)
|
||||
local acc = ""
|
||||
local prefixes = {"super", "hyper", "ultra"}
|
||||
|
||||
while i > 0 do
|
||||
acc = prefixes[((i - 1) % 3) + 1] .. acc
|
||||
i = math.floor(i / 3)
|
||||
end
|
||||
|
||||
return #acc == 0 and "Corrupted" or acc:gsub("^%l", string.upper) .. "corrupted"
|
||||
end
|
||||
|
||||
local is_corrupted = level > 1
|
||||
local exclusions = is_corrupted and "" or Jane.rarity_names[level]
|
||||
local separator = level == 2 and " " or (is_corrupted and ", " or "")
|
||||
|
||||
if is_corrupted then
|
||||
for i = 1, level do
|
||||
exclusions = exclusions .. separator .. (i == level and "and " or "") .. Jane.rarity_names[i]
|
||||
end
|
||||
end
|
||||
|
||||
return {vars = {
|
||||
is_corrupted and " (Corrupted)" or "",
|
||||
is_corrupted and " and Uncommon" or "",
|
||||
is_corrupted and " (" .. level_name(level - 2) .. ")" or "",
|
||||
(exclusions or ""):sub(#separator),
|
||||
is_corrupted and "" or " jokers",
|
||||
is_corrupted and "jokers " or "",
|
||||
is_corrupted and "" or "Getting another ",
|
||||
is_corrupted and (level >= #Jane.rarity_names - 1 and "Cannot be upgraded." or "") or "Getting another ",
|
||||
is_corrupted and "" or "Honey",
|
||||
is_corrupted and "" or "corrupts ",
|
||||
is_corrupted and "" or "this Joker",
|
||||
|
|
@ -196,10 +269,16 @@ SMODS.Joker {
|
|||
update = function(_, card, _)
|
||||
if card.added_to_deck and card.children.center and card.children.floating_sprite then
|
||||
local extra = card.ability.extra or {}
|
||||
local y = extra.is_corrupted and 1 or 0
|
||||
local y = tonumber(extra.level) > 1 and 1 or 0
|
||||
card.children.center:set_sprite_pos({x = 0, y = y})
|
||||
card.children.floating_sprite:set_sprite_pos({x = Jane.sinister and 2 or 1, y = y})
|
||||
end
|
||||
|
||||
local level = tonumber(card.ability.extra.level)
|
||||
|
||||
if not Jane.sinister and level > 2 then
|
||||
card:juice_up(0, math.random() * (level - 2) / #Jane.rarity_ids)
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
|
|
@ -210,14 +289,21 @@ end
|
|||
local orig_rarity = SMODS.poll_rarity
|
||||
|
||||
function SMODS.poll_rarity(_pool_key, _rand_key)
|
||||
local is_corrupted
|
||||
local max = 0
|
||||
|
||||
for _, v in pairs(SMODS.find_card("j_jane_honey")) do
|
||||
is_corrupted = is_corrupted or v.ability.extra.is_corrupted
|
||||
max = math.max(max, v.ability.extra.level)
|
||||
end
|
||||
|
||||
local rarity = orig_rarity(_pool_key, _rand_key)
|
||||
return (is_corrupted and (rarity == 1 or rarity == 2)) and 3 or ((is_corrupted ~= nil and rarity == 1) and 2 or rarity)
|
||||
|
||||
for i = 1, max do
|
||||
if rarity == Jane.rarity_ids[i] then
|
||||
return Jane.rarity_ids[max + 1] or Jane.rarity_ids[#Jane.rarity_ids]
|
||||
end
|
||||
end
|
||||
|
||||
return rarity
|
||||
end
|
||||
|
||||
local oxy_quotes = {
|
||||
|
|
@ -234,6 +320,35 @@ local oxy_quotes = {
|
|||
}
|
||||
}
|
||||
|
||||
function Jane.oxy(card, removed)
|
||||
local extra = card.ability.extra or {}
|
||||
local destroyed_steel = 0
|
||||
|
||||
for _, v in pairs(removed or {}) do
|
||||
if (v.ability or {}).name == "Steel Card" then
|
||||
destroyed_steel = destroyed_steel + 1
|
||||
end
|
||||
end
|
||||
|
||||
if destroyed_steel > 0 then
|
||||
extra.progress = extra.progress + destroyed_steel
|
||||
|
||||
card_eval_status_text(
|
||||
card,
|
||||
"extra",
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
{
|
||||
message = (extra.is_corrupted and "+" or "-") .. destroyed_steel,
|
||||
colour = extra.is_corrupted and G.C.PURPLE or G.C.GREY
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
local steel = 1.5
|
||||
|
||||
SMODS.Joker {
|
||||
key = "oxy",
|
||||
atlas = "janeoxy",
|
||||
|
|
@ -248,7 +363,7 @@ SMODS.Joker {
|
|||
"{C:inactive,s:0.75,E:1}#11#{C:red,s:1.5,E:1}#12#",
|
||||
}
|
||||
},
|
||||
config = {extra = {corrupted_steel = 2.5, is_corrupted = false, milestone = 3, progress = 0, steel = 1.5}},
|
||||
config = {extra = {corrupted_steel = 2.5, is_corrupted = false, milestone = 3, progress = 0}},
|
||||
pos = {x = 0, y = 0},
|
||||
sinis = {x = 2, y = 0},
|
||||
soul_pos = {x = 1, y = 0},
|
||||
|
|
@ -260,7 +375,7 @@ SMODS.Joker {
|
|||
local milestone = ability.milestone
|
||||
local progress = ability.progress
|
||||
local is_corrupted = ability.is_corrupted
|
||||
local amount = is_corrupted and ability.corrupted_steel or ability.steel
|
||||
local amount = is_corrupted and ability.corrupted_steel or steel
|
||||
local effective = is_corrupted and progress or milestone - progress
|
||||
local plural = effective == 1 and "" or "s"
|
||||
|
||||
|
|
@ -289,29 +404,7 @@ SMODS.Joker {
|
|||
end,
|
||||
calculate = function(_, card, context)
|
||||
local extra = card.ability.extra or {}
|
||||
local destroyed_steel = 0
|
||||
|
||||
for _, v in pairs(context.removed or {}) do
|
||||
if (v.ability or {}).name == "Steel Card" then
|
||||
destroyed_steel = destroyed_steel + 1
|
||||
end
|
||||
end
|
||||
|
||||
if destroyed_steel > 0 then
|
||||
extra.progress = extra.progress + destroyed_steel
|
||||
|
||||
card_eval_status_text(
|
||||
card,
|
||||
"extra",
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
{
|
||||
message = (extra.is_corrupted and "+" or "-") .. destroyed_steel,
|
||||
colour = extra.is_corrupted and G.C.PURPLE or G.C.GREY
|
||||
}
|
||||
)
|
||||
end
|
||||
Jane.oxy(card, context.removed)
|
||||
|
||||
if context.end_of_round and
|
||||
extra.progress > 0 and not
|
||||
|
|
|
|||
53
src/main.lua
53
src/main.lua
|
|
@ -9,6 +9,10 @@ Jane = {
|
|||
Jane.misprintize = (Cryptid or {}).misprintize
|
||||
Jane.misprintize_tbl = (Cryptid or {}).misprintize_tbl
|
||||
Jane.misprinitze_val = (Cryptid or {}).misprintize_val
|
||||
Jane.rarity_ids = Cryptid and {1, 2, 3, "cry_epic", 4, "cry_exotic", "jane_junk"} or {1, 2, 3, 4, "jane_junk"}
|
||||
|
||||
Jane.rarity_names = Cryptid and {"Common", "Uncommon", "Rare", "Epic", "Legendary", "Exotic", "Junk"} or
|
||||
{"Common", "Uncommon", "Rare", "Legendary", "Junk"}
|
||||
|
||||
if not Jane.misprintize then
|
||||
assert(SMODS.load_file("src/misprintize.lua"))()
|
||||
|
|
@ -170,6 +174,25 @@ function Jane.play_sound(sound, per, vol)
|
|||
}))
|
||||
end
|
||||
|
||||
function Jane.resize(card, mod, force_save)
|
||||
if force_save or not card.origsize then
|
||||
card.origsize = {w = card.T.w, h = card.T.h}
|
||||
end
|
||||
|
||||
card:hard_set_T(card.T.x, card.T.y, card.T.w * mod, card.T.h * mod)
|
||||
remove_all(card.children)
|
||||
card.children = {}
|
||||
card.children.shadow = Moveable(0, 0, 0, 0)
|
||||
card:set_sprites(card.config.center, card.base.id and card.config.card)
|
||||
|
||||
if card.area and
|
||||
((G.shop_jokers and card.area == G.shop_jokers) or
|
||||
(G.shop_booster and card.area == G.shop_booster) or
|
||||
(G.shop_vouchers and card.area == G.shop_vouchers)) then
|
||||
create_shop_card_ui(card)
|
||||
end
|
||||
end
|
||||
|
||||
function Jane.q(fc, de, t, tr, bl, ba)
|
||||
G.E_MANAGER:add_event(Event({
|
||||
timer = t,
|
||||
|
|
@ -226,16 +249,6 @@ 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,
|
||||
|
|
@ -338,25 +351,7 @@ function Game:update(dt)
|
|||
local blind = get_blind_amount((ante >= 1 and ante <= 8) and math.floor(ante) or ante)
|
||||
G.P_BLINDS["bl_jane_wee"].mult = 22 / blind
|
||||
G.P_BLINDS["bl_jane_descending"].mult = math.floor(8 * math.sqrt(blind)) / blind
|
||||
|
||||
while G.GAME do
|
||||
local honey = SMODS.find_card("j_jane_honey")
|
||||
local first = find_uncorrupted(honey, 1)
|
||||
|
||||
if not first then
|
||||
break
|
||||
end
|
||||
|
||||
local second = find_uncorrupted(honey, first)
|
||||
|
||||
if not second then
|
||||
break
|
||||
end
|
||||
|
||||
honey[first].sell_cost = honey[first].sell_cost + honey[second].sell_cost
|
||||
honey[first].ability.extra.is_corrupted = true
|
||||
honey[second]:start_dissolve()
|
||||
end
|
||||
Jane.update_honey()
|
||||
|
||||
if not Jane.bans_done then
|
||||
delete_hardbans()
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ local exotic = Cryptid and "cry_exotic" or 4
|
|||
|
||||
SMODS.Rarity {
|
||||
key = "junk",
|
||||
default_weight = 1e-9,
|
||||
loc_txt = {name = "Junk"},
|
||||
badge_colour = G.C.JOKER_GREY,
|
||||
}
|
||||
|
|
@ -313,6 +314,10 @@ SMODS.Joker {
|
|||
return not card.debuff and Jane.can_use() and next(G.hand.highlighted)
|
||||
end,
|
||||
Bakery_use_joker = function(_, _)
|
||||
for _, v in pairs(SMODS.find_card("j_jane_oxy")) do
|
||||
Jane.oxy(v, G.hand.highlighted)
|
||||
end
|
||||
|
||||
for _, v in pairs(G.hand.highlighted) do
|
||||
v:start_dissolve()
|
||||
end
|
||||
|
|
@ -623,6 +628,12 @@ SMODS.Joker {
|
|||
cost = 1,
|
||||
rarity = "jane_junk",
|
||||
in_pool = function (_, _)
|
||||
for _, v in pairs(SMODS.find_card("j_jane_honey")) do
|
||||
if tonumber(v.ability.extra.level) == #Jane.rarity_ids - 1 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return not not next(SMODS.find_card("j_jane_rot"))
|
||||
end,
|
||||
calculate = function(_, card, context)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue