From 62baf3ac40630e79b97024570816d48755f83e14 Mon Sep 17 00:00:00 2001 From: efhiii Date: Wed, 13 Mar 2024 18:55:25 -0700 Subject: [PATCH] mime and steel breakdown --- balatro-sim.js | 16 +++++- breakdown.js | 141 ++++++++++++++++++++++++++++++++++++++++++++++- manageWorkers.js | 16 ++++-- worker.js | 2 +- 4 files changed, 164 insertions(+), 11 deletions(-) diff --git a/balatro-sim.js b/balatro-sim.js index 5f6c40f..8a665ec 100644 --- a/balatro-sim.js +++ b/balatro-sim.js @@ -901,8 +901,20 @@ class Hand { } // retriggers - if(!retrigger && card[SEAL] === RED_SEAL) { - this.triggerCardInHand(card, true); + if(!retrigger) { + if(card[SEAL] === RED_SEAL) { + this.triggerCardInHand(card, true); + } + + for(let j = 0; j < this.jokers.length; j++) { + const joker = this.jokers[j]; + if(joker[JOKER_DISABLED]) continue; + switch(joker[JOKER]) { + case 14: + this.triggerCardInHand(card, true); + break; + } + } } } diff --git a/breakdown.js b/breakdown.js index 3663d62..cd1bc24 100644 --- a/breakdown.js +++ b/breakdown.js @@ -1032,6 +1032,16 @@ class Hand { if(!retrigger) { if(card[SEAL] === RED_SEAL) { this.triggerCard(card, true); + + if(this.bd) { + this.breakdown.push({ + cards: [card], + description: 'Retrigger', + chips: this.compiledChips, + mult: this.compiledMult, + retrigger: true + }); + } } for(let j = 0; j < this.jokers.length; j++) { @@ -1041,18 +1051,48 @@ class Hand { case 13: // Sock and Buskin if(isFace) { + if(this.bd) { + this.breakdown.push({ + cards: [card, joker], + description: 'Retrigger', + chips: this.compiledChips, + mult: this.compiledMult, + retrigger: true + }); + } + this.triggerCard(card, true); } break; case 25: // Hack if(card[RANK] <= _5) { + if(this.bd) { + this.breakdown.push({ + cards: [card, joker], + description: 'Retrigger', + chips: this.compiledChips, + mult: this.compiledMult, + retrigger: true + }); + } + this.triggerCard(card, true); } break; case 69: // Hanging Chad if(this.jokersExtraValue[j] === 0) { + if(this.bd) { + this.breakdown.push({ + cards: [card, joker], + description: 'Retrigger', + chips: this.compiledChips, + mult: this.compiledMult, + retrigger: true + }); + } + this.jokersExtraValue[j]++; this.triggerCard(card, true); } @@ -1060,11 +1100,31 @@ class Hand { case 74: // Dusk if(joker[VALUE] !== 0) { + if(this.bd) { + this.breakdown.push({ + cards: [card, joker], + description: 'Retrigger', + chips: this.compiledChips, + mult: this.compiledMult, + retrigger: true + }); + } + this.triggerCard(card, true); } break; case 153: // Seltzer + if(this.bd) { + this.breakdown.push({ + cards: [card, joker], + description: 'Retrigger', + chips: this.compiledChips, + mult: this.compiledMult, + retrigger: true + }); + } + this.triggerCard(card, true); break; } @@ -1077,6 +1137,15 @@ class Hand { if(card[ENHANCEMENT] === STEEL && !card[CARD_DISABLED]) { this.compiledInHandPlusMult = bigTimes(1.5, this.compiledInHandPlusMult); this.compiledInHandTimesMult = bigTimes(1.5, this.compiledInHandTimesMult); + + if(this.bd) { + this.inHandBreakdown.push({ + cards: [card], + description: `${prodc}1.5${endc} Mult`, + chips: this.compiledInHandTimesMult, + mult: this.compiledInHandPlusMult + }); + } } for(let j = 0; j < this.jokers.length; j++) { @@ -1087,12 +1156,30 @@ class Hand { // Raised Fist if(card === this.compiledValues[j] && card[ENHANCEMENT] !== STONE) { this.compiledInHandPlusMult = bigAdd(2 * (card[RANK] === ACE ? 11 : Math.max(10, card[RANK] + 2)), this.compiledInHandPlusMult); + + if(this.bd) { + this.inHandBreakdown.push({ + cards: [card, joker], + description: `${multc}+${2 * (card[RANK] === ACE ? 11 : Math.max(10, card[RANK] + 2))}${endc} Mult`, + chips: this.compiledInHandTimesMult, + mult: this.compiledInHandPlusMult + }); + } } break; case 62: // Shoot the Moon if(card[RANK] === QUEEN && card[ENHANCEMENT] !== STONE) { this.compiledInHandPlusMult = bigAdd(13, this.compiledInHandPlusMult); + + if(this.bd) { + this.inHandBreakdown.push({ + cards: [card, joker], + description: `${multc}+13${endc} Mult`, + chips: this.compiledInHandTimesMult, + mult: this.compiledInHandPlusMult + }); + } } break; case 126: @@ -1100,14 +1187,55 @@ class Hand { if(card[RANK] === KING && card[ENHANCEMENT] !== STONE) { this.compiledInHandPlusMult = bigTimes(1.5, this.compiledInHandPlusMult); this.compiledInHandTimesMult = bigTimes(1.5, this.compiledInHandTimesMult); + + if(this.bd) { + this.inHandBreakdown.push({ + cards: [card, joker], + description: `${prodc}1.5${endc} Mult`, + chips: this.compiledInHandTimesMult, + mult: this.compiledInHandPlusMult + }); + } } break; } } // retriggers - if(!retrigger && card[SEAL] === RED_SEAL) { - this.triggerCardInHand(card, true); + if(!retrigger) { + if(card[SEAL] === RED_SEAL) { + if(this.bd) { + this.inHandBreakdown.push({ + cards: [card], + description: 'Retrigger', + chips: this.compiledInHandTimesMult, + mult: this.compiledInHandPlusMult, + retrigger: true + }); + } + + this.triggerCardInHand(card, true); + } + + for(let j = 0; j < this.jokers.length; j++) { + const joker = this.jokers[j]; + if(joker[JOKER_DISABLED]) continue; + switch(joker[JOKER]) { + case 14: + if(this.bd) { + this.inHandBreakdown.push({ + cards: [card, joker], + description: 'Retrigger', + chips: this.compiledInHandTimesMult, + mult: this.compiledInHandPlusMult, + retrigger: true + }); + } + + this.triggerCardInHand(card, true); + break; + } + } } } @@ -1362,6 +1490,7 @@ class Hand { this.lowestCard = false; this.breakdown = []; + this.inHandBreakdown = []; for(let c = 0; c < this.cards.length; c++) { if(this.cards[c][ENHANCEMENT] === WILD) { @@ -1801,6 +1930,14 @@ class Hand { } // score cards-in-hand + if(this.bd) { + for(let l = 0; l < this.inHandBreakdown.length; l++) { + this.inHandBreakdown[l].mult = bigBigAdd(bigBigTimes(this.inHandBreakdown[l].chips, this.mult), this.inHandBreakdown[l].mult); + this.inHandBreakdown[l].chips = this.chips; + } + this.breakdown.push(...this.inHandBreakdown); + } + this.mult = bigBigTimes(this.compiledInHandTimesMult, this.mult); this.mult = bigBigAdd(this.compiledInHandPlusMult, this.mult); diff --git a/manageWorkers.js b/manageWorkers.js index 373eeca..f574f40 100644 --- a/manageWorkers.js +++ b/manageWorkers.js @@ -207,6 +207,7 @@ function terminateThreads() { let tmpBestJokers; let tmpBestCards; +let tmpBestCardsInHand; let tmpBestHighHand; let tmpBestLowHand; let tmpTypeOfHand; @@ -219,17 +220,19 @@ function workerMessage(msg) { bestScore = msg.data[1]; tmpBestJokers = msg.data[2]; tmpBestCards = msg.data[3]; - tmpBestHighHand = msg.data[4]; - tmpBestLowHand = msg.data[5]; - tmpTypeOfHand = msg.data[6]; + tmpBestCardsInHand = msg.data[4]; + tmpBestHighHand = msg.data[5]; + tmpBestLowHand = msg.data[6]; + tmpTypeOfHand = msg.data[7]; } if(msg.data[1][1] > bestScore[1] || (msg.data[1][1] === bestScore[1] && msg.data[1][0] > bestScore[0])) { bestScore = msg.data[1]; tmpBestJokers = msg.data[2]; tmpBestCards = msg.data[3]; - tmpBestHighHand = msg.data[4]; - tmpBestLowHand = msg.data[5]; - tmpTypeOfHand = msg.data[6]; + tmpBestCardsInHand = msg.data[4]; + tmpBestHighHand = msg.data[5]; + tmpBestLowHand = msg.data[6]; + tmpTypeOfHand = msg.data[7]; } if(tasks === 0) { bestJokers = tmpBestJokers.map(a => { @@ -258,6 +261,7 @@ function workerMessage(msg) { breakdownHand.jokers = tmpBestJokers; breakdownHand.cards = tmpBestCards; + breakdownHand.cardsInHand = tmpBestCardsInHand; breakdownHand.compileAll(); breakdownHand.simulateWorstHand(); updateBreakdown(breakdownHand.breakdown.map(a => { diff --git a/worker.js b/worker.js index ee034ea..f36534a 100644 --- a/worker.js +++ b/worker.js @@ -230,7 +230,7 @@ function run(jokers = [[]]) { thisHand.compileAll(); - postMessage([taskID, bestScore, bestJokers, bestCards, thisHand.simulateBestHand(), thisHand.simulateWorstHand(), thisHand.typeOfHand]); + postMessage([taskID, bestScore, bestJokers, bestCards, bestCardsInHand, thisHand.simulateBestHand(), thisHand.simulateWorstHand(), thisHand.typeOfHand]); } self.onmessage = async function(msg) {