Skip to content

Commit

Permalink
5.0.4 bugfix
Browse files Browse the repository at this point in the history
4 Apr  2024 - v5.0.4 - Bugfixes for Prize Tickets, first 10 mystery boxes, and Calico Jack dealer draws
  • Loading branch information
MouseyPounds committed Apr 4, 2024
1 parent 24f5a32 commit 8b47c12
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Please report any bugs, suggestions, or other feedback to [the topic in the Star

## Changelog

* 4 Apr 2024 - v5.0.4 - Bugfixes for Prize Tickets, first 10 mystery boxes, and Calico Jack dealer draws
* 30 Mar 2024 - v5.0.3 - Finally added slightly more friendly error-handling
* 28 Mar 2024 - v5.0.2 - Fixed precision loss bug in enchantment code
* 27 Mar 2024 - v5.0.1 - Update cart item lists for 1.6.3 patch
Expand Down
7 changes: 5 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="./jquery-3.2.1.min.js"><\/script>')</script>
<script src="./cs-random.js"></script>
<script src="./stardew-predictor.js?v=5.0.3"></script>
<script src="./stardew-predictor.js?v=5.0.4"></script>
<script src="./BigInteger.min.js"></script>
<script src="./xxhash.min.js"></script>

Expand Down Expand Up @@ -68,7 +68,8 @@ <h3 id="advanced_usage">Advanced Usage</h3>
<tr><td class="code">gameID</td><td class="code">id</td><td>Integer</td><td class="long_list">Sets the game seed</td></tr>
<tr><td class="code">daysPlayed</td><td class="code">dp</td><td>Integer</td><td class="long_list">Sets days played which changes where calendar views start</td></tr>
<tr><td class="code">dayAdjust</td><td class="code">da</td><td>Integer</td><td class="long_list">Offsets days played by the given amount to deal with old multiplayer bugs</td></tr>
<tr><td class="code">dailyLuck</td><td class="code">dl</td><td>Float</td><td class="long_list">Sets daily luck for garbage checks; will be forced into range [-0.1, 0.1]</td></tr>
<tr><td class="code">dailyLuck</td><td class="code">dl</td><td>Float</td><td class="long_list">Sets daily luck for garbage checks; will be forced into range [-0.1, 0.1]<br/>Note, this is raw luck before special charm is taken into account</td></tr>
<tr><td class="code">luckLevel</td><td class="code">ll</td><td>Integer</td><td class="long_list">Sets luck buff level (from food, rings, etc.)</td></tr>
<tr><td class="code">geodesCracked</td><td class="code">gc</td><td>Integer</td><td class="long_list">Sets number of geodes cracked by the host</td></tr>
<tr><td class="code">mysteryBoxesOpened</td><td class="code">mb</td><td>Integer</td><td class="long_list">Sets number of mystery boxes opened by the host</td></tr>
<tr><td class="code">ticketPrizesClaimed</td><td class="code">pt</td><td>Integer</td><td class="long_list">Sets number of prize ticket rewards claimed by the host</td></tr>
Expand Down Expand Up @@ -184,6 +185,7 @@ <h3>Bookseller</h3>
<h3>CalicoJack</h3>
<p class="intro" id="cj-intro">Predicted results from playing the <a href="https://stardewvalleywiki.com/CalicoJack">Blackjack-like card game</a> at the <a href="https://stardewvalleywiki.com/Casino">Oasis Casino</a>. The results tell you what actions to take to win the game if possible. The game does not keep a cumulative counts of plays in the save, but instead uses a fresh counter every play session. As a result, the layout of this tab is a little different with two sets of navigation buttons. The top set lets you change the day of prediction, and the bottom set changes number of games played in the current session.</p>
<p>Since one can bet "Double or Nothing" following a win, coins can be quickly accumulated during long win streaks although one must be careful to avoid overflowing their coin count into the negatives. If starting from nothing, overflow would happen on the 22nd consecutive win.</p>
<p>Stardew 1.6 added a very rare chance for the dealer to draw a card worth 999 and results in the player winning 3 times their bet. Predictor should indicate when this is likely to happen (the roll is modified by both daily luck and luck buffs) but it does not currently attempt to search out this result.</p>
<p class="note" id="cj-note"></p>
<fieldset id="cj-d-buttons"><div class="buttons">
<button id="cj-d-prev-week" type="button" class="browse">&lt;&lt; Previous Week</button>
Expand Down Expand Up @@ -636,6 +638,7 @@ <h3>Feast of the Winter Star Gift Assignments</h3>
<noscript><span class="error">Javascript appears to be unsupported by or disabled in your browser. Stardew Predictor will not work without it.</span></noscript>
<h2 id="sec_changelog">Changelog</h2>
<ul>
<li> 4 Apr 2024 - v5.0.4 - Bugfixes for Prize Tickets, first 10 mystery boxes, and Calico Jack dealer draws</li>
<li>30 Mar 2024 - v5.0.3 - Finally added slightly more friendly error-handling</li>
<li>28 Mar 2024 - v5.0.2 - Fixed precision loss bug in enchantment code</li>
<li>27 Mar 2024 - v5.0.1 - Update cart item lists for 1.6.3 patch</li>
Expand Down
24 changes: 22 additions & 2 deletions stardew-predictor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3377,6 +3377,7 @@ window.onload = function () {
save.deepestMineLevel = 0;
save.timesFedRaccoons = 0;
save.dailyLuck = -.1;
save.luckLevel = 0;
save.canHaveChildren = false;
save.quarryUnlocked = false;
save.desertUnlocked = false;
Expand Down Expand Up @@ -3758,6 +3759,7 @@ window.onload = function () {
wasChanged.timesFedRaccoons = overrideSaveData("timesFedRaccoons", "timesFedRaccoons", "tfr", "int");
wasChanged.visitsUntilY1Guarantee = overrideSaveData("visitsUntilY1Guarantee", "visitsUntilY1Guarantee", "vg", "int");
wasChanged.dailyLuck = overrideSaveData("dailyLuck", "dailyLuck", "dl", "num");
wasChanged.luckLevel = overrideSaveData("luckLevel", "luckLevel", "ll", "int");
wasChanged.canHaveChildren = overrideSaveData("canHaveChildren", "canHaveChildren", "chc", "bool");
wasChanged.quarryUnlocked = overrideSaveData("quarryUnlocked", "quarryUnlocked", "qu", "bool");
wasChanged.desertUnlocked = overrideSaveData("desertUnlocked", "desertUnlocked", "du", "bool");
Expand Down Expand Up @@ -3790,7 +3792,7 @@ window.onload = function () {
save.dailyLuck = Math.min(0.1, Math.max(-0.1, save.dailyLuck));
// Add share URL. dayAdjust and all boolean options only included if non-default
var share_URL = window.location.protocol + '//' + window.location.host + window.location.pathname + "?id=" + save.gameID +
"&amp;v=" + save.version + "&amp;dp=" + save.daysPlayed + "&amp;dl=" + save.dailyLuck +
"&amp;v=" + save.version + "&amp;dp=" + save.daysPlayed + "&amp;dl=" + save.dailyLuck + "&amp;ll=" + save.luckLevel +
"&amp;dml=" + save.deepestMineLevel + "&amp;vg=" + save.visitsUntilY1Guarantee + "&amp;gc=" + save.geodesCracked[0] +
"&amp;mb=" + save.mysteryBoxesOpened[0] + "&amp;te=" + save.timesEnchanted[0] + "&amp;tc=" + save.trashCansChecked[0] +
"&amp;pt=" + save.ticketPrizesClaimed[0] + "&amp;tfr=" + save.timesFedRaccoons +
Expand Down Expand Up @@ -3889,6 +3891,7 @@ window.onload = function () {
}
output += '</span><br/>';
output += '<span class="result">' + (wasChanged.dailyLuck ? "*":'') + 'Daily Luck is assumed to be ' + save.dailyLuck + '</span><br/>';
output += '<span class="result">' + (wasChanged.luckLevel ? "*":'') + 'Luck buffs are assumed to be ' + save.luckLevel + '</span><br/>';
output += '</td><td>';

output += '<span class="result">' + (wasChanged.useLegacyRandom ? "*":'') + 'Legacy RNG Seeding is ' + (save.useLegacyRandom ? "on" : "off") +
Expand Down Expand Up @@ -8131,6 +8134,7 @@ Object.keys(test).forEach(function(key, index) { if (test[key].s > 0 && test[key
playerTotal = choice[i].t;
r = choice[i].r;
var dealerTotal = dealerStart;
var superBust = '';
// playerTotal is guaranteed to be <= 21 here so the conditional is
// simplified from what the game does
while (dealerTotal < 18 || dealerTotal < playerTotal) {
Expand All @@ -8143,7 +8147,22 @@ Object.keys(test).forEach(function(key, index) { if (test[key].s > 0 && test[key
case 18: autoBust = roll[r++] < .1; break;
default: // always keep original draw
}
dealerTotal += autoBust ? Math.floor(distance + 3 * roll[r++] + 1) : next;
// We need to calculate the autoBust now even though it might get superseded later
if (autoBust) {
next = Math.floor(distance + 3 * roll[r++] + 1);
}
// The superBust (my term) is luck-based
var minRoll = 0.0005;
var chance = Math.max(0.0005, 0.001 + save.dailyLuck/20 + save.luckLevel*.002);
var sbRoll = roll[r++];
if (sbRoll < minRoll) {
next = 999;
superBust = "<br/>Guaranteed super bust with 3x winnings";
} else if (sbRoll < chance) {
next = 999;
superBust = "<br/>Probable super bust with 3x winnings";
}
dealerTotal += next;
}
if (dealerTotal > 21) {
if (choice[i].h === 0) {
Expand All @@ -8157,6 +8176,7 @@ Object.keys(test).forEach(function(key, index) { if (test[key].s > 0 && test[key
havePush = true;
advice = "TIE: Hit " + choice[i].h + " time" + (choice[i].h == 1 ? '' : 's') + " and stand at " + playerTotal;
}
advice += superBust;
}
}

Expand Down

0 comments on commit 8b47c12

Please sign in to comment.