Skip to content

Commit 1465618

Browse files
author
jolly[bot]
committed
jolly-bot: auto-format Lua files using Stylua
1 parent 62b67d7 commit 1465618

File tree

5 files changed

+142
-122
lines changed

5 files changed

+142
-122
lines changed

items/challenge.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,9 @@ function Game:start_run(args)
487487
G.GAME.joker_rate = 1e300
488488
end
489489
for i, v in pairs(G.handlist) do
490-
if v == "cry_Declare0" then d0 = true end
490+
if v == "cry_Declare0" then
491+
d0 = true
492+
end
491493
end
492494
if not d0 then
493495
table.insert(G.handlist, 1, "cry_Declare0")

items/code.lua

Lines changed: 117 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -2851,14 +2851,17 @@ local declare = {
28512851
loc_vars = function(self, q, card)
28522852
return {
28532853
vars = {
2854-
localize(({
2855-
"Straight",
2856-
"Flush",
2857-
"Full House",
2858-
"Full House"
2859-
})[(G.GAME.DECLARE_USED or 0) + 1], "poker_hands"),
2860-
number_format(-G.GAME.DECLARE_USED)
2861-
}
2854+
localize(
2855+
({
2856+
"Straight",
2857+
"Flush",
2858+
"Full House",
2859+
"Full House",
2860+
})[(G.GAME.DECLARE_USED or 0) + 1],
2861+
"poker_hands"
2862+
),
2863+
number_format(-G.GAME.DECLARE_USED),
2864+
},
28622865
}
28632866
end,
28642867
can_use = function(self, card)
@@ -2881,7 +2884,7 @@ local declare = {
28812884
G.CHOOSE_CARD.alignment.offset.y = 0
28822885
G.ROOM.jiggle = G.ROOM.jiggle + 1
28832886
G.CHOOSE_CARD:align_to_major()
2884-
end,
2887+
end,
28852888
init = function()
28862889
function create_UIBox_declare(card)
28872890
G.E_MANAGER:add_event(Event({
@@ -2956,115 +2959,117 @@ local declare = {
29562959
})
29572960
return t
29582961
end
2959-
G.FUNCS.declare_cancel = function()
2962+
G.FUNCS.declare_cancel = function()
29602963
if G.CHOOSE_CARD then
29612964
G.CHOOSE_CARD:remove()
29622965
end
29632966
G.GAME.USING_CODE = false
29642967
G.GAME.USING_DECLARE = false
29652968
end
2966-
G.FUNCS.declare_apply = function()
2967-
G.GAME.hands["cry_Declare"..tostring(G.GAME.DECLARE_USED or 0)] = Cryptid.create_declare_hand(G.hand.highlighted, G.ENTERED_CARD)
2968-
G.GAME.DECLARE_USED = (G.GAME.DECLARE_USED or 0) + 1
2969-
G.FUNCS.declare_cancel()
2970-
end
2971-
G.FUNCS.declare_apply_suitless = function()
2972-
G.GAME.hands["cry_Declare"..tostring(G.GAME.DECLARE_USED or 0)] = Cryptid.create_declare_hand(G.hand.highlighted, G.ENTERED_CARD, true)
2973-
G.GAME.DECLARE_USED = (G.GAME.DECLARE_USED or 0) + 1
2974-
G.FUNCS.declare_cancel()
2975-
end
2976-
Cryptid.create_declare_hand = function(cards, name, suitless)
2977-
if G.ENTERED_CARD == "" then
2978-
G.ENTERED_CARD = "cry_Declare"..tostring(G.GAME.DECLARE_USED or 0)
2979-
end
2980-
local complexity = #cards
2981-
local ranks = {}
2982-
local suits = {}
2983-
for i, v in pairs(cards) do
2984-
if not ranks[v:get_id()] then
2985-
ranks[v:get_id()] = true
2986-
complexity = complexity + 0.85
2987-
end
2988-
if not suitless then
2989-
if (SMODS.has_no_suit(v) and not suits["suitless"]) or not suits[v.base.suit] then
2990-
suits[SMODS.has_no_suit(v) and "suitless" or v.base.suit] = true
2991-
complexity = complexity + 0.45
2992-
end
2993-
end
2994-
end
2995-
if #cards > 5 then
2996-
complexity = complexity * 1.25 ^ (#cards - 5)
2997-
end
2998-
complexity = complexity * 0.75
2999-
local mult = complexity
3000-
local chips = complexity * 8.45 --arbitrary just shake it up a little
3001-
local l_mult = complexity * 0.1
3002-
local l_chips = complexity
3003-
local declare_cards = {}
3004-
for i, v in pairs(cards) do
3005-
local card = {
3006-
rank = v:get_id() > 0 and v:get_id() or "rankless",
3007-
suit = not suitless and (SMODS.has_no_suit(v) and "suitless" or v.base.suit),
3008-
}
3009-
declare_cards[#declare_cards+1] = card
3010-
end
3011-
for i, v in pairs(G.GAME.hands) do
3012-
v.order = (v.order or 0) + 1
3013-
end
3014-
local desc = localize("cry_Declare"..tostring(G.GAME.DECLARE_USED or 0), "poker_hand_descriptions")
3015-
desc[#desc+1] = localize("cry_code_suitless")
3016-
return {
3017-
order = 1,
3018-
l_mult = l_mult,
3019-
l_chips = l_chips,
3020-
mult = mult,
3021-
chips = chips,
3022-
example = Cryptid.create_declare_example(cards, suitless),
3023-
visible = true,
3024-
played = 0,
3025-
_saved_d_v = true,
3026-
played_this_round = 0,
3027-
s_mult = mult,
3028-
s_chips = chips,
3029-
from_declare = true,
3030-
declare_cards = declare_cards,
3031-
declare_name = G.ENTERED_CARD,
3032-
level = 1,
3033-
index = G.GAME.DECLARE_USED or 0,
3034-
desc_text = suitless and desc or nil,
3035-
}
3036-
end
3037-
local localize_ref = localize
3038-
function localize(first, second, ...)
3039-
if second == "poker_hands" then
3040-
if G and G.GAME and G.GAME.hands[first] and G.GAME.hands[first].declare_name then
3041-
return G.GAME.hands[first].declare_name
3042-
end
3043-
end
3044-
if second == "poker_hand_descriptions" then
3045-
if G and G.GAME and G.GAME.hands[first] and G.GAME.hands[first].desc_text then
3046-
return G.GAME.hands[first].desc_text
3047-
end
3048-
end
3049-
return localize_ref(first, second, ...)
3050-
end
3051-
local is_visibleref = SMODS.is_poker_hand_visible
3052-
function SMODS.is_poker_hand_visible(handname)
3053-
if not SMODS.PokerHands[handname]
3054-
then return G.GAME.hands[handname].visible
3055-
end
3056-
return is_visibleref(handname)
3057-
end
3058-
function Cryptid.create_declare_example(cards, suitless)
3059-
local c = {}
3060-
for i, v in pairs(cards) do
3061-
local key = SMODS.Suits[v.base.suit].card_key.."_"..SMODS.Ranks[v.base.value].card_key
3062-
local enhancement = (SMODS.has_no_suit(v) and "m_stone") or (suitless and "m_wild") or nil
3063-
c[#c+1] = {key, true, enhancement = enhancement}
3064-
end
3065-
return c
3066-
end
3067-
end
2969+
G.FUNCS.declare_apply = function()
2970+
G.GAME.hands["cry_Declare" .. tostring(G.GAME.DECLARE_USED or 0)] =
2971+
Cryptid.create_declare_hand(G.hand.highlighted, G.ENTERED_CARD)
2972+
G.GAME.DECLARE_USED = (G.GAME.DECLARE_USED or 0) + 1
2973+
G.FUNCS.declare_cancel()
2974+
end
2975+
G.FUNCS.declare_apply_suitless = function()
2976+
G.GAME.hands["cry_Declare" .. tostring(G.GAME.DECLARE_USED or 0)] =
2977+
Cryptid.create_declare_hand(G.hand.highlighted, G.ENTERED_CARD, true)
2978+
G.GAME.DECLARE_USED = (G.GAME.DECLARE_USED or 0) + 1
2979+
G.FUNCS.declare_cancel()
2980+
end
2981+
Cryptid.create_declare_hand = function(cards, name, suitless)
2982+
if G.ENTERED_CARD == "" then
2983+
G.ENTERED_CARD = "cry_Declare" .. tostring(G.GAME.DECLARE_USED or 0)
2984+
end
2985+
local complexity = #cards
2986+
local ranks = {}
2987+
local suits = {}
2988+
for i, v in pairs(cards) do
2989+
if not ranks[v:get_id()] then
2990+
ranks[v:get_id()] = true
2991+
complexity = complexity + 0.85
2992+
end
2993+
if not suitless then
2994+
if (SMODS.has_no_suit(v) and not suits["suitless"]) or not suits[v.base.suit] then
2995+
suits[SMODS.has_no_suit(v) and "suitless" or v.base.suit] = true
2996+
complexity = complexity + 0.45
2997+
end
2998+
end
2999+
end
3000+
if #cards > 5 then
3001+
complexity = complexity * 1.25 ^ (#cards - 5)
3002+
end
3003+
complexity = complexity * 0.75
3004+
local mult = complexity
3005+
local chips = complexity * 8.45 --arbitrary just shake it up a little
3006+
local l_mult = complexity * 0.1
3007+
local l_chips = complexity
3008+
local declare_cards = {}
3009+
for i, v in pairs(cards) do
3010+
local card = {
3011+
rank = v:get_id() > 0 and v:get_id() or "rankless",
3012+
suit = not suitless and (SMODS.has_no_suit(v) and "suitless" or v.base.suit),
3013+
}
3014+
declare_cards[#declare_cards + 1] = card
3015+
end
3016+
for i, v in pairs(G.GAME.hands) do
3017+
v.order = (v.order or 0) + 1
3018+
end
3019+
local desc = localize("cry_Declare" .. tostring(G.GAME.DECLARE_USED or 0), "poker_hand_descriptions")
3020+
desc[#desc + 1] = localize("cry_code_suitless")
3021+
return {
3022+
order = 1,
3023+
l_mult = l_mult,
3024+
l_chips = l_chips,
3025+
mult = mult,
3026+
chips = chips,
3027+
example = Cryptid.create_declare_example(cards, suitless),
3028+
visible = true,
3029+
played = 0,
3030+
_saved_d_v = true,
3031+
played_this_round = 0,
3032+
s_mult = mult,
3033+
s_chips = chips,
3034+
from_declare = true,
3035+
declare_cards = declare_cards,
3036+
declare_name = G.ENTERED_CARD,
3037+
level = 1,
3038+
index = G.GAME.DECLARE_USED or 0,
3039+
desc_text = suitless and desc or nil,
3040+
}
3041+
end
3042+
local localize_ref = localize
3043+
function localize(first, second, ...)
3044+
if second == "poker_hands" then
3045+
if G and G.GAME and G.GAME.hands[first] and G.GAME.hands[first].declare_name then
3046+
return G.GAME.hands[first].declare_name
3047+
end
3048+
end
3049+
if second == "poker_hand_descriptions" then
3050+
if G and G.GAME and G.GAME.hands[first] and G.GAME.hands[first].desc_text then
3051+
return G.GAME.hands[first].desc_text
3052+
end
3053+
end
3054+
return localize_ref(first, second, ...)
3055+
end
3056+
local is_visibleref = SMODS.is_poker_hand_visible
3057+
function SMODS.is_poker_hand_visible(handname)
3058+
if not SMODS.PokerHands[handname] then
3059+
return G.GAME.hands[handname].visible
3060+
end
3061+
return is_visibleref(handname)
3062+
end
3063+
function Cryptid.create_declare_example(cards, suitless)
3064+
local c = {}
3065+
for i, v in pairs(cards) do
3066+
local key = SMODS.Suits[v.base.suit].card_key .. "_" .. SMODS.Ranks[v.base.value].card_key
3067+
local enhancement = (SMODS.has_no_suit(v) and "m_stone") or (suitless and "m_wild") or nil
3068+
c[#c + 1] = { key, true, enhancement = enhancement }
3069+
end
3070+
return c
3071+
end
3072+
end,
30683073
}
30693074

30703075
-- ://Class

lib/ascended.lua

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,15 @@ function G.FUNCS.get_poker_hand_info(_cards)
134134
["cry_Clusterfuck"] = 8,
135135
["cry_UltPair"] = 8,
136136
["cry_WholeDeck"] = 52,
137-
["cry_Declare0"] = G.GAME.hands.cry_Declare0 and G.GAME.hands.cry_Declare0.declare_cards and #G.GAME.hands.cry_Declare0.declare_cards,
138-
["cry_Declare1"] = G.GAME.hands.cry_Declare1 and G.GAME.hands.cry_Declare1.declare_cards and #G.GAME.hands.cry_Declare1.declare_cards,
139-
["cry_Declare2"] = G.GAME.hands.cry_Declare2 and G.GAME.hands.cry_Declare2.declare_cards and #G.GAME.hands.cry_Declare2.declare_cards
137+
["cry_Declare0"] = G.GAME.hands.cry_Declare0
138+
and G.GAME.hands.cry_Declare0.declare_cards
139+
and #G.GAME.hands.cry_Declare0.declare_cards,
140+
["cry_Declare1"] = G.GAME.hands.cry_Declare1
141+
and G.GAME.hands.cry_Declare1.declare_cards
142+
and #G.GAME.hands.cry_Declare1.declare_cards,
143+
["cry_Declare2"] = G.GAME.hands.cry_Declare2
144+
and G.GAME.hands.cry_Declare2.declare_cards
145+
and #G.GAME.hands.cry_Declare2.declare_cards,
140146
}
141147
-- this is where all the logic for asc hands is. currently it's very simple but if you want more complex logic, here's the place to do it
142148
if hand_table[text] and Cryptid.enabled("set_cry_poker_hand_stuff") == true then
@@ -145,7 +151,8 @@ function G.FUNCS.get_poker_hand_info(_cards)
145151
or #scoring_hand - hand_table[text]
146152

147153
if G.GAME.hands[text] and G.GAME.hands[text].declare_cards then
148-
G.GAME.current_round.current_hand.cry_asc_num = G.GAME.current_round.current_hand.cry_asc_num + (Cryptid.declare_hand_ascended_counter(_cards, G.GAME.hands[text]) - #scoring_hand)
154+
G.GAME.current_round.current_hand.cry_asc_num = G.GAME.current_round.current_hand.cry_asc_num
155+
+ (Cryptid.declare_hand_ascended_counter(_cards, G.GAME.hands[text]) - #scoring_hand)
149156
end
150157
else
151158
G.GAME.current_round.current_hand.cry_asc_num = 0

lib/misc.lua

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,8 +1401,12 @@ function Cryptid.declare_hand_ascended_counter(hand, declarehand)
14011401
local rank
14021402
for i2, v2 in pairs(hand) do
14031403
if not v2.marked then
1404-
if SMODS.has_no_rank(v2) and v.rank == "rankless" or v2:get_id() == v.rank then rank = true end
1405-
if v2:is_suit(v.suit) or (v.suit == "suitless" and SMODS.has_no_suit(v2)) or not v.suit then suit = true end
1404+
if SMODS.has_no_rank(v2) and v.rank == "rankless" or v2:get_id() == v.rank then
1405+
rank = true
1406+
end
1407+
if v2:is_suit(v.suit) or (v.suit == "suitless" and SMODS.has_no_suit(v2)) or not v.suit then
1408+
suit = true
1409+
end
14061410
if not (suit and rank) then
14071411
suit = false
14081412
rank = false
@@ -1413,11 +1417,13 @@ function Cryptid.declare_hand_ascended_counter(hand, declarehand)
14131417
end
14141418
end
14151419
end
1416-
if not rank or not suit then how_many_fit = 0 end
1420+
if not rank or not suit then
1421+
how_many_fit = 0
1422+
end
14171423
total = total + how_many_fit
14181424
end
14191425
for i2, v2 in pairs(hand) do
14201426
v2.marked = nil
14211427
end
14221428
return total
1423-
end
1429+
end

localization/en-us.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ return {
761761
"Your {C:attention}currently{} selected cards",
762762
"become a {C:cry_code}new{} Poker hand which is",
763763
"considered to contain a {C:attention}#1#{}",
764-
"You may create up to {C:attention}3{} {C:inactive}[#2#]{} Hands"
764+
"You may create up to {C:attention}3{} {C:inactive}[#2#]{} Hands",
765765
},
766766
},
767767
},

0 commit comments

Comments
 (0)