npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

momir

v0.1.0

Published

A model for emulating a momir game

Downloads

5

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