Skip to content

Instantly share code, notes, and snippets.

Created January 16, 2012 02:59
Show Gist options
  • Select an option

  • Save anonymous/1618812 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/1618812 to your computer and use it in GitHub Desktop.
grom358 - MtG
function Card(cardName, cardType) {
this.cardName = cardName;
this.cardType = cardType;
this.manaCost = new Mana();
this.tapped = false;
this.summonSickness = false;
this.power = 0;
this.toughness = 0;
this.owner = null;
this.player = null;
this.abilities = [];
}
Card.prototype.tap = function() {
this.tapped = true;
};
Card.prototype.untap = function() {
this.tapped = false;
};
Card.prototype.convertedManaCost = function() {
return this.manaCost.total();
};
function Swamp() {
Card.apply(this, 'Swamp', 'Land');
}
Swamp.prototype.tap = function() {
this.tapped = true;
this.player.manaPool.black++;
};
Swamp.prototype.untap = function() {
this.tapped = false;
this.player.manaPool.black--;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment