improve david protection

This commit is contained in:
Maximilian Keßler 2022-09-18 00:03:01 +02:00
parent 2a9d53fe53
commit 1da4f5ae36
Signed by: max
GPG key ID: BCC5A619923C0BA5

View file

@ -105,7 +105,7 @@ function injectCounter() {
davidProtectionButton.className = "btn btn-success btn-xs";
davidProtectionButton.id = "davidProtection";
davidProtectionButton.type = "button";
davidProtectionButton.innerHTML = 'David protection: <span id="davidProtectionValue" data-on="On" data-off="Off">Yes</span>';
davidProtectionButton.innerHTML = 'David protection: <span id="davidProtectionValue" data-on="On" data-off="Off">Off</span>';
var showRemainingButton = document.createElement('button');
showRemainingButton.className = "btn btn-info btn-xs";
@ -400,8 +400,10 @@ function injectCounter() {
ot.$fold.unbind();
ot.$fold.hide().click(function () {
if (otc.davidProtection) {
if(ot.$passCards.length != 0 && !otc.davidProtectionTriggered) {
ot.$gameMessage.text("You have selected cards to play but folded. Are you sure? Press fold again to fold");
if(ot.$passCards().length != 0 && !otc.davidProtectionTriggered) {
console.log('david protection triggered');
ot.$gameMessage.text("Selected cards detected. Press again to fold!");
ot.HorizontalAlign(ot.$gameMessage);
otc.davidProtectionTriggered = true;
return;
}
@ -411,11 +413,6 @@ function injectCounter() {
$(this).hide();
});
ot.$fold.hide().click(function () {
ot.action.Fold();
$(this).hide();
});
MyTableState = (function() {
var cachedFunction = ot.reaction.TableState;