3.0.28 • Published 12 months ago

splinterlands-simulator v3.0.28

Weekly downloads
-
License
GPL-3.0+
Repository
github
Last release
12 months ago

Splinterlands Simulator

Simulator for battles in the Splinterlands game.

NPM package

GitHub

Installation and Setup

To install via NPM use:

npm install splinterlands-simulator

A simple game can be created like so

const mylor = new GameSummoner(/* id */ 259, /* level */ 3);
const nectarQueen = new GameMonster(/* id */ 226, /* level */ 2);
const teamOne = new GameTeam(mylor, [nectarQueen]);

const tarsa = new GameSummoner(/* id */ 440, /* level */ 2);
const chicken = new GameMonster(/* id */ 131, /* level */ 1);
const forgottenOne = new GameMonster(/* id */ 404, /* level */ 1);
const teamTwo = new GameTeam(tarsa, [chicken, forgottenOne]);

const rules = new Set([Ruleset.BACK_TO_BASICS, Ruleset.LOST_LEGENDARIES]);
const game = new Game(teamOne, teamTwo, rules, /* shouldLog */ true);
game.playGame();

const winner = game.getWinner();
const logs = game.getBattleLogs();

Configuration

The Game constructor takes in shouldLog as an optional fourth parameter. If set to true, the game logs can be retrieved using game.getBattleLogs(). This returns an array of BattleLogs. The logs will contain the action, and the snapshot of the relevant monsters after the action has taken place.

It is recommended to get the cards using https://api2.splinterlands.com/cards/get_details and creating GameSummoner/GameMonsters using the cards directly. Instantiating a GameSummoner/GameMonster using card ID relies on a local version of the cards that is not guaranteed to be up to date.

Samples

Simulator Accuracy

This simulator is not guaranteed to be 100% accurate and there are bugs with it. The simulator logic was based on playing the game and making educated guesses on how the simulator was working. There are still many edge cases that are still missing and need to be solved. If you find a bug feel free to open a PR or open an issue. If you would like to discuss the simulator you can join us on the Splintertools discord

Feature requests

For feature requests open an issue

Contributing Code

See our Contributions readme

If you would like to contribute to the code base, please make pull requests to the feature branch. The feature branch will be merged to master ~once a week, and the NPM package will automatically be updated.

3.0.28

12 months ago

3.0.12

1 year ago

3.0.4

1 year ago

3.0.13

1 year ago

3.0.10

1 year ago

3.0.11

1 year ago

3.0.16

1 year ago

3.0.8

1 year ago

3.0.17

1 year ago

3.0.7

1 year ago

3.0.14

1 year ago

3.0.6

1 year ago

3.0.15

1 year ago

3.0.5

1 year ago

3.0.23

1 year ago

3.0.24

1 year ago

3.0.21

1 year ago

3.0.22

1 year ago

3.0.27

1 year ago

3.0.25

1 year ago

3.0.26

1 year ago

3.0.20

1 year ago

3.0.18

1 year ago

3.0.19

1 year ago

3.0.9

1 year ago

3.0.3

1 year ago

3.0.2

1 year ago

3.0.1

2 years ago

3.0.0

2 years ago

2.1.25

2 years ago

2.1.26

2 years ago

2.1.24

2 years ago

2.1.19

2 years ago

2.1.23

2 years ago

2.1.21

2 years ago

2.1.22

2 years ago

2.1.20

2 years ago

2.1.18

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.4

2 years ago

2.0.5

2 years ago

2.1.3

2 years ago

2.1.6

2 years ago

2.0.7

2 years ago

2.1.5

2 years ago

2.0.6

2 years ago

2.1.8

2 years ago

2.1.7

2 years ago

2.0.8

2 years ago

2.1.0

2 years ago

2.1.9

2 years ago

2.1.16

2 years ago

2.1.17

2 years ago

2.1.14

2 years ago

2.1.15

2 years ago

2.1.12

2 years ago

2.1.13

2 years ago

2.1.10

2 years ago

2.1.11

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago