-
-
Save hughfdjackson/1618815 to your computer and use it in GitHub Desktop.
grom358 - MtG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'); | |
| } | |
| // make the prototype of swamp an instance of card | |
| Swamp.prototype = new Card() | |
| // reset the constructor value of Swamp.prototype ( which originally pointed to Swamp, but got overwritten in the above assignment. | |
| Swamp.prototype.constructor = Swamp | |
| 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