lycan-city / werewolf-brain

Werewolf game logic in a well documented npm package.
12 stars 11 forks source link

Add metadata to moderator script #33

Open mamodom opened 7 years ago

mamodom commented 7 years ago

Return an object with metadata instead of a string

vetom commented 7 years ago

Does anyone have an idea about how this object should look?

mamodom commented 7 years ago

Maybe something like this. This way it's up to the client to filter, eg:

moderator.getScriptFromDeck(deck, selectedLanguage).filter(call => call.inGame === true)

and/or we could add another param called scope, eg:

moderator.getScriptFromDeck(deck, selectedLanguage, scope)

scope being 'game' | 'deck' | 'all'

wovalle commented 7 years ago

@mamodom awesome! a couple of notes:

1- Instead of receiving selectedLanguage and scope I would receive a hash options in case we want to extend that later 2- Scope should have 'game' as default value 3- What's scope.deck? 4- Also, options should receive a value firstNight : bool (with true as default) in case we want to directly filter the roles are only called on the first night

mamodom commented 7 years ago
  1. Cool
  2. Cool
  3. It's the script as if all the cards in the deck were in play (Imagine a deck where there are ww, vg, and a seer, in the case that the created game didn't include a seer, as the moderator, you might want to keep calling the seer at night to confuse the players and/or to not reveal there is no seer)
vetom commented 7 years ago

@wOvalle keep in mind that the firstNight property is for tell the user that this call has to be made the first night only.

@mamodom nice example!

mamodom commented 7 years ago

@wOvalle I don't understand what would be the usage of a first class support of said filter. (The 4th point)

vetom commented 7 years ago

Should I include the metadata to the cards file or create another one dedicated to metadata?