@@ -909,24 +909,67 @@ end
909909-- Forced joker triggering, used by Demicolon
910910function force_calculate (card )
911911 local context = safe_get (Cryptid .force_contexts , card .config .center .key )
912- if not context then
912+ if not ( context and context [ 1 ]) then
913913 return false
914914 end
915+ if type (context [1 ]) == " function" then
916+ context = context [1 ](context [2 ] or {})
917+ else
918+ context = context [1 ]
919+ end
915920 context .forced = true
916921 local eval , post = eval_card (card , context )
917922 local effects = { eval }
918923 SMODS .trigger_effects (effects , card )
919924 return eval and true or post
920925end
921926
927+ function __context (t , arg )
928+ local ret = arg or {}
929+ for k , v in pairs (t ) do
930+ ret [k ] = v
931+ end
932+ return ret
933+ end
934+
935+ function __joker_main (t )
936+ return __context (t , { cardarea = G .jokers , joker_main = true })
937+ end
938+
939+ function __individual_play (t )
940+ return __context (t , { cardarea = G .play , individual = true })
941+ end
942+
943+ function __poker_hand (t )
944+ return { poker_hands = { [t ] = {" m" } } }
945+ end
946+
947+ __any_suit = { other_card = { is_suit = function (self ) return true end } }
948+
949+ -- How these work: {constructor function, extra args}
922950Cryptid .force_contexts = {
923951 -- Vanilla Jokers (collection order)
924-
952+ -- Page 1
953+ j_joker = {__joker_main },
954+ j_greedy_joker = {__individual_play , __any_suit },
955+ j_lusty_joker = {__individual_play , __any_suit },
956+ j_wrathful_joker = {__individual_play , __any_suit },
957+ j_gluttenous_joker = {__individual_play , __any_suit },
958+ j_jolly = {__joker_main , __poker_hand (" Pair" )},
959+ j_zany = {__joker_main , __poker_hand (" Three of a Kind" )},
960+ j_mad = {__joker_main , __poker_hand (" Two Pair" )},
961+ j_crazy = {__joker_main , __poker_hand (" Straight" )},
962+ j_droll = {__joker_main , __poker_hand (" Flush" )},
963+ j_sly = {__joker_main , __poker_hand (" Pair" )},
964+ j_wily = {__joker_main , __poker_hand (" Three of a Kind" )},
965+ j_clever = {__joker_main , __poker_hand (" Two Pair" )},
966+ j_devious = {__joker_main , __poker_hand (" Straight" )},
967+ j_crafty = {__joker_main , __poker_hand (" Flush" )},
925968 -- Cryptid Jokers (alphabetical order probably?)
926- j_cry_demicolon = { joker_main = true },
927- j_cry_m = { selling_card = true , card = {
969+ j_cry_demicolon = {__joker_main },
970+ j_cry_m = {{ selling_card = true , card = {
928971 is_jolly = function (self )
929972 return true
930973 end ,
931- } },
974+ } }} ,
932975}
0 commit comments