use of games.strategy.engine.data.UnitType in project triplea by triplea-game.
the class MoveDelegateTest method testmultipleMovesExceedingMovementLimit.
@Test
public void testmultipleMovesExceedingMovementLimit() {
final IntegerMap<UnitType> map = new IntegerMap<>();
map.put(infantry, 2);
Route route = new Route();
route.setStart(eastAfrica);
route.add(kenya);
assertEquals(2, eastAfrica.getUnits().size());
assertEquals(0, kenya.getUnits().size());
String results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
assertValid(results);
assertEquals(0, eastAfrica.getUnits().size());
assertEquals(2, kenya.getUnits().size());
route = new Route();
route.setStart(kenya);
route.add(egypt);
assertEquals(2, kenya.getUnits().size());
assertEquals(18, egypt.getUnits().size());
results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
assertError(results);
assertEquals(2, kenya.getUnits().size());
assertEquals(18, egypt.getUnits().size());
}
use of games.strategy.engine.data.UnitType in project triplea by triplea-game.
the class MoveDelegateTest method testCantMoveThroughConqueredNeutral.
@Test
public void testCantMoveThroughConqueredNeutral() {
// take over neutral
Route route = new Route();
route.setStart(equatorialAfrica);
route.add(westAfrica);
IntegerMap<UnitType> map = new IntegerMap<>();
map.put(armour, 1);
String results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
assertValid(results);
// make sure we cant move through it by land
route = new Route();
route.setStart(equatorialAfrica);
route.add(westAfrica);
route.add(algeria);
map = new IntegerMap<>();
map.put(armour, 1);
results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
assertError(results);
// make sure we can still move units to the territory
route = new Route();
route.setStart(equatorialAfrica);
route.add(westAfrica);
map = new IntegerMap<>();
map.put(armour, 1);
results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
assertValid(results);
// make sure air can though
route = new Route();
route.setStart(congoSeaZone);
route.add(westAfricaSeaZone);
route.add(westAfrica);
route.add(equatorialAfrica);
map = new IntegerMap<>();
map.put(fighter, 3);
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 testOverrunNeutral.
@Test
public void testOverrunNeutral() {
final IntegerMap<UnitType> map = new IntegerMap<>();
map.put(armour, 2);
final Route route = new Route();
route.setStart(equatorialAfrica);
route.add(westAfrica);
assertEquals(4, equatorialAfrica.getUnits().size());
assertEquals(0, westAfrica.getUnits().size());
assertEquals(PlayerID.NULL_PLAYERID, westAfrica.getOwner());
assertEquals(35, british.getResources().getQuantity(pus));
final String results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
assertValid(results);
assertEquals(2, equatorialAfrica.getUnits().size());
assertEquals(2, westAfrica.getUnits().size());
assertEquals(westAfrica.getOwner(), british);
assertEquals(32, british.getResources().getQuantity(pus));
}
use of games.strategy.engine.data.UnitType in project triplea by triplea-game.
the class MoveDelegateTest method testNonCombatAttackNeutral.
@Test
public void testNonCombatAttackNeutral() {
bridge.setStepName("britishNonCombatMove");
delegate.setDelegateBridgeAndPlayer(bridge);
delegate.start();
final Route route = new Route();
route.setStart(equatorialAfrica);
route.add(westAfrica);
final IntegerMap<UnitType> map = new IntegerMap<>();
map.put(armour, 2);
final String 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 TuvUtilsTest method testCostsForTuvWithConsumesUnit.
@Test
public void testCostsForTuvWithConsumesUnit() {
final PlayerID germans = GameDataTestUtil.germany(gameData);
final IntegerMap<UnitType> result = TuvUtils.getCostsForTuv(germans, gameData);
assertEquals(11, result.getInt(GameDataTestUtil.germanFactory(gameData)));
}
Aggregations