public void actionPerformed(ActionEvent e) { myTarget = decodeTargetInfo(e.getActionCommand()); if (currentPanel instanceof FiringDisplay) { ((FiringDisplay) currentPanel).target(myTarget); } else if (currentPanel instanceof PhysicalDisplay) { ((PhysicalDisplay) currentPanel).target(myTarget); } else if (currentPanel instanceof TargetingPhaseDisplay) { ((TargetingPhaseDisplay) currentPanel).target(myTarget); } } });
private void doStrafe() { target(null); clearAttacks(); isStrafing = true; setStatusBarText(Messages .getString("FiringDisplay.Strafing.StatusLabel")); refreshAll(); }
/** * A VTOL or LAM in airmech mode making a bombing or strafing attack already has the target set * during the movement phase. */ void updateVTOLGroundTarget() { clientgui.bv.clearStrafingCoords(); target(null); isStrafing = false; strafingCoords.clear(); if (ce().isBomber() && ((IBomber)ce()).isVTOLBombing()) { target(((IBomber)ce()).getVTOLBombTarget()); clientgui.bv.addStrafingCoords(target.getPosition()); } else if ((ce() instanceof VTOL) && ((VTOL)ce()).getStrafingCoords().size() > 0) { strafingCoords.addAll(((VTOL)ce()).getStrafingCoords()); strafingCoords.forEach(c -> clientgui.bv.addStrafingCoords(c)); isStrafing = true; } }
private void selectTarget() { Vector<Entity> list = new Vector<Entity>(); IPlayer localPlayer = client.getLocalPlayer(); boolean friendlyFire = (game.getOptions() .booleanOption(OptionsConstants.BASE_FRIENDLY_FIRE)); for (Entity en : game.getEntitiesVector(coords)) { // Only add the unit if it's actually visible // With double blind on, the game may have unseen units if ((en.isEnemyOf(myEntity) || friendlyFire) && !en.equals(myEntity) && !en.isSensorReturn(localPlayer) && en.hasSeenEntity(localPlayer)) { list.add(en); } } if (list.size() == 1) { myTarget = selectedEntity = list.firstElement(); // gui.bv.centerOnHex(myTarget.getPosition()); // gui.getBoardView().select(myTarget.getPosition()); if (currentPanel instanceof FiringDisplay) { FiringDisplay panel = (FiringDisplay) currentPanel; panel.target(myTarget); } else if (currentPanel instanceof PhysicalDisplay) { ((PhysicalDisplay) currentPanel).target(myTarget); } else if (currentPanel instanceof TargetingPhaseDisplay) { ((TargetingPhaseDisplay) currentPanel).target(myTarget); } } }
/** * Jump to our next target. If there isn't one, well, don't do anything. */ private void jumpToTarget(boolean nextTarg, boolean onlyValid, boolean ignoreAllies) { Entity targ = getNextTarget(nextTarg, onlyValid, ignoreAllies); if (targ == null) { return; } // HACK : don't show the choice dialog. showTargetChoice = false; clientgui.bv.centerOnHex(targ.getPosition()); clientgui.getBoardView().select(targ.getPosition()); // HACK : show the choice dialog again. showTargetChoice = true; target(targ); }
@Override public void clear() { if (clientgui.getClient().isMyTurn()) { setStatusBarText(Messages .getString("FiringDisplay.its_your_turn")); //$NON-NLS-1$ } if ((target instanceof Entity) && Compute.isGroundToAir(ce(), target)) { ((Entity)target).setPlayerPickedPassThrough(cen, null); } if ((ce() != null) && !ce().isMakingVTOLGroundAttack()) { target(null); } clearAttacks(); clientgui.getBoardView().select(null); clientgui.getBoardView().cursor(null); refreshAll(); }
/** * Does end turn stuff. */ protected void endMyTurn() { // end my turn, then. IGame game = clientgui.getClient().getGame(); Entity next = game.getNextEntity(game.getTurnIndex()); if ((game.getPhase() == IGame.Phase.PHASE_FIRING) && (next != null) && (ce() != null) && (next.getOwnerId() != ce().getOwnerId())) { clientgui.setDisplayVisible(false); } cen = Entity.NONE; target(null); clientgui.getBoardView().select(null); clientgui.getBoardView().highlight(null); clientgui.getBoardView().cursor(null); clientgui.bv.clearMovementData(); clientgui.bv.clearFiringSolutionData(); clientgui.bv.clearStrafingCoords(); clientgui.bv.clearFieldofF(); clientgui.setSelectedEntityNum(Entity.NONE); disableButtons(); clearVisibleTargets(); }