Add blind art
This commit is contained in:
parent
3f5d86af73
commit
4cfe3fa7c2
3 changed files with 63 additions and 48 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 10 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 2.6 KiB |
111
src/blind.lua
111
src/blind.lua
|
|
@ -7,12 +7,73 @@ SMODS.Atlas {
|
||||||
atlas_table = "ANIMATION_ATLAS",
|
atlas_table = "ANIMATION_ATLAS",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local function disable_improbable()
|
||||||
|
G.GAME.improbable = nil
|
||||||
|
local orig = (getmetatable(G.GAME.probabilities) or {}).orig
|
||||||
|
|
||||||
|
if orig then
|
||||||
|
G.GAME.probabilities = orig
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if cry_prob then
|
||||||
|
local orig_prob = cry_prob
|
||||||
|
|
||||||
|
---@diagnostic disable-next-line: lowercase-global
|
||||||
|
cry_prob = function(owned, den, rigged)
|
||||||
|
return G.GAME.improbable and 0 or orig_prob(owned, den, rigged)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local orig_update = Game.update
|
||||||
|
|
||||||
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
|
function Game:update(dt)
|
||||||
|
orig_update(self, dt)
|
||||||
|
local orig = G.GAME.probabilities
|
||||||
|
|
||||||
|
if not G.GAME.improbable or not getmetatable(orig) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local mt = {
|
||||||
|
orig = orig,
|
||||||
|
__index = function (_, k)
|
||||||
|
return k == "normal" and 0 or orig[k]
|
||||||
|
end,
|
||||||
|
__newindex = function (_, k, v)
|
||||||
|
if k ~= "normal" or v ~= 0 then
|
||||||
|
orig[k] = v
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
local proxy = {}
|
||||||
|
setmetatable(proxy, mt)
|
||||||
|
G.GAME.probabilities = proxy
|
||||||
|
end
|
||||||
|
|
||||||
|
SMODS.Blind {
|
||||||
|
key = "improbable",
|
||||||
|
boss = {min = 1, max = 10},
|
||||||
|
boss_colour = HEX("009966"),
|
||||||
|
atlas = "blind",
|
||||||
|
pos = {x = 0, y = 0},
|
||||||
|
mult = 2,
|
||||||
|
dollars = 5,
|
||||||
|
defeat = disable_improbable,
|
||||||
|
disable = disable_improbable,
|
||||||
|
set_blind = function(_)
|
||||||
|
G.GAME.improbable = true
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
SMODS.Blind {
|
SMODS.Blind {
|
||||||
key = "nimble",
|
key = "nimble",
|
||||||
boss = {min = 1, max = 10},
|
boss = {min = 1, max = 10},
|
||||||
boss_colour = HEX("0291fb"),
|
boss_colour = HEX("0291fb"),
|
||||||
atlas = "blind",
|
atlas = "blind",
|
||||||
pos = {x = 0, y = 0},
|
pos = {x = 0, y = 1},
|
||||||
mult = 2,
|
mult = 2,
|
||||||
dollars = 5,
|
dollars = 5,
|
||||||
defeat = function(self)
|
defeat = function(self)
|
||||||
|
|
@ -38,7 +99,7 @@ SMODS.Blind {
|
||||||
if not self.disabled then
|
if not self.disabled then
|
||||||
self.disabled = true
|
self.disabled = true
|
||||||
G.E_MANAGER:add_event(Event({
|
G.E_MANAGER:add_event(Event({
|
||||||
delay = 0.1,
|
delay = 1,
|
||||||
trigger = "after",
|
trigger = "after",
|
||||||
func = force_hand,
|
func = force_hand,
|
||||||
}))
|
}))
|
||||||
|
|
@ -48,49 +109,3 @@ SMODS.Blind {
|
||||||
self.disabled = false
|
self.disabled = false
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
local function disable()
|
|
||||||
local orig = (getmetatable(G.GAME.probabilities) or {}).orig
|
|
||||||
|
|
||||||
if orig then
|
|
||||||
G.GAME.probabilities = orig
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local orig_pseudorandom = pseudorandom
|
|
||||||
|
|
||||||
---@diagnostic disable-next-line: lowercase-global
|
|
||||||
function pseudorandom(seed, min, max)
|
|
||||||
return getmetatable(G.GAME.probabilities) and 0 / 0 or orig_pseudorandom(seed, min, max)
|
|
||||||
end
|
|
||||||
|
|
||||||
SMODS.Blind {
|
|
||||||
key = "improbable",
|
|
||||||
boss = {min = 1, max = 10},
|
|
||||||
boss_colour = HEX("aaaaaa"),
|
|
||||||
atlas = "blind",
|
|
||||||
pos = {x = 0, y = 0},
|
|
||||||
mult = 2,
|
|
||||||
dollars = 5,
|
|
||||||
defeat = disable,
|
|
||||||
disable = disable,
|
|
||||||
set_blind = function(_)
|
|
||||||
local orig = G.GAME.probabilities
|
|
||||||
|
|
||||||
local mt = {
|
|
||||||
orig = orig,
|
|
||||||
__index = function (_, k)
|
|
||||||
return k == "normal" and 0 or orig[k]
|
|
||||||
end,
|
|
||||||
__newindex = function (_, k, v)
|
|
||||||
if k ~= "normal" or v ~= 0 then
|
|
||||||
orig[k] = v
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
local proxy = {}
|
|
||||||
setmetatable(proxy, mt)
|
|
||||||
G.GAME.probabilities = proxy
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue