Fix Frozen on various jokers
This commit is contained in:
parent
f77dbe3ac8
commit
51ad870d8c
3 changed files with 36 additions and 8 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
"author": [
|
"author": [
|
||||||
"Emik"
|
"Emik"
|
||||||
],
|
],
|
||||||
"version": "2.2.0",
|
"version": "2.2.1",
|
||||||
"badge_colour": "8BE9FD",
|
"badge_colour": "8BE9FD",
|
||||||
"main_file": "src/main.lua",
|
"main_file": "src/main.lua",
|
||||||
"badge_text_colour": "44475A",
|
"badge_text_colour": "44475A",
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@ SMODS.Edition {
|
||||||
freeze(card)
|
freeze(card)
|
||||||
end,
|
end,
|
||||||
on_remove = function(card)
|
on_remove = function(card)
|
||||||
|
card.Roland_frozen_proxy = nil
|
||||||
card.Roland_frozen_estate = nil
|
card.Roland_frozen_estate = nil
|
||||||
card.Roland_frozen_ability = nil
|
card.Roland_frozen_ability = nil
|
||||||
end,
|
end,
|
||||||
|
|
@ -125,6 +126,11 @@ local orig_calculate_joker = Card.calculate_joker
|
||||||
function Card:calculate_joker(context, ...)
|
function Card:calculate_joker(context, ...)
|
||||||
local is_frozen = self.edition and self.edition.Roland_frozen
|
local is_frozen = self.edition and self.edition.Roland_frozen
|
||||||
|
|
||||||
|
if is_frozen and self.ability.name == "Loyalty Card" then
|
||||||
|
return (context.joker_main and self.ability.loyalty_remaining == 0) and
|
||||||
|
{xmult = self.ability.extra.Xmult} or nil
|
||||||
|
end
|
||||||
|
|
||||||
if is_frozen and self.ability.name == "Turtle Bean" then
|
if is_frozen and self.ability.name == "Turtle Bean" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
@ -188,6 +194,7 @@ q(function()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param card Card|{ Roland_frozen_estate: integer }
|
||||||
local function estate_pos(card)
|
local function estate_pos(card)
|
||||||
if card.area ~= G.jokers and card.area.config.type ~= "title" then
|
if card.area ~= G.jokers and card.area.config.type ~= "title" then
|
||||||
return 1
|
return 1
|
||||||
|
|
@ -204,7 +211,6 @@ q(function()
|
||||||
|
|
||||||
local orig_calculate = estate.calculate
|
local orig_calculate = estate.calculate
|
||||||
|
|
||||||
---@param card Card|{ Roland_frozen_ability: table, Roland_frozen_estate: integer }
|
|
||||||
function estate:calculate(card, context, ...)
|
function estate:calculate(card, context, ...)
|
||||||
if not card or not card.edition or not card.edition.Roland_frozen then
|
if not card or not card.edition or not card.edition.Roland_frozen then
|
||||||
return orig_calculate(self, card, context, ...)
|
return orig_calculate(self, card, context, ...)
|
||||||
|
|
@ -239,25 +245,25 @@ q(function()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param card Card|{ Roland_frozen_proxy: number }
|
||||||
local function get_proxied_joker(card)
|
local function get_proxied_joker(card)
|
||||||
if not G.jokers or not G.jokers.cards then
|
if not G.jokers or not G.jokers.cards then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local ability = freeze(card)
|
card.Roland_frozen_proxy = card.Roland_frozen_proxy or
|
||||||
|
(Bakery_API.get_proxied_joker() or card).unique_val
|
||||||
|
|
||||||
---@param v Card
|
---@param v Card
|
||||||
local function eq(v)
|
local function eq(v)
|
||||||
return v.unique_val == ability.Roland_frozen_proxy
|
return v.unique_val == card.Roland_frozen_proxy
|
||||||
end
|
end
|
||||||
|
|
||||||
ability.Roland_frozen_proxy = (Bakery_API.get_proxied_joker() or card).unique_val
|
|
||||||
return f(G.jokers.cards):any(eq) ---@type Card?
|
return f(G.jokers.cards):any(eq) ---@type Card?
|
||||||
end
|
end
|
||||||
|
|
||||||
local orig_calculate = proxy.calculate
|
local orig_calculate = proxy.calculate
|
||||||
|
|
||||||
---@param card Card|{ Roland_frozen_ability: table }
|
|
||||||
function proxy:calculate(card, context, ...)
|
function proxy:calculate(card, context, ...)
|
||||||
if not card or not card.edition or not card.edition.Roland_frozen then
|
if not card or not card.edition or not card.edition.Roland_frozen then
|
||||||
return orig_calculate(self, card, context, ...)
|
return orig_calculate(self, card, context, ...)
|
||||||
|
|
@ -284,3 +290,17 @@ q(function()
|
||||||
return {vars = {var}}
|
return {vars = {var}}
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
q(function()
|
||||||
|
local orig_flip_double_sided = (Bakery_API or {}).flip_double_sided
|
||||||
|
|
||||||
|
if not orig_flip_double_sided then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
function Bakery_API.flip_double_sided(card, ...)
|
||||||
|
if not card.edition or not card.edition.Roland_frozen then
|
||||||
|
return orig_flip_double_sided(card, ...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
|
||||||
|
|
@ -588,8 +588,16 @@ joker {
|
||||||
}
|
}
|
||||||
|
|
||||||
function SMODS.current_mod.reset_game_globals()
|
function SMODS.current_mod.reset_game_globals()
|
||||||
|
local immutable = f(SMODS.find_card "j_Roland_suitable"):any(is_frozen)
|
||||||
local suitable = {suit = "Spades"}
|
local suitable = {suit = "Spades"}
|
||||||
G.GAME.current_round.Roland_suitable = suitable
|
|
||||||
|
G.GAME.current_round.Roland_suitable = immutable and
|
||||||
|
G.GAME.current_round.Roland_suitable or suitable
|
||||||
|
|
||||||
|
if immutable then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local suits = f(G.playing_cards):where(SMODS.has_no_suit, false):table()
|
local suits = f(G.playing_cards):where(SMODS.has_no_suit, false):table()
|
||||||
local card = pseudorandom_element(suits, "Roland_suitable" .. G.GAME.round_resets.ante)
|
local card = pseudorandom_element(suits, "Roland_suitable" .. G.GAME.round_resets.ante)
|
||||||
suitable.suit = card and card.base.suit or suitable.suit
|
suitable.suit = card and card.base.suit or suitable.suit
|
||||||
|
|
@ -680,7 +688,7 @@ joker {
|
||||||
eternal_compat = true,
|
eternal_compat = true,
|
||||||
blueprint_compat = true,
|
blueprint_compat = true,
|
||||||
perishable_compat = true,
|
perishable_compat = true,
|
||||||
loc_vars = function(self, card, _)
|
loc_vars = function(self, _, card)
|
||||||
return {vars = {self:xmult_frozen(card)}}
|
return {vars = {self:xmult_frozen(card)}}
|
||||||
end,
|
end,
|
||||||
calculate = function(self, card, context)
|
calculate = function(self, card, context)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue