use of games.strategy.engine.data.UnitType in project triplea by triplea-game.
the class MoveDelegateTest method testMoveTransportsTwice.
@Test
public void testMoveTransportsTwice() {
// move transports
Route route = new Route();
route.setStart(congoSeaZone);
route.add(southAtlantic);
final IntegerMap<UnitType> map = new IntegerMap<>();
map.put(infantry, 2);
map.put(transport, 1);
String results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
assertValid(results);
// move again
route = new Route();
route.setStart(southAtlantic);
route.add(angolaSeaZone);
results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
assertValid(results);
}
use of games.strategy.engine.data.UnitType in project triplea by triplea-game.
the class MoveDelegateTest method testTransportsMustStayWithUnits.
@Test
public void testTransportsMustStayWithUnits() {
IntegerMap<UnitType> map = new IntegerMap<>();
map.put(armour, 2);
Route route = new Route();
route.setStart(egypt);
route.add(redSea);
String results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route, route.getEnd().getUnits().getUnits());
assertValid(results);
map = new IntegerMap<>();
map.put(transport, 2);
route = new Route();
route.setStart(redSea);
route.add(indianOcean);
results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
assertError(results);
}
use of games.strategy.engine.data.UnitType in project triplea by triplea-game.
the class MoveDelegateTest method testCant2StepBlitzWithNonBlitzingUnits.
@Test
public void testCant2StepBlitzWithNonBlitzingUnits() {
final IntegerMap<UnitType> map = new IntegerMap<>();
map.put(armour, 1);
Route route = new Route();
route.setStart(egypt);
route.add(libya);
// Disable canBlitz attachment
gameData.performChange(ChangeFactory.attachmentPropertyChange(UnitAttachment.get(armour), "false", "canBlitz"));
String results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
assertValid(results);
// Validate move happened
assertEquals(1, libya.getUnits().size());
assertEquals(libya.getOwner(), british);
// Try to move 2nd space
route = new Route();
route.setStart(libya);
route.add(algeria);
// Fail because not 'canBlitz'
results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
assertError(results);
}
use of games.strategy.engine.data.UnitType in project triplea by triplea-game.
the class MoveDelegateTest method testNeutralConquered.
@Test
public void testNeutralConquered() {
// take over neutral
final Route route = new Route();
route.setStart(equatorialAfrica);
route.add(westAfrica);
final IntegerMap<UnitType> map = new IntegerMap<>();
map.put(armour, 1);
final String results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
assertValid(results);
assertTrue(DelegateFinder.battleDelegate(gameData).getBattleTracker().wasConquered(westAfrica));
assertTrue(!DelegateFinder.battleDelegate(gameData).getBattleTracker().wasBlitzed(westAfrica));
}
use of games.strategy.engine.data.UnitType in project triplea by triplea-game.
the class MoveDelegateTest method testBattleAdded.
@Test
public void testBattleAdded() {
// TODO if air make sure otnot alwasys battle
// this was causing an exception
final Route route = new Route();
route.setStart(egypt);
route.add(libya);
final IntegerMap<UnitType> map = new IntegerMap<>();
map.put(bomber, 1);
final String results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
assertValid(results);
}
Aggregations