├── .gitignore ├── README.md └── balatroverlay.lua /.gitignore: -------------------------------------------------------------------------------- 1 | balatrofiles 2 | test.lua -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BalatrOverlay 2 | 3 | ## Overlay mod for game "Balatro" written on lua 4 | 5 | ### What this mod allows (and will allow) 6 | 7 | 1. See the combinations in the hand. (remained Flush House) 8 | 2. Calculate the odds of each combination falling out when the hand is discarded (WIP) 9 | 3. Calculating the chips the hand will bring (WIP) 10 | 11 | ## Why did I do this 12 | 13 | I think balatro is a very tough game. Especially if you want to conquer it, because you need to be oriented to the situation and make calculations in your mind as chips and possible combinations at discard 14 | 15 | Therefore, I decided to write this mod, which will help people who do not want to go into the depths of probability theory to enjoy the game without losing Full House in a search for a Flush 16 | 17 | ## Installation 18 | 19 | To install this mod simply use a [Steamodded](https://github.com/Steamopollys/Steamodded) modloader and put the .lua file in Mods directory 20 | -------------------------------------------------------------------------------- /balatroverlay.lua: -------------------------------------------------------------------------------- 1 | --- STEAMODDED HEADER 2 | --- MOD_NAME: BalatrOverlay 3 | --- MOD_ID: balover 4 | --- MOD_AUTHOR: [cantlookback] 5 | --- MOD_DESCRIPTION: Helpful game overlay 6 | ---------------------------------------------- 7 | ------------MOD CODE ------------------------- 8 | 9 | -- CONFIG VARIABLES 10 | ------------------- 11 | combo_conf = false 12 | chips_calc_conf = false 13 | probability_calc_conf = false 14 | ------------------- 15 | 16 | local load_ref = love.resize 17 | function love.resize(self, w, h) 18 | local desiredWidth = 1920 19 | local desiredHeight = 1080 20 | 21 | local windowWidth = love.graphics.getWidth() 22 | local windowHeight = love.graphics.getHeight() 23 | 24 | local scaleX = windowWidth / desiredWidth 25 | local scaleY = windowHeight / desiredHeight 26 | scale = math.min(scaleX, scaleY) 27 | 28 | xoffset = (windowWidth - desiredWidth * scale) / 2 29 | yoffset = (windowHeight - desiredHeight * scale) / 2 30 | quad = love.graphics.newQuad(72, 0, 72, 95, 497, 475) 31 | load_ref(self, w, h) 32 | end 33 | 34 | local test_ref = love.draw 35 | function love.draw(self) 36 | test_ref(self) 37 | 38 | if (G.hand ~= nil and scale ~= nil) then 39 | -- Display overlay boxes and data 40 | 41 | if (not G.deck_preview and not G.OVERLAY_MENU and G.STATE == G.STATES.SELECTING_HAND or G.STATE == 42 | G.STATES.HAND_PLAYED or G.STATE == G.STATES.DRAW_TO_HAND or G.STATE == G.STATES.PLAY_TAROT or G.STATE == 43 | G.STATES.ROUND_EVAL) then 44 | 45 | -- BOX SECTION 46 | love.graphics.setColor(1, 1, 1, 0.5) 47 | 48 | -- Combo box 49 | if (combo_conf) then 50 | love.graphics.draw(G.ASSET_ATLAS["centers"].image, quad, 500 * scale + xoffset, 300 * scale + yoffset, 51 | 0, scale * 3.5, scale * 3) 52 | end 53 | 54 | -- Probabilities box 55 | if (probability_calc_conf) then 56 | love.graphics.draw(G.ASSET_ATLAS["centers"].image, quad, 1650 * scale + xoffset, 300 * scale + yoffset, 57 | 0, scale * 3.5, scale * 3) 58 | end 59 | 60 | -- Evaluate box 61 | if (chips_calc_conf) then 62 | love.graphics.draw(G.ASSET_ATLAS["centers"].image, quad, 800 * scale + xoffset, 300 * scale + yoffset, 63 | 0, scale * 5, scale) 64 | end 65 | 66 | -- DATA SECTION 67 | love.graphics.setColor(0, 0, 0, 1) 68 | 69 | -- Combos 70 | if (combos ~= nil and combo_conf) then 71 | for i = 1, #combos do 72 | love.graphics.print(combos[i], 510 * scale + xoffset, (300 + 20 * i) * scale + yoffset, 0, scale, 73 | scale) 74 | end 75 | end 76 | 77 | -- Probabilities 78 | if (probability_calc_conf) then 79 | love.graphics.print("Straight-Flush: ", 1670 * scale + xoffset, 320 * scale + yoffset, 0, scale, scale) 80 | love.graphics.print("Four of a Kind: ", 1670 * scale + xoffset, 350 * scale + yoffset, 0, scale, scale) 81 | love.graphics.print("Full House: ", 1670 * scale + xoffset, 380 * scale + yoffset, 0, scale, scale) 82 | love.graphics.print("Flush: ", 1670 * scale + xoffset, 410 * scale + yoffset, 0, scale, scale) 83 | love.graphics.print("Straight: ", 1670 * scale + xoffset, 440 * scale + yoffset, 0, scale, scale) 84 | love.graphics.print("Three of a Kind: ", 1670 * scale + xoffset, 470 * scale + yoffset, 0, scale, scale) 85 | love.graphics.print("Two Pair: ", 1670 * scale + xoffset, 500 * scale + yoffset, 0, scale, scale) 86 | love.graphics.print("Pair: ", 1670 * scale + xoffset, 530 * scale + yoffset, 0, scale, scale) 87 | end 88 | 89 | -- Evaluate hand 90 | if (minmax ~= nil and chips_calc_conf) then 91 | if (minmax["min"] == minmax["max"]) then 92 | love.graphics.printf(minmax["min"] .. " Chips", 800 * scale + xoffset, 325 * scale + yoffset, 93 | 72 * scale * 5 / 1.5, "center", 0, scale * 1.5, scale * 1.5) 94 | else 95 | love.graphics.printf(minmax["min"] .. " to " .. minmax["max"] .. " Chips", 800 * scale + xoffset, 96 | 325 * scale + yoffset, 72 * scale * 5 / 1.5, "center", 0, scale * 1.5, scale * 1.5) 97 | 98 | end 99 | end 100 | 101 | end 102 | end 103 | 104 | end 105 | 106 | function checkHand() 107 | if (G.STATE ~= G.STATES.MENU and G.hand.cards ~= nil) then 108 | -- Add Flush House and check Flush Five 109 | 110 | hasFlush() 111 | hasStraight() -- Straight, Straight-Flush (No Royal Flush) 112 | hasPairs() -- Two pair, Set, Full House, Four+Five of a kind 113 | end 114 | end 115 | 116 | function hasPairs() 117 | local counter = { 118 | ["Ace"] = 0, 119 | ["King"] = 0, 120 | ["Queen"] = 0, 121 | ["Jack"] = 0, 122 | ["10"] = 0, 123 | ["9"] = 0, 124 | ["8"] = 0, 125 | ["7"] = 0, 126 | ["6"] = 0, 127 | ["5"] = 0, 128 | ["4"] = 0, 129 | ["3"] = 0, 130 | ["2"] = 0 131 | } 132 | 133 | local suitsCounter = { 134 | ["Ace"] = {}, 135 | ["King"] = {}, 136 | ["Queen"] = {}, 137 | ["Jack"] = {}, 138 | ["10"] = {}, 139 | ["9"] = {}, 140 | ["8"] = {}, 141 | ["7"] = {}, 142 | ["6"] = {}, 143 | ["5"] = {}, 144 | ["4"] = {}, 145 | ["3"] = {}, 146 | ["2"] = {} 147 | } 148 | 149 | local comboCounter = { 150 | ["Pair"] = {}, 151 | ["Set"] = {} 152 | } 153 | 154 | local suits = {"Hearts", "Diamonds", "Spades", "Clubs"} 155 | 156 | for i = 1, #G.hand.cards do 157 | counter[G.hand.cards[i].base.value] = counter[G.hand.cards[i].base.value] + 1 158 | table.insert(suitsCounter[G.hand.cards[i].base.value], G.hand.cards[i].base.suit) 159 | end 160 | 161 | for value, count in pairs(counter) do 162 | repeat 163 | if (count >= 5) then 164 | local suitCounter = 0 165 | for i = 1, #suits do 166 | for i = 1, #suitsCounter[value] do 167 | if (suitsCounter[value][i] == suits[i]) then 168 | suitCounter = suitCounter + 1 169 | end 170 | end 171 | if (suitCounter == 5) then 172 | break 173 | else 174 | suitCounter = 0 175 | end 176 | end 177 | if (suitCounter >= 5) then 178 | table.insert(combos, "Flush Five: " .. value .. 's') 179 | else 180 | table.insert(combos, "Five of a Kind: " .. value .. 's') 181 | end 182 | end 183 | if (count >= 4) then 184 | table.insert(combos, "Four of a K0ind: " .. value .. 's') 185 | end 186 | if (count >= 3) then 187 | table.insert(comboCounter["Set"], value) 188 | 189 | end 190 | if (count >= 2) then 191 | table.insert(comboCounter["Pair"], value) 192 | end 193 | until true 194 | end 195 | 196 | for i = 1, #comboCounter["Set"] do 197 | for j = 1, #comboCounter["Pair"] do 198 | if (comboCounter["Set"][i] ~= comboCounter["Pair"][j]) then 199 | table.insert(combos, "Full House: " .. "3x" .. comboCounter["Set"][i] .. " + " .. "2x" .. 200 | comboCounter["Pair"][j]) 201 | end 202 | end 203 | end 204 | for i = 1, #comboCounter["Set"] - 1 do 205 | if (#comboCounter["Set"][i] ~= #comboCounter["Set"][i + 1]) then 206 | table.insert(combos, "Full House: " .. "3x" .. comboCounter["Set"][i] .. " + " .. "2x" .. 207 | comboCounter["Set"][i + 1]) 208 | end 209 | end 210 | 211 | for i = 1, #comboCounter["Set"] do 212 | table.insert(combos, "Three of a Kind: " .. "3x" .. comboCounter["Set"][i]) 213 | end 214 | 215 | for i = 1, #comboCounter["Pair"] - 1 do 216 | if (comboCounter["Pair"][i] ~= comboCounter["Pair"][i + 1]) then 217 | table.insert(combos, "Two Pair: " .. "2x" .. comboCounter["Pair"][i] .. " + " .. "2x" .. 218 | comboCounter["Pair"][i + 1]) 219 | end 220 | end 221 | 222 | if (#combos == 0 and #comboCounter["Pair"] > 0) then 223 | table.insert(combos, "Pair: " .. "2x" .. comboCounter["Pair"][1]) 224 | end 225 | 226 | if (#combos == 0) then 227 | if (counter["Ace"] > 0) then 228 | table.insert(combos, "High Card: " .. "Ace") 229 | return true 230 | end 231 | if (counter["King"] > 0) then 232 | table.insert(combos, "High Card: " .. "King") 233 | return true 234 | end 235 | if (counter["Queen"] > 0) then 236 | table.insert(combos, "High Card: " .. "Queen") 237 | return true 238 | end 239 | if (counter["Jack"] > 0) then 240 | table.insert(combos, "High Card: " .. "Jack") 241 | return true 242 | end 243 | for key, value in pairs(counter) do 244 | if (value > 0) then 245 | table.insert(combos, "High Card: " .. key) 246 | break 247 | end 248 | end 249 | end 250 | 251 | end 252 | 253 | function hasFlush() 254 | local counter = { 255 | ["Spades"] = 0, 256 | ["Clubs"] = 0, 257 | ["Diamonds"] = 0, 258 | ["Hearts"] = 0 259 | } 260 | 261 | for i = 1, #G.hand.cards do 262 | counter[G.hand.cards[i].base.suit] = counter[G.hand.cards[i].base.suit] + 1 263 | end 264 | 265 | for value, count in pairs(counter) do 266 | if (count >= 5) then 267 | table.insert(combos, "Flush: " .. value) 268 | end 269 | end 270 | end 271 | 272 | local cardRanks = { 273 | ["Ace"] = 13, 274 | ["King"] = 12, 275 | ["Queen"] = 11, 276 | ["Jack"] = 10, 277 | ["10"] = 9, 278 | ["9"] = 8, 279 | ["8"] = 7, 280 | ["7"] = 6, 281 | ["6"] = 5, 282 | ["5"] = 4, 283 | ["4"] = 3, 284 | ["3"] = 2, 285 | ["2"] = 1 286 | } 287 | 288 | local function sortByCardRank(a, b) 289 | return cardRanks[a] > cardRanks[b] 290 | end 291 | 292 | function hasStraight() 293 | local counter = { 294 | ["Ace"] = 0, 295 | ["King"] = 0, 296 | ["Queen"] = 0, 297 | ["Jack"] = 0, 298 | ["10"] = 0, 299 | ["9"] = 0, 300 | ["8"] = 0, 301 | ["7"] = 0, 302 | ["6"] = 0, 303 | ["5"] = 0, 304 | ["4"] = 0, 305 | ["3"] = 0, 306 | ["2"] = 0 307 | } 308 | 309 | local counterSuits = { 310 | ["Ace"] = {}, 311 | ["King"] = {}, 312 | ["Queen"] = {}, 313 | ["Jack"] = {}, 314 | ["10"] = {}, 315 | ["9"] = {}, 316 | ["8"] = {}, 317 | ["7"] = {}, 318 | ["6"] = {}, 319 | ["5"] = {}, 320 | ["4"] = {}, 321 | ["3"] = {}, 322 | ["2"] = {} 323 | } 324 | 325 | local suits = {"Spades", "Hearts", "Clubs", "Diamonds"} 326 | 327 | local keys = {} 328 | for k in pairs(counter) do 329 | table.insert(keys, k) 330 | end 331 | 332 | table.sort(keys, sortByCardRank) 333 | 334 | for i = 1, #G.hand.cards do 335 | counter[G.hand.cards[i].base.value] = counter[G.hand.cards[i].base.value] + 1 336 | table.insert(counterSuits[G.hand.cards[i].base.value], G.hand.cards[i].base.suit) 337 | end 338 | 339 | local straightLength = 0 340 | straight = {} 341 | local suitCount = 0 342 | 343 | for _, key in ipairs(keys) do 344 | if (straightLength == 5) then 345 | for i = 1, #suits do 346 | for j = 1, #straight do 347 | for k = 1, #counterSuits[straight[j]] do 348 | repeat 349 | if (counterSuits[straight[j]][k] == suits[i]) then 350 | suitCount = suitCount + 1 351 | break 352 | end 353 | until true 354 | end 355 | end 356 | if (suitCount >= 5) then 357 | table.insert(combos, 358 | "Straight-Flush: " .. straight[1] .. ',' .. straight[2] .. ',' .. straight[3] .. ',' .. 359 | straight[4] .. ',' .. straight[5]) 360 | table.remove(straight, 1) 361 | straightLength = straightLength - 1 362 | suitCount = 0 363 | else 364 | suitCount = 0 365 | end 366 | end 367 | if (straightLength == 5) then 368 | table.insert(combos, "Straight: " .. straight[1] .. ',' .. straight[2] .. ',' .. straight[3] .. ',' .. 369 | straight[4] .. ',' .. straight[5]) 370 | table.remove(straight, 1) 371 | straightLength = straightLength - 1 372 | end 373 | end 374 | if (counter[key] > 0) then 375 | straightLength = straightLength + 1 376 | table.insert(straight, key) 377 | else 378 | straightLength = 0 379 | straight = {} 380 | end 381 | if (straightLength == 4 and key == "2" and counter["Ace"] > 0) then 382 | table.insert(straight, "A") 383 | table.insert(combos, "Straight: " .. straight[1] .. ',' .. straight[2] .. ',' .. straight[3] .. ',' .. 384 | straight[4] .. ',' .. straight[5]) 385 | end 386 | end 387 | end 388 | 389 | function calculate() 390 | if (G.STATE ~= G.STATES.MENU and handCards ~= nil and deckCards ~= nil) then 391 | 392 | end 393 | end 394 | 395 | function pairProb() 396 | 397 | end 398 | 399 | function evaluatePlay() 400 | text, disp_text, poker_hands, scoring_hand, non_loc_disp_text = G.FUNCS.get_poker_hand_info(G.hand.highlighted) 401 | 402 | G.GAME.hands[text].visible = true 403 | 404 | -- Add all the pure bonus cards to the scoring hand 405 | local pures = {} 406 | for i = 1, #G.play.cards do 407 | if next(find_joker('Splash')) then 408 | scoring_hand[i] = G.play.cards[i] 409 | else 410 | if G.play.cards[i].ability.effect == 'Stone Card' then 411 | local inside = false 412 | for j = 1, #scoring_hand do 413 | if scoring_hand[j] == G.play.cards[i] then 414 | inside = true 415 | end 416 | end 417 | if not inside then 418 | table.insert(pures, G.play.cards[i]) 419 | end 420 | end 421 | end 422 | end 423 | for i = 1, #pures do 424 | table.insert(scoring_hand, pures[i]) 425 | end 426 | table.sort(scoring_hand, function(a, b) 427 | return a.T.x < b.T.x 428 | end) 429 | 430 | local percent = 0.3 431 | local percent_delta = 0.08 432 | 433 | if not G.GAME.blind:debuff_hand(G.play.cards, poker_hands, text) then 434 | mult = mod_mult(G.GAME.hands[text].mult) 435 | hand_chips = mod_chips(G.GAME.hands[text].chips) 436 | 437 | if G.GAME.first_used_hand_level and G.GAME.first_used_hand_level > 0 then 438 | level_up_hand(G.deck.cards[1], text, nil, G.GAME.first_used_hand_level) 439 | G.GAME.first_used_hand_level = nil 440 | end 441 | 442 | local hand_text_set = false 443 | for i = 1, #G.jokers.cards do 444 | -- Calculate the joker effects 445 | local effects = eval_card(G.jokers.cards[i], { 446 | cardarea = G.jokers, 447 | full_hand = G.play.cards, 448 | scoring_hand = scoring_hand, 449 | scoring_name = text, 450 | poker_hands = poker_hands, 451 | before = true 452 | }) 453 | if effects.jokers then 454 | percent = percent + percent_delta 455 | if effects.jokers.level_up then 456 | level_up_hand(G.jokers.cards[i], text) 457 | end 458 | end 459 | end 460 | 461 | mult = mod_mult(G.GAME.hands[text].mult) 462 | hand_chips = mod_chips(G.GAME.hands[text].chips) 463 | 464 | local modded = false 465 | 466 | mult, hand_chips, modded = G.GAME.blind:modify_hand(G.play.cards, poker_hands, text, mult, hand_chips) 467 | mult, hand_chips = mod_mult(mult), mod_chips(hand_chips) 468 | 469 | for i = 1, #scoring_hand do 470 | -- Add cards played to list 471 | if scoring_hand[i].ability.effect ~= 'Stone Card' then 472 | G.GAME.cards_played[scoring_hand[i].base.value].total = 473 | G.GAME.cards_played[scoring_hand[i].base.value].total + 1 474 | G.GAME.cards_played[scoring_hand[i].base.value].suits[scoring_hand[i].base.suit] = true 475 | end 476 | -- If card is debuffed 477 | if scoring_hand[i].debuff then 478 | G.GAME.blind.triggered = true 479 | else 480 | -- Check for play doubling 481 | local reps = {1} 482 | 483 | -- From Red seal 484 | local eval = eval_card(scoring_hand[i], { 485 | repetition_only = true, 486 | cardarea = G.play, 487 | full_hand = G.play.cards, 488 | scoring_hand = scoring_hand, 489 | scoring_name = text, 490 | poker_hands = poker_hands, 491 | repetition = true 492 | }) 493 | if next(eval) then 494 | for h = 1, eval.seals.repetitions do 495 | reps[#reps + 1] = eval 496 | end 497 | end 498 | -- From jokers 499 | for j = 1, #G.jokers.cards do 500 | -- calculate the joker effects 501 | local eval = eval_card(G.jokers.cards[j], { 502 | cardarea = G.play, 503 | full_hand = G.play.cards, 504 | scoring_hand = scoring_hand, 505 | scoring_name = text, 506 | poker_hands = poker_hands, 507 | other_card = scoring_hand[i], 508 | repetition = true 509 | }) 510 | if next(eval) and eval.jokers then 511 | for h = 1, eval.jokers.repetitions do 512 | reps[#reps + 1] = eval 513 | end 514 | end 515 | end 516 | for j = 1, #reps do 517 | percent = percent + percent_delta 518 | 519 | -- calculate the hand effects 520 | local effects = {eval_card(scoring_hand[i], { 521 | cardarea = G.play, 522 | full_hand = G.play.cards, 523 | scoring_hand = scoring_hand, 524 | poker_hand = text 525 | })} 526 | for k = 1, #G.jokers.cards do 527 | -- calculate the joker individual card effects 528 | local eval = G.jokers.cards[k]:calculate_joker({ 529 | cardarea = G.play, 530 | full_hand = G.play.cards, 531 | scoring_hand = scoring_hand, 532 | scoring_name = text, 533 | poker_hands = poker_hands, 534 | other_card = scoring_hand[i], 535 | individual = true 536 | }) 537 | if eval then 538 | table.insert(effects, eval) 539 | end 540 | end 541 | scoring_hand[i].lucky_trigger = nil 542 | 543 | for ii = 1, #effects do 544 | -- If chips added, do chip add event and add the chips to the total 545 | if effects[ii].chips then 546 | if effects[ii].card then 547 | ass = 1 -- ASS 548 | end 549 | hand_chips = mod_chips(hand_chips + effects[ii].chips) 550 | end 551 | 552 | -- If mult added, do mult add event and add the mult to the total 553 | if effects[ii].mult then 554 | mult = mod_mult(mult + effects[ii].mult) 555 | end 556 | 557 | -- Any extra effects 558 | if effects[ii].extra then 559 | local extras = { 560 | mult = false, 561 | hand_chips = false 562 | } 563 | if effects[ii].extra.mult_mod then 564 | mult = mod_mult(mult + effects[ii].extra.mult_mod); 565 | extras.mult = true 566 | end 567 | if effects[ii].extra.chip_mod then 568 | hand_chips = mod_chips(hand_chips + effects[ii].extra.chip_mod); 569 | extras.hand_chips = true 570 | end 571 | if effects[ii].extra.swap then 572 | local old_mult = mult 573 | mult = mod_mult(hand_chips) 574 | hand_chips = mod_chips(old_mult) 575 | extras.hand_chips = true; 576 | extras.mult = true 577 | end 578 | end 579 | 580 | -- If x_mult added, do mult add event and mult the mult to the total 581 | if effects[ii].x_mult then 582 | mult = mod_mult(mult * effects[ii].x_mult) 583 | end 584 | 585 | -- calculate the card edition effects 586 | if effects[ii].edition then 587 | hand_chips = mod_chips(hand_chips + (effects[ii].edition.chip_mod or 0)) 588 | mult = mult + (effects[ii].edition.mult_mod or 0) 589 | mult = mod_mult(mult * (effects[ii].edition.x_mult_mod or 1)) 590 | end 591 | end 592 | end 593 | end 594 | end 595 | 596 | local mod_percent = false 597 | for i = 1, #G.hand.cards do 598 | if mod_percent then 599 | percent = percent + percent_delta 600 | end 601 | mod_percent = false 602 | 603 | -- Check for hand doubling 604 | local reps = {1} 605 | local j = 1 606 | while j <= #reps do 607 | 608 | -- calculate the hand effects 609 | local effects = {eval_card(G.hand.cards[i], { 610 | cardarea = G.hand, 611 | full_hand = G.play.cards, 612 | scoring_hand = scoring_hand, 613 | scoring_name = text, 614 | poker_hands = poker_hands 615 | })} 616 | 617 | for k = 1, #G.jokers.cards do 618 | -- calculate the joker individual card effects 619 | local eval = G.jokers.cards[k]:calculate_joker({ 620 | cardarea = G.hand, 621 | full_hand = G.play.cards, 622 | scoring_hand = scoring_hand, 623 | scoring_name = text, 624 | poker_hands = poker_hands, 625 | other_card = G.hand.cards[i], 626 | individual = true 627 | }) 628 | if eval then 629 | mod_percent = true 630 | table.insert(effects, eval) 631 | end 632 | end 633 | 634 | if reps[j] == 1 then 635 | -- Check for hand doubling 636 | 637 | -- From Red seal 638 | local eval = eval_card(G.hand.cards[i], { 639 | repetition_only = true, 640 | cardarea = G.hand, 641 | full_hand = G.play.cards, 642 | scoring_hand = scoring_hand, 643 | scoring_name = text, 644 | poker_hands = poker_hands, 645 | repetition = true, 646 | card_effects = effects 647 | }) 648 | if next(eval) and (next(effects[1]) or #effects > 1) then 649 | for h = 1, eval.seals.repetitions do 650 | reps[#reps + 1] = eval 651 | end 652 | end 653 | 654 | -- From Joker 655 | for j = 1, #G.jokers.cards do 656 | -- calculate the joker effects 657 | local eval = eval_card(G.jokers.cards[j], { 658 | cardarea = G.hand, 659 | full_hand = G.play.cards, 660 | scoring_hand = scoring_hand, 661 | scoring_name = text, 662 | poker_hands = poker_hands, 663 | other_card = G.hand.cards[i], 664 | repetition = true, 665 | card_effects = effects 666 | }) 667 | if next(eval) then 668 | for h = 1, eval.jokers.repetitions do 669 | reps[#reps + 1] = eval 670 | end 671 | end 672 | end 673 | end 674 | 675 | for ii = 1, #effects do 676 | -- if this effect came from a joker 677 | if effects[ii].card then 678 | mod_percent = true 679 | end 680 | 681 | -- If hold mult added, do hold mult add event and add the mult to the total 682 | 683 | if effects[ii].h_mult then 684 | mod_percent = true 685 | mult = mod_mult(mult + effects[ii].h_mult) 686 | end 687 | 688 | if effects[ii].x_mult then 689 | mod_percent = true 690 | mult = mod_mult(mult * effects[ii].x_mult) 691 | end 692 | 693 | if effects[ii].message then 694 | mod_percent = true 695 | end 696 | end 697 | j = j + 1 698 | end 699 | end 700 | -- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 701 | -- Joker Effects 702 | -- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 703 | percent = percent + percent_delta 704 | for i = 1, #G.jokers.cards + #G.consumeables.cards do 705 | local _card = G.jokers.cards[i] or G.consumeables.cards[i - #G.jokers.cards] 706 | -- calculate the joker edition effects 707 | local edition_effects = eval_card(_card, { 708 | cardarea = G.jokers, 709 | full_hand = G.play.cards, 710 | scoring_hand = scoring_hand, 711 | scoring_name = text, 712 | poker_hands = poker_hands, 713 | edition = true 714 | }) 715 | if edition_effects.jokers then 716 | edition_effects.jokers.edition = true 717 | if edition_effects.jokers.chip_mod then 718 | hand_chips = mod_chips(hand_chips + edition_effects.jokers.chip_mod) 719 | end 720 | if edition_effects.jokers.mult_mod then 721 | mult = mod_mult(mult + edition_effects.jokers.mult_mod) 722 | end 723 | percent = percent + percent_delta 724 | end 725 | 726 | -- calculate the joker effects 727 | local effects = eval_card(_card, { 728 | cardarea = G.jokers, 729 | full_hand = G.play.cards, 730 | scoring_hand = scoring_hand, 731 | scoring_name = text, 732 | poker_hands = poker_hands, 733 | joker_main = true 734 | }) 735 | 736 | -- Any Joker effects 737 | if effects.jokers then 738 | local extras = { 739 | mult = false, 740 | hand_chips = false 741 | } 742 | if effects.jokers.mult_mod then 743 | mult = mod_mult(mult + effects.jokers.mult_mod); 744 | extras.mult = true 745 | end 746 | if effects.jokers.chip_mod then 747 | hand_chips = mod_chips(hand_chips + effects.jokers.chip_mod); 748 | extras.hand_chips = true 749 | end 750 | if effects.jokers.Xmult_mod then 751 | mult = mod_mult(mult * effects.jokers.Xmult_mod); 752 | extras.mult = true 753 | end 754 | 755 | percent = percent + percent_delta 756 | end 757 | 758 | -- Joker on Joker effects 759 | for _, v in ipairs(G.jokers.cards) do 760 | local effect = v:calculate_joker{ 761 | full_hand = G.play.cards, 762 | scoring_hand = scoring_hand, 763 | scoring_name = text, 764 | poker_hands = poker_hands, 765 | other_joker = _card 766 | } 767 | if effect then 768 | local extras = { 769 | mult = false, 770 | hand_chips = false 771 | } 772 | if effect.mult_mod then 773 | mult = mod_mult(mult + effect.mult_mod); 774 | extras.mult = true 775 | end 776 | if effect.chip_mod then 777 | hand_chips = mod_chips(hand_chips + effect.chip_mod); 778 | extras.hand_chips = true 779 | end 780 | if effect.Xmult_mod then 781 | mult = mod_mult(mult * effect.Xmult_mod); 782 | extras.mult = true 783 | end 784 | percent = percent + percent_delta 785 | end 786 | end 787 | 788 | if edition_effects.jokers then 789 | if edition_effects.jokers.x_mult_mod then 790 | mult = mod_mult(mult * edition_effects.jokers.x_mult_mod) 791 | end 792 | percent = percent + percent_delta 793 | end 794 | end 795 | 796 | mult = mod_mult(nu_mult or mult) 797 | hand_chips = mod_chips(nu_chip or hand_chips) 798 | 799 | else 800 | mult = mod_mult(0) 801 | hand_chips = mod_chips(0) 802 | 803 | -- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 804 | -- Joker Debuff Effects 805 | -- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 806 | for i = 1, #G.jokers.cards do 807 | 808 | -- calculate the joker effects 809 | local effects = eval_card(G.jokers.cards[i], { 810 | cardarea = G.jokers, 811 | full_hand = G.play.cards, 812 | scoring_hand = scoring_hand, 813 | scoring_name = text, 814 | poker_hands = poker_hands, 815 | debuffed_hand = true 816 | }) 817 | 818 | -- Any Joker effects 819 | if effects.jokers then 820 | card_eval_status_text(G.jokers.cards[i], 'jokers', nil, percent, nil, effects.jokers) 821 | percent = percent + percent_delta 822 | end 823 | end 824 | end 825 | 826 | for i = 1, #G.jokers.cards do 827 | -- calculate the joker after hand played effects 828 | local effects = eval_card(G.jokers.cards[i], { 829 | cardarea = G.jokers, 830 | full_hand = G.play.cards, 831 | scoring_hand = scoring_hand, 832 | scoring_name = text, 833 | poker_hands = poker_hands, 834 | after = true 835 | }) 836 | if effects.jokers then 837 | card_eval_status_text(G.jokers.cards[i], 'jokers', nil, percent, nil, effects.jokers) 838 | percent = percent + percent_delta 839 | end 840 | end 841 | return hand_chips * mult 842 | end 843 | 844 | minmax = { 845 | ["min"] = 0, 846 | ["max"] = 0 847 | } 848 | 849 | local draw_ref = G.FUNCS.draw_from_discard_to_deck 850 | function G.FUNCS.draw_from_discard_to_deck(self, e) 851 | draw_ref(self, e) 852 | minmax["min"] = 0 853 | minmax["max"] = 0 854 | end 855 | 856 | local sec_ref = CardArea.align_cards 857 | function CardArea.align_cards(self) 858 | sec_ref(self) 859 | 860 | -- local handCards = G.hand.cards 861 | -- local deckCards = G.deck.cards 862 | if (combo_conf) then 863 | probabilities = {} 864 | combos = {} 865 | checkHand() 866 | end 867 | end 868 | 869 | local card_ref = Card.click 870 | function Card.click(self) 871 | 872 | card_ref(self) 873 | result = 0 874 | if (chips_calc_conf) then 875 | if self.area and self.area:can_highlight(self) then 876 | if (#G.hand.highlighted ~= 0) then 877 | result = evaluatePlay() 878 | minmax["min"] = result 879 | minmax["max"] = result 880 | for i = 1, 49 do 881 | result = evaluatePlay() 882 | if (result < minmax["min"]) then 883 | minmax["min"] = result 884 | elseif (result > minmax["max"]) then 885 | minmax["max"] = result 886 | end 887 | end 888 | 889 | end 890 | end 891 | end 892 | 893 | end 894 | 895 | ---------------------------------------------- 896 | ------------MOD CODE END---------------------- 897 | --------------------------------------------------------------------------------