Exemplo n.º 1
0
def test_assassin_abilities(game):
    # arrange
    player = game.add_player('Player', char=Character.Assassin)

    # act
    sink = CommandsSink(player, game)

    # assert
    assert sink.possible_abilities == (commands.Kill(), )
Exemplo n.º 2
0
def test_kill_merchant_if_anybody_is_low_on_gold(bot, game, assassin, player1,
                                                 player2):
    # arrange
    player1.cash_in(4)

    context = bot.create_context(assassin, game)

    sink = CommandsSink(assassin, game)

    # act
    command = bot.kill(sink.possible_abilities, context, assassin, game)

    # assert
    assert command == commands.Kill(char=Character.Merchant)
Exemplo n.º 3
0
def test_kill_architect_if_lead_player_is_low_on_cards(bot, game, assassin,
                                                       player1, player2):
    # arrange
    player1.build_district(District.Cathedral)

    player2.build_district(District.Watchtower)
    player2.build_district(District.Docks)
    player2.build_district(District.Cathedral)

    context = bot.create_context(assassin, game)

    sink = CommandsSink(assassin, game)

    # act
    command = bot.kill(sink.possible_abilities, context, assassin, game)

    # assert
    assert command == commands.Kill(char=Character.Architect)
Exemplo n.º 4
0
def test_kill_lead_player_if_he_has_color_bias(bot, game, assassin, player1,
                                               player2):
    # arrange
    player1.build_district(District.Cathedral)

    player2.build_district(District.Watchtower)
    player2.build_district(District.Battlefield)
    player2.build_district(District.Fortress)
    player2.build_district(District.Docks)

    context = bot.create_context(assassin, game)

    sink = CommandsSink(assassin, game)

    # act
    command = bot.kill(sink.possible_abilities, context, assassin, game)

    # assert
    assert command == commands.Kill(char=Character.Warlord)
Exemplo n.º 5
0
def test_kill(player, game):
    # arrange
    command = commands.Kill()

    game.turn.drop_char(Character.Architect)

    # act
    choices = command.choices(ShadowPlayer(player, me=True),
                              ShadowGame(player, game))
    assert choices
    assert Character.Assassin not in choices
    assert Character.Architect not in choices

    command.select(Character.King)
    assert not command.choices(ShadowPlayer(player, me=True),
                               ShadowGame(player, game))

    command.apply(player, game)

    # assert
    assert game.turn.killed_char == Character.King
Exemplo n.º 6
0
 def __init__(self, char: Character):
     compulsory = commands.Restriction.Compulsory
     self.abilities = {
         Character.Assassin: [commands.Kill()],
         Character.Thief: [commands.Rob()],
         Character.Magician: [commands.SwapHands(),
                              commands.ReplaceHand()],
         #Character.King: [commands.TakeCrown(restriction=commands.Restriction.OnStartTurn|compulsory)], # TODO: ?
         Character.Merchant: [
             commands.CashIn(1,
                             source='ability',
                             restriction=commands.Restriction.OnAfterAction
                             | compulsory)
         ],  # MERCHANT-GOLD
         Character.Architect: [
             commands.DrawCards(
                 2,
                 restriction=commands.Restriction.OnAfterAction
                 | compulsory)
         ],  # ARCHITECT-DRAW2
         Character.Warlord:
         [commands.Destroy(restriction=commands.Restriction.OnEndTurn)],
     }.get(char, [])