@sillyal/dominion
Version:
Representation of Dominion, a deck-building card game created by Donald X. Vaccarino and published by Rio Grande Games.
449 lines • 14.6 kB
JavaScript
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var Card = /** @class */ (function () {
function Card(name, cost) {
this.name = name;
this.cost = cost;
}
return Card;
}());
exports.Card = Card;
var VictoryCard = /** @class */ (function (_super) {
__extends(VictoryCard, _super);
function VictoryCard(name, cost, points) {
var _this = _super.call(this, name, cost) || this;
_this.points = points;
return _this;
}
return VictoryCard;
}(Card));
exports.VictoryCard = VictoryCard;
var EstateCard = /** @class */ (function (_super) {
__extends(EstateCard, _super);
function EstateCard() {
return _super.call(this, "Estate", 2, 1) || this;
}
EstateCard.prototype.accept = function (visitor) {
visitor.visitEstate(this);
};
return EstateCard;
}(VictoryCard));
exports.EstateCard = EstateCard;
exports.Estate = new EstateCard();
var DuchyCard = /** @class */ (function (_super) {
__extends(DuchyCard, _super);
function DuchyCard() {
return _super.call(this, "Duchy", 5, 3) || this;
}
DuchyCard.prototype.accept = function (visitor) {
visitor.visitDuchy(this);
};
return DuchyCard;
}(VictoryCard));
exports.DuchyCard = DuchyCard;
exports.Duchy = new DuchyCard();
var ProvinceCard = /** @class */ (function (_super) {
__extends(ProvinceCard, _super);
function ProvinceCard() {
return _super.call(this, "Province", 8, 5) || this;
}
ProvinceCard.prototype.accept = function (visitor) {
visitor.visitProvince(this);
};
return ProvinceCard;
}(VictoryCard));
exports.ProvinceCard = ProvinceCard;
exports.Province = new ProvinceCard();
var CurseCard = /** @class */ (function (_super) {
__extends(CurseCard, _super);
function CurseCard() {
return _super.call(this, "Curse", 0, -1) || this;
}
CurseCard.prototype.accept = function (visitor) {
visitor.visitCurse(this);
};
return CurseCard;
}(VictoryCard));
exports.CurseCard = CurseCard;
exports.Curse = new CurseCard();
var GardensCard = /** @class */ (function (_super) {
__extends(GardensCard, _super);
function GardensCard() {
// TODO Evaluate points for Gardens
return _super.call(this, "Gardens", 4, 0) || this;
}
GardensCard.prototype.accept = function (visitor) {
visitor.visitGardens(this);
};
return GardensCard;
}(VictoryCard));
exports.GardensCard = GardensCard;
exports.Gardens = new GardensCard();
function isVictoryCard(card) {
return card.points !== undefined;
}
exports.isVictoryCard = isVictoryCard;
var TreasureCard = /** @class */ (function (_super) {
__extends(TreasureCard, _super);
function TreasureCard(name, cost, coins) {
var _this = _super.call(this, name, cost) || this;
_this.coins = coins;
return _this;
}
return TreasureCard;
}(Card));
exports.TreasureCard = TreasureCard;
var CopperCard = /** @class */ (function (_super) {
__extends(CopperCard, _super);
function CopperCard() {
return _super.call(this, "Copper", 0, 1) || this;
}
CopperCard.prototype.accept = function (visitor) {
visitor.visitCopper(this);
};
return CopperCard;
}(TreasureCard));
exports.CopperCard = CopperCard;
exports.Copper = new CopperCard();
var SilverCard = /** @class */ (function (_super) {
__extends(SilverCard, _super);
function SilverCard() {
return _super.call(this, "Silver", 3, 2) || this;
}
SilverCard.prototype.accept = function (visitor) {
visitor.visitSilver(this);
};
return SilverCard;
}(TreasureCard));
exports.SilverCard = SilverCard;
exports.Silver = new SilverCard();
var GoldCard = /** @class */ (function (_super) {
__extends(GoldCard, _super);
function GoldCard() {
return _super.call(this, "Gold", 6, 3) || this;
}
GoldCard.prototype.accept = function (visitor) {
visitor.visitGold(this);
};
return GoldCard;
}(TreasureCard));
exports.GoldCard = GoldCard;
exports.Gold = new GoldCard();
function isTreasureCard(card) {
return card.coins !== undefined;
}
exports.isTreasureCard = isTreasureCard;
var ActionCard = /** @class */ (function (_super) {
__extends(ActionCard, _super);
function ActionCard() {
return _super !== null && _super.apply(this, arguments) || this;
}
return ActionCard;
}(Card));
exports.ActionCard = ActionCard;
var CellarCard = /** @class */ (function (_super) {
__extends(CellarCard, _super);
function CellarCard() {
return _super.call(this, "Cellar", 2) || this;
}
CellarCard.prototype.accept = function (visitor) {
visitor.visitCellar(this);
};
return CellarCard;
}(ActionCard));
exports.CellarCard = CellarCard;
exports.Cellar = new CellarCard();
var ChapelCard = /** @class */ (function (_super) {
__extends(ChapelCard, _super);
function ChapelCard() {
return _super.call(this, "Chapel", 2) || this;
}
ChapelCard.prototype.accept = function (visitor) {
visitor.visitChapel(this);
};
return ChapelCard;
}(ActionCard));
exports.ChapelCard = ChapelCard;
exports.Chapel = new ChapelCard();
var MoatCard = /** @class */ (function (_super) {
__extends(MoatCard, _super);
function MoatCard() {
return _super.call(this, "Moat", 2) || this;
}
MoatCard.prototype.accept = function (visitor) {
visitor.visitMoat(this);
};
return MoatCard;
}(ActionCard));
exports.MoatCard = MoatCard;
exports.Moat = new MoatCard();
var HarbingerCard = /** @class */ (function (_super) {
__extends(HarbingerCard, _super);
function HarbingerCard() {
return _super.call(this, "Harbinger", 3) || this;
}
HarbingerCard.prototype.accept = function (visitor) {
visitor.visitHarbinger(this);
};
return HarbingerCard;
}(ActionCard));
exports.HarbingerCard = HarbingerCard;
exports.Harbinger = new HarbingerCard();
var MerchantCard = /** @class */ (function (_super) {
__extends(MerchantCard, _super);
function MerchantCard() {
return _super.call(this, "Merchant", 3) || this;
}
MerchantCard.prototype.accept = function (visitor) {
visitor.visitMerchant(this);
};
return MerchantCard;
}(ActionCard));
exports.MerchantCard = MerchantCard;
exports.Merchant = new MerchantCard();
var VassalCard = /** @class */ (function (_super) {
__extends(VassalCard, _super);
function VassalCard() {
return _super.call(this, "Vassal", 3) || this;
}
VassalCard.prototype.accept = function (visitor) {
visitor.visitVassal(this);
};
return VassalCard;
}(ActionCard));
exports.VassalCard = VassalCard;
exports.Vassal = new VassalCard();
var VillageCard = /** @class */ (function (_super) {
__extends(VillageCard, _super);
function VillageCard() {
return _super.call(this, "Village", 3) || this;
}
VillageCard.prototype.accept = function (visitor) {
visitor.visitVillage(this);
};
return VillageCard;
}(ActionCard));
exports.VillageCard = VillageCard;
exports.Village = new VillageCard();
var WorkshopCard = /** @class */ (function (_super) {
__extends(WorkshopCard, _super);
function WorkshopCard() {
return _super.call(this, "Workshop", 3) || this;
}
WorkshopCard.prototype.accept = function (visitor) {
visitor.visitWorkshop(this);
};
return WorkshopCard;
}(ActionCard));
exports.WorkshopCard = WorkshopCard;
exports.Workshop = new WorkshopCard();
var BureaucratCard = /** @class */ (function (_super) {
__extends(BureaucratCard, _super);
function BureaucratCard() {
return _super.call(this, "Bureaucrat", 4) || this;
}
BureaucratCard.prototype.accept = function (visitor) {
visitor.visitBureaucrat(this);
};
return BureaucratCard;
}(ActionCard));
exports.BureaucratCard = BureaucratCard;
exports.Bureaucrat = new BureaucratCard();
var MilitiaCard = /** @class */ (function (_super) {
__extends(MilitiaCard, _super);
function MilitiaCard() {
return _super.call(this, "Militia", 4) || this;
}
MilitiaCard.prototype.accept = function (visitor) {
visitor.visitMilitia(this);
};
return MilitiaCard;
}(ActionCard));
exports.MilitiaCard = MilitiaCard;
exports.Militia = new MilitiaCard();
var MoneylenderCard = /** @class */ (function (_super) {
__extends(MoneylenderCard, _super);
function MoneylenderCard() {
return _super.call(this, "Moneylender", 4) || this;
}
MoneylenderCard.prototype.accept = function (visitor) {
visitor.visitMoneylender(this);
};
return MoneylenderCard;
}(ActionCard));
exports.MoneylenderCard = MoneylenderCard;
exports.Moneylender = new MoneylenderCard();
var PoachCard = /** @class */ (function (_super) {
__extends(PoachCard, _super);
function PoachCard() {
return _super.call(this, "Poacher", 4) || this;
}
PoachCard.prototype.accept = function (visitor) {
visitor.visitPoacher(this);
};
return PoachCard;
}(ActionCard));
exports.PoachCard = PoachCard;
exports.Poacher = new PoachCard();
var RemodelCard = /** @class */ (function (_super) {
__extends(RemodelCard, _super);
function RemodelCard() {
return _super.call(this, "Remodel", 4) || this;
}
RemodelCard.prototype.accept = function (visitor) {
visitor.visitRemodel(this);
};
return RemodelCard;
}(ActionCard));
exports.RemodelCard = RemodelCard;
exports.Remodel = new RemodelCard();
var SmithyCard = /** @class */ (function (_super) {
__extends(SmithyCard, _super);
function SmithyCard() {
return _super.call(this, "Smithy", 4) || this;
}
SmithyCard.prototype.accept = function (visitor) {
visitor.visitSmithy(this);
};
return SmithyCard;
}(ActionCard));
exports.SmithyCard = SmithyCard;
exports.Smithy = new SmithyCard();
var ThroneRoomCard = /** @class */ (function (_super) {
__extends(ThroneRoomCard, _super);
function ThroneRoomCard() {
return _super.call(this, "ThroneRoom", 4) || this;
}
ThroneRoomCard.prototype.accept = function (visitor) {
visitor.visitThroneRoom(this);
};
return ThroneRoomCard;
}(ActionCard));
exports.ThroneRoomCard = ThroneRoomCard;
exports.ThroneRoom = new ThroneRoomCard();
var BanditCard = /** @class */ (function (_super) {
__extends(BanditCard, _super);
function BanditCard() {
return _super.call(this, "Bandit", 5) || this;
}
BanditCard.prototype.accept = function (visitor) {
visitor.visitBandit(this);
};
return BanditCard;
}(ActionCard));
exports.BanditCard = BanditCard;
exports.Bandit = new BanditCard();
var FestivalCard = /** @class */ (function (_super) {
__extends(FestivalCard, _super);
function FestivalCard() {
return _super.call(this, "Festival", 5) || this;
}
FestivalCard.prototype.accept = function (visitor) {
visitor.visitFestival(this);
};
return FestivalCard;
}(ActionCard));
exports.FestivalCard = FestivalCard;
exports.Festival = new FestivalCard();
var LaboratoryCard = /** @class */ (function (_super) {
__extends(LaboratoryCard, _super);
function LaboratoryCard() {
return _super.call(this, "Laboratory", 5) || this;
}
LaboratoryCard.prototype.accept = function (visitor) {
visitor.visitLaboratory(this);
};
return LaboratoryCard;
}(ActionCard));
exports.LaboratoryCard = LaboratoryCard;
exports.Laboratory = new LaboratoryCard();
var LibraryCard = /** @class */ (function (_super) {
__extends(LibraryCard, _super);
function LibraryCard() {
return _super.call(this, "Library", 5) || this;
}
LibraryCard.prototype.accept = function (visitor) {
visitor.visitLibrary(this);
};
return LibraryCard;
}(ActionCard));
exports.LibraryCard = LibraryCard;
exports.Library = new LibraryCard();
var MarketCard = /** @class */ (function (_super) {
__extends(MarketCard, _super);
function MarketCard() {
return _super.call(this, "Market", 5) || this;
}
MarketCard.prototype.accept = function (visitor) {
visitor.visitMarket(this);
};
return MarketCard;
}(ActionCard));
exports.MarketCard = MarketCard;
exports.Market = new MarketCard();
var MineCard = /** @class */ (function (_super) {
__extends(MineCard, _super);
function MineCard() {
return _super.call(this, "Mine", 5) || this;
}
MineCard.prototype.accept = function (visitor) {
visitor.visitMine(this);
};
return MineCard;
}(ActionCard));
exports.MineCard = MineCard;
exports.Mine = new MineCard();
var SentryCard = /** @class */ (function (_super) {
__extends(SentryCard, _super);
function SentryCard() {
return _super.call(this, "Sentry", 5) || this;
}
SentryCard.prototype.accept = function (visitor) {
visitor.visitSentry(this);
};
return SentryCard;
}(ActionCard));
exports.SentryCard = SentryCard;
exports.Sentry = new SentryCard();
var WitchCard = /** @class */ (function (_super) {
__extends(WitchCard, _super);
function WitchCard() {
return _super.call(this, "Witch", 5) || this;
}
WitchCard.prototype.accept = function (visitor) {
visitor.visitWitch(this);
};
return WitchCard;
}(ActionCard));
exports.WitchCard = WitchCard;
exports.Witch = new WitchCard();
var ArtisanCard = /** @class */ (function (_super) {
__extends(ArtisanCard, _super);
function ArtisanCard() {
return _super.call(this, "Artisan", 6) || this;
}
ArtisanCard.prototype.accept = function (visitor) {
visitor.visitArtisan(this);
};
return ArtisanCard;
}(ActionCard));
exports.ArtisanCard = ArtisanCard;
exports.Artisan = new ArtisanCard();
function isActionCard(card) {
return !isVictoryCard(card) && !isTreasureCard(card);
}
exports.isActionCard = isActionCard;
//# sourceMappingURL=card.js.map