28 lines
556 B
JavaScript
28 lines
556 B
JavaScript
|
|
function HandCard() {
|
|
Card.apply(this, arguments);
|
|
}
|
|
|
|
HandCard.prototype.onClick = function() {
|
|
var card = this;
|
|
return function() {
|
|
if(status.playing && status.step == "ToPlay") {
|
|
if(selected != undefined) {
|
|
selected.setSelected(false);
|
|
} else {
|
|
card.play();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
HandCard.prototype.setSelected = setSelected;
|
|
|
|
HandCard.prototype.play = function() {
|
|
var matching = matchingInRiver(this.value);
|
|
if(matching.length > 1) {
|
|
this.setSelected(true);
|
|
} else {
|
|
play({play: this.name});
|
|
}
|
|
}
|