Compare commits
2 commits
860381ebff
...
386db180b5
| Author | SHA1 | Date | |
|---|---|---|---|
| 386db180b5 | |||
| 9ed747a33e |
3 changed files with 59 additions and 3 deletions
|
|
@ -3,7 +3,7 @@
|
|||
"id": "Roland",
|
||||
"name": "Roland",
|
||||
"prefix": "Roland",
|
||||
"version": "2.9.42",
|
||||
"version": "2.9.44",
|
||||
"badge_colour": "8BE9FD",
|
||||
"display_name": "Roland",
|
||||
"main_file": "src/main.lua",
|
||||
|
|
|
|||
|
|
@ -54,9 +54,22 @@ local function freeze(card)
|
|||
end
|
||||
|
||||
(card.ability or {}).Roland_crimson = not not (card.ability or {}).Roland_crimson
|
||||
local config = card.config or {}
|
||||
|
||||
card.Roland_frozen_base = card.Roland_frozen_base or copy(card.base)
|
||||
card.Roland_frozen_card = card.Roland_frozen_card or copy(config.card)
|
||||
card.Roland_frozen_ability = card.Roland_frozen_ability or copy(card.ability)
|
||||
|
||||
card.base = card.Roland_frozen_base and copy(card.Roland_frozen_base) or card.base
|
||||
config.card = card.Roland_frozen_card and copy(card.Roland_frozen_card) or config.card
|
||||
card.ability = card.Roland_frozen_ability and copy(card.Roland_frozen_ability) or card.ability
|
||||
card.Roland_frozen = card.Roland_frozen or {probability = SMODS.get_probability_vars(card, 1, 1)}
|
||||
|
||||
if type(card.set_sprites) == "function" and
|
||||
f(card.Roland_frozen_card):diff(config.card) then
|
||||
card:set_sprites(card.config.center, card.config.card)
|
||||
end
|
||||
|
||||
local ability, ret = card.ability, card.Roland_frozen_ability
|
||||
ability.extra = ability.extra == nil and {} or ability.extra
|
||||
|
||||
|
|
@ -196,10 +209,14 @@ SMODS.Edition {
|
|||
local _ = not context.fix_probability and not context.mod_probability and freeze(card)
|
||||
end,
|
||||
on_remove = function(card)
|
||||
card.Roland_frozen, card.Roland_frozen_ability, card.Roland_frozen_current_round = nil, nil, nil
|
||||
card.Roland_frozen,
|
||||
card.Roland_frozen_base,
|
||||
card.Roland_frozen_card,
|
||||
card.Roland_frozen_ability,
|
||||
card.Roland_frozen_current_round = nil, nil, nil, nil, nil
|
||||
end,
|
||||
get_weight = function(self)
|
||||
return G.GAME.edition_rate * self.weight
|
||||
return self.weight * G.GAME.edition_rate
|
||||
end,
|
||||
}
|
||||
|
||||
|
|
@ -231,6 +248,30 @@ function Card:click(...)
|
|||
return ret
|
||||
end
|
||||
|
||||
local orig_save = Card.save
|
||||
|
||||
function Card:save(...)
|
||||
if false then
|
||||
---@type Card|{Roland_frozen: table, Roland_frozen_ability: table, Roland_frozen_base: table, Roland_frozen_card: table, Roland_frozen_current_round: table}
|
||||
self = self
|
||||
end
|
||||
|
||||
local ret = orig_save(self, ...)
|
||||
|
||||
ret.Roland_frozen,
|
||||
ret.Roland_frozen_base,
|
||||
ret.Roland_frozen_card,
|
||||
ret.Roland_frozen_ability,
|
||||
ret.Roland_frozen_current_round =
|
||||
self.Roland_frozen,
|
||||
self.Roland_frozen_base,
|
||||
self.Roland_frozen_card,
|
||||
self.Roland_frozen_ability,
|
||||
self.Roland_frozen_current_round
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
local orig_calculate_joker = Card.calculate_joker
|
||||
|
||||
---@param self Card|{Roland_frozen_ability?: table}
|
||||
|
|
|
|||
|
|
@ -289,6 +289,7 @@ function f.new(fnext)
|
|||
concat = f.concat,
|
||||
const = f.const,
|
||||
count = f.count,
|
||||
diff = f.diff,
|
||||
each = f.each,
|
||||
eq = f.eq,
|
||||
fals = f.fals,
|
||||
|
|
@ -718,6 +719,20 @@ function f:count(func)
|
|||
return ret
|
||||
end
|
||||
|
||||
---@generic K, V
|
||||
---@param self F|{ [K]: V }
|
||||
---@param other { [K]: V }
|
||||
---@return K?
|
||||
---@overload fun(self: F|{ [K]: V }, func: string): integer
|
||||
---@nodiscard
|
||||
function f:diff(other)
|
||||
for k, v in self.next do
|
||||
if other[k] ~= v then
|
||||
return k
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---@generic K, V, T
|
||||
---@param self F|{ [K]: V }
|
||||
---@param _ `T`
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue