Commit 461d252c authored by talljosh's avatar talljosh

On a 1v1 map, use SilverBot instead of RangerBot for the machines team.

parent bf54e3cf2aa3
......@@ -110,9 +110,10 @@ class ArenaModelForm(forms.ModelForm):
label='Humans vs. Machines bot difficulty',
)
balance_bot_kind = forms.ChoiceField(choices=get_bot_kind_choices())
balance_bot_kind = forms.ChoiceField(choices=get_bot_kind_choices(), required=False)
machines_bot_kind = forms.ChoiceField(
choices=get_bot_kind_choices(),
required=False,
label='Humans vs. Machines bot kind',
)
......
......@@ -21,6 +21,7 @@ import logging
from twisted.internet import defer
from trosnoth.const import DEFAULT_BOT_DIFFICULTY
from trosnoth.levels.maps import SmallMap
log = logging.getLogger(__name__)
......@@ -94,14 +95,14 @@ class HumansVsMachinesBotManager(object):
def _addBots(self):
game = self.universe.game
while self.botSurplus < 0:
bot_name = None
bot_name = ''
if game.serverInterface:
difficulty = game.serverInterface.get_machines_difficulty()
bot_name = game.serverInterface.get_machines_bot_name()
else:
difficulty = DEFAULT_BOT_DIFFICULTY
if bot_name is None:
if not bot_name:
bot_name = self._get_default_bot_name()
agent = yield game.addBot(bot_name, team=self.botTeam, difficulty=difficulty)
......@@ -109,7 +110,13 @@ class HumansVsMachinesBotManager(object):
self.botSurplus += 1
def _get_default_bot_name(self):
# TODO: if it's on a 1v1 map, use SilverBot instead of RangerBot
from trosnoth.levels.standard import StandardLevel
level = self.universe.scenarioManager.level
if isinstance(level, StandardLevel):
map_object = level.level_options.get_map(level)
if isinstance(map_object, SmallMap):
# If we're on a 1v1 map, use SilverBot instead of RangerBot
return 'silver'
return 'ranger'
def _removeBots(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment