Exemple #1
0
def new_game_no_gui(difficulty_name, initial_speed=1):
    global curr_speed
    curr_speed = initial_speed
    global pl

    from singularity.code.stats import itself as stats
    stats.reset()

    from singularity.code import data, difficulty, player, base, tech

    diff = difficulty.difficulties[difficulty_name]

    pl = player.Player(cash=diff.starting_cash, difficulty=diff)

    tech.tech_reinitialized()

    for tech_id in diff.techs:
        pl.techs[tech_id].finish(is_player=False)

    #Starting base
    open = [loc for loc in pl.locations.values() if loc.available()]
    random.choice(open).add_base(
        base.Base(_("University Computer"),
                  base_type["Stolen Computer Time"],
                  built=True))
Exemple #2
0
def new_game_no_gui(difficulty_name, initial_speed=1):
    global curr_speed
    curr_speed = initial_speed
    global pl

    from singularity.code.stats import itself as stats
    stats.reset()

    from singularity.code import data, difficulty, player, base, tech
    data.reload_all_mutable()

    diff = difficulty.difficulties[difficulty_name]

    pl = player.Player(cash=diff.starting_cash, difficulty=diff)

    tech.tech_reinitialized()

    for tech_id in diff.techs:
        pl.techs[tech_id].finish(is_player=False)

    #Starting base
    open = [loc for loc in pl.locations.values() if loc.available()]
    random.choice(open).add_base(
        base.Base(_("University Computer"),
                  base_type["Stolen Computer Time"],
                  built=True))

    #Assign region modifiers to each starting location.
    for reg in regions.values():
        random.shuffle(reg.modifiers_list)
        for mod, loc in zip(reg.modifiers_list, reg.locations):
            pl.locations[loc].modifiers = mod
            if debug:
                print("%s gets modifiers %s" % (loc, mod))
Exemple #3
0
def after_load_savegame():
    tech.tech_reinitialized()
    for b in g.all_bases():
        if b.done:
            b.recalc_cpu()
    g.pl.recalc_cpu()

    # Play the appropriate music
    if g.pl.apotheosis:
        mixer.play_music("win")
    else:
        mixer.play_music("music")