private boolean isEntityOnMap(final Entity entity) { return entity.isDeployed() && !entity.isOffBoard(); }
/** * Sets up up the hashtable of who deploys when */ public void setupRoundDeployment() { deploymentTable = new Hashtable<Integer, Vector<Entity>>(); for (Entity ent : entities) { if (ent.isDeployed()) { continue; } Vector<Entity> roundVec = deploymentTable.get(new Integer(ent.getDeployRound())); if (null == roundVec) { roundVec = new Vector<Entity>(); deploymentTable.put(ent.getDeployRound(), roundVec); } roundVec.addElement(ent); lastDeploymentRound = Math.max(lastDeploymentRound, ent.getDeployRound()); } }
public GAAttack(TestBot tb, CEntity attacker, ArrayList<ArrayList<AttackOption>> attack, int population, int generations, boolean isEnemy) { super(attack.size() + 1, population, .7, .05, generations, .4); this.attack = attack; this.attacker = attacker; game = tb.getGame(); target_array = new ArrayList<Entity>(game.getEntitiesVector()); ArrayList<Integer> temp = new ArrayList<Integer>(); for (int i = 0; i < target_array.size(); i++) { Entity entity = target_array.get(i); if (entity.isEnemyOf(attacker.entity) && entity.isDeployed()) { temp.add(new Integer(i)); } } targets = new CEntity.Table(tb); valid_target_indexes = temp; if (attacker.tsm_offset) { overheat_eligible = true; } if (isEnemy || ((attacker.last != null) && (!attacker.last.inDanger || attacker.last.doomed))) { overheat_eligible = true; } }
/** * Returns the elevation of this entity, relative to the current Hex's * surface */ @Override public int getElevation() { if (Entity.NONE != getTransportId()) { return game.getEntity(getTransportId()).getElevation(); } if ((null == getPosition()) && (isDeployed())) { throw new IllegalStateException("Entity #" + getId() + " does not know its position."); } if (isOffBoard()) { return 0; } return elevation; }
graph.drawString( Messages.getString("UnitOverview.HULLDOWN"), x - 2, y + 33); //$NON-NLS-1$ } else if (!entity.isDeployed()) { int roundsLeft = entity.getDeployRound() - clientgui.getClient().getGame().getRoundCount();
/** * Returns true if the player has a valid unit with the Tactical Genius * pilot special ability. */ public boolean hasTacticalGenius(IPlayer player) { for (Entity entity : entities) { if (entity.hasAbility(OptionsConstants.MISC_TACTICAL_GENIUS) && entity.getOwner().equals(player) && !entity.isDestroyed() && entity.isDeployed() && !entity.isCarcass() && !entity.getCrew().isUnconscious()) { return true; } } return false; }
|| !friend.isDeployed() || (friend.getTransportId() != Entity.NONE)) { continue; // useless to us...
/** * Apply PSR modifier for difficult terrain at the specified coordinates * * @param roll the PSR to modify * @param c the coordinates where the PSR happens * @param enteringRubble True if entering rubble, else false */ public void addPilotingModifierForTerrain(PilotingRollData roll, Coords c, boolean enteringRubble) { if ((c == null) || (roll == null)) { return; } if (isOffBoard() || !(isDeployed())) { return; } IHex hex = game.getBoard().getHex(c); hex.terrainPilotingModifier(getMovementMode(), roll, enteringRubble); if (hex.containsTerrain(Terrains.JUNGLE) && hasAbility(OptionsConstants.PILOT_TM_FOREST_RANGER)) { roll.addModifier(-1, "Forest Ranger"); } }
if ((phase == IGame.Phase.PHASE_DEPLOYMENT) == isDeployed()) { return false;
/** * defensively check and correct elevation */ public boolean fixElevation() { if (!isDeployed() || isOffBoard() || !game.getBoard().contains(getPosition())) { return false; } if (!isElevationValid(getElevation(), game.getBoard().getHex(getPosition()))) { System.err.println(getDisplayName() + " in hex " + HexTarget.coordsToId(getPosition()) + " is at invalid elevation: " + getElevation()); setElevation(0 - game.getBoard() .getHex(getPosition()).depth()); System.err.println(" moved to elevation " + getElevation()); return true; } return false; }
getPathEnumerator().clear(); for (Entity entity : getGame().getEntitiesVector()) { if (entity.isActive() && entity.isDeployed() && entity.getPosition() != null) { getDirtyUnits().add(entity.getId());
@Override public void unitSelected(BoardViewEvent b) { // Are we ignoring events? if (isIgnoringEvents()) { return; } Entity e = clientgui.getClient().getGame().getEntity(b.getEntityId()); if (clientgui.getPointblankEID() == e.getId()) { selectEntity(e.getId()); } else { clientgui.setDisplayVisible(true); clientgui.mechD.displayEntity(e); if (e.isDeployed()) { clientgui.bv.centerOnHex(e.getPosition()); } } }
@Override public void unitSelected(BoardViewEvent b) { // Are we ignoring events? if (isIgnoringEvents()) { return; } Entity e = clientgui.getClient().getGame().getEntity(b.getEntityId()); if (clientgui.getClient().isMyTurn()) { if (clientgui.getClient().getMyTurn() .isValidEntity(e, clientgui.getClient().getGame())) { selectEntity(e.getId()); } } else { clientgui.setDisplayVisible(true); clientgui.mechD.displayEntity(e); if (e.isDeployed()) { clientgui.bv.centerOnHex(e.getPosition()); } } }
if (e.isDeployed() && (!e.isOffBoard())) { decentFacing = deployCoords.direction(e.getPosition()); break;
@Override public void unitSelected(BoardViewEvent b) { // Are we ignoring events? if (isIgnoringEvents()) { return; } Entity e = clientgui.getClient().getGame().getEntity(b.getEntityId()); if (clientgui.getClient().isMyTurn()) { if (clientgui.getClient().getMyTurn() .isValidEntity(e, clientgui.getClient().getGame())) { selectEntity(e.getId()); } } else { clientgui.setDisplayVisible(true); clientgui.mechD.displayEntity(e); if (e.isDeployed()) { clientgui.bv.centerOnHex(e.getPosition()); } } }
@Override public void unitSelected(BoardViewEvent b) { // Are we ignoring events? if (isIgnoringEvents()) { return; } Entity e = clientgui.getClient().getGame().getEntity(b.getEntityId()); if (clientgui.getClient().isMyTurn()) { if (clientgui.getClient().getMyTurn() .isValidEntity(e, clientgui.getClient().getGame())) { selectEntity(e.getId()); } } else { clientgui.setDisplayVisible(true); clientgui.mechD.displayEntity(e); if (e.isDeployed()) { clientgui.bv.centerOnHex(e.getPosition()); } } }
&& entity.getOwner().equals(this) && !entity.isDestroyed() && entity.isDeployed() && !entity.isOffBoard() && entity.getCrew().isActive()
if (!target.isDeployed()) { continue;
@Override public void unitSelected(BoardViewEvent b) { // Are we ignoring events? if (isIgnoringEvents()) { return; } Entity e = clientgui.getClient().getGame().getEntity(b.getEntityId()); if (null == e) { return; } if (clientgui.getClient().isMyTurn()) { if (clientgui.getClient().getGame().getTurn() .isValidEntity(e, clientgui.getClient().getGame())) { selectEntity(e.getId()); } } else { clientgui.setDisplayVisible(true); clientgui.mechD.displayEntity(e); if (e.isDeployed()) { clientgui.bv.centerOnHex(e.getPosition()); } } }
clientgui.setDisplayVisible(true); clientgui.mechD.displayEntity(e); if (e.isDeployed()) { clientgui.bv.centerOnHex(e.getPosition());