momir
v0.1.0
Published
A model for emulating a momir game
Downloads
2
Readme
momir
A model for emulating a momir game
Installation
npm install --save momir
Usage
Call start
to intiatiate a game.
const momir = require('momir')
momir.start().then((game) => {
game.player1 // the first player
game.player2 // the second player
// a reference to whichever player is active
// chosen at random
game.activePlayer
// switches the active player
// and untaps all permanents on the battlefield for that player
game.endTurn()
// if there's some kind of effect that would prevent the permanents
// from untapping, you can pass `skipUntap: true`
game.endTurn({
skipUntap: true
})
})
The game will have a player1
and player2
to manipulate the game.
game.player1.life // player 1's life total, defaults to 24
game.player1.name // player 1's name, defaults to 'Player'
game.player.adjustLife(5) // add 5 to the players life total
game.player.adjustLife(-5) // subtract 5 from the players life total
// player 1's deck, an array of basic land cards
// defaults to 12 of each basic land card
game.player1.deck
game.player1.library // a shuffled array of the cards in player1.deck
game.player1.hand // an array representing the cards in hand
game.player1.battelfield // an array representing the cards on the battlefield
game.player1.graveyard // an array representing the cards in the graveyard
game.player1.exileZone // an array representing the cards in exile
game.player1.shuffle() // shuffle player 1's deck
game.player1.draw() // draw a card
game.player1.draw(3) // draw 3 cards
// put a particular card from one zone into another zone
// tokens created by using the momir ability will dissapear
// when they change zones
game.player1.moveZones(card, zone1, zone1)
// see following commands for shortcuts for moveZones
game.player1.play(card) // put a particular card from hand onto the battlefield
game.player1.discard(card) // put a particular card from hand into the graveyard
game.player1.destroy(card) // put a particular card from the battlefield into the graveyard
game.player1.exile(card) // put a particular card from the battlefield into exile
game.player1.exile(card, 'hand') // put a particular card from hand into exile
game.player1.exile(card, 'graveyard') // put a particular card from graveyard into exile
game.player1.bounce(card) // put a particular card from battlefield into the hand
game.player1.bounce(card, 'library') // put a particular card from battlefield onto the top of the library
game.player1.untap() // untap all permaments on battlefield
game.player1.momir(amountOfManaToSpend, cardFromHandToDiscard).then((card) => {
// card will automatically be added to the battlefield
// but you'll have a reference to it here in case you
// want to show it to the player
})
You can configure the players:
momir.start({
player1: {
name: 'Momir Vig',
startingLife: 50
}
}).then((game) => {
game.player1.name // 'Momir Vig'
game.player1.life // 50
})
Development
Running Tests
npm test