Exemplo n.º 1
0
def show_current_human_player(game_master):
    datastore = Datastore()
    asset = datastore.get_entry('player_colour')
    player = game_master.current_player()
    if isinstance(player, risk.player.HumonRiskPlayer):
        try:
            asset.set_colour(TerritoryAsset.mapping[player])
        except KeyError:
            error("couldn't find key entry for player: %s" % player.name)
            asset.set_colour(assets.base.BLACK)
    else:
        asset.set_colour(assets.base.GREY)
Exemplo n.º 2
0
Arquivo: input.py Projeto: B-Lock/risk
def attacking_mode(player, game_master, origin):
    picasso = get_picasso()
    datastore = Datastore()
    feedback_asset = datastore.get_entry('attack_feedback')
    picasso.add_asset(LAYER, feedback_asset)
    target = scan_pygame_event(player, game_master, choose_target)
    try:
        game_master.player_attack(player, origin.name, target.name)
    except (GameMasterError, RiskBattleError, KeyError):
        pass
    finally:
        picasso.remove_asset(LAYER, feedback_asset)
Exemplo n.º 3
0
def show_current_human_player(game_master):
    datastore = Datastore()
    asset = datastore.get_entry('player_colour')
    player = game_master.current_player()
    if isinstance(player, risk.player.HumonRiskPlayer):
        try:
            asset.set_colour(TerritoryAsset.mapping[player])
        except KeyError:
            error("couldn't find key entry for player: %s" % player.name)
            asset.set_colour(assets.base.BLACK)
    else:
        asset.set_colour(assets.base.GREY)
Exemplo n.º 4
0
def show_bot_player_hint(game_master):
    datastore = Datastore()
    picasso = get_picasso()
    if not datastore.has_entry('bot_player_hint'):
        hint_asset = assets.text.CentredTextAsset(INFO_PANEL_X, INFO_PANEL_Y, 
                    INFO_PANEL_WIDTH, INFO_PANEL_HEIGHT, 
                    "AI TAKING TURNS...",
                    bold=True)
        datastore.add_entry('bot_player_hint', hint_asset)
    hint_asset = datastore.get_entry('bot_player_hint')
    if isinstance(game_master.current_player(), risk.ai.bots.BasicRiskBot):
        picasso.add_asset(UI_OVERLAY_LEVEL0, hint_asset)
    else:
        picasso.remove_asset(UI_OVERLAY_LEVEL0, hint_asset)
Exemplo n.º 5
0
def show_bot_player_hint(game_master):
    datastore = Datastore()
    picasso = get_picasso()
    if not datastore.has_entry('bot_player_hint'):
        hint_asset = assets.text.CentredTextAsset(INFO_PANEL_X, INFO_PANEL_Y,
                                                  INFO_PANEL_WIDTH, INFO_PANEL_HEIGHT,
                                                  "AI TAKING TURNS...",
                                                  bold=True)
        datastore.add_entry('bot_player_hint', hint_asset)
    hint_asset = datastore.get_entry('bot_player_hint')
    if isinstance(game_master.current_player(), risk.ai.bots.BasicRiskBot):
        picasso.add_asset(UI_OVERLAY_LEVEL0, hint_asset)
    else:
        picasso.remove_asset(UI_OVERLAY_LEVEL0, hint_asset)