Added option for redraw
This commit is contained in:
@@ -9,6 +9,7 @@ var sameColorExtra = 4; // extra points given for sets of the same color if they
|
|||||||
var autoDraw = false; // whether the script should automatically draw on start and on discard
|
var autoDraw = false; // whether the script should automatically draw on start and on discard
|
||||||
var autoRecommend = true; // whether the script should automatically recommend on change
|
var autoRecommend = true; // whether the script should automatically recommend on change
|
||||||
var measurePerformance = false; // whether the performance should be logged into the console
|
var measurePerformance = false; // whether the performance should be logged into the console
|
||||||
|
var allowRedraw = true; // if redrawing a card by hand is allowed (sometimes the real game is bugged and will give dupes)
|
||||||
|
|
||||||
var allCards = undefined;
|
var allCards = undefined;
|
||||||
var deck = undefined;
|
var deck = undefined;
|
||||||
@@ -191,12 +192,24 @@ function drawCard(cardId, thisHand = null, thisDeck = null) {
|
|||||||
handGiven = false;
|
handGiven = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isHandFull(thisHand) && thisDeck.includes(cardId)) {
|
if (!isHandFull(thisHand)) {
|
||||||
thisDeck.splice(thisDeck.indexOf(cardId), 1);
|
let allowed = false;
|
||||||
thisHand.push(cardId);
|
if (allowRedraw) {
|
||||||
|
allowed = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (thisDeck.includes(cardId)) {
|
||||||
|
allowed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!handGiven) {
|
if (allowed) {
|
||||||
updateUI();
|
thisDeck.splice(thisDeck.indexOf(cardId), 1);
|
||||||
|
thisHand.push(cardId);
|
||||||
|
|
||||||
|
if (!handGiven) {
|
||||||
|
updateUI();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user