Added shorthand ways to define some game attrs

This commit is contained in:
Eric Froemling 2020-05-19 17:27:40 -07:00
parent 5828881f3d
commit 3ff115272f
23 changed files with 511 additions and 679 deletions

View File

@ -124,7 +124,7 @@ class CoopSession(Session):
settings = level.get_settings() settings = level.get_settings()
# Make sure all settings the game expects are present. # Make sure all settings the game expects are present.
neededsettings = gametype.get_settings(type(self)) neededsettings = gametype.get_game_settings(type(self))
for settingname, setting in neededsettings: for settingname, setting in neededsettings:
if settingname not in settings: if settingname not in settings:
settings[settingname] = setting['default'] settings[settingname] = setting['default']
@ -147,7 +147,7 @@ class CoopSession(Session):
settings = nextlevel.get_settings() settings = nextlevel.get_settings()
# Make sure all settings the game expects are present. # Make sure all settings the game expects are present.
neededsettings = gametype.get_settings(type(self)) neededsettings = gametype.get_game_settings(type(self))
for settingname, setting in neededsettings: for settingname, setting in neededsettings:
if settingname not in settings: if settingname not in settings:
settings[settingname] = setting['default'] settings[settingname] = setting['default']

View File

@ -51,6 +51,18 @@ class GameActivity(Activity[PlayerType, TeamType]):
tips: List[Union[str, Dict[str, Any]]] = [] tips: List[Union[str, Dict[str, Any]]] = []
# Default get_name() will return this if not None.
name: Optional[str] = None
# Default get_description() will return this if not None.
description: Optional[str] = None
# Default get_game_settings() will return this if not None.
game_settings: Optional[List[Tuple[str, Dict[str, Any]]]] = None
# Default get_score_info() will return this if not None.
score_info: Optional[ba.ScoreInfo] = None
@classmethod @classmethod
def create_config_ui( def create_config_ui(
cls, cls,
@ -69,9 +81,9 @@ class GameActivity(Activity[PlayerType, TeamType]):
success or None on cancel. success or None on cancel.
Generally subclasses don't need to override this; if they override Generally subclasses don't need to override this; if they override
ba.GameActivity.get_settings() and ba.GameActivity.get_supported_maps() ba.GameActivity.get_game_settings() and
they can just rely on the default implementation here which calls those ba.GameActivity.get_supported_maps() they can just rely on
methods. the default implementation here which calls those methods.
""" """
delegate = _ba.app.delegate delegate = _ba.app.delegate
assert delegate is not None assert delegate is not None
@ -81,15 +93,15 @@ class GameActivity(Activity[PlayerType, TeamType]):
@classmethod @classmethod
def get_score_info(cls) -> ba.ScoreInfo: def get_score_info(cls) -> ba.ScoreInfo:
"""Return info about game scoring setup; can be overridden by games.""" """Return info about game scoring setup; can be overridden by games."""
return ScoreInfo() return cls.score_info if cls.score_info is not None else ScoreInfo()
@classmethod @classmethod
def get_name(cls) -> str: def get_name(cls) -> str:
"""Return a str name for this game type.""" """Return a str name for this game type.
try:
return cls.__module__.replace('_', ' ') This default implementation simply returns the 'name' class attr.
except Exception: """
return 'Untitled Game' return cls.name if cls.name is not None else 'Untitled Game'
@classmethod @classmethod
def get_display_string(cls, settings: Optional[Dict] = None) -> ba.Lstr: def get_display_string(cls, settings: Optional[Dict] = None) -> ba.Lstr:
@ -119,13 +131,14 @@ class GameActivity(Activity[PlayerType, TeamType]):
@classmethod @classmethod
def get_description(cls, sessiontype: Type[ba.Session]) -> str: def get_description(cls, sessiontype: Type[ba.Session]) -> str:
""" """Get a str description of this game type.
Subclasses should override this to return a description for this
activity type (in English) within the context of the given The default implementation simply returns the 'description' class var.
ba.Session type. Classes which want to change their description depending on the session
can override this method.
""" """
del sessiontype # unused arg del sessiontype # unused arg
return '' return cls.description if cls.description is not None else ''
@classmethod @classmethod
def get_description_display_string( def get_description_display_string(
@ -138,7 +151,7 @@ class GameActivity(Activity[PlayerType, TeamType]):
return Lstr(translate=('gameDescriptions', description)) return Lstr(translate=('gameDescriptions', description))
@classmethod @classmethod
def get_settings( def get_game_settings(
cls, cls,
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]: sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
""" """
@ -162,9 +175,9 @@ class GameActivity(Activity[PlayerType, TeamType]):
'increment': Value increment for int/float settings. 'increment': Value increment for int/float settings.
# example get_settings() implementation for a capture-the-flag game: # example get_game_settings() for a capture-the-flag game:
@classmethod @classmethod
def get_settings(cls,sessiontype): def get_game_settings(cls, sessiontype):
return [("Score to Win", { return [("Score to Win", {
'default': 3, 'default': 3,
'min_value': 1 'min_value': 1
@ -199,7 +212,7 @@ class GameActivity(Activity[PlayerType, TeamType]):
})] })]
""" """
del sessiontype # Unused arg. del sessiontype # Unused arg.
return [] return [] if cls.game_settings is None else cls.game_settings
@classmethod @classmethod
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]: def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
@ -353,7 +366,7 @@ class GameActivity(Activity[PlayerType, TeamType]):
This is shown in the center of the screen below the game name at the This is shown in the center of the screen below the game name at the
start of a game. It should start with a capital letter and end with a start of a game. It should start with a capital letter and end with a
period, and can be a bit more verbose than the version returned by period, and can be a bit more verbose than the version returned by
get_instance_scoreboard_description(). get_instance_description_short().
Note that translation is applied by looking up the specific returned Note that translation is applied by looking up the specific returned
value as a key, so the number of returned variations should be limited; value as a key, so the number of returned variations should be limited;
@ -361,7 +374,7 @@ class GameActivity(Activity[PlayerType, TeamType]):
description, you can return a sequence of values in the following description, you can return a sequence of values in the following
form instead of just a string: form instead of just a string:
# this will give us something like 'Score 3 goals.' in English # This will give us something like 'Score 3 goals.' in English
# and can properly translate to 'Anota 3 goles.' in Spanish. # and can properly translate to 'Anota 3 goles.' in Spanish.
# If we just returned the string 'Score 3 Goals' here, there would # If we just returned the string 'Score 3 Goals' here, there would
# have to be a translation entry for each specific number. ew. # have to be a translation entry for each specific number. ew.
@ -373,7 +386,7 @@ class GameActivity(Activity[PlayerType, TeamType]):
""" """
return self.get_description(type(self.session)) return self.get_description(type(self.session))
def get_instance_scoreboard_description(self) -> Union[str, Sequence]: def get_instance_description_short(self) -> Union[str, Sequence]:
"""Return a short description for this game instance in English. """Return a short description for this game instance in English.
This description is used above the game scoreboard in the This description is used above the game scoreboard in the
@ -387,7 +400,7 @@ class GameActivity(Activity[PlayerType, TeamType]):
description, you can return a sequence of values in the following form description, you can return a sequence of values in the following form
instead of just a string: instead of just a string:
# this will give us something like 'score 3 goals' in English # This will give us something like 'score 3 goals' in English
# and can properly translate to 'anota 3 goles' in Spanish. # and can properly translate to 'anota 3 goles' in Spanish.
# If we just returned the string 'score 3 goals' here, there would # If we just returned the string 'score 3 goals' here, there would
# have to be a translation entry for each specific number. ew. # have to be a translation entry for each specific number. ew.
@ -669,7 +682,7 @@ class GameActivity(Activity[PlayerType, TeamType]):
# the description can be either a string or a sequence with args # the description can be either a string or a sequence with args
# to swap in post-translation # to swap in post-translation
sb_desc_in = self.get_instance_scoreboard_description() sb_desc_in = self.get_instance_description_short()
sb_desc_l: Sequence sb_desc_l: Sequence
if isinstance(sb_desc_in, str): if isinstance(sb_desc_in, str):
sb_desc_l = [sb_desc_in] # handle simple string case sb_desc_l = [sb_desc_in] # handle simple string case

View File

@ -151,7 +151,7 @@ def filter_playlist(playlist: PlaylistType,
entry['is_unowned_game'] = True entry['is_unowned_game'] = True
# Make sure all settings the game defines are present. # Make sure all settings the game defines are present.
neededsettings = gameclass.get_settings(sessiontype) neededsettings = gameclass.get_game_settings(sessiontype)
for setting_name, setting in neededsettings: for setting_name, setting in neededsettings:
if (setting_name not in entry['settings'] if (setting_name not in entry['settings']
and 'default' in setting): and 'default' in setting):

View File

@ -26,7 +26,6 @@
from __future__ import annotations from __future__ import annotations
import random import random
from dataclasses import dataclass
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import ba import ba
@ -34,33 +33,48 @@ from bastd.actor.playerspaz import PlayerSpaz, PlayerSpazDeathMessage
from bastd.actor.flag import Flag from bastd.actor.flag import Flag
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Any, Type, List, Dict, Tuple, Sequence, Union from typing import Any, Type, List, Dict, Sequence, Union
@dataclass(eq=False)
class Player(ba.Player['Team']): class Player(ba.Player['Team']):
"""Our player type for this game.""" """Our player type for this game."""
@dataclass(eq=False)
class Team(ba.Team[Player]): class Team(ba.Team[Player]):
"""Our team type for this game.""" """Our team type for this game."""
base_pos: Sequence[float]
flag: Flag def __init__(self, base_pos: Sequence[float], flag: Flag) -> None:
score: int = 0 self.base_pos = base_pos
self.flag = flag
self.score = 0
# ba_meta export game # ba_meta export game
class AssaultGame(ba.TeamGameActivity[Player, Team]): class AssaultGame(ba.TeamGameActivity[Player, Team]):
"""Game where you score by touching the other team's flag.""" """Game where you score by touching the other team's flag."""
@classmethod name = 'Assault'
def get_name(cls) -> str: description = 'Reach the enemy flag to score.'
return 'Assault' game_settings = [
('Score to Win', {
@classmethod 'min_value': 1,
def get_description(cls, sessiontype: Type[ba.Session]) -> str: 'default': 3
return 'Reach the enemy flag to score.' }),
('Time Limit', {
'choices': [('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
('5 Minutes', 300), ('10 Minutes', 600),
('20 Minutes', 1200)],
'default': 0
}),
('Respawn Times', {
'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
('Long', 2.0), ('Longer', 4.0)],
'default': 1.0
}),
('Epic Mode', {
'default': False
}),
]
@classmethod @classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool: def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool:
@ -70,31 +84,6 @@ class AssaultGame(ba.TeamGameActivity[Player, Team]):
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]: def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('team_flag') return ba.getmaps('team_flag')
@classmethod
def get_settings(
cls,
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
return [
('Score to Win', {
'min_value': 1,
'default': 3
}),
('Time Limit', {
'choices': [('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
('5 Minutes', 300), ('10 Minutes', 600),
('20 Minutes', 1200)],
'default': 0
}),
('Respawn Times', {
'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
('Long', 2.0), ('Longer', 4.0)],
'default': 1.0
}),
('Epic Mode', {
'default': False
}),
]
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
from bastd.actor.scoreboard import Scoreboard from bastd.actor.scoreboard import Scoreboard
super().__init__(settings) super().__init__(settings)
@ -116,7 +105,7 @@ class AssaultGame(ba.TeamGameActivity[Player, Team]):
return 'Touch the enemy flag.' return 'Touch the enemy flag.'
return 'Touch the enemy flag ${ARG1} times.', self._score_to_win return 'Touch the enemy flag ${ARG1} times.', self._score_to_win
def get_instance_scoreboard_description(self) -> Union[str, Sequence]: def get_instance_description_short(self) -> Union[str, Sequence]:
if self._score_to_win == 1: if self._score_to_win == 1:
return 'touch 1 flag' return 'touch 1 flag'
return 'touch ${ARG1} flags', self._score_to_win return 'touch ${ARG1} flags', self._score_to_win

View File

@ -34,7 +34,7 @@ from bastd.actor.playerspaz import PlayerSpaz, PlayerSpazDeathMessage
from bastd.actor.scoreboard import Scoreboard from bastd.actor.scoreboard import Scoreboard
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Any, Type, List, Dict, Tuple, Sequence, Union, Optional from typing import Any, Type, List, Dict, Sequence, Union, Optional
class CTFFlag(stdflag.Flag): class CTFFlag(stdflag.Flag):
@ -110,13 +110,38 @@ class Team(ba.Team[Player]):
class CaptureTheFlagGame(ba.TeamGameActivity[Player, Team]): class CaptureTheFlagGame(ba.TeamGameActivity[Player, Team]):
"""Game of stealing other team's flag and returning it to your base.""" """Game of stealing other team's flag and returning it to your base."""
@classmethod name = 'Capture the Flag'
def get_name(cls) -> str: description = 'Return the enemy flag to score.'
return 'Capture the Flag' game_settings = [
('Score to Win', {
@classmethod 'min_value': 1,
def get_description(cls, sessiontype: Type[ba.Session]) -> str: 'default': 3
return 'Return the enemy flag to score.' }),
('Flag Touch Return Time', {
'min_value': 0,
'default': 0,
'increment': 1
}),
('Flag Idle Return Time', {
'min_value': 5,
'default': 30,
'increment': 5
}),
('Time Limit', {
'choices': [('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
('5 Minutes', 300), ('10 Minutes', 600),
('20 Minutes', 1200)],
'default': 0
}),
('Respawn Times', {
'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
('Long', 2.0), ('Longer', 4.0)],
'default': 1.0
}),
('Epic Mode', {
'default': False
}),
]
@classmethod @classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool: def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool:
@ -126,41 +151,6 @@ class CaptureTheFlagGame(ba.TeamGameActivity[Player, Team]):
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]: def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('team_flag') return ba.getmaps('team_flag')
@classmethod
def get_settings(
cls,
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
return [
('Score to Win', {
'min_value': 1,
'default': 3
}),
('Flag Touch Return Time', {
'min_value': 0,
'default': 0,
'increment': 1
}),
('Flag Idle Return Time', {
'min_value': 5,
'default': 30,
'increment': 5
}),
('Time Limit', {
'choices': [('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
('5 Minutes', 300), ('10 Minutes', 600),
('20 Minutes', 1200)],
'default': 0
}),
('Respawn Times', {
'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
('Long', 2.0), ('Longer', 4.0)],
'default': 1.0
}),
('Epic Mode', {
'default': False
}),
]
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
super().__init__(settings) super().__init__(settings)
self._scoreboard = Scoreboard() self._scoreboard = Scoreboard()
@ -192,7 +182,7 @@ class CaptureTheFlagGame(ba.TeamGameActivity[Player, Team]):
return 'Steal the enemy flag.' return 'Steal the enemy flag.'
return 'Steal the enemy flag ${ARG1} times.', self._score_to_win return 'Steal the enemy flag ${ARG1} times.', self._score_to_win
def get_instance_scoreboard_description(self) -> Union[str, Sequence]: def get_instance_description_short(self) -> Union[str, Sequence]:
if self._score_to_win == 1: if self._score_to_win == 1:
return 'return 1 flag' return 'return 1 flag'
return 'return ${ARG1} flags', self._score_to_win return 'return ${ARG1} flags', self._score_to_win

View File

@ -32,8 +32,7 @@ from bastd.actor.flag import Flag
from bastd.actor.playerspaz import PlayerSpaz, PlayerSpazDeathMessage from bastd.actor.playerspaz import PlayerSpaz, PlayerSpazDeathMessage
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import (Any, Type, List, Dict, Tuple, Optional, Sequence, from typing import Any, Type, List, Dict, Optional, Sequence, Union
Union)
@dataclass(eq=False) @dataclass(eq=False)
@ -56,55 +55,42 @@ class ChosenOneGame(ba.TeamGameActivity[Player, Team]):
kill you and become the chosen one themselves. kill you and become the chosen one themselves.
""" """
@classmethod name = 'Chosen One'
def get_name(cls) -> str: description = ('Be the chosen one for a length of time to win.\n'
return 'Chosen One' 'Kill the chosen one to become it.')
game_settings = [
@classmethod ('Chosen One Time', {
def get_score_info(cls) -> ba.ScoreInfo: 'min_value': 10,
return ba.ScoreInfo(label='Time Held') 'default': 30,
'increment': 10
@classmethod }),
def get_description(cls, sessiontype: Type[ba.Session]) -> str: ('Chosen One Gets Gloves', {
return ('Be the chosen one for a length of time to win.\n' 'default': True
'Kill the chosen one to become it.') }),
('Chosen One Gets Shield', {
'default': False
}),
('Time Limit', {
'choices': [('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
('5 Minutes', 300), ('10 Minutes', 600),
('20 Minutes', 1200)],
'default': 0
}),
('Respawn Times', {
'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
('Long', 2.0), ('Longer', 4.0)],
'default': 1.0
}),
('Epic Mode', {
'default': False
}),
]
score_info = ba.ScoreInfo(label='Time Held')
@classmethod @classmethod
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]: def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('keep_away') return ba.getmaps('keep_away')
@classmethod
def get_settings(
cls,
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
return [
('Chosen One Time', {
'min_value': 10,
'default': 30,
'increment': 10
}),
('Chosen One Gets Gloves', {
'default': True
}),
('Chosen One Gets Shield', {
'default': False
}),
('Time Limit', {
'choices': [('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
('5 Minutes', 300), ('10 Minutes', 600),
('20 Minutes', 1200)],
'default': 0
}),
('Respawn Times', {
'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
('Long', 2.0), ('Longer', 4.0)],
'default': 1.0
}),
('Epic Mode', {
'default': False
}),
]
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
from bastd.actor.scoreboard import Scoreboard from bastd.actor.scoreboard import Scoreboard
super().__init__(settings) super().__init__(settings)

View File

@ -33,8 +33,7 @@ from bastd.actor.flag import Flag
from bastd.actor.playerspaz import PlayerSpazDeathMessage from bastd.actor.playerspaz import PlayerSpazDeathMessage
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import (Any, Optional, Type, List, Tuple, Dict, Sequence, from typing import Any, Optional, Type, List, Dict, Sequence, Union
Union)
class ConquestFlag(Flag): class ConquestFlag(Flag):
@ -60,13 +59,24 @@ class ConquestFlag(Flag):
class ConquestGame(ba.TeamGameActivity[ba.Player, ba.Team]): class ConquestGame(ba.TeamGameActivity[ba.Player, ba.Team]):
"""A game where teams try to claim all flags on the map.""" """A game where teams try to claim all flags on the map."""
@classmethod name = 'Conquest'
def get_name(cls) -> str: description = 'Secure all flags on the map to win.'
return 'Conquest' game_settings = [
('Time Limit', {
@classmethod 'choices': [('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
def get_description(cls, sessiontype: Type[ba.Session]) -> str: ('5 Minutes', 300), ('10 Minutes', 600),
return 'Secure all flags on the map to win.' ('20 Minutes', 1200)],
'default': 0
}),
('Respawn Times', {
'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
('Long', 2.0), ('Longer', 4.0)],
'default': 1.0
}),
('Epic Mode', {
'default': False
}),
]
@classmethod @classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool: def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool:
@ -76,29 +86,6 @@ class ConquestGame(ba.TeamGameActivity[ba.Player, ba.Team]):
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]: def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('conquest') return ba.getmaps('conquest')
@classmethod
def get_settings(
cls,
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
return [
('Time Limit', {
'choices': [('None', 0), ('1 Minute', 60),
('2 Minutes', 120),
('5 Minutes', 300),
('10 Minutes', 600),
('20 Minutes', 1200)],
'default': 0
}),
('Respawn Times', {
'choices': [('Shorter', 0.25),
('Short', 0.5),
('Normal', 1.0),
('Long', 2.0),
('Longer', 4.0)],
'default': 1.0
}),
('Epic Mode', {'default': False})] # yapf: disable
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
from bastd.actor.scoreboard import Scoreboard from bastd.actor.scoreboard import Scoreboard
super().__init__(settings) super().__init__(settings)
@ -119,7 +106,7 @@ class ConquestGame(ba.TeamGameActivity[ba.Player, ba.Team]):
def get_instance_description(self) -> Union[str, Sequence]: def get_instance_description(self) -> Union[str, Sequence]:
return 'Secure all ${ARG1} flags.', len(self.map.flag_points) return 'Secure all ${ARG1} flags.', len(self.map.flag_points)
def get_instance_scoreboard_description(self) -> Union[str, Sequence]: def get_instance_description_short(self) -> Union[str, Sequence]:
return 'secure all ${ARG1} flags', len(self.map.flag_points) return 'secure all ${ARG1} flags', len(self.map.flag_points)
def on_transition_in(self) -> None: def on_transition_in(self) -> None:

View File

@ -38,25 +38,14 @@ if TYPE_CHECKING:
class DeathMatchGame(ba.TeamGameActivity[ba.Player, ba.Team]): class DeathMatchGame(ba.TeamGameActivity[ba.Player, ba.Team]):
"""A game type based on acquiring kills.""" """A game type based on acquiring kills."""
@classmethod name = 'Death Match'
def get_name(cls) -> str: description = 'Kill a set number of enemies to win.'
return 'Death Match'
# Print messages when players die since it matters here.
announce_player_deaths = True
@classmethod @classmethod
def get_description(cls, sessiontype: Type[ba.Session]) -> str: def get_game_settings(
return 'Kill a set number of enemies to win.'
@classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool:
return (issubclass(sessiontype, ba.DualTeamSession)
or issubclass(sessiontype, ba.FreeForAllSession))
@classmethod
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('melee')
@classmethod
def get_settings(
cls, cls,
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]: sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
settings: List[Tuple[str, Dict[str, Any]]] = [ settings: List[Tuple[str, Dict[str, Any]]] = [
@ -66,24 +55,20 @@ class DeathMatchGame(ba.TeamGameActivity[ba.Player, ba.Team]):
'increment': 1 'increment': 1
}), }),
('Time Limit', { ('Time Limit', {
'choices': 'choices': [('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
[('None', 0), ('5 Minutes', 300), ('10 Minutes', 600),
('1 Minute', 60), ('2 Minutes', 120), ('20 Minutes', 1200)],
('5 Minutes', 300), ('10 Minutes', 600), 'default': 0
('20 Minutes', 1200)],
'default': 0
}), }),
('Respawn Times', { ('Respawn Times', {
'choices': 'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
[('Shorter', 0.25), ('Short', 0.5), ('Long', 2.0), ('Longer', 4.0)],
('Normal', 1.0), ('Long', 2.0), 'default': 1.0
('Longer', 4.0)],
'default': 1.0
}), }),
('Epic Mode', { ('Epic Mode', {
'default': False 'default': False
}) }),
] # yapf: disable ]
# In teams mode, a suicide gives a point to the other team, but in # In teams mode, a suicide gives a point to the other team, but in
# free-for-all it subtracts from your own score. By default we clamp # free-for-all it subtracts from your own score. By default we clamp
@ -95,15 +80,21 @@ class DeathMatchGame(ba.TeamGameActivity[ba.Player, ba.Team]):
return settings return settings
@classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool:
return (issubclass(sessiontype, ba.DualTeamSession)
or issubclass(sessiontype, ba.FreeForAllSession))
@classmethod
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('melee')
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
from bastd.actor.scoreboard import Scoreboard from bastd.actor.scoreboard import Scoreboard
super().__init__(settings) super().__init__(settings)
if self.settings_raw['Epic Mode']: if self.settings_raw['Epic Mode']:
self.slow_motion = True self.slow_motion = True
# Print messages when players die since it matters here.
self.announce_player_deaths = True
self._scoreboard = Scoreboard() self._scoreboard = Scoreboard()
self._score_to_win = None self._score_to_win = None
self._dingsound = ba.getsound('dingSmall') self._dingsound = ba.getsound('dingSmall')
@ -111,7 +102,7 @@ class DeathMatchGame(ba.TeamGameActivity[ba.Player, ba.Team]):
def get_instance_description(self) -> Union[str, Sequence]: def get_instance_description(self) -> Union[str, Sequence]:
return 'Crush ${ARG1} of your enemies.', self._score_to_win return 'Crush ${ARG1} of your enemies.', self._score_to_win
def get_instance_scoreboard_description(self) -> Union[str, Sequence]: def get_instance_description_short(self) -> Union[str, Sequence]:
return 'kill ${ARG1} enemies', self._score_to_win return 'kill ${ARG1} enemies', self._score_to_win
def on_transition_in(self) -> None: def on_transition_in(self) -> None:

View File

@ -33,6 +33,7 @@ from bastd.actor import bomb
from bastd.actor import playerspaz from bastd.actor import playerspaz
from bastd.actor import spazbot from bastd.actor import spazbot
from bastd.actor.onscreencountdown import OnScreenCountdown from bastd.actor.onscreencountdown import OnScreenCountdown
from bastd.actor.scoreboard import Scoreboard
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Any, Type, Dict, List, Tuple, Optional from typing import Any, Type, Dict, List, Tuple, Optional
@ -42,17 +43,10 @@ if TYPE_CHECKING:
class EasterEggHuntGame(ba.TeamGameActivity[ba.Player, ba.Team]): class EasterEggHuntGame(ba.TeamGameActivity[ba.Player, ba.Team]):
"""A game where score is based on collecting eggs.""" """A game where score is based on collecting eggs."""
@classmethod name = 'Easter Egg Hunt'
def get_name(cls) -> str: description = 'Gather eggs!'
return 'Easter Egg Hunt' game_settings = [('Pro Mode', {'default': False})]
score_info = ba.ScoreInfo(label='Score', scoretype=ba.ScoreType.POINTS)
@classmethod
def get_score_info(cls) -> ba.ScoreInfo:
return ba.ScoreInfo(label='Score', scoretype=ba.ScoreType.POINTS)
@classmethod
def get_description(cls, sessiontype: Type[ba.Session]) -> str:
return 'Gather eggs!'
# We're currently hard-coded for one map. # We're currently hard-coded for one map.
@classmethod @classmethod
@ -66,14 +60,7 @@ class EasterEggHuntGame(ba.TeamGameActivity[ba.Player, ba.Team]):
or issubclass(sessiontype, ba.DualTeamSession) or issubclass(sessiontype, ba.DualTeamSession)
or issubclass(sessiontype, ba.FreeForAllSession)) or issubclass(sessiontype, ba.FreeForAllSession))
@classmethod
def get_settings(
cls,
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
return [('Pro Mode', {'default': False})]
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
from bastd.actor.scoreboard import Scoreboard
super().__init__(settings) super().__init__(settings)
self._last_player_death_time = None self._last_player_death_time = None
self._scoreboard = Scoreboard() self._scoreboard = Scoreboard()

View File

@ -182,31 +182,16 @@ class Team(ba.Team[Player]):
class EliminationGame(ba.TeamGameActivity[Player, Team]): class EliminationGame(ba.TeamGameActivity[Player, Team]):
"""Game type where last player(s) left alive win.""" """Game type where last player(s) left alive win."""
@classmethod name = 'Elimination'
def get_name(cls) -> str: description = 'Last remaining alive wins.'
return 'Elimination' score_info = ba.ScoreInfo(label='Survived',
scoretype=ba.ScoreType.SECONDS,
none_is_winner=True)
# Show messages when players die since it's meaningful here.
announce_player_deaths = True
@classmethod @classmethod
def get_score_info(cls) -> ba.ScoreInfo: def get_game_settings(
return ba.ScoreInfo(label='Survived',
scoretype=ba.ScoreType.SECONDS,
none_is_winner=True)
@classmethod
def get_description(cls, sessiontype: Type[ba.Session]) -> str:
return 'Last remaining alive wins.'
@classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool:
return (issubclass(sessiontype, ba.DualTeamSession)
or issubclass(sessiontype, ba.FreeForAllSession))
@classmethod
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('melee')
@classmethod
def get_settings(
cls, cls,
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]: sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
settings: List[Tuple[str, Dict[str, Any]]] = [ settings: List[Tuple[str, Dict[str, Any]]] = [
@ -231,13 +216,20 @@ class EliminationGame(ba.TeamGameActivity[Player, Team]):
'default': False 'default': False
}), }),
] ]
if issubclass(sessiontype, ba.DualTeamSession): if issubclass(sessiontype, ba.DualTeamSession):
settings.append(('Solo Mode', {'default': False})) settings.append(('Solo Mode', {'default': False}))
settings.append(('Balance Total Lives', {'default': False})) settings.append(('Balance Total Lives', {'default': False}))
return settings return settings
@classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool:
return (issubclass(sessiontype, ba.DualTeamSession)
or issubclass(sessiontype, ba.FreeForAllSession))
@classmethod
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('melee')
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
from bastd.actor.scoreboard import Scoreboard from bastd.actor.scoreboard import Scoreboard
super().__init__(settings) super().__init__(settings)
@ -253,8 +245,6 @@ class EliminationGame(ba.TeamGameActivity[Player, Team]):
self._solo_mode = bool(settings.get('Solo Mode', False)) self._solo_mode = bool(settings.get('Solo Mode', False))
# Base class overrides: # Base class overrides:
# Show messages when players die since it's meaningful here.
self.announce_player_deaths = True
self.slow_motion = self._epic_mode self.slow_motion = self._epic_mode
self.default_music = (ba.MusicType.EPIC self.default_music = (ba.MusicType.EPIC
if self._epic_mode else ba.MusicType.SURVIVAL) if self._epic_mode else ba.MusicType.SURVIVAL)
@ -263,7 +253,7 @@ class EliminationGame(ba.TeamGameActivity[Player, Team]):
return 'Last team standing wins.' if isinstance( return 'Last team standing wins.' if isinstance(
self.session, ba.DualTeamSession) else 'Last one standing wins.' self.session, ba.DualTeamSession) else 'Last one standing wins.'
def get_instance_scoreboard_description(self) -> Union[str, Sequence]: def get_instance_description_short(self) -> Union[str, Sequence]:
return 'last team standing wins' if isinstance( return 'last team standing wins' if isinstance(
self.session, ba.DualTeamSession) else 'last one standing wins' self.session, ba.DualTeamSession) else 'last one standing wins'

View File

@ -38,8 +38,7 @@ from bastd.actor.playerspaz import PlayerSpaz, PlayerSpazDeathMessage
from bastd.actor.scoreboard import Scoreboard from bastd.actor.scoreboard import Scoreboard
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import (Any, List, Tuple, Type, Dict, Sequence, Optional, from typing import Any, List, Type, Dict, Sequence, Optional, Union
Union)
from bastd.actor.spaz import Spaz from bastd.actor.spaz import Spaz
@ -81,46 +80,36 @@ class Team(ba.Team[Player]):
class FootballTeamGame(ba.TeamGameActivity[Player, Team]): class FootballTeamGame(ba.TeamGameActivity[Player, Team]):
"""Football game for teams mode.""" """Football game for teams mode."""
@classmethod name = 'Football'
def get_name(cls) -> str: description = 'Get the flag to the enemy end zone.'
return 'Football' game_settings = [
('Score to Win', {
'min_value': 7,
'default': 21,
'increment': 7
}),
('Time Limit', {
'choices': [('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
('5 Minutes', 300), ('10 Minutes', 600),
('20 Minutes', 1200)],
'default': 0
}),
('Respawn Times', {
'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
('Long', 2.0), ('Longer', 4.0)],
'default': 1.0
}),
]
@classmethod @classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool: def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool:
# We only support two-team play. # We only support two-team play.
return issubclass(sessiontype, ba.DualTeamSession) return issubclass(sessiontype, ba.DualTeamSession)
@classmethod
def get_description(cls, sessiontype: Type[ba.Session]) -> str:
return 'Get the flag to the enemy end zone.'
@classmethod @classmethod
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]: def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('football') return ba.getmaps('football')
@classmethod
def get_settings(
cls,
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
return [
('Score to Win', {
'min_value': 7,
'default': 21,
'increment': 7
}),
('Time Limit', {
'choices': [('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
('5 Minutes', 300), ('10 Minutes', 600),
('20 Minutes', 1200)],
'default': 0
}),
('Respawn Times', {
'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
('Long', 2.0), ('Longer', 4.0)],
'default': 1.0
})
] # yapf: disable
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
super().__init__(settings) super().__init__(settings)
self._scoreboard: Optional[Scoreboard] = Scoreboard() self._scoreboard: Optional[Scoreboard] = Scoreboard()
@ -131,7 +120,6 @@ class FootballTeamGame(ba.TeamGameActivity[Player, Team]):
self._score_sound = ba.getsound('score') self._score_sound = ba.getsound('score')
self._swipsound = ba.getsound('swip') self._swipsound = ba.getsound('swip')
self._whistle_sound = ba.getsound('refWhistle') self._whistle_sound = ba.getsound('refWhistle')
self.score_region_material = ba.Material() self.score_region_material = ba.Material()
self.score_region_material.add_actions( self.score_region_material.add_actions(
conditions=('they_have_material', conditions=('they_have_material',
@ -147,6 +135,7 @@ class FootballTeamGame(ba.TeamGameActivity[Player, Team]):
def get_instance_description(self) -> Union[str, Sequence]: def get_instance_description(self) -> Union[str, Sequence]:
touchdowns = self.settings_raw['Score to Win'] / 7 touchdowns = self.settings_raw['Score to Win'] / 7
# NOTE: if use just touchdowns = self.settings_raw['Score to Win'] // 7 # NOTE: if use just touchdowns = self.settings_raw['Score to Win'] // 7
# and we will need to score, for example, 27 points, # and we will need to score, for example, 27 points,
# we will be required to score 3 (not 4) goals .. # we will be required to score 3 (not 4) goals ..
@ -155,7 +144,7 @@ class FootballTeamGame(ba.TeamGameActivity[Player, Team]):
return 'Score ${ARG1} touchdowns.', touchdowns return 'Score ${ARG1} touchdowns.', touchdowns
return 'Score a touchdown.' return 'Score a touchdown.'
def get_instance_scoreboard_description(self) -> Union[str, Sequence]: def get_instance_description_short(self) -> Union[str, Sequence]:
touchdowns = self.settings_raw['Score to Win'] / 7 touchdowns = self.settings_raw['Score to Win'] / 7
touchdowns = math.ceil(touchdowns) touchdowns = math.ceil(touchdowns)
if touchdowns > 1: if touchdowns > 1:
@ -336,15 +325,9 @@ class FootballCoopGame(ba.CoopGameActivity[Player, Team]):
Co-op variant of football Co-op variant of football
""" """
name = 'Football'
tips = ['Use the pick-up button to grab the flag < ${PICKUP} >'] tips = ['Use the pick-up button to grab the flag < ${PICKUP} >']
score_info = ba.ScoreInfo(scoretype=ba.ScoreType.MILLISECONDS, version='B')
@classmethod
def get_name(cls) -> str:
return 'Football'
@classmethod
def get_score_info(cls) -> ba.ScoreInfo:
return ba.ScoreInfo(scoretype=ba.ScoreType.MILLISECONDS, version='B')
# FIXME: Need to update co-op games to use get_score_info. # FIXME: Need to update co-op games to use get_score_info.
def get_score_type(self) -> str: def get_score_type(self) -> str:
@ -357,7 +340,7 @@ class FootballCoopGame(ba.CoopGameActivity[Player, Team]):
return 'Score ${ARG1} touchdowns.', touchdowns return 'Score ${ARG1} touchdowns.', touchdowns
return 'Score a touchdown.' return 'Score a touchdown.'
def get_instance_scoreboard_description(self) -> Union[str, Sequence]: def get_instance_description_short(self) -> Union[str, Sequence]:
touchdowns = self._score_to_win / 7 touchdowns = self._score_to_win / 7
touchdowns = math.ceil(touchdowns) touchdowns = math.ceil(touchdowns)
if touchdowns > 1: if touchdowns > 1:

View File

@ -31,8 +31,7 @@ import ba
from bastd.actor import playerspaz from bastd.actor import playerspaz
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import (Any, Sequence, Dict, Type, List, Tuple, Optional, from typing import Any, Sequence, Dict, Type, List, Optional, Union
Union)
class PuckDeathMessage: class PuckDeathMessage:
@ -109,13 +108,26 @@ class Puck(ba.Actor):
class HockeyGame(ba.TeamGameActivity[ba.Player, ba.Team]): class HockeyGame(ba.TeamGameActivity[ba.Player, ba.Team]):
"""Ice hockey game.""" """Ice hockey game."""
@classmethod name = 'Hockey'
def get_name(cls) -> str: description = 'Score some goals.'
return 'Hockey' game_settings = [
('Score to Win', {
@classmethod 'min_value': 1,
def get_description(cls, sessiontype: Type[ba.Session]) -> str: 'default': 1,
return 'Score some goals.' 'increment': 1
}),
('Time Limit', {
'choices': [('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
('5 Minutes', 300), ('10 Minutes', 600),
('20 Minutes', 1200)],
'default': 0
}),
('Respawn Times', {
'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
('Long', 2.0), ('Longer', 4.0)],
'default': 1.0
}),
]
@classmethod @classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool: def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool:
@ -125,26 +137,6 @@ class HockeyGame(ba.TeamGameActivity[ba.Player, ba.Team]):
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]: def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('hockey') return ba.getmaps('hockey')
@classmethod
def get_settings(
cls,
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
return [
('Score to Win', {
'min_value': 1, 'default': 1, 'increment': 1
}),
('Time Limit', {
'choices': [('None', 0), ('1 Minute', 60),
('2 Minutes', 120), ('5 Minutes', 300),
('10 Minutes', 600), ('20 Minutes', 1200)],
'default': 0
}),
('Respawn Times', {
'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
('Long', 2.0), ('Longer', 4.0)],
'default': 1.0
})] # yapf: disable
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
from bastd.actor.scoreboard import Scoreboard from bastd.actor.scoreboard import Scoreboard
from bastd.actor import powerupbox from bastd.actor import powerupbox
@ -201,7 +193,7 @@ class HockeyGame(ba.TeamGameActivity[ba.Player, ba.Team]):
return 'Score a goal.' return 'Score a goal.'
return 'Score ${ARG1} goals.', self.settings_raw['Score to Win'] return 'Score ${ARG1} goals.', self.settings_raw['Score to Win']
def get_instance_scoreboard_description(self) -> Union[str, Sequence]: def get_instance_description_short(self) -> Union[str, Sequence]:
if self.settings_raw['Score to Win'] == 1: if self.settings_raw['Score to Win'] == 1:
return 'score a goal' return 'score a goal'
return 'score ${ARG1} goals', self.settings_raw['Score to Win'] return 'score ${ARG1} goals', self.settings_raw['Score to Win']

View File

@ -25,7 +25,7 @@
from __future__ import annotations from __future__ import annotations
from dataclasses import dataclass from enum import Enum
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import ba import ba
@ -34,16 +34,21 @@ from bastd.actor.flag import (Flag, FlagDroppedMessage, FlagDeathMessage,
from bastd.actor.playerspaz import PlayerSpaz, PlayerSpazDeathMessage from bastd.actor.playerspaz import PlayerSpaz, PlayerSpazDeathMessage
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import (Any, Type, List, Tuple, Dict, Optional, Sequence, from typing import Any, Type, List, Dict, Optional, Sequence, Union
Union)
class FlagState(Enum):
"""States our single flag can be in."""
NEW = 0
UNCONTESTED = 1
CONTESTED = 2
HELD = 3
@dataclass(eq=False)
class Player(ba.Player['Team']): class Player(ba.Player['Team']):
"""Our player type for this game.""" """Our player type for this game."""
@dataclass(eq=False)
class Team(ba.Team[Player]): class Team(ba.Team[Player]):
"""Our team type for this game.""" """Our team type for this game."""
@ -52,22 +57,27 @@ class Team(ba.Team[Player]):
class KeepAwayGame(ba.TeamGameActivity[Player, Team]): class KeepAwayGame(ba.TeamGameActivity[Player, Team]):
"""Game where you try to keep the flag away from your enemies.""" """Game where you try to keep the flag away from your enemies."""
FLAG_NEW = 0 name = 'Keep Away'
FLAG_UNCONTESTED = 1 description = 'Carry the flag for a set length of time.'
FLAG_CONTESTED = 2 game_settings = [
FLAG_HELD = 3 ('Hold Time', {
'min_value': 10,
@classmethod 'default': 30,
def get_name(cls) -> str: 'increment': 10
return 'Keep Away' }),
('Time Limit', {
@classmethod 'choices': [('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
def get_description(cls, sessiontype: Type[ba.Session]) -> str: ('5 Minutes', 300), ('10 Minutes', 600),
return 'Carry the flag for a set length of time.' ('20 Minutes', 1200)],
'default': 0
@classmethod }),
def get_score_info(cls) -> ba.ScoreInfo: ('Respawn Times', {
return ba.ScoreInfo(label='Time Held') 'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
('Long', 2.0), ('Longer', 4.0)],
'default': 1.0
}),
]
score_info = ba.ScoreInfo(label='Time Held')
@classmethod @classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool: def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool:
@ -78,29 +88,6 @@ class KeepAwayGame(ba.TeamGameActivity[Player, Team]):
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]: def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('keep_away') return ba.getmaps('keep_away')
@classmethod
def get_settings(
cls,
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
return [
('Hold Time', {
'min_value': 10,
'default': 30,
'increment': 10
}),
('Time Limit', {
'choices': [('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
('5 Minutes', 300), ('10 Minutes', 600),
('20 Minutes', 1200)],
'default': 0
}),
('Respawn Times', {
'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
('Long', 2.0), ('Longer', 4.0)],
'default': 1.0
})
] # yapf: disable
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
from bastd.actor.scoreboard import Scoreboard from bastd.actor.scoreboard import Scoreboard
super().__init__(settings) super().__init__(settings)
@ -122,7 +109,7 @@ class KeepAwayGame(ba.TeamGameActivity[Player, Team]):
self._flag_spawn_pos: Optional[Sequence[float]] = None self._flag_spawn_pos: Optional[Sequence[float]] = None
self._update_timer: Optional[ba.Timer] = None self._update_timer: Optional[ba.Timer] = None
self._holding_players: List[Player] = [] self._holding_players: List[Player] = []
self._flag_state: Optional[int] = None self._flag_state: Optional[FlagState] = None
self._flag_light: Optional[ba.Node] = None self._flag_light: Optional[ba.Node] = None
self._scoring_team: Optional[Team] = None self._scoring_team: Optional[Team] = None
self._flag: Optional[Flag] = None self._flag: Optional[Flag] = None
@ -131,7 +118,7 @@ class KeepAwayGame(ba.TeamGameActivity[Player, Team]):
return ('Carry the flag for ${ARG1} seconds.', return ('Carry the flag for ${ARG1} seconds.',
self.settings_raw['Hold Time']) self.settings_raw['Hold Time'])
def get_instance_scoreboard_description(self) -> Union[str, Sequence]: def get_instance_description_short(self) -> Union[str, Sequence]:
return ('carry the flag for ${ARG1} seconds', return ('carry the flag for ${ARG1} seconds',
self.settings_raw['Hold Time']) self.settings_raw['Hold Time'])
@ -224,18 +211,18 @@ class KeepAwayGame(ba.TeamGameActivity[Player, Team]):
assert self._flag_light assert self._flag_light
assert self._flag.node assert self._flag.node
if len(holding_teams) > 1: if len(holding_teams) > 1:
self._flag_state = self.FLAG_CONTESTED self._flag_state = FlagState.CONTESTED
self._scoring_team = None self._scoring_team = None
self._flag_light.color = (0.6, 0.6, 0.1) self._flag_light.color = (0.6, 0.6, 0.1)
self._flag.node.color = (1.0, 1.0, 0.4) self._flag.node.color = (1.0, 1.0, 0.4)
elif len(holding_teams) == 1: elif len(holding_teams) == 1:
holding_team = list(holding_teams)[0] holding_team = list(holding_teams)[0]
self._flag_state = self.FLAG_HELD self._flag_state = FlagState.HELD
self._scoring_team = holding_team self._scoring_team = holding_team
self._flag_light.color = ba.normalized_color(holding_team.color) self._flag_light.color = ba.normalized_color(holding_team.color)
self._flag.node.color = holding_team.color self._flag.node.color = holding_team.color
else: else:
self._flag_state = self.FLAG_UNCONTESTED self._flag_state = FlagState.UNCONTESTED
self._scoring_team = None self._scoring_team = None
self._flag_light.color = (0.2, 0.2, 0.2) self._flag_light.color = (0.2, 0.2, 0.2)
self._flag.node.color = (1, 1, 1) self._flag.node.color = (1, 1, 1)
@ -248,7 +235,7 @@ class KeepAwayGame(ba.TeamGameActivity[Player, Team]):
self._flash_flag_spawn() self._flash_flag_spawn()
assert self._flag_spawn_pos is not None assert self._flag_spawn_pos is not None
self._flag = Flag(dropped_timeout=20, position=self._flag_spawn_pos) self._flag = Flag(dropped_timeout=20, position=self._flag_spawn_pos)
self._flag_state = self.FLAG_NEW self._flag_state = FlagState.NEW
self._flag_light = ba.newnode('light', self._flag_light = ba.newnode('light',
owner=self._flag.node, owner=self._flag.node,
attrs={ attrs={

View File

@ -26,51 +26,66 @@
from __future__ import annotations from __future__ import annotations
import weakref import weakref
from dataclasses import dataclass from enum import Enum
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import ba import ba
from bastd.actor.flag import Flag from bastd.actor.flag import Flag
from bastd.actor.playerspaz import PlayerSpaz, PlayerSpazDeathMessage from bastd.actor.playerspaz import PlayerSpaz, PlayerSpazDeathMessage
from bastd.actor.scoreboard import Scoreboard
if TYPE_CHECKING: if TYPE_CHECKING:
from weakref import ReferenceType from weakref import ReferenceType
from typing import (Any, Type, List, Dict, Tuple, Optional, Sequence, from typing import Any, Type, List, Dict, Optional, Sequence, Union
Union)
class FlagState(Enum):
"""States our single flag can be in."""
NEW = 0
UNCONTESTED = 1
CONTESTED = 2
HELD = 3
@dataclass(eq=False)
class Player(ba.Player['Team']): class Player(ba.Player['Team']):
"""Our player type for this game.""" """Our player type for this game."""
time_at_flag: int = 0
def __init__(self) -> None:
self.time_at_flag = 0
@dataclass(eq=False)
class Team(ba.Team[Player]): class Team(ba.Team[Player]):
"""Our team type for this game.""" """Our team type for this game."""
time_remaining: int
def __init__(self, time_remaining: int) -> None:
self.time_remaining = time_remaining
# ba_meta export game # ba_meta export game
class KingOfTheHillGame(ba.TeamGameActivity[Player, Team]): class KingOfTheHillGame(ba.TeamGameActivity[Player, Team]):
"""Game where a team wins by holding a 'hill' for a set amount of time.""" """Game where a team wins by holding a 'hill' for a set amount of time."""
FLAG_NEW = 0 name = 'King of the Hill'
FLAG_UNCONTESTED = 1 description = 'Secure the flag for a set length of time.'
FLAG_CONTESTED = 2 game_settings = [
FLAG_HELD = 3 ('Hold Time', {
'min_value': 10,
@classmethod 'default': 30,
def get_name(cls) -> str: 'increment': 10
return 'King of the Hill' }),
('Time Limit', {
@classmethod 'choices': [('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
def get_description(cls, sessiontype: Type[ba.Session]) -> str: ('5 Minutes', 300), ('10 Minutes', 600),
return 'Secure the flag for a set length of time.' ('20 Minutes', 1200)],
'default': 0
@classmethod }),
def get_score_info(cls) -> ba.ScoreInfo: ('Respawn Times', {
return ba.ScoreInfo(label='Time Held') 'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
('Long', 2.0), ('Longer', 4.0)],
'default': 1.0
}),
]
score_info = ba.ScoreInfo(label='Time Held')
@classmethod @classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool: def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool:
@ -80,31 +95,7 @@ class KingOfTheHillGame(ba.TeamGameActivity[Player, Team]):
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]: def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('king_of_the_hill') return ba.getmaps('king_of_the_hill')
@classmethod
def get_settings(
cls,
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
return [
('Hold Time', {
'min_value': 10,
'default': 30,
'increment': 10
}),
('Time Limit', {
'choices': [('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
('5 Minutes', 300), ('10 Minutes', 600),
('20 Minutes', 1200)],
'default': 0
}),
('Respawn Times', {
'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
('Long', 2.0), ('Longer', 4.0)],
'default': 1.0
}),
]
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
from bastd.actor.scoreboard import Scoreboard
super().__init__(settings) super().__init__(settings)
self._scoreboard = Scoreboard() self._scoreboard = Scoreboard()
self._swipsound = ba.getsound('swip') self._swipsound = ba.getsound('swip')
@ -122,23 +113,23 @@ class KingOfTheHillGame(ba.TeamGameActivity[Player, Team]):
1: ba.getsound('announceOne') 1: ba.getsound('announceOne')
} }
self._flag_pos: Optional[Sequence[float]] = None self._flag_pos: Optional[Sequence[float]] = None
self._flag_state: Optional[int] = None self._flag_state: Optional[FlagState] = None
self._flag: Optional[Flag] = None self._flag: Optional[Flag] = None
self._flag_light: Optional[ba.Node] = None self._flag_light: Optional[ba.Node] = None
self._scoring_team: Optional[ReferenceType[Team]] = None self._scoring_team: Optional[ReferenceType[Team]] = None
self._hold_time = int(settings['Hold Time']) self._hold_time = int(settings['Hold Time'])
self._time_limit = float(settings['Time Limit']) self._time_limit = float(settings['Time Limit'])
self._flag_region_material = ba.Material() self._flag_region_material = ba.Material()
self._flag_region_material.add_actions( self._flag_region_material.add_actions(
conditions=('they_have_material', ba.sharedobj('player_material')), conditions=('they_have_material', ba.sharedobj('player_material')),
actions=(('modify_part_collision', 'collide', actions=(
True), ('modify_part_collision', 'physical', False), ('modify_part_collision', 'collide', True),
('call', 'at_connect', ('modify_part_collision', 'physical', False),
ba.Call(self._handle_player_flag_region_collide, True)), ('call', 'at_connect',
('call', 'at_disconnect', ba.Call(self._handle_player_flag_region_collide, True)),
ba.Call(self._handle_player_flag_region_collide, ('call', 'at_disconnect',
False)))) ba.Call(self._handle_player_flag_region_collide, False)),
))
# Base class overrides. # Base class overrides.
self.default_music = ba.MusicType.SCARY self.default_music = ba.MusicType.SCARY
@ -146,7 +137,7 @@ class KingOfTheHillGame(ba.TeamGameActivity[Player, Team]):
def get_instance_description(self) -> Union[str, Sequence]: def get_instance_description(self) -> Union[str, Sequence]:
return 'Secure the flag for ${ARG1} seconds.', self._hold_time return 'Secure the flag for ${ARG1} seconds.', self._hold_time
def get_instance_scoreboard_description(self) -> Union[str, Sequence]: def get_instance_description_short(self) -> Union[str, Sequence]:
return 'secure the flag for ${ARG1} seconds', self._hold_time return 'secure the flag for ${ARG1} seconds', self._hold_time
def create_team(self, sessionteam: ba.SessionTeam) -> Team: def create_team(self, sessionteam: ba.SessionTeam) -> Team:
@ -158,7 +149,7 @@ class KingOfTheHillGame(ba.TeamGameActivity[Player, Team]):
self.setup_standard_powerup_drops() self.setup_standard_powerup_drops()
self._flag_pos = self.map.get_flag_position(None) self._flag_pos = self.map.get_flag_position(None)
ba.timer(1.0, self._tick, repeat=True) ba.timer(1.0, self._tick, repeat=True)
self._flag_state = self.FLAG_NEW self._flag_state = FlagState.NEW
self.project_flag_stand(self._flag_pos) self.project_flag_stand(self._flag_pos)
self._flag = Flag(position=self._flag_pos, self._flag = Flag(position=self._flag_pos,
@ -172,7 +163,6 @@ class KingOfTheHillGame(ba.TeamGameActivity[Player, Team]):
'radius': 0.4, 'radius': 0.4,
'color': (0.2, 0.2, 0.2) 'color': (0.2, 0.2, 0.2)
}) })
# Flag region. # Flag region.
flagmats = [ flagmats = [
self._flag_region_material, self._flag_region_material,
@ -238,18 +228,18 @@ class KingOfTheHillGame(ba.TeamGameActivity[Player, Team]):
assert self._flag is not None assert self._flag is not None
assert self._flag.node assert self._flag.node
if len(holding_teams) > 1: if len(holding_teams) > 1:
self._flag_state = self.FLAG_CONTESTED self._flag_state = FlagState.CONTESTED
self._scoring_team = None self._scoring_team = None
self._flag_light.color = (0.6, 0.6, 0.1) self._flag_light.color = (0.6, 0.6, 0.1)
self._flag.node.color = (1.0, 1.0, 0.4) self._flag.node.color = (1.0, 1.0, 0.4)
elif len(holding_teams) == 1: elif len(holding_teams) == 1:
holding_team = list(holding_teams)[0] holding_team = list(holding_teams)[0]
self._flag_state = self.FLAG_HELD self._flag_state = FlagState.HELD
self._scoring_team = weakref.ref(holding_team) self._scoring_team = weakref.ref(holding_team)
self._flag_light.color = ba.normalized_color(holding_team.color) self._flag_light.color = ba.normalized_color(holding_team.color)
self._flag.node.color = holding_team.color self._flag.node.color = holding_team.color
else: else:
self._flag_state = self.FLAG_UNCONTESTED self._flag_state = FlagState.UNCONTESTED
self._scoring_team = None self._scoring_team = None
self._flag_light.color = (0.2, 0.2, 0.2) self._flag_light.color = (0.2, 0.2, 0.2)
self._flag.node.color = (1, 1, 1) self._flag.node.color = (1, 1, 1)

View File

@ -34,7 +34,7 @@ from bastd.actor.playerspaz import PlayerSpazDeathMessage
from bastd.actor.onscreentimer import OnScreenTimer from bastd.actor.onscreentimer import OnScreenTimer
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Any, Tuple, Sequence, Optional, List, Dict, Type, Type from typing import Any, Sequence, Optional, List, Dict, Type, Type
class Player(ba.Player['Team']): class Player(ba.Player['Team']):
@ -53,31 +53,21 @@ class Team(ba.Team[Player]):
class MeteorShowerGame(ba.TeamGameActivity[Player, Team]): class MeteorShowerGame(ba.TeamGameActivity[Player, Team]):
"""Minigame involving dodging falling bombs.""" """Minigame involving dodging falling bombs."""
@classmethod name = 'Meteor Shower'
def get_name(cls) -> str: description = 'Dodge the falling bombs.'
return 'Meteor Shower' game_settings = [('Epic Mode', {'default': False})]
score_info = ba.ScoreInfo(label='Survived',
scoretype=ba.ScoreType.MILLISECONDS,
version='B')
@classmethod # Print messages when players die (since its meaningful in this game).
def get_score_info(cls) -> ba.ScoreInfo: announce_player_deaths = True
return ba.ScoreInfo(label='Survived',
scoretype=ba.ScoreType.MILLISECONDS,
version='B')
@classmethod
def get_description(cls, sessiontype: Type[ba.Session]) -> str:
return 'Dodge the falling bombs.'
# we're currently hard-coded for one map.. # we're currently hard-coded for one map..
@classmethod @classmethod
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]: def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ['Rampage'] return ['Rampage']
@classmethod
def get_settings(
cls,
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
return [('Epic Mode', {'default': False})]
# We support teams, free-for-all, and co-op sessions. # We support teams, free-for-all, and co-op sessions.
@classmethod @classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool: def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool:
@ -85,9 +75,6 @@ class MeteorShowerGame(ba.TeamGameActivity[Player, Team]):
or issubclass(sessiontype, ba.FreeForAllSession) or issubclass(sessiontype, ba.FreeForAllSession)
or issubclass(sessiontype, ba.CoopSession)) or issubclass(sessiontype, ba.CoopSession))
# Print messages when players die (since its meaningful in this game).
announce_player_deaths = True
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
super().__init__(settings) super().__init__(settings)
@ -256,9 +243,6 @@ class MeteorShowerGame(ba.TeamGameActivity[Player, Team]):
for team in self.teams: for team in self.teams:
for player in team.players: for player in team.players:
if not player:
print(f'GOT DEAD PLAYER {id(player)}')
survived = False survived = False
# Throw an extra fudge factor in so teams that # Throw an extra fudge factor in so teams that

View File

@ -44,19 +44,11 @@ class NinjaFightGame(ba.TeamGameActivity[ba.Player, ba.Team]):
of Ninjas as fast as possible of Ninjas as fast as possible
""" """
@classmethod name = 'Ninja Fight'
def get_name(cls) -> str: description = 'How fast can you defeat the ninjas?'
return 'Ninja Fight' score_info = ba.ScoreInfo(label='Time',
scoretype=ba.ScoreType.MILLISECONDS,
@classmethod lower_is_better=True)
def get_score_info(cls) -> ba.ScoreInfo:
return ba.ScoreInfo(label='Time',
scoretype=ba.ScoreType.MILLISECONDS,
lower_is_better=True)
@classmethod
def get_description(cls, sessiontype: Type[ba.Session]) -> str:
return 'How fast can you defeat the ninjas?'
@classmethod @classmethod
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]: def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:

View File

@ -52,6 +52,9 @@ class Team(ba.Team[Player]):
class OnslaughtGame(ba.CoopGameActivity[Player, Team]): class OnslaughtGame(ba.CoopGameActivity[Player, Team]):
"""Co-op game where players try to survive attacking waves of enemies.""" """Co-op game where players try to survive attacking waves of enemies."""
name = 'Onslaught'
description = 'Defeat all enemies.'
tips: List[Union[str, Dict[str, Any]]] = [ tips: List[Union[str, Dict[str, Any]]] = [
'Hold any button to run.' 'Hold any button to run.'
' (Trigger buttons work well if you have them)', ' (Trigger buttons work well if you have them)',
@ -63,13 +66,8 @@ class OnslaughtGame(ba.CoopGameActivity[Player, Team]):
'Your punches do much more damage if you are running or spinning.' 'Your punches do much more damage if you are running or spinning.'
] ]
@classmethod # Show messages when players die since it matters here.
def get_name(cls) -> str: announce_player_deaths = True
return 'Onslaught'
@classmethod
def get_description(cls, sessiontype: Type[ba.Session]) -> str:
return 'Defeat all enemies.'
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
@ -88,9 +86,6 @@ class OnslaughtGame(ba.CoopGameActivity[Player, Team]):
super().__init__(settings) super().__init__(settings)
# Show messages when players die since it matters here.
self.announce_player_deaths = True
self._new_wave_sound = ba.getsound('scoreHit01') self._new_wave_sound = ba.getsound('scoreHit01')
self._winsound = ba.getsound('score') self._winsound = ba.getsound('score')
self._cashregistersound = ba.getsound('cashRegister') self._cashregistersound = ba.getsound('cashRegister')

View File

@ -81,30 +81,14 @@ class Team(ba.Team[Player]):
class RaceGame(ba.TeamGameActivity[Player, Team]): class RaceGame(ba.TeamGameActivity[Player, Team]):
"""Game of racing around a track.""" """Game of racing around a track."""
@classmethod name = 'Race'
def get_name(cls) -> str: description = 'Run real fast!'
return 'Race' score_info = ba.ScoreInfo(label='Time',
lower_is_better=True,
scoretype=ba.ScoreType.MILLISECONDS)
@classmethod @classmethod
def get_description(cls, sessiontype: Type[ba.Session]) -> str: def get_game_settings(
return 'Run real fast!'
@classmethod
def get_score_info(cls) -> ba.ScoreInfo:
return ba.ScoreInfo(label='Time',
lower_is_better=True,
scoretype=ba.ScoreType.MILLISECONDS)
@classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool:
return issubclass(sessiontype, ba.MultiTeamSession)
@classmethod
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('race')
@classmethod
def get_settings(
cls, cls,
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]: sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
settings: List[Tuple[str, Dict[str, Any]]] = [ settings: List[Tuple[str, Dict[str, Any]]] = [
@ -114,9 +98,9 @@ class RaceGame(ba.TeamGameActivity[Player, Team]):
'increment': 1 'increment': 1
}), }),
('Time Limit', { ('Time Limit', {
'choices': [('None', 0), ('1 Minute', 60), 'choices': [('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
('2 Minutes', 120), ('5 Minutes', 300), ('5 Minutes', 300), ('10 Minutes', 600),
('10 Minutes', 600), ('20 Minutes', 1200)], ('20 Minutes', 1200)],
'default': 0 'default': 0
}), }),
('Mine Spawning', { ('Mine Spawning', {
@ -128,16 +112,26 @@ class RaceGame(ba.TeamGameActivity[Player, Team]):
'choices': [('None', 0), ('8 Seconds', 8000), 'choices': [('None', 0), ('8 Seconds', 8000),
('4 Seconds', 4000), ('2 Seconds', 2000), ('4 Seconds', 4000), ('2 Seconds', 2000),
('1 Second', 1000)], ('1 Second', 1000)],
'default': 2000 'default': 2000
}), }),
('Epic Mode', { ('Epic Mode', {
'default': False 'default': False
})] # yapf: disable }),
]
# We have some specific settings in teams mode.
if issubclass(sessiontype, ba.DualTeamSession): if issubclass(sessiontype, ba.DualTeamSession):
settings.append(('Entire Team Must Finish', {'default': False})) settings.append(('Entire Team Must Finish', {'default': False}))
return settings return settings
@classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool:
return issubclass(sessiontype, ba.MultiTeamSession)
@classmethod
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('race')
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
from bastd.actor.scoreboard import Scoreboard from bastd.actor.scoreboard import Scoreboard
self._race_started = False self._race_started = False
@ -175,7 +169,7 @@ class RaceGame(ba.TeamGameActivity[Player, Team]):
return 'Run ${ARG1} laps.' + t_str, self.settings_raw['Laps'] return 'Run ${ARG1} laps.' + t_str, self.settings_raw['Laps']
return 'Run 1 lap.' + t_str return 'Run 1 lap.' + t_str
def get_instance_scoreboard_description(self) -> Union[str, Sequence]: def get_instance_description_short(self) -> Union[str, Sequence]:
if self.settings_raw['Laps'] > 1: if self.settings_raw['Laps'] > 1:
return 'run ${ARG1} laps', self.settings_raw['Laps'] return 'run ${ARG1} laps', self.settings_raw['Laps']
return 'run 1 lap' return 'run 1 lap'

View File

@ -41,6 +41,8 @@ if TYPE_CHECKING:
class RunaroundGame(ba.CoopGameActivity[ba.Player, ba.Team]): class RunaroundGame(ba.CoopGameActivity[ba.Player, ba.Team]):
"""Game involving trying to bomb bots as they walk through the map.""" """Game involving trying to bomb bots as they walk through the map."""
name = 'Runaround'
description = 'Prevent enemies from reaching the exit.'
tips = [ tips = [
'Jump just as you\'re throwing to get bombs up to the highest levels.', 'Jump just as you\'re throwing to get bombs up to the highest levels.',
'No, you can\'t get up on the ledge. You have to throw bombs.', 'No, you can\'t get up on the ledge. You have to throw bombs.',
@ -64,14 +66,6 @@ class RunaroundGame(ba.CoopGameActivity[ba.Player, ba.Team]):
spazbot.StickyBot: 0.5 spazbot.StickyBot: 0.5
} }
@classmethod
def get_name(cls) -> str:
return 'Runaround'
@classmethod
def get_description(cls, sessiontype: Type[ba.Session]) -> str:
return 'Prevent enemies from reaching the exit.'
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
settings['map'] = 'Tower D' settings['map'] = 'Tower D'
super().__init__(settings) super().__init__(settings)

View File

@ -26,41 +26,49 @@
from __future__ import annotations from __future__ import annotations
import random import random
from dataclasses import dataclass
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import ba import ba
from bastd.actor import playerspaz from bastd.actor import playerspaz
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Any, Type, List, Dict, Optional, Tuple, Sequence from typing import Any, Type, List, Dict, Optional, Sequence
from bastd.actor.onscreencountdown import OnScreenCountdown from bastd.actor.onscreencountdown import OnScreenCountdown
from bastd.actor.bomb import Bomb, Blast from bastd.actor.bomb import Bomb, Blast
@dataclass(eq=False)
class Player(ba.Player['Team']): class Player(ba.Player['Team']):
"""Our player type for this game.""" """Our player type for this game."""
streak: int = 0
def __init__(self) -> None:
self.streak = 0
@dataclass(eq=False)
class Team(ba.Team[Player]): class Team(ba.Team[Player]):
"""Our team type for this game.""" """Our team type for this game."""
score: int = 0
def __init__(self) -> None:
self.score = 0
# ba_meta export game # ba_meta export game
class TargetPracticeGame(ba.TeamGameActivity[Player, Team]): class TargetPracticeGame(ba.TeamGameActivity[Player, Team]):
"""Game where players try to hit targets with bombs.""" """Game where players try to hit targets with bombs."""
@classmethod name = 'Target Practice'
def get_name(cls) -> str: description = 'Bomb as many targets as you can.'
return 'Target Practice' game_settings = [
('Target Count', {
@classmethod 'min_value': 1,
def get_description(cls, sessiontype: Type[ba.Session]) -> str: 'default': 3
return 'Bomb as many targets as you can.' }),
('Enable Impact Bombs', {
'default': True
}),
('Enable Triple Bombs', {
'default': True
}),
]
@classmethod @classmethod
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]: def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
@ -72,23 +80,6 @@ class TargetPracticeGame(ba.TeamGameActivity[Player, Team]):
return (issubclass(sessiontype, ba.CoopSession) return (issubclass(sessiontype, ba.CoopSession)
or issubclass(sessiontype, ba.MultiTeamSession)) or issubclass(sessiontype, ba.MultiTeamSession))
@classmethod
def get_settings(
cls,
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
return [
('Target Count', {
'min_value': 1,
'default': 3
}),
('Enable Impact Bombs', {
'default': True
}),
('Enable Triple Bombs', {
'default': True
}),
]
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
from bastd.actor.scoreboard import Scoreboard from bastd.actor.scoreboard import Scoreboard
super().__init__(settings) super().__init__(settings)

View File

@ -49,29 +49,22 @@ class Team(ba.Team[Player]):
class TheLastStandGame(ba.CoopGameActivity[Player, Team]): class TheLastStandGame(ba.CoopGameActivity[Player, Team]):
"""Slow motion how-long-can-you-last game.""" """Slow motion how-long-can-you-last game."""
name = 'The Last Stand'
description = 'Final glorious epic slow motion battle to the death.'
tips = [ tips = [
'This level never ends, but a high score here\n' 'This level never ends, but a high score here\n'
'will earn you eternal respect throughout the world.' 'will earn you eternal respect throughout the world.'
] ]
@classmethod # Show messages when players die since it matters here.
def get_name(cls) -> str: announce_player_deaths = True
return 'The Last Stand'
@classmethod # And of course the most important part.
def get_description(cls, sessiontype: Type[ba.Session]) -> str: slow_motion = True
return 'Final glorious epic slow motion battle to the death.'
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
settings['map'] = 'Rampage' settings['map'] = 'Rampage'
super().__init__(settings) super().__init__(settings)
# Show messages when players die since it matters here.
self.announce_player_deaths = True
# And of course the most important part.
self.slow_motion = True
self._new_wave_sound = ba.getsound('scoreHit01') self._new_wave_sound = ba.getsound('scoreHit01')
self._winsound = ba.getsound('score') self._winsound = ba.getsound('score')
self._cashregistersound = ba.getsound('cashRegister') self._cashregistersound = ba.getsound('cashRegister')

View File

@ -72,7 +72,7 @@ class PlaylistEditGameWindow(ba.Window):
ba.screenmessage(ba.Lstr(resource='noValidMapsErrorText')) ba.screenmessage(ba.Lstr(resource='noValidMapsErrorText'))
raise Exception('No valid maps') raise Exception('No valid maps')
self._settings_defs = gameclass.get_settings(sessiontype) self._settings_defs = gameclass.get_game_settings(sessiontype)
self._completion_call = completion_call self._completion_call = completion_call
# To start with, pick a random map out of the ones we own. # To start with, pick a random map out of the ones we own.

View File

@ -1,5 +1,5 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND --> <!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2020-05-19 for Ballistica version 1.5.0 build 20021</em></h4> <h4><em>last updated on 2020-05-19 for Ballistica version 1.5.0 build 20023</em></h4>
<p>This page documents the Python classes and functions in the 'ba' module, <p>This page documents the Python classes and functions in the 'ba' module,
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p> which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
<hr> <hr>
@ -1519,7 +1519,7 @@ start_long_action(callback_when_done=<a href="#class_ba_ContextCall">ba.ContextC
</dd> </dd>
</dl> </dl>
<h3>Methods Inherited:</h3> <h3>Methods Inherited:</h3>
<h5><a href="#method_ba_GameActivity__add_actor_weak_ref">add_actor_weak_ref()</a>, <a href="#method_ba_GameActivity__add_player">add_player()</a>, <a href="#method_ba_GameActivity__add_team">add_team()</a>, <a href="#method_ba_GameActivity__begin">begin()</a>, <a href="#method_ba_GameActivity__continue_or_end_game">continue_or_end_game()</a>, <a href="#method_ba_GameActivity__create_config_ui">create_config_ui()</a>, <a href="#method_ba_GameActivity__create_player">create_player()</a>, <a href="#method_ba_GameActivity__create_team">create_team()</a>, <a href="#method_ba_GameActivity__dep_is_present">dep_is_present()</a>, <a href="#method_ba_GameActivity__destroy">destroy()</a>, <a href="#method_ba_GameActivity__end">end()</a>, <a href="#method_ba_GameActivity__end_game">end_game()</a>, <a href="#method_ba_GameActivity__get_config_display_string">get_config_display_string()</a>, <a href="#method_ba_GameActivity__get_description">get_description()</a>, <a href="#method_ba_GameActivity__get_description_display_string">get_description_display_string()</a>, <a href="#method_ba_GameActivity__get_display_string">get_display_string()</a>, <a href="#method_ba_GameActivity__get_dynamic_deps">get_dynamic_deps()</a>, <a href="#method_ba_GameActivity__get_instance_description">get_instance_description()</a>, <a href="#method_ba_GameActivity__get_instance_display_string">get_instance_display_string()</a>, <a href="#method_ba_GameActivity__get_instance_scoreboard_description">get_instance_scoreboard_description()</a>, <a href="#method_ba_GameActivity__get_instance_scoreboard_display_string">get_instance_scoreboard_display_string()</a>, <a href="#method_ba_GameActivity__get_name">get_name()</a>, <a href="#method_ba_GameActivity__get_score_info">get_score_info()</a>, <a href="#method_ba_GameActivity__get_settings">get_settings()</a>, <a href="#method_ba_GameActivity__get_supported_maps">get_supported_maps()</a>, <a href="#method_ba_GameActivity__get_team_display_string">get_team_display_string()</a>, <a href="#method_ba_GameActivity__handlemessage">handlemessage()</a>, <a href="#method_ba_GameActivity__has_begun">has_begun()</a>, <a href="#method_ba_GameActivity__has_ended">has_ended()</a>, <a href="#method_ba_GameActivity__has_transitioned_in">has_transitioned_in()</a>, <a href="#method_ba_GameActivity__is_transitioning_out">is_transitioning_out()</a>, <a href="#method_ba_GameActivity__is_waiting_for_continue">is_waiting_for_continue()</a>, <a href="#method_ba_GameActivity__on_continue">on_continue()</a>, <a href="#method_ba_GameActivity__on_expire">on_expire()</a>, <a href="#method_ba_GameActivity__on_player_join">on_player_join()</a>, <a href="#method_ba_GameActivity__on_player_leave">on_player_leave()</a>, <a href="#method_ba_GameActivity__on_team_join">on_team_join()</a>, <a href="#method_ba_GameActivity__on_team_leave">on_team_leave()</a>, <a href="#method_ba_GameActivity__on_transition_in">on_transition_in()</a>, <a href="#method_ba_GameActivity__on_transition_out">on_transition_out()</a>, <a href="#method_ba_GameActivity__project_flag_stand">project_flag_stand()</a>, <a href="#method_ba_GameActivity__remove_player">remove_player()</a>, <a href="#method_ba_GameActivity__remove_team">remove_team()</a>, <a href="#method_ba_GameActivity__respawn_player">respawn_player()</a>, <a href="#method_ba_GameActivity__retain_actor">retain_actor()</a>, <a href="#method_ba_GameActivity__set_has_ended">set_has_ended()</a>, <a href="#method_ba_GameActivity__set_immediate_end">set_immediate_end()</a>, <a href="#method_ba_GameActivity__setup_standard_powerup_drops">setup_standard_powerup_drops()</a>, <a href="#method_ba_GameActivity__setup_standard_time_limit">setup_standard_time_limit()</a>, <a href="#method_ba_GameActivity__show_info">show_info()</a>, <a href="#method_ba_GameActivity__show_scoreboard_info">show_scoreboard_info()</a>, <a href="#method_ba_GameActivity__show_zoom_message">show_zoom_message()</a>, <a href="#method_ba_GameActivity__spawn_player">spawn_player()</a>, <a href="#method_ba_GameActivity__spawn_player_if_exists">spawn_player_if_exists()</a>, <a href="#method_ba_GameActivity__transition_in">transition_in()</a>, <a href="#method_ba_GameActivity__transition_out">transition_out()</a></h5> <h5><a href="#method_ba_GameActivity__add_actor_weak_ref">add_actor_weak_ref()</a>, <a href="#method_ba_GameActivity__add_player">add_player()</a>, <a href="#method_ba_GameActivity__add_team">add_team()</a>, <a href="#method_ba_GameActivity__begin">begin()</a>, <a href="#method_ba_GameActivity__continue_or_end_game">continue_or_end_game()</a>, <a href="#method_ba_GameActivity__create_config_ui">create_config_ui()</a>, <a href="#method_ba_GameActivity__create_player">create_player()</a>, <a href="#method_ba_GameActivity__create_team">create_team()</a>, <a href="#method_ba_GameActivity__dep_is_present">dep_is_present()</a>, <a href="#method_ba_GameActivity__destroy">destroy()</a>, <a href="#method_ba_GameActivity__end">end()</a>, <a href="#method_ba_GameActivity__end_game">end_game()</a>, <a href="#method_ba_GameActivity__get_config_display_string">get_config_display_string()</a>, <a href="#method_ba_GameActivity__get_description">get_description()</a>, <a href="#method_ba_GameActivity__get_description_display_string">get_description_display_string()</a>, <a href="#method_ba_GameActivity__get_display_string">get_display_string()</a>, <a href="#method_ba_GameActivity__get_dynamic_deps">get_dynamic_deps()</a>, <a href="#method_ba_GameActivity__get_game_settings">get_game_settings()</a>, <a href="#method_ba_GameActivity__get_instance_description">get_instance_description()</a>, <a href="#method_ba_GameActivity__get_instance_description_short">get_instance_description_short()</a>, <a href="#method_ba_GameActivity__get_instance_display_string">get_instance_display_string()</a>, <a href="#method_ba_GameActivity__get_instance_scoreboard_display_string">get_instance_scoreboard_display_string()</a>, <a href="#method_ba_GameActivity__get_name">get_name()</a>, <a href="#method_ba_GameActivity__get_score_info">get_score_info()</a>, <a href="#method_ba_GameActivity__get_supported_maps">get_supported_maps()</a>, <a href="#method_ba_GameActivity__get_team_display_string">get_team_display_string()</a>, <a href="#method_ba_GameActivity__handlemessage">handlemessage()</a>, <a href="#method_ba_GameActivity__has_begun">has_begun()</a>, <a href="#method_ba_GameActivity__has_ended">has_ended()</a>, <a href="#method_ba_GameActivity__has_transitioned_in">has_transitioned_in()</a>, <a href="#method_ba_GameActivity__is_transitioning_out">is_transitioning_out()</a>, <a href="#method_ba_GameActivity__is_waiting_for_continue">is_waiting_for_continue()</a>, <a href="#method_ba_GameActivity__on_continue">on_continue()</a>, <a href="#method_ba_GameActivity__on_expire">on_expire()</a>, <a href="#method_ba_GameActivity__on_player_join">on_player_join()</a>, <a href="#method_ba_GameActivity__on_player_leave">on_player_leave()</a>, <a href="#method_ba_GameActivity__on_team_join">on_team_join()</a>, <a href="#method_ba_GameActivity__on_team_leave">on_team_leave()</a>, <a href="#method_ba_GameActivity__on_transition_in">on_transition_in()</a>, <a href="#method_ba_GameActivity__on_transition_out">on_transition_out()</a>, <a href="#method_ba_GameActivity__project_flag_stand">project_flag_stand()</a>, <a href="#method_ba_GameActivity__remove_player">remove_player()</a>, <a href="#method_ba_GameActivity__remove_team">remove_team()</a>, <a href="#method_ba_GameActivity__respawn_player">respawn_player()</a>, <a href="#method_ba_GameActivity__retain_actor">retain_actor()</a>, <a href="#method_ba_GameActivity__set_has_ended">set_has_ended()</a>, <a href="#method_ba_GameActivity__set_immediate_end">set_immediate_end()</a>, <a href="#method_ba_GameActivity__setup_standard_powerup_drops">setup_standard_powerup_drops()</a>, <a href="#method_ba_GameActivity__setup_standard_time_limit">setup_standard_time_limit()</a>, <a href="#method_ba_GameActivity__show_info">show_info()</a>, <a href="#method_ba_GameActivity__show_scoreboard_info">show_scoreboard_info()</a>, <a href="#method_ba_GameActivity__show_zoom_message">show_zoom_message()</a>, <a href="#method_ba_GameActivity__spawn_player">spawn_player()</a>, <a href="#method_ba_GameActivity__spawn_player_if_exists">spawn_player_if_exists()</a>, <a href="#method_ba_GameActivity__transition_in">transition_in()</a>, <a href="#method_ba_GameActivity__transition_out">transition_out()</a></h5>
<h3>Methods Defined or Overridden:</h3> <h3>Methods Defined or Overridden:</h3>
<h5><a href="#method_ba_CoopGameActivity____init__">&lt;constructor&gt;</a>, <a href="#method_ba_CoopGameActivity__celebrate">celebrate()</a>, <a href="#method_ba_CoopGameActivity__fade_to_red">fade_to_red()</a>, <a href="#method_ba_CoopGameActivity__get_score_type">get_score_type()</a>, <a href="#method_ba_CoopGameActivity__on_begin">on_begin()</a>, <a href="#method_ba_CoopGameActivity__setup_low_life_warning_sound">setup_low_life_warning_sound()</a>, <a href="#method_ba_CoopGameActivity__spawn_player_spaz">spawn_player_spaz()</a>, <a href="#method_ba_CoopGameActivity__supports_session_type">supports_session_type()</a></h5> <h5><a href="#method_ba_CoopGameActivity____init__">&lt;constructor&gt;</a>, <a href="#method_ba_CoopGameActivity__celebrate">celebrate()</a>, <a href="#method_ba_CoopGameActivity__fade_to_red">fade_to_red()</a>, <a href="#method_ba_CoopGameActivity__get_score_type">get_score_type()</a>, <a href="#method_ba_CoopGameActivity__on_begin">on_begin()</a>, <a href="#method_ba_CoopGameActivity__setup_low_life_warning_sound">setup_low_life_warning_sound()</a>, <a href="#method_ba_CoopGameActivity__spawn_player_spaz">spawn_player_spaz()</a>, <a href="#method_ba_CoopGameActivity__supports_session_type">supports_session_type()</a></h5>
<dl> <dl>
@ -2043,7 +2043,7 @@ its time with lingering corpses, sound effects, etc.</p>
<h3>Methods Inherited:</h3> <h3>Methods Inherited:</h3>
<h5><a href="#method_ba_Activity__add_actor_weak_ref">add_actor_weak_ref()</a>, <a href="#method_ba_Activity__add_player">add_player()</a>, <a href="#method_ba_Activity__add_team">add_team()</a>, <a href="#method_ba_Activity__begin">begin()</a>, <a href="#method_ba_Activity__create_player">create_player()</a>, <a href="#method_ba_Activity__create_team">create_team()</a>, <a href="#method_ba_Activity__dep_is_present">dep_is_present()</a>, <a href="#method_ba_Activity__destroy">destroy()</a>, <a href="#method_ba_Activity__get_dynamic_deps">get_dynamic_deps()</a>, <a href="#method_ba_Activity__has_begun">has_begun()</a>, <a href="#method_ba_Activity__has_ended">has_ended()</a>, <a href="#method_ba_Activity__has_transitioned_in">has_transitioned_in()</a>, <a href="#method_ba_Activity__is_transitioning_out">is_transitioning_out()</a>, <a href="#method_ba_Activity__on_expire">on_expire()</a>, <a href="#method_ba_Activity__on_team_join">on_team_join()</a>, <a href="#method_ba_Activity__on_team_leave">on_team_leave()</a>, <a href="#method_ba_Activity__on_transition_out">on_transition_out()</a>, <a href="#method_ba_Activity__remove_player">remove_player()</a>, <a href="#method_ba_Activity__remove_team">remove_team()</a>, <a href="#method_ba_Activity__retain_actor">retain_actor()</a>, <a href="#method_ba_Activity__set_has_ended">set_has_ended()</a>, <a href="#method_ba_Activity__set_immediate_end">set_immediate_end()</a>, <a href="#method_ba_Activity__transition_in">transition_in()</a>, <a href="#method_ba_Activity__transition_out">transition_out()</a></h5> <h5><a href="#method_ba_Activity__add_actor_weak_ref">add_actor_weak_ref()</a>, <a href="#method_ba_Activity__add_player">add_player()</a>, <a href="#method_ba_Activity__add_team">add_team()</a>, <a href="#method_ba_Activity__begin">begin()</a>, <a href="#method_ba_Activity__create_player">create_player()</a>, <a href="#method_ba_Activity__create_team">create_team()</a>, <a href="#method_ba_Activity__dep_is_present">dep_is_present()</a>, <a href="#method_ba_Activity__destroy">destroy()</a>, <a href="#method_ba_Activity__get_dynamic_deps">get_dynamic_deps()</a>, <a href="#method_ba_Activity__has_begun">has_begun()</a>, <a href="#method_ba_Activity__has_ended">has_ended()</a>, <a href="#method_ba_Activity__has_transitioned_in">has_transitioned_in()</a>, <a href="#method_ba_Activity__is_transitioning_out">is_transitioning_out()</a>, <a href="#method_ba_Activity__on_expire">on_expire()</a>, <a href="#method_ba_Activity__on_team_join">on_team_join()</a>, <a href="#method_ba_Activity__on_team_leave">on_team_leave()</a>, <a href="#method_ba_Activity__on_transition_out">on_transition_out()</a>, <a href="#method_ba_Activity__remove_player">remove_player()</a>, <a href="#method_ba_Activity__remove_team">remove_team()</a>, <a href="#method_ba_Activity__retain_actor">retain_actor()</a>, <a href="#method_ba_Activity__set_has_ended">set_has_ended()</a>, <a href="#method_ba_Activity__set_immediate_end">set_immediate_end()</a>, <a href="#method_ba_Activity__transition_in">transition_in()</a>, <a href="#method_ba_Activity__transition_out">transition_out()</a></h5>
<h3>Methods Defined or Overridden:</h3> <h3>Methods Defined or Overridden:</h3>
<h5><a href="#method_ba_GameActivity____init__">&lt;constructor&gt;</a>, <a href="#method_ba_GameActivity__continue_or_end_game">continue_or_end_game()</a>, <a href="#method_ba_GameActivity__create_config_ui">create_config_ui()</a>, <a href="#method_ba_GameActivity__end">end()</a>, <a href="#method_ba_GameActivity__end_game">end_game()</a>, <a href="#method_ba_GameActivity__get_config_display_string">get_config_display_string()</a>, <a href="#method_ba_GameActivity__get_description">get_description()</a>, <a href="#method_ba_GameActivity__get_description_display_string">get_description_display_string()</a>, <a href="#method_ba_GameActivity__get_display_string">get_display_string()</a>, <a href="#method_ba_GameActivity__get_instance_description">get_instance_description()</a>, <a href="#method_ba_GameActivity__get_instance_display_string">get_instance_display_string()</a>, <a href="#method_ba_GameActivity__get_instance_scoreboard_description">get_instance_scoreboard_description()</a>, <a href="#method_ba_GameActivity__get_instance_scoreboard_display_string">get_instance_scoreboard_display_string()</a>, <a href="#method_ba_GameActivity__get_name">get_name()</a>, <a href="#method_ba_GameActivity__get_score_info">get_score_info()</a>, <a href="#method_ba_GameActivity__get_settings">get_settings()</a>, <a href="#method_ba_GameActivity__get_supported_maps">get_supported_maps()</a>, <a href="#method_ba_GameActivity__get_team_display_string">get_team_display_string()</a>, <a href="#method_ba_GameActivity__handlemessage">handlemessage()</a>, <a href="#method_ba_GameActivity__is_waiting_for_continue">is_waiting_for_continue()</a>, <a href="#method_ba_GameActivity__on_begin">on_begin()</a>, <a href="#method_ba_GameActivity__on_continue">on_continue()</a>, <a href="#method_ba_GameActivity__on_player_join">on_player_join()</a>, <a href="#method_ba_GameActivity__on_player_leave">on_player_leave()</a>, <a href="#method_ba_GameActivity__on_transition_in">on_transition_in()</a>, <a href="#method_ba_GameActivity__project_flag_stand">project_flag_stand()</a>, <a href="#method_ba_GameActivity__respawn_player">respawn_player()</a>, <a href="#method_ba_GameActivity__setup_standard_powerup_drops">setup_standard_powerup_drops()</a>, <a href="#method_ba_GameActivity__setup_standard_time_limit">setup_standard_time_limit()</a>, <a href="#method_ba_GameActivity__show_info">show_info()</a>, <a href="#method_ba_GameActivity__show_scoreboard_info">show_scoreboard_info()</a>, <a href="#method_ba_GameActivity__show_zoom_message">show_zoom_message()</a>, <a href="#method_ba_GameActivity__spawn_player">spawn_player()</a>, <a href="#method_ba_GameActivity__spawn_player_if_exists">spawn_player_if_exists()</a>, <a href="#method_ba_GameActivity__spawn_player_spaz">spawn_player_spaz()</a>, <a href="#method_ba_GameActivity__supports_session_type">supports_session_type()</a></h5> <h5><a href="#method_ba_GameActivity____init__">&lt;constructor&gt;</a>, <a href="#method_ba_GameActivity__continue_or_end_game">continue_or_end_game()</a>, <a href="#method_ba_GameActivity__create_config_ui">create_config_ui()</a>, <a href="#method_ba_GameActivity__end">end()</a>, <a href="#method_ba_GameActivity__end_game">end_game()</a>, <a href="#method_ba_GameActivity__get_config_display_string">get_config_display_string()</a>, <a href="#method_ba_GameActivity__get_description">get_description()</a>, <a href="#method_ba_GameActivity__get_description_display_string">get_description_display_string()</a>, <a href="#method_ba_GameActivity__get_display_string">get_display_string()</a>, <a href="#method_ba_GameActivity__get_game_settings">get_game_settings()</a>, <a href="#method_ba_GameActivity__get_instance_description">get_instance_description()</a>, <a href="#method_ba_GameActivity__get_instance_description_short">get_instance_description_short()</a>, <a href="#method_ba_GameActivity__get_instance_display_string">get_instance_display_string()</a>, <a href="#method_ba_GameActivity__get_instance_scoreboard_display_string">get_instance_scoreboard_display_string()</a>, <a href="#method_ba_GameActivity__get_name">get_name()</a>, <a href="#method_ba_GameActivity__get_score_info">get_score_info()</a>, <a href="#method_ba_GameActivity__get_supported_maps">get_supported_maps()</a>, <a href="#method_ba_GameActivity__get_team_display_string">get_team_display_string()</a>, <a href="#method_ba_GameActivity__handlemessage">handlemessage()</a>, <a href="#method_ba_GameActivity__is_waiting_for_continue">is_waiting_for_continue()</a>, <a href="#method_ba_GameActivity__on_begin">on_begin()</a>, <a href="#method_ba_GameActivity__on_continue">on_continue()</a>, <a href="#method_ba_GameActivity__on_player_join">on_player_join()</a>, <a href="#method_ba_GameActivity__on_player_leave">on_player_leave()</a>, <a href="#method_ba_GameActivity__on_transition_in">on_transition_in()</a>, <a href="#method_ba_GameActivity__project_flag_stand">project_flag_stand()</a>, <a href="#method_ba_GameActivity__respawn_player">respawn_player()</a>, <a href="#method_ba_GameActivity__setup_standard_powerup_drops">setup_standard_powerup_drops()</a>, <a href="#method_ba_GameActivity__setup_standard_time_limit">setup_standard_time_limit()</a>, <a href="#method_ba_GameActivity__show_info">show_info()</a>, <a href="#method_ba_GameActivity__show_scoreboard_info">show_scoreboard_info()</a>, <a href="#method_ba_GameActivity__show_zoom_message">show_zoom_message()</a>, <a href="#method_ba_GameActivity__spawn_player">spawn_player()</a>, <a href="#method_ba_GameActivity__spawn_player_if_exists">spawn_player_if_exists()</a>, <a href="#method_ba_GameActivity__spawn_player_spaz">spawn_player_spaz()</a>, <a href="#method_ba_GameActivity__supports_session_type">supports_session_type()</a></h5>
<dl> <dl>
<dt><h4><a name="method_ba_GameActivity____init__">&lt;constructor&gt;</a></dt></h4><dd> <dt><h4><a name="method_ba_GameActivity____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.GameActivity(settings: Dict[str, Any])</span></p> <p><span>ba.GameActivity(settings: Dict[str, Any])</span></p>
@ -2073,9 +2073,9 @@ and calls either end_game or continue_game depending on the result</p>
success or None on cancel.</p> success or None on cancel.</p>
<p>Generally subclasses don't need to override this; if they override <p>Generally subclasses don't need to override this; if they override
<a href="#method_ba_GameActivity__get_settings">ba.GameActivity.get_settings</a>() and <a href="#method_ba_GameActivity__get_supported_maps">ba.GameActivity.get_supported_maps</a>() <a href="#method_ba_GameActivity__get_game_settings">ba.GameActivity.get_game_settings</a>() and
they can just rely on the default implementation here which calls those <a href="#method_ba_GameActivity__get_supported_maps">ba.GameActivity.get_supported_maps</a>() they can just rely on
methods.</p> the default implementation here which calls those methods.</p>
</dd> </dd>
<dt><h4><a name="method_ba_GameActivity__end">end()</a></dt></h4><dd> <dt><h4><a name="method_ba_GameActivity__end">end()</a></dt></h4><dd>
@ -2114,9 +2114,11 @@ is up next in a series.</p>
<h5><span><em>&lt;class method&gt;</span></em></h5> <h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_description(sessiontype: Type[<a href="#class_ba_Session">ba.Session</a>]) -&gt; str </span></p> <p><span>get_description(sessiontype: Type[<a href="#class_ba_Session">ba.Session</a>]) -&gt; str </span></p>
<p>Subclasses should override this to return a description for this <p>Get a str description of this game type.</p>
activity type (in English) within the context of the given
<a href="#class_ba_Session">ba.Session</a> type.</p> <p>The default implementation simply returns the 'description' class var.
Classes which want to change their description depending on the session
can override this method.</p>
</dd> </dd>
<dt><h4><a name="method_ba_GameActivity__get_description_display_string">get_description_display_string()</a></dt></h4><dd> <dt><h4><a name="method_ba_GameActivity__get_description_display_string">get_description_display_string()</a></dt></h4><dd>
@ -2137,92 +2139,9 @@ activity type (in English) within the context of the given
<p>Subclasses should override get_name(); not this.</p> <p>Subclasses should override get_name(); not this.</p>
</dd> </dd>
<dt><h4><a name="method_ba_GameActivity__get_instance_description">get_instance_description()</a></dt></h4><dd> <dt><h4><a name="method_ba_GameActivity__get_game_settings">get_game_settings()</a></dt></h4><dd>
<p><span>get_instance_description(self) -&gt; Union[str, Sequence]</span></p>
<p>Return a description for this game instance, in English.</p>
<p>This is shown in the center of the screen below the game name at the
start of a game. It should start with a capital letter and end with a
period, and can be a bit more verbose than the version returned by
get_instance_scoreboard_description().</p>
<p>Note that translation is applied by looking up the specific returned
value as a key, so the number of returned variations should be limited;
ideally just one or two. To include arbitrary values in the
description, you can return a sequence of values in the following
form instead of just a string:</p>
<pre><span><em><small># this will give us something like 'Score 3 goals.' in English</small></em></span>
<span><em><small># and can properly translate to 'Anota 3 goles.' in Spanish.</small></em></span>
<span><em><small># If we just returned the string 'Score 3 Goals' here, there would</small></em></span>
<span><em><small># have to be a translation entry for each specific number. ew.</small></em></span>
return ['Score ${ARG1} goals.', self.settings_raw['Score to Win']]</pre>
<p>This way the first string can be consistently translated, with any arg
values then substituted into the result. ${ARG1} will be replaced with
the first value, ${ARG2} with the second, etc.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_instance_display_string">get_instance_display_string()</a></dt></h4><dd>
<p><span>get_instance_display_string(self) -&gt; <a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>Return a name for this particular game instance.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_instance_scoreboard_description">get_instance_scoreboard_description()</a></dt></h4><dd>
<p><span>get_instance_scoreboard_description(self) -&gt; Union[str, Sequence]</span></p>
<p>Return a short description for this game instance in English.</p>
<p>This description is used above the game scoreboard in the
corner of the screen, so it should be as concise as possible.
It should be lowercase and should not contain periods or other
punctuation.</p>
<p>Note that translation is applied by looking up the specific returned
value as a key, so the number of returned variations should be limited;
ideally just one or two. To include arbitrary values in the
description, you can return a sequence of values in the following form
instead of just a string:</p>
<pre><span><em><small># this will give us something like 'score 3 goals' in English</small></em></span>
<span><em><small># and can properly translate to 'anota 3 goles' in Spanish.</small></em></span>
<span><em><small># If we just returned the string 'score 3 goals' here, there would</small></em></span>
<span><em><small># have to be a translation entry for each specific number. ew.</small></em></span>
return ['score ${ARG1} goals', self.settings_raw['Score to Win']]</pre>
<p>This way the first string can be consistently translated, with any arg
values then substituted into the result. ${ARG1} will be replaced
with the first value, ${ARG2} with the second, etc.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_instance_scoreboard_display_string">get_instance_scoreboard_display_string()</a></dt></h4><dd>
<p><span>get_instance_scoreboard_display_string(self) -&gt; <a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>Return a name for this particular game instance.</p>
<p>This name is used above the game scoreboard in the corner
of the screen, so it should be as concise as possible.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_name">get_name()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5> <h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_name() -&gt; str </span></p> <p><span>get_game_settings(sessiontype: Type[<a href="#class_ba_Session">ba.Session</a>]) -&gt; List[Tuple[str, Dict[str, Any]]] </span></p>
<p>Return a str name for this game type.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_score_info">get_score_info()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_score_info() -&gt; <a href="#class_ba_ScoreInfo">ba.ScoreInfo</a> </span></p>
<p>Return info about game scoring setup; can be overridden by games.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_settings">get_settings()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_settings(sessiontype: Type[<a href="#class_ba_Session">ba.Session</a>]) -&gt; List[Tuple[str, Dict[str, Any]]] </span></p>
<p>Called by the default <a href="#method_ba_GameActivity__create_config_ui">ba.GameActivity.create_config_ui</a>() <p>Called by the default <a href="#method_ba_GameActivity__create_config_ui">ba.GameActivity.create_config_ui</a>()
implementation; should return a dict of config options to be presented implementation; should return a dict of config options to be presented
@ -2244,9 +2163,9 @@ of a name and a dict of options.</p>
<p>'increment': Value increment for int/float settings.</p> <p>'increment': Value increment for int/float settings.</p>
<pre><span><em><small># example get_settings() implementation for a capture-the-flag game:</small></em></span> <pre><span><em><small># example get_game_settings() for a capture-the-flag game:</small></em></span>
@classmethod @classmethod
def get_settings(cls,sessiontype): def get_game_settings(cls, sessiontype):
return [("Score to Win", { return [("Score to Win", {
'default': 3, 'default': 3,
'min_value': 1 'min_value': 1
@ -2280,6 +2199,91 @@ def get_settings(cls,sessiontype):
'default': False 'default': False
})]</pre> })]</pre>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_instance_description">get_instance_description()</a></dt></h4><dd>
<p><span>get_instance_description(self) -&gt; Union[str, Sequence]</span></p>
<p>Return a description for this game instance, in English.</p>
<p>This is shown in the center of the screen below the game name at the
start of a game. It should start with a capital letter and end with a
period, and can be a bit more verbose than the version returned by
get_instance_description_short().</p>
<p>Note that translation is applied by looking up the specific returned
value as a key, so the number of returned variations should be limited;
ideally just one or two. To include arbitrary values in the
description, you can return a sequence of values in the following
form instead of just a string:</p>
<pre><span><em><small># This will give us something like 'Score 3 goals.' in English</small></em></span>
<span><em><small># and can properly translate to 'Anota 3 goles.' in Spanish.</small></em></span>
<span><em><small># If we just returned the string 'Score 3 Goals' here, there would</small></em></span>
<span><em><small># have to be a translation entry for each specific number. ew.</small></em></span>
return ['Score ${ARG1} goals.', self.settings_raw['Score to Win']]</pre>
<p>This way the first string can be consistently translated, with any arg
values then substituted into the result. ${ARG1} will be replaced with
the first value, ${ARG2} with the second, etc.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_instance_description_short">get_instance_description_short()</a></dt></h4><dd>
<p><span>get_instance_description_short(self) -&gt; Union[str, Sequence]</span></p>
<p>Return a short description for this game instance in English.</p>
<p>This description is used above the game scoreboard in the
corner of the screen, so it should be as concise as possible.
It should be lowercase and should not contain periods or other
punctuation.</p>
<p>Note that translation is applied by looking up the specific returned
value as a key, so the number of returned variations should be limited;
ideally just one or two. To include arbitrary values in the
description, you can return a sequence of values in the following form
instead of just a string:</p>
<pre><span><em><small># This will give us something like 'score 3 goals' in English</small></em></span>
<span><em><small># and can properly translate to 'anota 3 goles' in Spanish.</small></em></span>
<span><em><small># If we just returned the string 'score 3 goals' here, there would</small></em></span>
<span><em><small># have to be a translation entry for each specific number. ew.</small></em></span>
return ['score ${ARG1} goals', self.settings_raw['Score to Win']]</pre>
<p>This way the first string can be consistently translated, with any arg
values then substituted into the result. ${ARG1} will be replaced
with the first value, ${ARG2} with the second, etc.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_instance_display_string">get_instance_display_string()</a></dt></h4><dd>
<p><span>get_instance_display_string(self) -&gt; <a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>Return a name for this particular game instance.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_instance_scoreboard_display_string">get_instance_scoreboard_display_string()</a></dt></h4><dd>
<p><span>get_instance_scoreboard_display_string(self) -&gt; <a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>Return a name for this particular game instance.</p>
<p>This name is used above the game scoreboard in the corner
of the screen, so it should be as concise as possible.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_name">get_name()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_name() -&gt; str </span></p>
<p>Return a str name for this game type.</p>
<p>This default implementation simply returns the 'name' class attr.</p>
</dd>
<dt><h4><a name="method_ba_GameActivity__get_score_info">get_score_info()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5>
<p><span>get_score_info() -&gt; <a href="#class_ba_ScoreInfo">ba.ScoreInfo</a> </span></p>
<p>Return info about game scoring setup; can be overridden by games.</p>
</dd> </dd>
<dt><h4><a name="method_ba_GameActivity__get_supported_maps">get_supported_maps()</a></dt></h4><dd> <dt><h4><a name="method_ba_GameActivity__get_supported_maps">get_supported_maps()</a></dt></h4><dd>
<h5><span><em>&lt;class method&gt;</span></em></h5> <h5><span><em>&lt;class method&gt;</span></em></h5>
@ -4810,7 +4814,7 @@ of the session.</p>
</dd> </dd>
</dl> </dl>
<h3>Methods Inherited:</h3> <h3>Methods Inherited:</h3>
<h5><a href="#method_ba_GameActivity__add_actor_weak_ref">add_actor_weak_ref()</a>, <a href="#method_ba_GameActivity__add_player">add_player()</a>, <a href="#method_ba_GameActivity__add_team">add_team()</a>, <a href="#method_ba_GameActivity__begin">begin()</a>, <a href="#method_ba_GameActivity__continue_or_end_game">continue_or_end_game()</a>, <a href="#method_ba_GameActivity__create_config_ui">create_config_ui()</a>, <a href="#method_ba_GameActivity__create_player">create_player()</a>, <a href="#method_ba_GameActivity__create_team">create_team()</a>, <a href="#method_ba_GameActivity__dep_is_present">dep_is_present()</a>, <a href="#method_ba_GameActivity__destroy">destroy()</a>, <a href="#method_ba_GameActivity__end_game">end_game()</a>, <a href="#method_ba_GameActivity__get_config_display_string">get_config_display_string()</a>, <a href="#method_ba_GameActivity__get_description">get_description()</a>, <a href="#method_ba_GameActivity__get_description_display_string">get_description_display_string()</a>, <a href="#method_ba_GameActivity__get_display_string">get_display_string()</a>, <a href="#method_ba_GameActivity__get_dynamic_deps">get_dynamic_deps()</a>, <a href="#method_ba_GameActivity__get_instance_description">get_instance_description()</a>, <a href="#method_ba_GameActivity__get_instance_display_string">get_instance_display_string()</a>, <a href="#method_ba_GameActivity__get_instance_scoreboard_description">get_instance_scoreboard_description()</a>, <a href="#method_ba_GameActivity__get_instance_scoreboard_display_string">get_instance_scoreboard_display_string()</a>, <a href="#method_ba_GameActivity__get_name">get_name()</a>, <a href="#method_ba_GameActivity__get_score_info">get_score_info()</a>, <a href="#method_ba_GameActivity__get_settings">get_settings()</a>, <a href="#method_ba_GameActivity__get_supported_maps">get_supported_maps()</a>, <a href="#method_ba_GameActivity__get_team_display_string">get_team_display_string()</a>, <a href="#method_ba_GameActivity__handlemessage">handlemessage()</a>, <a href="#method_ba_GameActivity__has_begun">has_begun()</a>, <a href="#method_ba_GameActivity__has_ended">has_ended()</a>, <a href="#method_ba_GameActivity__has_transitioned_in">has_transitioned_in()</a>, <a href="#method_ba_GameActivity__is_transitioning_out">is_transitioning_out()</a>, <a href="#method_ba_GameActivity__is_waiting_for_continue">is_waiting_for_continue()</a>, <a href="#method_ba_GameActivity__on_continue">on_continue()</a>, <a href="#method_ba_GameActivity__on_expire">on_expire()</a>, <a href="#method_ba_GameActivity__on_player_join">on_player_join()</a>, <a href="#method_ba_GameActivity__on_player_leave">on_player_leave()</a>, <a href="#method_ba_GameActivity__on_team_join">on_team_join()</a>, <a href="#method_ba_GameActivity__on_team_leave">on_team_leave()</a>, <a href="#method_ba_GameActivity__on_transition_out">on_transition_out()</a>, <a href="#method_ba_GameActivity__project_flag_stand">project_flag_stand()</a>, <a href="#method_ba_GameActivity__remove_player">remove_player()</a>, <a href="#method_ba_GameActivity__remove_team">remove_team()</a>, <a href="#method_ba_GameActivity__respawn_player">respawn_player()</a>, <a href="#method_ba_GameActivity__retain_actor">retain_actor()</a>, <a href="#method_ba_GameActivity__set_has_ended">set_has_ended()</a>, <a href="#method_ba_GameActivity__set_immediate_end">set_immediate_end()</a>, <a href="#method_ba_GameActivity__setup_standard_powerup_drops">setup_standard_powerup_drops()</a>, <a href="#method_ba_GameActivity__setup_standard_time_limit">setup_standard_time_limit()</a>, <a href="#method_ba_GameActivity__show_info">show_info()</a>, <a href="#method_ba_GameActivity__show_scoreboard_info">show_scoreboard_info()</a>, <a href="#method_ba_GameActivity__show_zoom_message">show_zoom_message()</a>, <a href="#method_ba_GameActivity__spawn_player">spawn_player()</a>, <a href="#method_ba_GameActivity__spawn_player_if_exists">spawn_player_if_exists()</a>, <a href="#method_ba_GameActivity__transition_in">transition_in()</a>, <a href="#method_ba_GameActivity__transition_out">transition_out()</a></h5> <h5><a href="#method_ba_GameActivity__add_actor_weak_ref">add_actor_weak_ref()</a>, <a href="#method_ba_GameActivity__add_player">add_player()</a>, <a href="#method_ba_GameActivity__add_team">add_team()</a>, <a href="#method_ba_GameActivity__begin">begin()</a>, <a href="#method_ba_GameActivity__continue_or_end_game">continue_or_end_game()</a>, <a href="#method_ba_GameActivity__create_config_ui">create_config_ui()</a>, <a href="#method_ba_GameActivity__create_player">create_player()</a>, <a href="#method_ba_GameActivity__create_team">create_team()</a>, <a href="#method_ba_GameActivity__dep_is_present">dep_is_present()</a>, <a href="#method_ba_GameActivity__destroy">destroy()</a>, <a href="#method_ba_GameActivity__end_game">end_game()</a>, <a href="#method_ba_GameActivity__get_config_display_string">get_config_display_string()</a>, <a href="#method_ba_GameActivity__get_description">get_description()</a>, <a href="#method_ba_GameActivity__get_description_display_string">get_description_display_string()</a>, <a href="#method_ba_GameActivity__get_display_string">get_display_string()</a>, <a href="#method_ba_GameActivity__get_dynamic_deps">get_dynamic_deps()</a>, <a href="#method_ba_GameActivity__get_game_settings">get_game_settings()</a>, <a href="#method_ba_GameActivity__get_instance_description">get_instance_description()</a>, <a href="#method_ba_GameActivity__get_instance_description_short">get_instance_description_short()</a>, <a href="#method_ba_GameActivity__get_instance_display_string">get_instance_display_string()</a>, <a href="#method_ba_GameActivity__get_instance_scoreboard_display_string">get_instance_scoreboard_display_string()</a>, <a href="#method_ba_GameActivity__get_name">get_name()</a>, <a href="#method_ba_GameActivity__get_score_info">get_score_info()</a>, <a href="#method_ba_GameActivity__get_supported_maps">get_supported_maps()</a>, <a href="#method_ba_GameActivity__get_team_display_string">get_team_display_string()</a>, <a href="#method_ba_GameActivity__handlemessage">handlemessage()</a>, <a href="#method_ba_GameActivity__has_begun">has_begun()</a>, <a href="#method_ba_GameActivity__has_ended">has_ended()</a>, <a href="#method_ba_GameActivity__has_transitioned_in">has_transitioned_in()</a>, <a href="#method_ba_GameActivity__is_transitioning_out">is_transitioning_out()</a>, <a href="#method_ba_GameActivity__is_waiting_for_continue">is_waiting_for_continue()</a>, <a href="#method_ba_GameActivity__on_continue">on_continue()</a>, <a href="#method_ba_GameActivity__on_expire">on_expire()</a>, <a href="#method_ba_GameActivity__on_player_join">on_player_join()</a>, <a href="#method_ba_GameActivity__on_player_leave">on_player_leave()</a>, <a href="#method_ba_GameActivity__on_team_join">on_team_join()</a>, <a href="#method_ba_GameActivity__on_team_leave">on_team_leave()</a>, <a href="#method_ba_GameActivity__on_transition_out">on_transition_out()</a>, <a href="#method_ba_GameActivity__project_flag_stand">project_flag_stand()</a>, <a href="#method_ba_GameActivity__remove_player">remove_player()</a>, <a href="#method_ba_GameActivity__remove_team">remove_team()</a>, <a href="#method_ba_GameActivity__respawn_player">respawn_player()</a>, <a href="#method_ba_GameActivity__retain_actor">retain_actor()</a>, <a href="#method_ba_GameActivity__set_has_ended">set_has_ended()</a>, <a href="#method_ba_GameActivity__set_immediate_end">set_immediate_end()</a>, <a href="#method_ba_GameActivity__setup_standard_powerup_drops">setup_standard_powerup_drops()</a>, <a href="#method_ba_GameActivity__setup_standard_time_limit">setup_standard_time_limit()</a>, <a href="#method_ba_GameActivity__show_info">show_info()</a>, <a href="#method_ba_GameActivity__show_scoreboard_info">show_scoreboard_info()</a>, <a href="#method_ba_GameActivity__show_zoom_message">show_zoom_message()</a>, <a href="#method_ba_GameActivity__spawn_player">spawn_player()</a>, <a href="#method_ba_GameActivity__spawn_player_if_exists">spawn_player_if_exists()</a>, <a href="#method_ba_GameActivity__transition_in">transition_in()</a>, <a href="#method_ba_GameActivity__transition_out">transition_out()</a></h5>
<h3>Methods Defined or Overridden:</h3> <h3>Methods Defined or Overridden:</h3>
<h5><a href="#method_ba_TeamGameActivity____init__">&lt;constructor&gt;</a>, <a href="#method_ba_TeamGameActivity__end">end()</a>, <a href="#method_ba_TeamGameActivity__on_begin">on_begin()</a>, <a href="#method_ba_TeamGameActivity__on_transition_in">on_transition_in()</a>, <a href="#method_ba_TeamGameActivity__spawn_player_spaz">spawn_player_spaz()</a>, <a href="#method_ba_TeamGameActivity__supports_session_type">supports_session_type()</a></h5> <h5><a href="#method_ba_TeamGameActivity____init__">&lt;constructor&gt;</a>, <a href="#method_ba_TeamGameActivity__end">end()</a>, <a href="#method_ba_TeamGameActivity__on_begin">on_begin()</a>, <a href="#method_ba_TeamGameActivity__on_transition_in">on_transition_in()</a>, <a href="#method_ba_TeamGameActivity__spawn_player_spaz">spawn_player_spaz()</a>, <a href="#method_ba_TeamGameActivity__supports_session_type">supports_session_type()</a></h5>
<dl> <dl>