@Test public void testRelieveIntensiveCheckConditionWithModerate() throws InvalidMoveException, JMSException { game.setMode(Mode.SILVO_PUZZLE); ManantialesFicha contig1 = new ManantialesFicha(5, 4, alice.getColor(), TokenType.INTENSIVE_PASTURE); ManantialesFicha contig2 = new ManantialesFicha(6, 4, alice.getColor(), TokenType.INTENSIVE_PASTURE); SetIds(contig1, contig2); GameGrid grid = game.getGrid(); if (grid.isEmpty()) grid.setCells(new HashSet<GridCell>()); game.getGrid().getCells().add(contig1); ManantialesMove move = new ManantialesMove(alice, contig2); game.move(move); assertEquals(MoveStatus.EVALUATED, move.getStatus()); assertEquals(1, game.getCheckConditions().size()); List<Message> messages = filterForEvent(GameEvent.CONDITION_RAISED); assertEquals(1, messages.size()); alice.setTurn(true); ManantialesFicha relief = new ManantialesFicha(5, 4, alice.getColor(), TokenType.MODERATE_PASTURE); move = new ManantialesMove(alice, contig1, relief); game.move(move); assertEquals(MoveStatus.EVALUATED, move.getStatus()); assertEquals( Arrays.toString(game.getCheckConditions().toArray()), 0, game.getCheckConditions().size()); messages = filterForEvent(GameEvent.CONDITION_RESOLVED); assertEquals(1, messages.size()); }
/* Tests for a constraint triggered by red, and ensure that it will expire * Bug seen in UI.*/ @Test public void testYellowYellowRed() throws InvalidMoveException, JMSException { ManantialesFicha a1 = new ManantialesFicha(3, 4, alice.getColor(), TokenType.MODERATE_PASTURE); ManantialesFicha a2 = new ManantialesFicha(2, 4, alice.getColor(), TokenType.MODERATE_PASTURE); ManantialesFicha trigger = new ManantialesFicha(0, 4, charlie.getColor(), TokenType.MODERATE_PASTURE); ManantialesFicha sp1 = new ManantialesFicha(5, 7, denise.getColor(), TokenType.MANAGED_FOREST); ManantialesFicha sp2 = new ManantialesFicha(1, 1, alice.getColor(), TokenType.MODERATE_PASTURE); ManantialesFicha expiry = new ManantialesFicha(6, 0, bob.getColor(), TokenType.MANAGED_FOREST); SetIds(a1, a2, trigger, sp1, sp2, expiry); ManantialesMove move = new ManantialesMove(alice, a1); game.move(move); assertEquals(MoveStatus.EVALUATED, move.getStatus()); alice.setTurn(true); assertEquals(MoveStatus.EVALUATED, move.getStatus()); move = new ManantialesMove(alice, a2); game.move(move); assertEquals(MoveStatus.EVALUATED, move.getStatus()); charlie.setTurn(true); move = new ManantialesMove(charlie, trigger); game.move(move); assertEquals(MoveStatus.EVALUATED, move.getStatus()); List<Message> messages = filterForEvent(GameEvent.CONDITION_RAISED); assertEquals(1, messages.size()); move = new ManantialesMove(denise, sp1); game.move(move); move = new ManantialesMove(alice, sp2); game.move(move); move = new ManantialesMove(bob, expiry); game.move(move); assertEquals(MoveStatus.EVALUATED, move.getStatus()); messages = filterForEvent(GameEvent.CONDITION_TRIGGERED); assertEquals(1, messages.size()); }
@Test public void testRelieveEastCheckConstraintsWithActiveManantialesConstraint() throws InvalidMoveException, JMSException { /* Northern Constraint */ ManantialesFicha nFicha = new ManantialesFicha(4, 3, alice.getColor(), TokenType.MODERATE_PASTURE); ManantialesFicha nFicha2 = new ManantialesFicha(4, 1, charlie.getColor(), TokenType.MODERATE_PASTURE); ManantialesFicha nFicha3 = new ManantialesFicha(4, 2, charlie.getColor(), TokenType.MODERATE_PASTURE); /* Manantials Constraint */ ManantialesFicha mFicha = new ManantialesFicha(4, 5, bob.getColor(), TokenType.MODERATE_PASTURE); /* Trigger */ ManantialesFicha mFicha2 = new ManantialesFicha(3, 4, charlie.getColor(), TokenType.MODERATE_PASTURE); SetIds(nFicha, nFicha2, nFicha3, mFicha, mFicha2); move(nFicha, nFicha2, nFicha3, mFicha2); List<Message> messages = filterForEvent(GameEvent.CONDITION_RAISED); assertEquals(1, messages.size()); /* Trigger Manantiales condition */ stripTurns(); bob.setTurn(true); ManantialesMove move = new ManantialesMove(bob, mFicha); assertTrue(move.isManantial()); game.move(move); assertEquals(MoveStatus.EVALUATED, move.getStatus()); messages = filterForEvent(GameEvent.CONDITION_TRIGGERED); assertEquals(1, messages.size()); messages = filterForEvent(GameEvent.CONDITION_RAISED); assertEquals(2, messages.size()); /* Check that expired Northern border constraint resolved Manantiales condition */ messages = filterForEvent(GameEvent.CONDITION_RESOLVED); assertEquals(1, messages.size()); }