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
162 changes: 161 additions & 1 deletion lovely/blind.toml
Original file line number Diff line number Diff line change
Expand Up @@ -587,4 +587,164 @@ pattern = "local blindTable = {"
position = "after"
payload = '''
effect = self.effect,
'''
'''

## Custom Small/Big Blinds Support

# Add custom small/big blinds to `G.GAME.bosses_used`
[[patches]]
[patches.pattern]
target = 'game.lua'
match_indent = true
position = 'at'
pattern = '''
local bosses_used = {}
'''
payload = '''
local bosses_used = setmetatable({boss = {}, small = {}, big = {}},{
__index = function(t, key)
return t.boss[key] or t.big[key] or t.small[key]
end,
__newindex = function(t, key, value)
rawset(t.boss, key, value)
end
})
'''

# Prepare bosses_used
[[patches]]
[patches.pattern]
target = 'game.lua'
match_indent = true
position = 'at'
pattern = '''
if v.boss then bosses_used[k] = 0 end
'''
payload = '''
if v.boss then bosses_used.boss[k] = 0 end
if v.small then bosses_used.small[k] = 0 end
if v.big then bosses_used.big[k] = 0 end
'''


## Custom Small/Big Blinds
[[patches]]
[patches.pattern]
target = 'functions/common_events.lua'
pattern = '''G.GAME.round_resets.blind_choices.Boss = get_new_boss()'''
position = 'at'
match_indent = true
payload = '''
SMODS.reset_blind_choices(G.GAME.round_resets.blind_choices)
'''

# Add Custom Small/Big Blinds
[[patches]]
[patches.pattern]
target = 'game.lua'
match_indent = true
position = 'at'
pattern = '''
self.GAME.round_resets.blind_choices.Boss = get_new_boss()
'''
payload = '''
SMODS.reset_blind_choices(self.GAME.round_resets.blind_choices)
'''

# Handle setting new blinds
[[patches]]
[patches.pattern]
target = 'blind.lua'
match_indent = true
position = 'at'
pattern = '''
self.boss = blind and not not blind.boss
'''
payload = '''
self[self.current_slot or ''] = nil
self[string.lower(G.GAME.blind_on_deck or '')] = blind and true or nil
self.current_slot = string.lower(G.GAME.blind_on_deck or '')
'''
# Handle 'Defeated' tagging
[[patches]]
[patches.pattern]
target = 'functions/state_events.lua'
match_indent = true
position = 'at'
pattern = '''
if G.GAME.round_resets.blind == G.P_BLINDS.bl_small then
'''
payload = '''
if G.GAME.round_resets.blind_states.Small == 'Current' then
'''
[[patches]]
[patches.pattern]
target = 'functions/state_events.lua'
match_indent = true
position = 'at'
pattern = '''
elseif G.GAME.round_resets.blind == G.P_BLINDS.bl_big then
'''
payload = '''
elseif G.GAME.round_resets.blind_states.Big == 'Current' then
'''

# Ensure boss table exists
[[patches]]
[patches.pattern]
target = "functions/common_events.lua"
pattern = '''if v.boss.showdown then '''
position = "at"
payload = '''if v.boss and v.boss.showdown then '''
match_indent = true

# # Fix boss colour not resetting properly
# [[patches]]
# [patches.pattern]
# target = 'blind.lua'
# match_indent = true
# position = 'at'
# pattern = '''
# if not self.boss and self.name then
# '''
# payload = '''
# if not self.boss and not self.in_blind then
# '''



# These patches prepare vanilla blinds for polling with weights and differing slots
[[patches]]
[patches.pattern]
target = 'game.lua'
match_indent = true
position = 'before'
pattern = '''
self.b_undiscovered = {name = 'Undiscovered', debuff_text = 'Defeat this blind to discover', pos = {x=0,y=30}}
'''
payload = '''
for key, blind in pairs(self.P_BLINDS) do
if blind.boss and blind.boss.max then
blind.boss.max = nil
if blind.boss.showdown then
blind.boss.min = nil
end
blind.blind_types = {'boss'}
end
if key == 'bl_small' then blind.small = {min = 1, allow_duplicates = true}; blind.blind_types = {'small'} end
if key == 'bl_big' then blind.big = {min = 1, allow_duplicates = true}; blind.blind_types = {'big'} end
end
'''

# Allow small and big blinds to block skipping
[[patches]]
[patches.pattern]
target = 'functions/UI_definitions.lua'
match_indent = true
position = 'at'
pattern = '''
extras = create_UIBox_blind_tag(type, run_info)
'''
payload = '''
if not blind_choice.config.unskippable then extras = create_UIBox_blind_tag(type, run_info) end
'''
45 changes: 45 additions & 0 deletions lovely/ui.toml
Original file line number Diff line number Diff line change
Expand Up @@ -490,3 +490,48 @@ self.draw_steps[#self.draw_steps+1] = {
payload = '''
tilt_shadow = v.tilt_shadow,
'''

# Blind mod badge display during run
[[patches]]
[patches.pattern]
target = 'functions/UI_definitions.lua'
match_indent = true
position = 'after'
pattern = '''
{n=G.UIT.R, config={align = "cm",padding = 0.15}, nodes={
{n=G.UIT.O, config={object = G.GAME.blind, draw_layer = 1}},
{n=G.UIT.C, config={align = "cm",r = 0.1, padding = 0.05, emboss = 0.05, minw = 2.9, colour = G.C.BLACK}, nodes={
{n=G.UIT.R, config={align = "cm", maxw = 2.8}, nodes={
{n=G.UIT.T, config={text = localize('ph_blind_score_at_least'), scale = 0.3, colour = G.C.WHITE, shadow = true}}
}},
{n=G.UIT.R, config={align = "cm", minh = 0.6}, nodes={
{n=G.UIT.O, config={w=0.5,h=0.5, colour = G.C.BLUE, object = stake_sprite, hover = true, can_collide = false}},
{n=G.UIT.B, config={h=0.1,w=0.1}},
{n=G.UIT.T, config={ref_table = G.GAME.blind, ref_value = 'chip_text', scale = 0.001, colour = G.C.RED, shadow = true, id = 'HUD_blind_count', func = 'blind_chip_UI_scale'}}
}},
{n=G.UIT.R, config={align = "cm", minh = 0.45, maxw = 2.8, func = 'HUD_blind_reward'}, nodes={
{n=G.UIT.T, config={text = localize('ph_blind_reward'), scale = 0.3, colour = G.C.WHITE}},
{n=G.UIT.O, config={object = DynaText({string = {{ref_table = G.GAME.current_round, ref_value = 'dollars_to_be_earned'}}, colours = {G.C.MONEY},shadow = true, rotate = true, bump = true, silent = true, scale = 0.45}),id = 'dollars_to_be_earned'}},
}},
}},
}},
}},
'''
payload = '''
{n=G.UIT.R, config = {align = "cm", r = 0.1, id = 'HUD_blind_badge', func = 'HUD_blind_badge'}, nodes = {
SMODS.create_blind_mod_badge()
}},
'''

# adjust placement of G.HUD
[[patches]]
[patches.pattern]
target = 'game.lua'
match_indent = true
position = 'at'
pattern = '''
config = {align=('cli'), offset = {x=-0.7,y=0},major = G.ROOM_ATTACH}
'''
payload = '''
config = {align=('cli'), offset = {x=-0.7,y=0.4},major = G.ROOM_ATTACH}
'''
38 changes: 0 additions & 38 deletions lovely/weights.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,42 +61,4 @@ if G.FORCE_TAG then return G.FORCE_TAG end
'''
payload = '''
if SMODS.optional_features.object_weights then return SMODS.poll_object({type = 'Tag', append = append}) end
'''


# These patches add functionality for polling blinds, but are a precursor for full support of modded small and big blinds
# TODO: move to blind related toml
# Adjust vanilla blinds max ante property
[[patches]]
[patches.pattern]
target = 'game.lua'
match_indent = true
position = 'before'
pattern = '''
self.b_undiscovered = {name = 'Undiscovered', debuff_text = 'Defeat this blind to discover', pos = {x=0,y=30}}
'''
payload = '''
for key, blind in pairs(self.P_BLINDS) do
if blind.boss and blind.boss.max then
blind.boss.max = nil
if blind.boss.showdown then
blind.boss.min = nil
end
end
if key == 'bl_small' then blind.small = {min = 1} end
if key == 'bl_big' then blind.big = {min = 1} end
end
'''

# Add custom small/big blinds to `G.GAME.bosses_used`
[[patches]]
[patches.pattern]
target = 'game.lua'
match_indent = true
position = 'after'
pattern = '''
if v.boss then bosses_used[k] = 0 end
'''
payload = '''
if v.small or v.big then bosses_used[k] = 0 end
'''
64 changes: 1 addition & 63 deletions src/game_object.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1809,69 +1809,7 @@ SMODS.UndiscoveredCompat = {
----- API CODE GameObject.Blind
-------------------------------------------------------------------------------------------------

SMODS.Blinds = {}
SMODS.Blind = SMODS.GameObject:extend {
obj_table = SMODS.Blinds,
obj_buffer = {},
class_prefix = 'bl',
debuff = {},
vars = {},
config = {},
dollars = 5,
mult = 2,
atlas = 'blind_chips',
discovered = false,
pos = { x = 0, y = 0 },
required_params = {
'key',
},
set = 'Blind',
get_obj = function(self, key) return G.P_BLINDS[key] end,
register = function(self)
self.name = self.name or self.key
SMODS.Blind.super.register(self)
end,
inject = function(self, i)
-- no pools to query length of, so we assign order manually
if not self.taken_ownership then
self.order = 30 + i
end
G.P_BLINDS[self.key] = self
if self.modifies_draw then SMODS.Blinds.modifies_draw[self.key] = true end
end
}
SMODS.Blind:take_ownership('eye', {
set_blind = function(self, reset, silent)
if not reset then
G.GAME.blind.hands = {}
for _, v in ipairs(G.handlist) do
G.GAME.blind.hands[v] = false
end
end
end
})
SMODS.Blind:take_ownership('wheel', {
loc_vars = function(self)
return { vars = { SMODS.get_probability_vars(self, 1, 7, 'wheel') } }
end,
collection_loc_vars = function(self)
return { vars = { '1', '7' }}
end,
process_loc_text = function(self)
local text = G.localization.descriptions.Blind[self.key].text[1]
if string.sub(text, 1, 3) ~= '#1#' then
G.localization.descriptions.Blind[self.key].text[1] = "#1#"..text
end
-- Is this too much hacky?
G.localization.descriptions.Blind[self.key].text[1] = string.gsub(G.localization.descriptions.Blind[self.key].text[1], "7", "#2#")
SMODS.Blind.process_loc_text(self)
end,
get_loc_debuff_text = function() return G.GAME.blind.loc_debuff_text end,
})

SMODS.Blinds.modifies_draw = {
bl_serpent = true
}
assert(load(SMODS.NFS.read(SMODS.path..'src/game_objects/blind.lua'), ('=[SMODS _ "src/game_objects/blind.lua"]')))()

-------------------------------------------------------------------------------------------------
----- API CODE GameObject.Seal
Expand Down
Loading