cardation
Version:
fundation of card games, card model
39 lines (38 loc) • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const CardError_1 = require("../../error/CardError");
const MarkerCard_1 = require("./MarkerCard");
class BlackMarkerCard extends MarkerCard_1.default {
_rank;
_point = 0;
constructor(point) {
super();
this._rank = 0;
this._point = this._rank;
if (point === undefined) {
this._point = this._rank;
}
else {
if (Number.isNaN(+point)) {
throw new CardError_1.default(`[BlackCard][constructor]: point is expected to be a number but get the type ${typeof point}!`);
}
this._point = +point;
}
}
getCardId() {
return `b${this._rank}.${this._point}`;
}
getPoint() {
return this._point;
}
getRank() {
return this._rank;
}
setPoint(point) {
this._point = point;
}
toString() {
return '⬛';
}
}
exports.default = BlackMarkerCard;