Skip to content

Commit 171855c

Browse files
authored
Merge pull request #23 from Joglacraft/dev
Fixed joker_equivalents and similar tables
2 parents bcc581a + ab936f1 commit 171855c

5 files changed

Lines changed: 31 additions & 31 deletions

File tree

content/aux_functions.lua

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function is_alternate(card,table)
1+
function FG.is_alternate(card,table)
22
for k, v in pairs(table) do
33
if card == v then
44
return "v"
@@ -33,20 +33,21 @@ end
3333
-- card is the card instance you are dealing with. 99% of the time it will be just card (the one provided you by the function)
3434
-- table is the reference table to look up and compare.
3535
function FG.alternate_card(key,card,table)
36-
local convert = FG.get_equivalent(key,table,FG.is_alternate(key,table))
37-
local new_card = create_card('Joker', G.jokers, false, nil, true, false, convert, nil)
38-
new_card:add_to_deck()
39-
G.jokers:emplace(new_card)
36+
local convert_to = FG.get_equivalent(key,table,FG.is_alternate(key,table))
37+
local new_card = SMODS.add_card({
38+
set = 'Joker',
39+
skip_materialize = true,
40+
key = tostring(convert_to),
41+
})
4042
if card.edition then
4143
new_card:set_edition(tostring(card.edition.key),true,true)
4244
else
4345
new_card:set_edition(nil,true,true)
4446
end
45-
4647
card:start_dissolve(nil,false,0,true)
4748
end
4849

49-
function flip_editions(card)
50+
function FG.flip_editions(card)
5051
if card.edition then
5152
if card.edition.negative then
5253
card:set_edition(nil, true)
@@ -65,7 +66,7 @@ function flip_editions(card)
6566
end
6667

6768
-- UNFINISHED !!!
68-
function change_pace()
69+
function FG.change_pace()
6970
if common_alt.default_weight > 0 then
7071
sendInfoMessage("Regular", "MyInfoLogger")
7172
common_alt.default_weight = 0

content/consumeables.lua

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SMODS.Consumable{
4141
can_use = function(self, card)
4242
if G.STATE ~= G.STATES.HAND_PLAYED and G.STATE ~= G.STATES.DRAW_TO_HAND and G.STATE ~= G.STATES.PLAY_TAROT or
4343
any_state then
44-
if #G.jokers.highlighted == 1 and is_alternate(G.jokers.highlighted[1].config.center_key,joker_equivalents) == "v" then
44+
if #G.jokers.highlighted == 1 and FG.is_alternate(G.jokers.highlighted[1].config.center_key,FG.joker_equivalents) == "v" then
4545
return true
4646
end
4747
end
@@ -52,7 +52,7 @@ SMODS.Consumable{
5252
trigger = 'after',
5353
delay = 0.4,
5454
func = function()
55-
alternate_card(G.jokers.highlighted[1].config.center_key, G.jokers.highlighted[1], joker_equivalents)
55+
FG.alternate_card(G.jokers.highlighted[1].config.center_key, G.jokers.highlighted[1], FG.joker_equivalents)
5656
return true
5757
end
5858
}))
@@ -76,7 +76,7 @@ SMODS.Consumable{
7676
can_use = function(self, card)
7777
if G.STATE ~= G.STATES.HAND_PLAYED and G.STATE ~= G.STATES.DRAW_TO_HAND and G.STATE ~= G.STATES.PLAY_TAROT or
7878
any_state then
79-
if #G.jokers.highlighted == 1 and is_alternate(G.jokers.highlighted[1].config.center_key,joker_equivalents) == "k" then
79+
if #G.jokers.highlighted == 1 and FG.is_alternate(G.jokers.highlighted[1].config.center_key,FG.joker_equivalents) == "k" then
8080
return true
8181
end
8282
end
@@ -87,7 +87,7 @@ SMODS.Consumable{
8787
trigger = 'after',
8888
delay = 0.4,
8989
func = function()
90-
alternate_card(G.jokers.highlighted[1].config.center_key, G.jokers.highlighted[1], joker_equivalents)
90+
FG.alternate_card(G.jokers.highlighted[1].config.center_key, G.jokers.highlighted[1], FG.joker_equivalents)
9191
return true
9292
end
9393
}))
@@ -124,7 +124,7 @@ SMODS.Consumable{
124124
delay = 0.4,
125125
func = function()
126126
for i in ipairs(G.hand.highlighted) do
127-
flip_editions(G.hand.highlighted[i]) -- change to alternate editions when theyre implemented
127+
FG.flip_editions(G.hand.highlighted[i]) -- change to alternate editions when theyre implemented
128128
end
129129
return true
130130
end
@@ -150,7 +150,7 @@ SMODS.Consumable{
150150
for i in ipairs(G.jokers.cards) do
151151
currentJoker = G.jokers.cards[i]
152152
if currentJoker.rarity == 1 then
153-
alternate_card(currentJoker)
153+
FG.alternate_card(currentJoker)
154154
end
155155
end
156156
return true
@@ -160,8 +160,8 @@ SMODS.Consumable{
160160
func = function()
161161
for i in ipairs(G.jokers.cards) do
162162
local currentCard = G.jokers.cards[i]
163-
if is_alternate(currentCard.config.center_key, joker_equivalents) == "k" and currentCard.config.center.rarity == 1 then
164-
alternate_card(currentCard.config.center_key, currentCard, joker_equivalents)
163+
if is_alternate(currentCard.config.center_key, FG.joker_equivalents) == "k" and currentCard.config.center.rarity == 1 then
164+
FG.alternate_card(currentCard.config.center_key, currentCard, FG.joker_equivalents)
165165
end
166166
end
167167
return true
@@ -187,7 +187,7 @@ SMODS.Consumable{
187187
for i in ipairs(G.jokers.cards) do
188188
currentJoker = G.jokers.cards[i]
189189
if currentJoker.rarity == 1 then
190-
alternate_card(currentJoker)
190+
FG.alternate_card(currentJoker)
191191
end
192192
end
193193
return true
@@ -197,8 +197,8 @@ SMODS.Consumable{
197197
func = function()
198198
for i in ipairs(G.jokers.cards) do
199199
local currentCard = G.jokers.cards[i]
200-
if is_alternate(currentCard.config.center_key, joker_equivalents) == "k" and currentCard.config.center.rarity == 2 then
201-
alternate_card(currentCard.config.center_key, currentCard, joker_equivalents)
200+
if is_alternate(currentCard.config.center_key, FG.joker_equivalents) == "k" and currentCard.config.center.rarity == 2 then
201+
FG.alternate_card(currentCard.config.center_key, currentCard, FG.joker_equivalents)
202202
end
203203
end
204204
return true
@@ -224,7 +224,7 @@ SMODS.Consumable{
224224
for i in ipairs(G.jokers.cards) do
225225
currentJoker = G.jokers.cards[i]
226226
if currentJoker.rarity == 1 then
227-
alternate_card(currentJoker)
227+
FG.alternate_card(currentJoker)
228228
end
229229
end
230230
return true
@@ -234,8 +234,8 @@ SMODS.Consumable{
234234
func = function()
235235
for i in ipairs(G.jokers.cards) do
236236
local currentCard = G.jokers.cards[i]
237-
if is_alternate(currentCard.config.center_key, joker_equivalents) == "k" and currentCard.config.center.rarity == 3 then
238-
alternate_card(currentCard.config.center_key, currentCard, joker_equivalents)
237+
if is_alternate(currentCard.config.center_key, FG.joker_equivalents) == "k" and currentCard.config.center.rarity == 3 then
238+
FG.alternate_card(currentCard.config.center_key, currentCard, FG.joker_equivalents)
239239
end
240240
end
241241
return true

content/editions.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
edition_equivalents = {
1+
FG.edition_equivalents = {
22
["e_polychrome"] = "e_fg_polychrome",
33
["e_negative"] = "e_fg_negative",
44
["e_holographic"] = "e_fg_holographic",

content/jokers.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ SMODS.Atlas {
1919
py = 95
2020
}
2121
-- All joker equivalents. Format is: original <> alternate
22-
joker_equivalents = {
22+
FG.joker_equivalents = {
2323
-- Mod jokers
2424
["j_fg_flipped_script"] = "j_fg_flipped_script_alt",
2525
["j_fg_concert"] = "j_fg_concertalt",
@@ -76,7 +76,7 @@ SMODS.Joker {
7676
cost = 8,
7777
calculate = function(self, card, context)
7878
if context.selling_self then
79-
for k, v in pairs(joker_equivalents) do
79+
for k, v in pairs(FG.joker_equivalents) do
8080
if not string.find(k, '_fg_') then
8181

8282
sendInfoMessage(k, "MyInfoLogger")
@@ -119,8 +119,8 @@ SMODS.Joker {
119119
func = function()
120120
for i in ipairs(G.jokers.cards) do
121121
local currentCard = G.jokers.cards[i]
122-
if is_alternate(currentCard.config.center_key, joker_equivalents) == "v" then
123-
alternate_card(currentCard.config.center_key, card, joker_equivalents)
122+
if FG.is_alternate(currentCard.config.center_key, FG.joker_equivalents) == "v" then
123+
FG.alternate_card(currentCard.config.center_key, card, FG.joker_equivalents)
124124
currentCard:start_dissolve(nil,false,0,true)
125125
end
126126
end
@@ -145,8 +145,8 @@ SMODS.Joker {
145145
func = function()
146146
for i in ipairs(G.jokers.cards) do
147147
local currentCard = G.jokers.cards[i]
148-
if is_alternate(currentCard.config.center_key, joker_equivalents) == "k" then
149-
alternate_card(currentCard.config.center_key, card, joker_equivalents)
148+
if FG.is_alternate(currentCard.config.center_key, FG.joker_equivalents) == "k" then
149+
FG.alternate_card(currentCard.config.center_key, card, FG.joker_equivalents)
150150
currentCard:start_dissolve(nil,false,0,true)
151151
end
152152
end
@@ -172,7 +172,7 @@ SMODS.Joker {
172172
sendInfoMessage("Should be changing if i did it right", "MyInfoLogger")
173173
for i in ipairs(G.jokers.cards) do
174174
local currentCard = G.jokers.cards[i]
175-
flip_editions(currentCard)
175+
FG.flip_editions(currentCard)
176176
-- if wanting to add an edition to cards without one just add it as an else to the g.joker.cards[i].edition
177177
end
178178
return true

main.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ SMODS.current_mod.extra_tabs = function()
4949
return {n = G.UIT.ROOT, config = {
5050
-- config values here, see 'Building a UI' page
5151
r = 0.1, minw = 10, minh = 6, align = "tm", padding = 0.2, colour = G.C.BLACK
52-
5352
}, nodes = {
5453
-- work your UI wizardry here, see 'Building a UI' page
5554
{n = G.UIT.R, config = {align = "tm"}, nodes = {{n = G.UIT.T, config = {text = "Fool's Gambit", colour = G.C.PURPLE, scale = .7}}}},

0 commit comments

Comments
 (0)