mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-21 06:37:09 -05:00
Simulator instances still get their scripts included somewhat hackily, but it's overall much less hacky than before. In particular, the init code is now an actual constructor, allowing TypeScript to perhaps validate it one future day.
30 lines
732 B
JavaScript
30 lines
732 B
JavaScript
/**
|
|
* Simulator process
|
|
* Pokemon Showdown - http://pokemonshowdown.com/
|
|
*
|
|
* This file is where the battle simulation itself happens.
|
|
*
|
|
* The most important part of the simulation happens in runEvent -
|
|
* see that function's definition for details.
|
|
*
|
|
* @license MIT license
|
|
*/
|
|
'use strict';
|
|
|
|
const Dex = require('./dex');
|
|
global.toId = Dex.getId;
|
|
const Battle = require('./battle');
|
|
const Side = require('./side');
|
|
const Pokemon = require('./pokemon');
|
|
const PRNG = require('./prng');
|
|
|
|
exports.construct = function (format, rated, send, prng) {
|
|
format = Dex.getFormat(format);
|
|
return new Battle(format, rated, send, prng);
|
|
};
|
|
|
|
exports.Pokemon = Pokemon;
|
|
exports.Side = Side;
|
|
exports.Battle = Battle;
|
|
exports.PRNG = PRNG;
|