Skip to content

Commit 4c2b6b3

Browse files
authored
Merge pull request #26 from Joglacraft/dev
idk if stuff works
2 parents 1799a31 + 723940b commit 4c2b6b3

2 files changed

Lines changed: 1112 additions & 1046 deletions

File tree

content/aux_functions.lua

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,45 +33,57 @@ 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_to = FG.get_equivalent(key,table,FG.is_alternate(key,table))
36+
local _table = table or FG.joker_equivalents
37+
local convert_to = FG.get_equivalent(key,_table,FG.is_alternate(key,_table))
3738
local new_card = SMODS.add_card({
3839
set = 'Joker',
3940
skip_materialize = true,
4041
key = tostring(convert_to),
4142
})
4243
if card.edition then
43-
new_card:set_edition(tostring(card.edition.key),true,true)
44-
else
45-
new_card:set_edition(nil,true,true)
44+
FG.update_edition(new_card)
4645
end
4746
card:start_dissolve(nil,false,0,true)
4847
end
4948

50-
function FG.flip_editions(card)
49+
-- Allows to integrate original<>alternate entries to the mod's tables.
50+
-- Target table: The table you are adding entries to.
51+
-- Source table: The table you are taking entries from.
52+
function FG.register_alternate(target_table, source_table)
53+
if not target_table or not source_table then
54+
sendWarnMessage("Missing or incorrect arguments: target_table [table], source_table [table]","Fool's Gambit/register_cards")
55+
return
56+
end
57+
for k,v in pairs(source_table) do
58+
target_table[k] = v
59+
end
60+
end
61+
62+
-- card is the old card, that is being deleted
63+
-- new_card is the new card created for alternating.
64+
function FG.update_alternate_values(old_card,new_card)
65+
for k,v in ipairs(old_card.config.extra.alternating_values) do
66+
new_card.config.extra.alternating_values.k = v
67+
end
68+
end
69+
70+
-- Transfers the edition from the old card to the new card.
71+
-- card is the card object of which the edition has to be updated.
72+
function FG.update_edition(card)
5173
if card.edition then
52-
if card.edition.negative then
53-
card:set_edition(nil, true)
54-
elseif card.edition.polychrome then
55-
card:set_edition("e_fg_polished", true)
56-
elseif card.edition.fg_polished then
57-
card:set_edition("e_polychrome", true)
58-
elseif card.edition.holo then
59-
card:set_edition("e_foil", true)
60-
elseif card.edition.foil then
61-
card:set_edition("e_holo", true)
62-
end
74+
card:set_edition(tostring(card.edition.key),true,true)
6375
else
64-
card:set_edition("e_negative", true)
76+
card:set_edition(nil,true,true)
6577
end
6678
end
6779

6880
-- UNFINISHED !!!
6981
function FG.change_pace()
7082
if common_alt.default_weight > 0 then
7183
sendInfoMessage("Regular", "MyInfoLogger")
72-
common_alt.default_weight = 0
73-
uncommon_alt.default_weight = 0
74-
rare_alt.default_weight= 0
84+
common_alt.default_weight = 0
85+
uncommon_alt.default_weight = 0
86+
rare_alt.default_weight= 0
7587
else
7688
sendInfoMessage("Alternate", "MyInfoLogger")
7789
common_alt.default_weight = .70

0 commit comments

Comments
 (0)