Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Games
trosnoth
Commits
fc9f0fe22638
Commit
461d252c
authored
Jan 27, 2021
by
talljosh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
On a 1v1 map, use SilverBot instead of RangerBot for the machines team.
parent
bf54e3cf2aa3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
trosnoth/djangoapp/forms.py
trosnoth/djangoapp/forms.py
+2
-1
trosnoth/levels/hvm.py
trosnoth/levels/hvm.py
+10
-3
No files found.
trosnoth/djangoapp/forms.py
View file @
fc9f0fe2
...
...
@@ -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'
,
)
...
...
trosnoth/levels/hvm.py
View file @
fc9f0fe2
...
...
@@ -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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment