|
1 | | ---- STEAMODDED HEADER |
2 | | ---- MOD_NAME: Survival Mode |
3 | | ---- MOD_ID: Survival |
4 | | ---- MOD_AUTHOR: [Aure] |
5 | | ---- MOD_DESCRIPTION: This mod adds two new game modes: Survival and Survival+. In both modes, the game is extended to last for 16 Antes, with final Boss Blinds every 4 Antes. Ante scaling from Ante 9 to Ante 16 have been adjusted by varying amounts depending on stake. On Survival+ mode, you start with 2 less joker slots, but gain an additional joker slot after defeating a final Boss Blind. |
6 | | - |
7 | | ----------------------------------------------- |
8 | | -------------MOD CODE ------------------------- |
9 | | - |
10 | | -function SMODS.INIT.Survival() |
11 | | - local Game_init_game_object_ref = Game.init_game_object |
12 | | - function Game:init_game_object() |
13 | | - local GAME = Game_init_game_object_ref(self) |
14 | | - if G.survival or G.survival_plus then |
15 | | - GAME.win_ante = 16 |
16 | | - GAME.showdown_ante = 4 |
17 | | - end |
18 | | - if G.survival_plus then |
19 | | - GAME.survival_plus = true |
20 | | - GAME.starting_params.joker_slots = 3 |
21 | | - end |
22 | | - return GAME |
23 | | - end |
| 1 | +local Survival = SMODS.current_mod |
| 2 | +Survival.config_tab = function() |
| 3 | + return {n = G.UIT.ROOT, config = {r = 0.1, minw = 4, align = "tm", padding = 0.2, colour = G.C.BLACK}, nodes = { |
| 4 | + create_option_cycle({ |
| 5 | + label = localize('k_survival_mode'), |
| 6 | + scale = 0.8, |
| 7 | + w = 4, |
| 8 | + options = localize('ml_survival_opt'), |
| 9 | + info = {localize('k_survival_info')}, |
| 10 | + opt_callback = 'survival_change_mode', |
| 11 | + current_option = Survival.config.mode or 2, |
| 12 | + }) |
| 13 | +}} |
| 14 | +end |
| 15 | +G.FUNCS.survival_change_mode = function(e) |
| 16 | + Survival.config.mode = e.to_key |
| 17 | +end |
24 | 18 |
|
25 | | - local get_new_boss_ref = get_new_boss |
26 | | - function get_new_boss() |
27 | | - local win_ante = G.GAME.win_ante |
28 | | - G.GAME.win_ante = G.GAME.showdown_ante or win_ante |
29 | | - local boss = get_new_boss_ref() |
30 | | - G.GAME.win_ante = win_ante |
31 | | - return boss |
| 19 | +local Game_init_game_object_ref = Game.init_game_object |
| 20 | +function Game:init_game_object() |
| 21 | + local ret = Game_init_game_object_ref(self) |
| 22 | + ret.survival = Survival.config.mode |
| 23 | + if ret.survival >= 2 then |
| 24 | + ret.win_ante = 16 |
| 25 | + ret.showdown_ante = 4 |
32 | 26 | end |
33 | | - |
34 | | - function get_blind_amount(ante) |
35 | | - local k = 0.75 |
36 | | - local amounts = {} |
37 | | - if not G.GAME.modifiers.scaling or G.GAME.modifiers.scaling == 1 then |
38 | | - amounts = { |
39 | | - 300, 800, 2800, 6000, 11000, 20000, 35000, 50000, |
40 | | - 90000, 150000, 260000, 450000, 800000, 1400000, 2400000, 4300000 |
41 | | - } |
42 | | - elseif G.GAME.modifiers.scaling == 2 then |
43 | | - amounts = { |
44 | | - 300, 1000, 3200, 9000, 18000, 32000, 56000, 90000, |
45 | | - 180000, 400000, 1000000, 2400000, 6000000, 16000000, 45000000, 135000000 |
46 | | - } |
47 | | - elseif G.GAME.modifiers.scaling == 3 then |
48 | | - amounts = { |
49 | | - 300, 1200, 3600, 10000, 25000, 50000, 90000, 180000, |
50 | | - 480000, 1600000, 6000000, 22000000, 90000000, 400000000, 2000000000, 12000000000 |
51 | | - } |
52 | | - end |
53 | | - if ante < 1 then return 100 end |
54 | | - if ante <= 16 then return amounts[ante] end |
55 | | - local a, b, c, d = amounts[16], 1.6, ante - 16, 1 + 0.2 * (ante - 16) |
56 | | - local amount = math.floor(a * (b + (k * c) ^ d) ^ c) |
57 | | - amount = amount - amount % (10 ^ math.floor(math.log10(amount) - 1)) |
58 | | - return amount |
| 27 | + if ret.survival >= 3 then |
| 28 | + ret.starting_params.joker_slots = ret.starting_params.joker_slots - 2 |
59 | 29 | end |
| 30 | + return ret |
60 | 31 | end |
61 | 32 |
|
| 33 | +local get_new_boss_ref = get_new_boss |
| 34 | +function get_new_boss() |
| 35 | + local win_ante = G.GAME.win_ante |
| 36 | + G.GAME.win_ante = G.GAME.showdown_ante or win_ante |
| 37 | + local boss = get_new_boss_ref() |
| 38 | + G.GAME.win_ante = win_ante |
| 39 | + return boss |
| 40 | +end |
62 | 41 |
|
63 | | - function G.FUNCS.change_survival(args) |
64 | | - G.survival = args.to_key == 2 |
65 | | - G.survival_plus = args.to_key == 3 |
66 | | - end |
67 | | - |
68 | | -local run_setup_option_ref = G.UIDEF.run_setup_option |
69 | | -function G.UIDEF.run_setup_option(type) |
70 | | - local t = run_setup_option_ref(type) |
71 | | - if type == 'New Run' then |
72 | | - --t.nodes[5] = t.nodes[4] |
73 | | - t.nodes[5] = create_option_cycle({ |
74 | | - options = { |
75 | | - 'Off', |
76 | | - 'Survival', |
77 | | - 'Survival+' |
78 | | - }, |
79 | | - label = 'Survival Mode', |
80 | | - cycle_shoulders = true, |
81 | | - opt_callback = 'change_survival', |
82 | | - current_option = G.survival_plus and 3 or G.survival and 2 or 1, |
83 | | - scale = 0.8, |
84 | | - w = 4 |
85 | | - }) |
86 | | - end |
87 | | - return t |
| 42 | +local to_big = to_big or function(x) return x end |
| 43 | +local gba = get_blind_amount |
| 44 | +function get_blind_amount(ante) |
| 45 | + if G.GAME.survival < 2 or (G.GAME.modifiers.scaling or 1) > 3 then return gba(ante) end |
| 46 | + local k = 0.75 |
| 47 | + local amounts = {} |
| 48 | + if not G.GAME.modifiers.scaling or G.GAME.modifiers.scaling == 1 then |
| 49 | + amounts = { |
| 50 | + to_big(300), to_big(800), to_big(2800), to_big(6000), to_big(11000), to_big(20000), to_big(35000), to_big(50000), |
| 51 | + to_big(9e4), to_big(1.5e5), to_big(2.6e5), to_big(4.5e5), to_big(8e5), to_big(1.4e6), to_big(2.4e6), to_big(4.3e6) |
| 52 | + } |
| 53 | + elseif G.GAME.modifiers.scaling == 2 then |
| 54 | + amounts = { |
| 55 | + to_big(300), to_big(1000), to_big(3200), to_big(9000), to_big(18000), to_big(32000), to_big(56000), to_big(90000), |
| 56 | + to_big(1.8e5), to_big(4e5), to_big(1e6), to_big(2.4e6), to_big(6e6), to_big(1.6e7), to_big(4.5e7), to_big(1.4e8) |
| 57 | + } |
| 58 | + elseif G.GAME.modifiers.scaling == 3 then |
| 59 | + amounts = { |
| 60 | + to_big(300), to_big(1200), to_big(3600), to_big(10000), to_big(25000), to_big(50000), to_big(90000), to_big(1.8e5), |
| 61 | + to_big(4.8e5), to_big(1.6e6), to_big(6e6), to_big(2.2e7), to_big(9e7), to_big(4e8), to_big(2e9), to_big(1.2e10) |
| 62 | + } |
| 63 | + end |
| 64 | + if ante < 1 then return 100 end |
| 65 | + if ante <= 16 then return amounts[ante] end |
| 66 | + local a, b, c, d = amounts[16], 1.6, ante - 16, 1 + 0.2 * (ante - 16) |
| 67 | + local amount = math.floor(a * (b + (k * c) ^ d) ^ c) |
| 68 | + amount = amount - amount % (10 ^ math.floor(math.log10(amount) - 1)) |
| 69 | + return amount |
88 | 70 | end |
89 | 71 |
|
90 | 72 | local set_blind_ref = Blind.set_blind |
91 | 73 | function Blind:set_blind(blind, reset, silent) |
92 | | - set_blind_ref(self, blind, reset, silent) |
| 74 | + set_blind_ref(self, blind, reset, silent) |
93 | 75 | G.GAME.last_blind.showdown = blind and blind.boss and blind.boss.showdown or nil |
94 | 76 | end |
95 | 77 |
|
96 | 78 | local evaluate_round_ref = G.FUNCS.evaluate_round |
97 | 79 | function G.FUNCS.evaluate_round() |
98 | | - evaluate_round_ref() |
99 | | - if G.GAME.survival_plus and G.GAME.last_blind and G.GAME.last_blind.boss and G.GAME.last_blind.showdown then |
100 | | - G.E_MANAGER:add_event(Event({ |
101 | | - func = function() |
| 80 | + evaluate_round_ref() |
| 81 | + if G.GAME.survival >= 3 and G.GAME.last_blind and G.GAME.last_blind.boss and G.GAME.last_blind.showdown then |
| 82 | + G.E_MANAGER:add_event(Event({ |
| 83 | + func = function() |
102 | 84 | if G.jokers then |
103 | 85 | G.jokers.config.card_limit = G.jokers.config.card_limit + 1 |
| 86 | + card_eval_status_text(G.deck.cards[1], 'extra', nil, nil, nil, { |
| 87 | + message = localize { type = 'variable', key = 'ml_negative_desc', vars = {1}}[2], |
| 88 | + colour = G.C.MONEY, |
| 89 | + instant = true |
| 90 | + }) |
104 | 91 | end |
105 | | - return true |
106 | | - end |
107 | | - })) |
108 | | - end |
| 92 | + return true |
| 93 | + end |
| 94 | + })) |
| 95 | + end |
109 | 96 | end |
110 | | - |
111 | | ----------------------------------------------- |
112 | | -------------MOD CODE END---------------------- |
0 commit comments