public FogOfWar(short width, short height, IPlayer player) { this.width = width; this.height = height; this.team = player.getTeamId(); this.sight = new byte[width][height]; }
private int calculateCiviliansCount(ISettlerInformation settlerInformation, int genericWorker) { return genericWorker + settlerInformation.getMovableCount(EMovableType.BEARER) + settlerInformation.getMovableCount(EMovableType.DIGGER) + settlerInformation.getMovableCount(EMovableType.BRICKLAYER); }
@Override public IPlayer getPlayer() { return new IPlayer.DummyPlayer(); }
private Color getColor(IMapObject object) { Color color = null; if (object instanceof IPlayerable) { color = context.getPlayerColor(((IPlayerable) object).getPlayer().getPlayerId()); } return color; }
private boolean isAlive(IPlayer player) { return isAlive(player.getPlayerId()); }
@Override protected ImageLink getBackgroundImage() { if (mannaInformation == null) { return null; } if (mannaInformation.getLevel(soldierType) >= mannaInformation.getMaximumLevel()) { return null; } else if (isActive()) { return imageLinksActive[mannaInformation.getLevel(soldierType)]; } else { return imageLinksInActive[mannaInformation.getLevel(soldierType)]; } }
@Override public String toString() { if (civilisation == null) { return Labels.getString("civilisation-random"); } return Labels.getString("civilisation-" + civilisation.name()); } }
@Override public boolean isActive() { return mannaInformation.isUpgradePossible(soldierType); }
@Override public IPlayer getPlayer() { return new IPlayer.DummyPlayer(); }
private boolean canSelectPlayer(IPlayer player) { return canSelectPlayer(player.getPlayerId()); }
private int calculateSoldiersCount(ISettlerInformation settlerInformation) { return settlerInformation.getMovableCount(EMovableType.SWORDSMAN_L1) + settlerInformation.getMovableCount(EMovableType.SWORDSMAN_L2) + settlerInformation.getMovableCount(EMovableType.SWORDSMAN_L3) + settlerInformation.getMovableCount(EMovableType.BOWMAN_L1) + settlerInformation.getMovableCount(EMovableType.BOWMAN_L2) + settlerInformation.getMovableCount(EMovableType.BOWMAN_L3) + settlerInformation.getMovableCount(EMovableType.PIKEMAN_L1) + settlerInformation.getMovableCount(EMovableType.PIKEMAN_L2) + settlerInformation.getMovableCount(EMovableType.PIKEMAN_L3) + settlerInformation.getMovableCount(EMovableType.MAGE); }
/** * * @param player * The player id of the first player. * @param otherAttackable * The other attackable. (Must not be null!) * * @return */ public static boolean isEnemy(IPlayer player, IAttackable otherAttackable) { return otherAttackable.getPlayer().getTeamId() != player.getTeamId() && otherAttackable.isAttackable(); }
public BuildingContainer(BuildingMapDataObject buildingObject, ShortPoint2D position) { this.buildingObject = buildingObject; this.position = position; this.player = new IPlayer.DummyPlayer(buildingObject.getPlayerId()); }
private boolean isDanger() { if (aiStatistics.getTotalNumberOfBuildingTypeForPlayer(BARRACK, playerId) < 1) { int numberOfSwordsmen = aiStatistics.getCountOfMovablesOfPlayer(player, EMovableType.SWORDSMEN); if (aiStatistics.getTotalNumberOfBuildingTypeForPlayer(TOWER, playerId) >= numberOfSwordsmen) { return true; } for (IPlayer enemy : aiStatistics.getAliveEnemiesOf(player)) { if (aiStatistics.getNumberOfBuildingTypeForPlayer(WEAPONSMITH, enemy.getPlayerId()) > 0) { return true; } } } return false; }
private int calculateGenericWorkersCount(ISettlerInformation settlerInformation) { return settlerInformation.getMovableCount(EMovableType.PIG_FARMER) + settlerInformation.getMovableCount(EMovableType.DOCKWORKER) + settlerInformation.getMovableCount(EMovableType.FARMER) + settlerInformation.getMovableCount(EMovableType.LUMBERJACK) + settlerInformation.getMovableCount(EMovableType.SAWMILLER) + settlerInformation.getMovableCount(EMovableType.FISHERMAN) + settlerInformation.getMovableCount(EMovableType.WATERWORKER) + settlerInformation.getMovableCount(EMovableType.BAKER) + settlerInformation.getMovableCount(EMovableType.MINER) + settlerInformation.getMovableCount(EMovableType.SLAUGHTERER) + settlerInformation.getMovableCount(EMovableType.MILLER) + settlerInformation.getMovableCount(EMovableType.SMITH) + settlerInformation.getMovableCount(EMovableType.FORESTER) + settlerInformation.getMovableCount(EMovableType.MELTER) + settlerInformation.getMovableCount(EMovableType.WINEGROWER) + settlerInformation.getMovableCount(EMovableType.CHARCOAL_BURNER) + settlerInformation.getMovableCount(EMovableType.STONECUTTER); }
public MovableObjectContainer(MovableObject movableObject, int x, int y) { this.movableObject = movableObject; this.position = new ShortPoint2D(x, y); this.player = new IPlayer.DummyPlayer(movableObject.getPlayerId()); }
private ShortPoint2D getTargetEnemyDoorToAttack(IPlayer enemyToAttack) { List<ShortPoint2D> myMilitaryBuildings = aiStatistics.getBuildingPositionsOfTypesForPlayer(EBuildingType.MILITARY_BUILDINGS, player.playerId); ShortPoint2D myBaseAveragePoint = AiStatistics.calculateAveragePointFromList(myMilitaryBuildings); List<ShortPoint2D> enemyMilitaryBuildings = aiStatistics.getBuildingPositionsOfTypesForPlayer(EBuildingType.MILITARY_BUILDINGS, enemyToAttack.getPlayerId()); ShortPoint2D nearestEnemyBuildingPosition = AiStatistics.detectNearestPointFromList(myBaseAveragePoint, enemyMilitaryBuildings); return aiStatistics.getBuildingAt(nearestEnemyBuildingPosition).getDoor(); }
private static String getMovableCountAsString(ISettlerInformation settlerInformation, EMovableType type) { return String.valueOf(settlerInformation.getMovableCount(type)); }