mirror of
https://gitlab.com/Deukhoofd/BattleSim.git
synced 2025-10-28 02:00:04 +00:00
Added /timer command for enabling the timer after battle has started
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
Query = require './queries'
|
||||
{Room} = require '../rooms'
|
||||
logger = require '../logger'
|
||||
randomTeam = require('../randomTeams')
|
||||
|
||||
|
||||
# Represents a single ongoing battle
|
||||
class @Battle extends Room
|
||||
@@ -41,7 +43,7 @@ class @Battle extends Room
|
||||
action: (action) ->
|
||||
@performMove(action.pokemon, action.move)
|
||||
|
||||
constructor: (@id, @players, attributes = {}) ->
|
||||
constructor: (@id, @players, attributes = {}, randomTeams = false) ->
|
||||
super(@id)
|
||||
# Number of pokemon on each side of the field
|
||||
@numActive = attributes.numActive || 1
|
||||
@@ -109,7 +111,13 @@ class @Battle extends Room
|
||||
@playerIds.push(player.id)
|
||||
@playerNames.push(player.name)
|
||||
# TODO: Get the actual player object and use player.name
|
||||
@teams[player.id] = new Team(this, player.id, player.name, player.team, @numActive)
|
||||
if randomTeams
|
||||
rteam2 = []
|
||||
randomTeam.createTeam @format, @conditions, (rTeam, rteamName) ->
|
||||
rteam2 = rTeam
|
||||
@teams[player.id] = new Team(this, player.id, player.name, rteam2, @numActive)
|
||||
else
|
||||
@teams[player.id] = new Team(this, player.id, player.name, player.team, @numActive)
|
||||
|
||||
# Holds battle state information
|
||||
@replacing = false
|
||||
|
||||
Reference in New Issue
Block a user