... | ... | @@ -36,20 +36,28 @@ console.log(dotSyntax('$variable.variable2')) |
|
|
|
|
|
# Server side API
|
|
|
|
|
|
|
|
|
## Global Variables
|
|
|
|
|
|
#### thisMatch
|
|
|
|
|
|
#### cardsList
|
|
|
Array of all card objects in this game, equivalent to `thisMatch.cardsList`
|
|
|
|
|
|
|
|
|
## Local Variables
|
|
|
|
|
|
#### **thisCard**
|
|
|
#### thisCard
|
|
|
|
|
|
#### **effectIndex**
|
|
|
#### effectIndex
|
|
|
|
|
|
#### **effectIndex**
|
|
|
#### **effectIndex**
|
|
|
#### effects
|
|
|
|
|
|
## Global Variables
|
|
|
This line's effects. Equivalent to `thisCard.effects[effectIndex]`
|
|
|
|
|
|
>
|
|
|
#### playerNumber
|
|
|
This card's playerNumber. Equivalent to `thisCard.playerNumber`
|
|
|
|
|
|
#### thisMatch
|
|
|
|
|
|
## Helper Functions
|
|
|
|
... | ... | @@ -59,7 +67,7 @@ console.log(dotSyntax('$variable.variable2')) |
|
|
|
|
|
A number that is a ciid.
|
|
|
|
|
|
#### **otherPlayer(*playerNumber*)**
|
|
|
#### otherPlayer(*playerNumber*)
|
|
|
|
|
|
In games with 2 players, get the playerNumber of the other player. Returns either string `"player1"` or `"player2"`
|
|
|
|
... | ... | @@ -86,7 +94,7 @@ A string that evaluates to an effectIndex or an array of effectIndexes. |
|
|
|
|
|
Optional.
|
|
|
|
|
|
#### **runEffect(*thisMatch*, *options*, *callback*)**
|
|
|
#### runEffect(*thisMatch*, *options*, *callback*)
|
|
|
|
|
|
*thisMatch* parameter
|
|
|
|
... | ... | @@ -133,6 +141,42 @@ With a string, replace any variables within. Uses dotSyntax. Example: |
|
|
stringVariableReplacement("This card is called $title. It has an attack power of $atk and a health of $health.")
|
|
|
```
|
|
|
|
|
|
#### effectSelectCard()
|
|
|
#### effectSelectCard(callback)
|
|
|
|
|
|
*callback* parameter
|
|
|
|
|
|
`function (selectedCards)`
|
|
|
|
|
|
| key | description | type |
|
|
|
| ------ | ------ | ------ |
|
|
|
| ciid | The ciid of the card you're executing. | int |
|
|
|
| effectIndex | The index of the effect you're executing on the target card. | int |
|
|
|
|
|
|
#### dulstError(*errorMessage*)
|
|
|
|
|
|
*errorMessage* parameter
|
|
|
|
|
|
| key | description | type |
|
|
|
| ------ | ------ | ------ |
|
|
|
| errorMessage | Some text explaining the error. | string |
|
|
|
|
|
|
#### thisMatch.getRandom()
|
|
|
|
|
|
Dulst safe random generator. Never use your own random.
|
|
|
|
|
|
Returns float like `Math.random()`
|
|
|
|
|
|
#### thisMatch.sample(*population*, *n*)
|
|
|
|
|
|
Dulst safe random sampling. Never use your own random sample.
|
|
|
|
|
|
Returns array.
|
|
|
|
|
|
*population* parameter
|
|
|
|
|
|
Array of possible choices.
|
|
|
|
|
|
*n* parameter
|
|
|
|
|
|
Number of elements to return.
|
|
|
|
|
|
Returns all possible choices based on the target |
|
|
\ No newline at end of file |