Scenarios
Scenarios allow you to make the game react to certain things, or to setup specific situations. You script the entire scenario in a JSON file to do this.
Using a scenario
To use a scenario, you must create a new game mode and set the scenario name in the SCENARIO parameter for the game mode:
{
"n": "SCENARIO",
"dt": 3,
"sv": "ELEMENTAL_DRAGONS_RAID_RED_DRAGON",
"t": ""
},
How scenarios work
You create a JSON file with the scenario file at GameData/Scenarios/(folder name for your scenarios)/. It has the following structure:
{
"name": "(name here)",
"teamsAreFixed": true,
"shouldGiveRewards": false,
"teams": [
"gameParameters": [],
"startingPlayer": 0,
"phases": []
}
| Name | Description |
|---|---|
name | The name of the scenario |
teamsAreFixed | Whether the team layout is fixed |
shouldGiveRewards | Whether this scenario should give the usual rewards |
teams | A list of each team in this scenario, if fixed |
gameParameters | Any override to game parameters |
startingPlayer | The slot of the starting player (0 to 3) |
phases | The scripting phases for the scenario |
initializers | Events to process before the game starts. These events are auto processed as if successful at the start of the battle |
Teams
Teams have two parameters:
| Name | Description |
|---|---|
name | The name of the team |
amount | How many players on this team |
playerPicksDeck | Whether the player should pick a deck |
Game Parameters
You can override parameters for the game mode this scenario runs on. This follows the characteristic reference.
{
"n": "STARTING_HAND_SIZE",
"dt": 1,
"iv": 1
},
...
{
"n": "ENABLE_MULLIGAN",
"dt": 0,
"bv": false
},
Phases
Phases have this structure:
{
"id": "(name)",
"players": [],
"events": []
}
| Name | Description |
|---|---|
id | The ID of the phase. This is necessary as you must change phase as a phase is triggered. The first phase should be called START |
players | Any cards to add to one or more players' zones |
events | Set up events this phase wants to handle |
Players
The players in phase defines which cards should be added to a player's zones as the phase starts
{
"slotIndex": 0,
"zones": [
{
"name": "ZONE_HERO",
"cards": [
{
"template": "STD|CARD_SUL_FARTHAL",
"amount": 1
}
]
},
{
"name": "ZONE_DECK",
"cards": [
{
"template": "AOF|CARD_VARLARI_TRAINEE",
"amount": 27
},
{
"template": "AOF|CARD_WERE_ADVENTURERS_NOW",
"amount": 1
},
{
"template": "STD|CARD_LION_CUB",
"amount": 2
}
]
}
]
},
Events
Events follow this structure:
{
"type": "EnterPhase",
"action": {
"type": "ChangeCardParameter",
"playerIndex": -1,
"cardZone": "ZONE_HERO",
"cardIndex": 0,
"parameter": {
"n": "HEALTH",
"dt": 1,
"iv": 5
}
}
},
| Name | Description |
|---|---|
type | The type of event we're waiting for |
timing | When to handle the event |
tag | A specific tag to check for a card or event name |
playerIndex | The player this event should affect if we're looking for a specific event |
cardIndex | The index of a card in its zone |
action | What should occur when the event triggers. More info below |
condition | A condition before the event triggers |
Event Types
Death
Death
Triggered as a tag is destroyed.
Use the tag parameter in the phase to identify the tags to search for, if any.
EnterPhase
EnterPhase
Triggered when we swap into this phase.
GameEvent
GameEvent
Triggered when a specific game event happens.
Use tag to specify the event name.
PlayCard
PlayCard
Triggered when a card is played.
Use the cardIndex to specify the card, or -1.
RemovePlayer
RemovePlayer
Triggered when a player is removed. (e.g., they lost)
Use the playerIndex to specify which player.
StartTurn
StartTurn
Triggered when a turn starts.
Use the playerIndex to specify which player.
Timing
| Name | Description |
|---|---|
CheckReplacements | Check if the event should be replaced |
Before | Before the event happens |
After | After the event happened |
AfterAll | After all events finish |
Action
| Name | Description |
|---|---|
type | The type of action |
target | The ID of the next phase |
The rest of the parameters depend on the action type
Event Action Type
SwitchPhase
SwitchPhase
This only uses the target field
Example:
{
"type": "GameEvent",
"tag": "EVENT_RESOURCE_ACTION",
"timing": "AfterAll",
"action": {
"type": "SwitchPhase",
"target": "PLAY1"
}
}
ReplaceCard
ReplaceCard
The card being replaced will be:
- During
PlayCard- The card being played. Do notice this requires a validcardIndexor for it to be-1. - During
Deaths- A card being destroyed.tagcan be used to filter by a specific card tag.removeTargetcan be used to remove the affected card from the event and silently from the game so you can do something with the original card, like replacing it. - During
RemovePlayer- The hero card of the player being removed. Thetagparameter can be used to filter by a specific card tag.eventControllercan be used to specify an animation to play.
| Name | Description |
|---|---|
target | The target card template to use in the format of `SETCODE |
removeTarget | Whether to remove the target (bool) |
PromptMessage
PromptMessage
| Name | Description |
|---|---|
text | The text string (will be auto translated if a string exists for it) |
position | A position for the message. This is a Vector2 (x, y object in json) |
Example:
{
"type": "EnterPhase",
"action": {
"type": "PromptMessage",
"text": "STRING_TUTORIAL1_MESSAGE2"
}
},
PromptImage
PromptImage
| Name | Description |
|---|---|
image | Path to an image asset |
text | The text string (will be auto translated if a string exists for it) |
position | A position for the message. This is a Vector2 (x, y object in json) |
Example:
{
"type": "StartTurn",
"timing": "After",
"playerIndex": 0,
"action": {
"type": "PromptImage",
"text": "STRING_TUTORIAL1_MESSAGE1",
"image": "Textures/Tutorials/Tutorial1_CardAnatomy_Mana.png",
"target": "RESOURCES"
}
}
DrawCard
DrawCard
| Name | Description |
|---|---|
playerIndex | The index of the player that will draw, or -1 for the last |
amount | How many cards the player should draw |
Example:
{
"type": "EnterPhase",
"action": {
"type": "DrawCard",
"amount": 1,
"playerIndex": 0
}
},
ChangeModeParameter
ChangeModeParameter
| Name | Description |
|---|---|
parameter | A CardParameter JSON object |
Example:
{
"type": "EnterPhase",
"action": {
"type": "ChangeModeParameter",
"parameter": {
"n": "ENABLE_PLUS_COST",
"dt": 0,
"bv": false
}
}
},
```
##### ChangeCardParameter
`ChangeCardParameter`
Name | Description
--------------------|------------
`playerIndex` | The player to change the cards of
`cardZone` | The zone the card is in
`cardIndex` | The index of the card, or -1 for the last
`parameter` | A CardParameter JSON object
Example:
```json
{
"type": "EnterPhase",
"action": {
"type": "ChangeCardParameter",
"playerIndex": -1,
"cardZone": "ZONE_HERO",
"cardIndex": 0,
"parameter": {
"n": "HEALTH",
"dt": 1,
"iv": 5
}
}
},
```
##### ChangePlayerParameter
`ChangePlayerParameter`
Name | Description
--------------------|------------
`playerIndex` | Which player to change
`parameter` | A CardParameter JSON object
Example:
```json
{
"type": "EnterPhase",
"action": {
"type": "ChangePlayerParameter",
"playerIndex": -1,
"parameter": {
"n": "GREEN_LEVEL",
"dt": 1,
"iv": 1
}
}
},
```
##### EnableEndTurn
`EnableEndTurn`
Name | Description
--------------------|------------
`boolValue` | Whether the end turn button is enabled
Example:
```json
{
"type": "EnterPhase",
"action": {
"type": "EnableEndTurn",
"boolValue": false
}
},
```
##### EnableAffinity
`EnableAffinity`
Name | Description
--------------------|------------
`intValue` | The index of the affinity. It goes from 0 to 3 from Fervor, Life, Aegis, Gloom
`boolValue` | Whether the affinity is enabled on the resource drops
Example:
```json
{
"type": "EnterPhase",
"action": {
"type": "EnableAffinity",
"boolValue": false,
"intValue": 0
}
},
```
##### OverrideInteractibleCard
`OverrideInteractibleCard`
Overrides which cards are interactible
Name | Description
--------------------|------------
`boolValue` | Whether to override. Setting this to `false` will disable all overrides.
`playerIndex` | The player to modify the card interactability
`cardZone` | The zone the card is located
`cardIndex` | The index of the card, or -1 for the last
Example:
```json
{
"type": "EnterPhase",
"action": {
"type": "OverrideInteractibleCard",
"boolValue": true,
"playerIndex": 0,
"cardZone": "ZONE_HAND",
"cardIndex": -1
}
},
```
##### EndTurn
`EndTurn`
Ends the turn once all events finish processing
Example:
```json
{
"type": "PlayCard",
"timing": "AfterAll",
"cardIndex": -1,
"playerIndex": -1,
"action": {
"type": "EndTurn",
"target": "QUESTSTART"
}
}
```
##### PlayCard
`PlayCard`
Requests the game to play a card. This does not guarantee the card will be played.
Name | Description
--------------------|------------
`cardIndex` | The index of the card to play. It will be played from the active player's hand
Example:
```json
{
"type": "EnterPhase",
"action": {
"type": "PlayCard",
"cardIndex": -1
}
},
```
##### DiscardCard
`DiscardCard`
Name | Description
--------------------|------------
`cardIndex` | The index of the card to discard. It will be discarded from the active player's hand
Example:
```json
{
"type": "EnterPhase",
"action": {
"type": "DiscardCard",
"cardIndex": -1
}
},
```
##### GrantAbility
`GrantAbility`
Name | Description
--------------------|------------
`playerIndex` | Which player to target
`abilityName` | The class name of the ability
`abilityTargetType` | `GameMode` for the game mode, `Player` for the player, and `Cards` for cards
`abilityParameters` | A list of all parameters for the ability. Missing parameters will cause the ability to not be granted.
`abilityCardTags` | Tags for which cards to search for when the `abilityTargetType` is `Cards`
`abilityCardSelf` | Whether to search cards of the current player when the `abilityTargetType` is `Cards`
`abilityCardAlly` | Whether to search cards of allied players when the `abilityTargetType` is `Cards`
`abilityCardEnemy` | Whether to search cards of enemy players when the `abilityTargetType` is `Cards`
`tag` | Tag for the ability (required)
Example:
```json
{
"type": "EnterPhase",
"timing": "CheckReplacements",
"action": {
"type": "GrantAbility",
"playerIndex": -1,
"abilityName": "ScenarioCardCharacteristicModifierCardAbility",
"abilityTargetType": "GameMode",
"abilityParameters": [
{
"n": "ZONES",
"dt": 3,
"sv": "ZONE_HAND"
},
{
"n": "CHARACTERISTICS",
"dt": 3,
"sv": "COST"
},
{
"n": "MODIFIER",
"dt": 1,
"iv": -2
},
{
"n": "SET",
"dt": 0,
"bv": false
},
{
"n": "TARGET_PLAYER_INDEX",
"dt": 7,
"pv": 3
},
{
"n": "SELF",
"dt": 0,
"bv": true
},
{
"n": "ALLY",
"dt": 0,
"bv": false
},
{
"n": "ENEMY",
"dt": 0,
"bv": false
},
{
"n": "MIN",
"dt": 1,
"iv": 1
}
],
"tag": "RAID_BUFF_COST"
}
},
```
##### RemoveAbility
`RemoveAbility`
Same as GrantAbility but removes it. You do not require ability parameters for this.
Example:
```json
{
"type": "EnterPhase",
"timing": "CheckReplacements",
"action": {
"type": "RemoveAbility",
"playerIndex": -1,
"abilityName": "ScenarioCardCharacteristicModifierCardAbility",
"abilityTargetType": "GameMode",
"tag": "RAID_BUFF_COST"
}
},
```