Skip to content

Latest commit

 

History

History
51 lines (47 loc) · 1.96 KB

SPECS-Models.MD

File metadata and controls

51 lines (47 loc) · 1.96 KB

HOW TO ADD CARDS PROPERLY

  • Open up DBs/cards.json
  • Observe the pattern and copy it.
  • You may add ANY VARIABLE YOU WANT.
  • Health? Damage? Size? Sprite? Weight? Cost?
  • Whatever! Just add it! You can use it~!

MODELS

ApiHelper

ApiHelper.get()

Returns the big json of DBs/cards.json

Card

new Card(obj OBJECT, int ID)

Creates a new Card, this method should not be used when possible

Card.findFromId(array DECK, int ID)

Returns Card from DECK based on ID Card.findFromId(player.hand, 2)

Card.findFromName(array DECK, string NAME)

Returns Card from DECK based on NAME Card.findFromName(player.hand, "smite")

Card.findFromRandom(array DECK)

Returns a random Card from DECK Card.findFromRandom(player.hand)

Card.findIndexFromId(array DECK, int ID)

Returns the index of a Card in DECK from ID Card.findIndexFromId(player.hand, "smite")

Card.moveFromId(array INITIALDECK, array TARGETDECK, int ID)

Moves a Card from INITIALDECK to TARGETDECK from ID Returns nothing Card.moveFromId(player.hand, player.discard, 3)

Card.copyFromId(array INITIALDECK, array TARGETDECK, int ID)

Makes a copy of a Card from INITIALDECK to TARGETDECK from ID Returns nothing Card.copyFromId(game.allCards, player.main, 2)

Card.shuffleDeck(array DECK)

Shuffles the Cards in DECK, randomizes each Card position in DECK Returns nothing Card.shuffleDeck(player.hand)

CardFunc

This is where you put in functions to be used from cards. Consult spec/test-spec.js for calling functions based on strings CardFunc[thisCard.function](thisCard.funcvar1) For the previous example, it assumes funcvar1 is stated in cards.json

Game

new Game()

Creates a new Game object, try to only make 1 of these, and use it as a "master object"

Game.loadCards(obj GAME)

Loads all the cards from ApiHelper.get() and puts it in GAME.allCards, this method should not be used when possible