Add sound for clicking the card
This commit is contained in:
parent
a04ac56169
commit
9a5c531a02
7 changed files with 37 additions and 9 deletions
BIN
assets/sounds/frozen1.ogg
Normal file
BIN
assets/sounds/frozen1.ogg
Normal file
Binary file not shown.
BIN
assets/sounds/frozen2.ogg
Normal file
BIN
assets/sounds/frozen2.ogg
Normal file
Binary file not shown.
BIN
assets/sounds/frozen4.ogg
Normal file
BIN
assets/sounds/frozen4.ogg
Normal file
Binary file not shown.
BIN
assets/sounds/frozen_click.ogg
Normal file
BIN
assets/sounds/frozen_click.ogg
Normal file
Binary file not shown.
|
|
@ -5,10 +5,14 @@ SMODS.Shader {
|
||||||
path = "frozen.fs",
|
path = "frozen.fs",
|
||||||
}
|
}
|
||||||
|
|
||||||
SMODS.Sound {
|
---@param suffix string
|
||||||
key = "frozen",
|
local function frozen_sound(suffix)
|
||||||
path = "frozen.ogg",
|
local key = "frozen" .. suffix
|
||||||
}
|
return SMODS.Sound {key = key, path = key .. ".ogg"}
|
||||||
|
end
|
||||||
|
|
||||||
|
frozen_sound "_click"
|
||||||
|
local frozen_sounds = f(4):map(frozen_sound):map("key"):table()
|
||||||
|
|
||||||
local needs_chip_mult_override = {
|
local needs_chip_mult_override = {
|
||||||
Bull = true,
|
Bull = true,
|
||||||
|
|
@ -71,7 +75,7 @@ SMODS.Edition {
|
||||||
key = "frozen",
|
key = "frozen",
|
||||||
shader = "frozen",
|
shader = "frozen",
|
||||||
pools = {Joker = true},
|
pools = {Joker = true},
|
||||||
sound = {sound = "Roland_frozen", per = 1.6, vol = 0.8},
|
sound = {sound = "Roland_frozen", per = 1, vol = 0.8},
|
||||||
weight = 8,
|
weight = 8,
|
||||||
extra_cost = 4,
|
extra_cost = 4,
|
||||||
in_shop = true,
|
in_shop = true,
|
||||||
|
|
@ -80,7 +84,6 @@ SMODS.Edition {
|
||||||
freeze(card)
|
freeze(card)
|
||||||
end,
|
end,
|
||||||
on_remove = function(card)
|
on_remove = function(card)
|
||||||
freeze(card)
|
|
||||||
card.Roland_frozen_ability = nil
|
card.Roland_frozen_ability = nil
|
||||||
end,
|
end,
|
||||||
get_weight = function(self)
|
get_weight = function(self)
|
||||||
|
|
@ -88,6 +91,31 @@ SMODS.Edition {
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local orig_play_sound = play_sound
|
||||||
|
|
||||||
|
function play_sound(sound, pitch, ...)
|
||||||
|
if sound ~= "Roland_frozen" and sound ~= "Roland_frozen_click" then
|
||||||
|
return orig_play_sound(sound, pitch, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
local overriden_sound = sound == "Roland_frozen" and
|
||||||
|
pseudorandom_element(frozen_sounds, pseudoseed "Roland_frozen") or
|
||||||
|
sound
|
||||||
|
|
||||||
|
local overriden_pitch = pseudorandom(pseudoseed "Roland_frozen_pitch") / 2 + 1.3
|
||||||
|
return orig_play_sound(overriden_sound, overriden_pitch, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
local orig_click = Card.click
|
||||||
|
|
||||||
|
function Card:click(...)
|
||||||
|
if self.edition and self.edition.Roland_frozen then
|
||||||
|
play_sound("Roland_frozen_click", nil, 0.6)
|
||||||
|
end
|
||||||
|
|
||||||
|
return orig_click(self, ...)
|
||||||
|
end
|
||||||
|
|
||||||
local orig_calculate_joker = Card.calculate_joker
|
local orig_calculate_joker = Card.calculate_joker
|
||||||
|
|
||||||
---@param self Card|{Roland_frozen_ability?: table}
|
---@param self Card|{Roland_frozen_ability?: table}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ spectral {
|
||||||
delay = 0.1,
|
delay = 0.1,
|
||||||
func = function()
|
func = function()
|
||||||
v:set_edition {negative = true}
|
v:set_edition {negative = true}
|
||||||
v:juice_up(0.5, 0.5)
|
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
|
|
@ -77,7 +76,9 @@ spectral {
|
||||||
return {vars = {card.ability.extra.amount}}
|
return {vars = {card.ability.extra.amount}}
|
||||||
end,
|
end,
|
||||||
can_use = function(_, card)
|
can_use = function(_, card)
|
||||||
return u() and card.ability.extra.amount == #G.jokers.highlighted + #Bakery_API.get_highlighted()
|
return u() and f(G.jokers.highlighted):concat(Bakery_API.get_highlighted()):count(function(v)
|
||||||
|
return not v.edition
|
||||||
|
end) == card.ability.extra.amount
|
||||||
end,
|
end,
|
||||||
use = function()
|
use = function()
|
||||||
f(G.jokers.highlighted):concat(Bakery_API.get_highlighted()):each(function(v)
|
f(G.jokers.highlighted):concat(Bakery_API.get_highlighted()):each(function(v)
|
||||||
|
|
@ -85,7 +86,6 @@ spectral {
|
||||||
delay = 0.1,
|
delay = 0.1,
|
||||||
func = function()
|
func = function()
|
||||||
v:set_edition {Roland_frozen = true}
|
v:set_edition {Roland_frozen = true}
|
||||||
v:juice_up(1, 1)
|
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue