コード例 #1
0
  @Override
  public void run(GameState gameState, MoveMaker move)
      throws AssertionError, UnsupportedOperationException, IllegalArgumentException {
    if (1 == 1) {
      throw new IllegalArgumentException();
    }

    gameState.setWhoseTurn(0);

    Collection<Card> hand = new ArrayList<Card>();
    hand.add(Card.CONSUL);

    gameState.setPlayerHand(0, hand);
    gameState.setPlayerSestertii(0, 10);

    move.placeCard(Card.CONSUL, Rules.DICE_DISC_2);

    gameState.setActionDice(new int[] {2, 2, 2});

    ConsulActivator activator = (ConsulActivator) move.chooseCardToActivate(Rules.DICE_DISC_2);
    activator.chooseConsulChangeAmount(1);
    activator.chooseWhichDiceChanges(2);
    activator.complete();

    int[] dice = gameState.getActionDice();

    boolean found = false;
    for (int die : dice) {
      if (die == 3) {
        found = true;
      }
    }

    assert (found);
  }
  @Override
  public void run(GameState gameState, MoveMaker move)
      throws AssertionError, UnsupportedOperationException, IllegalArgumentException {

    gameState.setWhoseTurn(0);
    gameState.setPlayerVictoryPoints(0, 10);
    gameState.setPlayerVictoryPoints(1, 10);
    gameState.setPlayerSestertii(0, 30);
    assert (gameState.getPoolVictoryPoints() == 16);

    Collection<Card> hand = new ArrayList<Card>();
    hand.add(Card.FORUM);
    hand.add(Card.BASILICA);

    gameState.setPlayerHand(0, hand);

    // no cards on the field
    Card[] field = new Card[Rules.NUM_DICE_DISCS];
    for (int i = 0; i < field.length; i++) {
      field[i] = Card.NOT_A_CARD;
    }

    gameState.setPlayerCardsOnDiscs(0, field);
    gameState.setPlayerCardsOnDiscs(1, field);

    gameState.setActionDice(new int[] {2, 2, 2});

    // ================ test starts ===================
    move.placeCard(Card.FORUM, Rules.DICE_DISC_2);
    assert (gameState.getPlayerSestertii(0) == 25);

    move.placeCard(Card.BASILICA, Rules.DICE_DISC_1);
    assert (gameState.getPlayerSestertii(0) == 19);

    ForumActivator activator = (ForumActivator) move.chooseCardToActivate(Rules.DICE_DISC_2);
    activator.chooseActionDice(2);
    activator.chooseActivateTemplum(false);
    activator.complete();

    assert (gameState.getPlayerVictoryPoints(0) == 14);
    assert (gameState.getPoolVictoryPoints() == 12);
  }