diff --git a/lovely/better_calc.toml b/lovely/better_calc.toml index d39ea1b1c..7faff5de1 100644 --- a/lovely/better_calc.toml +++ b/lovely/better_calc.toml @@ -1971,3 +1971,65 @@ position = 'at' payload = ''' delay(0.4); ease_ante(1, true); delay(0.4); check_for_unlock({type = 'ante_up', ante = G.GAME.round_resets.ante + 1}) ''' + +# Make draw_card and draw_card_from actually use stay_flipped +[[patches]] +[patches.pattern] +target = "cardarea.lua" +match_indent = true +pattern = ''' +local stay_flipped = G.GAME and G.GAME.blind and G.GAME.blind:stay_flipped(self, card, area) +''' +position = "at" +payload = ''' +local stay_flipped = G.GAME and G.GAME.blind and G.GAME.blind:stay_flipped(self, card, area) or stay_flipped +''' + +[[patches]] +[patches.pattern] +target = "cardarea.lua" +match_indent = true +pattern = ''' +local stay_flipped = G.GAME and G.GAME.blind and G.GAME.blind:stay_flipped(to, card, from) +''' +position = "at" +payload = ''' +local stay_flipped = G.GAME and G.GAME.blind and G.GAME.blind:stay_flipped(to, card, from) or stay_flipped +''' + +# Discard From Play context +[[patches]] +[patches.pattern] +target = 'functions/state_events.lua' +match_indent = true +pattern = ''' +draw_card(G.play,G.discard, it*100/play_count,'down', false, v) +''' +position = 'at' +payload = ''' +local flags = SMODS.calculate_context({discard_from_play = true, card = v, num_discarded = k}) +local discard_to = G[flags.draw_to] or G.discard +draw_card(G.play,discard_to, it*100/play_count,'down', false, v, nil, nil, flags.stay_flipped) +''' + +# Draw Individual context +[[patches]] +[patches.pattern] +target = 'functions/state_events.lua' +match_indent = true +pattern = ''' + draw_card(G.deck,G.hand, i*100/hand_space,'up', true, cards_to_draw[i]) +else + draw_card(G.deck,G.hand, i*100/hand_space,'up', true, cards_to_draw[i]) +end +''' +position = 'at' +payload = ''' + local flags = SMODS.calculate_context({draw_individual = true, card = cards_to_draw[i], num_drawn = i, to_booster = true}) + draw_card(G.deck,G.hand, i*100/hand_space,'up', true, cards_to_draw[i], nil, nil, flags.stay_flipped) +else + local flags = SMODS.calculate_context({draw_individual = true, card = cards_to_draw[i], num_drawn = i, to_booster = false}) + local draw_to = G[flags.draw_to] or G.hand + draw_card(G.deck,draw_to, i*100/hand_space,'up', true, cards_to_draw[i], nil, nil, flags.stay_flipped) +end +''' \ No newline at end of file diff --git a/src/utils.lua b/src/utils.lua index 4e3522411..274cb015f 100644 --- a/src/utils.lua +++ b/src/utils.lua @@ -1347,7 +1347,7 @@ SMODS.calculate_individual_effect = function(effect, scored_card, key, amount, f end if key == 'remove' or key == 'debuff_text' or key == 'cards_to_draw' or key == 'numerator' or key == 'denominator' or key == 'no_destroy' or - key == 'replace_scoring_name' or key == 'replace_display_name' or key == 'replace_poker_hands' or key == 'modify' then + key == 'replace_scoring_name' or key == 'replace_display_name' or key == 'replace_poker_hands' or key == 'modify' or key == 'draw_to' then return { [key] = amount } end @@ -1448,7 +1448,8 @@ SMODS.other_calculation_keys = { 'numerator', 'denominator', 'modify', 'no_destroy', 'prevent_trigger', - 'replace_scoring_name', 'replace_display_name', 'replace_poker_hands' + 'replace_scoring_name', 'replace_display_name', 'replace_poker_hands', + 'draw_to' } SMODS.silent_calculation = { saved = true, effect = true, remove = true,