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.className = "btn btn-success btn-xs";
davidProtectionButton.id = "davidProtection"; davidProtectionButton.id = "davidProtection";
davidProtectionButton.type = "button"; 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'); var showRemainingButton = document.createElement('button');
showRemainingButton.className = "btn btn-info btn-xs"; showRemainingButton.className = "btn btn-info btn-xs";
@ -400,8 +400,10 @@ function injectCounter() {
ot.$fold.unbind(); ot.$fold.unbind();
ot.$fold.hide().click(function () { ot.$fold.hide().click(function () {
if (otc.davidProtection) { if (otc.davidProtection) {
if(ot.$passCards.length != 0 && !otc.davidProtectionTriggered) { 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"); console.log('david protection triggered');
ot.$gameMessage.text("Selected cards detected. Press again to fold!");
ot.HorizontalAlign(ot.$gameMessage);
otc.davidProtectionTriggered = true; otc.davidProtectionTriggered = true;
return; return;
} }
@ -411,11 +413,6 @@ function injectCounter() {
$(this).hide(); $(this).hide();
}); });
ot.$fold.hide().click(function () {
ot.action.Fold();
$(this).hide();
});
MyTableState = (function() { MyTableState = (function() {
var cachedFunction = ot.reaction.TableState; var cachedFunction = ot.reaction.TableState;