Exemplo n.º 1
0
    def start_new_game(self, player_name: str, enemy_name: str,
                       conflictTheater: ConflictTheater, midgame: bool,
                       multiplier: float, period: datetime,
                       settings: Settings):

        # Reset name generator
        namegen.reset()
        start_generator.prepare_theater(conflictTheater, settings, midgame)

        print("-- Starting New Game Generator")
        print("Enemy name : " + enemy_name)
        print("Player name : " + player_name)
        print("Midgame : " + str(midgame))
        start_generator.generate_inital_units(conflictTheater, enemy_name,
                                              True, multiplier)

        print("-- Initial units generated")
        game = Game(player_name=player_name,
                    enemy_name=enemy_name,
                    theater=conflictTheater,
                    start_date=period,
                    settings=settings)

        print("-- Game Object generated")
        start_generator.generate_groundobjects(conflictTheater, game)
        game.budget = int(game.budget * multiplier)
        game.settings.multiplier = multiplier
        game.settings.sams = True
        game.settings.version = CONST.VERSION_STRING

        if midgame:
            game.budget = game.budget * 4 * len(
                list(conflictTheater.conflicts()))

        return game
Exemplo n.º 2
0
    def start_new_game(self, player_name: str, enemy_name: str, terrain: str,
                       sams: bool, midgame: bool, multiplier: float):
        if terrain == "persiangulf":
            conflicttheater = persiangulf.PersianGulfTheater()
        elif terrain == "nevada":
            conflicttheater = nevada.NevadaTheater()
        else:
            conflicttheater = caucasus.CaucasusTheater()

        if midgame:
            for i in range(0, int(len(conflicttheater.controlpoints) / 2)):
                conflicttheater.controlpoints[i].captured = True

        start_generator.generate_inital_units(conflicttheater, enemy_name,
                                              sams, multiplier)
        start_generator.generate_groundobjects(conflicttheater)
        game = Game(player_name=player_name,
                    enemy_name=enemy_name,
                    theater=conflicttheater)
        game.budget = int(game.budget * multiplier)
        game.settings.multiplier = multiplier
        game.settings.sams = sams
        game.settings.version = logging_module.version_string()

        if midgame:
            game.budget = game.budget * 4 * len(
                list(conflicttheater.conflicts()))

        self.proceed_to_main_menu(game)
Exemplo n.º 3
0
def init(
    player_country: str, enemy_country: str,
    theater_klass: typing.Type[ConflictTheater]
) -> typing.Tuple[Game, ConflictTheater]:
    global PLAYER_COUNTRY
    global ENEMY_COUNTRY

    PLAYER_COUNTRY = player_country
    ENEMY_COUNTRY = enemy_country

    # prerequisites
    persistency.setup("./tests/userfolder/")
    theater = theater_klass()
    start_generator.generate_inital_units(theater, ENEMY_COUNTRY, True, 1)
    start_generator.generate_groundobjects(theater)
    return Game(PLAYER_COUNTRY, ENEMY_COUNTRY, theater), theater
Exemplo n.º 4
0
    def start_new_game(self, player_name: str, enemy_name: str,
                       conflicttheater: ConflictTheater, midgame: bool,
                       multiplier: float, period: datetime):

        if midgame:
            for i in range(0, int(len(conflicttheater.controlpoints) / 2)):
                conflicttheater.controlpoints[i].captured = True

        # Reset name generator
        namegen.reset()

        print("-- Starting New Game Generator")
        print("Enemy name : " + enemy_name)
        print("Player name : " + player_name)
        print("Midgame : " + str(midgame))
        start_generator.generate_inital_units(conflicttheater, enemy_name,
                                              True, multiplier)

        print("-- Initial units generated")
        game = Game(player_name=player_name,
                    enemy_name=enemy_name,
                    theater=conflicttheater,
                    start_date=period)

        print("-- Game Object generated")
        start_generator.generate_groundobjects(conflicttheater, game)
        game.budget = int(game.budget * multiplier)
        game.settings.multiplier = multiplier
        game.settings.sams = True
        game.settings.version = "2.0RC7"

        if midgame:
            game.budget = game.budget * 4 * len(
                list(conflicttheater.conflicts()))

        return game