Examples of Aero


Examples of megamek.common.Aero

        } else if (ev.getActionCommand().equals(MOVE_MANEUVER)) {
            ManeuverChoiceDialog choiceDialog = new ManeuverChoiceDialog(
                    clientgui.frame, Messages
                            .getString("MovementDisplay.ManeuverDialog.title"), //$NON-NLS-1$
                    "huh?");
            Aero a = (Aero) ce;
            MoveStep last = cmd.getLastStep();
            int vel = a.getCurrentVelocity();
            int elev = a.getElevation();
            Coords pos = a.getPosition();
            int distance = 0;
            if (null != last) {
                vel = last.getVelocityLeft();
                elev = last.getElevation();
                pos = last.getPosition();
                distance = last.getDistance();
            }
            int ceil = client.game.getBoard().getHex(pos).ceiling();
            choiceDialog.checkPerformability(vel, elev, ceil, a.isVSTOL(),
                    distance);
            choiceDialog.setVisible(true);
            int manType = choiceDialog.getChoice();
            if ((manType > ManeuverType.MAN_NONE) && addManeuver(manType)) {
                clientgui.bv.drawMovementData(ce, cmd);
View Full Code Here

Examples of megamek.common.Aero

        final Entity ce = ce();
        boolean dontCheckPSR = false;
        if (ce instanceof Aero) {

            Aero a = (Aero) ce;

            // first check for stalling
            if (client.game.getBoard().inAtmosphere() && !a.isVSTOL() && !a.isSpheroid()  && !client.game.getPlanetaryConditions().isVacuum()
                    && (((md == null) && (a.getCurrentVelocity() == 0)) || ((md != null) && (md.getFinalVelocity() == 0)))) {

                // add a stall to the movement path
                md.addStep(MovePath.STEP_STALL);
            }

            // should check to see if md is null. If so I need to check and see
            // if the units
            // current velocity is zero
            if (md != null) {

                boolean isRamming = false;
                if ((md.getLastStep() != null) && (md.getLastStep().getType() == MovePath.STEP_RAM)) {
                    isRamming = true;
                }

                // if using advanced movement then I need to add on movement
                // steps
                // to get the vessel from point a to point b
                // if the unit is ramming then this is already done
                if (client.game.useVectorMove() && !isRamming) {
                    // get rid of any illegal moves or the rest won't be added
                    md.clipToPossible();
                    md = addSteps(md, ce);

                }

                // check to see if the unit is out of control. If so, then set
                // up a new
                // move path for them.
                // the same should be true if the unit is shutdown or the pilot
                // is unconscious
                if (!client.game.useVectorMove() && (a.isOutControlTotal() || a.isShutDown() || a.getCrew().isUnconscious())) {

                    MovePath oldmd = md;

                    dontCheckPSR = true;
                    md = new MovePath(client.game, ce);
                    int vel = a.getCurrentVelocity();

                    // need to check for stall here as well
                    if ((vel == 0) && !(a.isSpheroid() || client.game.getPlanetaryConditions().isVacuum()) && client.game.getBoard().inAtmosphere() && !a.isVSTOL()) {
                        // add a stall to the movement path
                        md.addStep(MovePath.STEP_STALL);
                    }

                    while (vel > 0) {
                        // check to see if the unit is currently on a border
                        // and facing a direction that would indicate leaving
                        // the map
                        Coords position = a.getPosition();
                        int facing = a.getFacing();
                        MoveStep step = md.getLastStep();
                        if (step != null) {
                            position = step.getPosition();
                            facing = step.getFacing();
                        }
                        boolean evenx = (position.x % 2) == 0;
                        if ((((position.x == 0) && ((facing == 5) || (facing == 4))) || ((position.x == client.game.getBoard().getWidth() - 1) && ((facing == 1) || (facing == 2))) || ((position.y == 0) && ((facing == 1) || (facing == 5) || (facing == 0)) && evenx) || ((position.y == 0) && (facing == 0)) || ((position.y == client.game.getBoard().getHeight() - 1) && ((facing == 2) || (facing == 3) || (facing == 4)) && !evenx) || ((position.y == client.game.getBoard().getHeight() - 1) && (facing == 3)))) {
                            // then this birdie go bye-bye
                            // set the conditions for removal
                            md.addStep(MovePath.STEP_OFF);
                            vel = 0;

                        } else {

                            if (a.isRandomMove()) {
                                int roll = Compute.d6(1);
                                switch (roll) {
                                case 1:
                                    md.addStep(MovePath.STEP_FORWARDS);
                                    md.addStep(MovePath.STEP_TURN_LEFT);
                                    md.addStep(MovePath.STEP_TURN_LEFT);
                                case 2:
                                    md.addStep(MovePath.STEP_FORWARDS);
                                    md.addStep(MovePath.STEP_TURN_LEFT);
                                case 3:
                                case 4:
                                    md.addStep(MovePath.STEP_FORWARDS);
                                case 5:
                                    md.addStep(MovePath.STEP_FORWARDS);
                                    md.addStep(MovePath.STEP_TURN_RIGHT);
                                case 6:
                                    md.addStep(MovePath.STEP_FORWARDS);
                                    md.addStep(MovePath.STEP_TURN_RIGHT);
                                    md.addStep(MovePath.STEP_TURN_RIGHT);
                                }
                            } else {
                                md.addStep(MovePath.STEP_FORWARDS);
                            }

                            vel--;
                        }

                    }

                    // check to see if old movement path contained a launch and
                    // we are still on the board
                    if (oldmd.contains(MovePath.STEP_LAUNCH) && !md.contains(MovePath.STEP_OFF)) {
                        // since launches have to be the last step
                        MoveStep lastStep = oldmd.getLastStep();
                        if (lastStep.getType() == MovePath.STEP_LAUNCH) {
                            md.addStep(lastStep.getType(), lastStep.getLaunched());
                        }
                    }

                } else {

                    // I think this should be ok now
                    md.clipToPossible();
                    // check to see if velocity left is zero
                    MoveStep step = md.getLastStep();
                    if (step != null) {
                        if ((step.getVelocityLeft() > 0) && !client.game.useVectorMove() && (step.getType() != MovePath.STEP_FLEE)) {
                            // pop up some dialog telling the unit that it did
                            // not spend enough
                            String title = Messages.getString("MovementDisplay.VelocityLeft.title"); //$NON-NLS-1$
                            String body = Messages.getString("MovementDisplay.VelocityLeft.message"); //$NON-NLS-1$
                            clientgui.doAlertDialog(title, body);
                            return;
                        }
                    } else {
                        // if the step is null then the unit didn't move. Make
                        // sure velocity is zero
                        if ((a.getCurrentVelocity() > 0) && !client.game.useVectorMove()) {
                            // pop up some dialog telling the unit that it did
                            // not spend enough
                            String title = Messages.getString("MovementDisplay.VelocityLeft.title"); //$NON-NLS-1$
                            String body = Messages.getString("MovementDisplay.VelocityLeft.message"); //$NON-NLS-1$
                            clientgui.doAlertDialog(title, body);
View Full Code Here

Examples of megamek.common.Aero

                ToHitData toHit = new RamAttackAction(cen, target.getTargetType(), target.getTargetId(), target.getPosition()).toHit(client.game, cmd);
                if (toHit.getValue() != TargetRoll.IMPOSSIBLE) {

                    // Determine how much damage the charger will take.
                    Aero ta = (Aero) target;
                    Aero ae = (Aero) ce;
                    int toAttacker = RamAttackAction.getDamageTakenBy(ae, ta, cmd.getSecondFinalPosition(ae.getPosition()), cmd.getHexesMoved(), ta.getCurrentVelocity());
                    int toDefender = RamAttackAction.getDamageFor(ae, ta, cmd.getSecondFinalPosition(ae.getPosition()), cmd.getHexesMoved(), ta.getCurrentVelocity());

                    // Ask the player if they want to charge.
                    if (clientgui.doYesNoDialog(Messages.getString("MovementDisplay.RamDialog.title", new Object[] { target.getDisplayName() }), //$NON-NLS-1$
                            Messages.getString("MovementDisplay.RamDialog.message", new Object[] { //$NON-NLS-1$
                                    toHit.getValueAsString(), new Double(Compute.oddsAbove(toHit.getValue())), toHit.getDesc(), new Integer(toDefender), toHit.getTableDesc(), new Integer(toAttacker) }))) {
View Full Code Here

Examples of megamek.common.Aero

        if (!(ce instanceof Aero)) {
            return;
        }

        Aero a = (Aero) ce;

        if (!(a.isSpheroid() || client.game.getPlanetaryConditions().isVacuum())) {
            return;
        }

        if (!client.game.getBoard().inAtmosphere()) {
            return;
View Full Code Here

Examples of megamek.common.Aero

        if (!(ce instanceof Aero)) {
            return;
        }

        Aero a = (Aero) ce;

        // only allow thrust if there is thrust left to spend
        int mpUsed = 0;
        MoveStep last = cmd.getLastStep();
        if (null != last) {
            mpUsed = last.getMpUsed();
        }

        if (mpUsed >= a.getRunMP()) {
            setThrustEnabled(false);
        } else {
            setThrustEnabled(true);
        }
View Full Code Here

Examples of megamek.common.Aero

        if (!(ce instanceof Aero)) {
            return;
        }

        Aero a = (Aero) ce;

        // only allow acceleration and deceleration if the cmd is empty or the
        // last step was
        // acc/dec

        setAccEnabled(false);
        setDecEnabled(false);
        MoveStep last = cmd.getLastStep();
        // figure out implied velocity so you can't decelerate below zero
        int vel = a.getCurrentVelocity();
        int veln = a.getNextVelocity();
        if (null != last) {
            vel = last.getVelocity();
            veln = last.getVelocityN();
        }

        if (null == last) {
            setAccEnabled(true);
            if (vel > 0) {
                setDecEnabled(true);
            }
        } else if (last.getType() == MovePath.STEP_ACC) {
            setAccEnabled(true);
        } else if ((last.getType() == MovePath.STEP_DEC) && (vel > 0)) {
            setDecEnabled(true);
        }

        // if the aero has failed a maneuver this turn, then don't allow
        if (a.didFailManeuver()) {
            setAccEnabled(false);
            setDecEnabled(false);
        }

        // if accelerated/decelerate at the end of last turn then disable
        if (a.didAccLast()) {
            setAccEnabled(false);
            setDecEnabled(false);
        }

        // allow acc/dec next if acceleration/deceleration hasn't been used
        setAccNEnabled(false);
        setDecNEnabled(false);
        if (!cmd.contains(MovePath.STEP_ACC) && !cmd.contains(MovePath.STEP_DEC) && !cmd.contains(MovePath.STEP_DECN)) {
            setAccNEnabled(true);
        }

        if (!cmd.contains(MovePath.STEP_ACC) && !cmd.contains(MovePath.STEP_DEC) && !cmd.contains(MovePath.STEP_ACCN) && (veln > 0)) {
            setDecNEnabled(true);
        }

        // acc/dec next needs to be disabled if acc/dec used before a failed
        // maneuver
        if (a.didFailManeuver() && a.didAccDecNow()) {
            setDecNEnabled(false);
            setAccNEnabled(false);
        }


        //if in atmosphere, limit acceleration to 2x safe thrust
        if(!client.game.getBoard().inSpace() && (vel == (2 * a.getWalkMP()))) {
            setAccEnabled(false);
        }
        //velocity next will get halved before next turn so allow up to 4 times
        if(!client.game.getBoard().inSpace() && (veln == (4 * a.getWalkMP()))) {
            setAccNEnabled(false);
        }

        // if this is a tele-operated missile then it can't decelerate no matter
        // what
View Full Code Here

Examples of megamek.common.Aero

        // and facing the right direction
        if (ce instanceof Aero) {
            MoveStep step = cmd.getLastStep();
            Coords position = ce.getPosition();
            int facing = ce.getFacing();
            Aero a = (Aero) ce;
            int velocityLeft = a.getCurrentVelocity();
            if (step != null) {
                position = step.getPosition();
                facing = step.getFacing();
                velocityLeft = step.getVelocityLeft();
            }
View Full Code Here

Examples of megamek.common.Aero

        if (!(ce instanceof Aero)) {
            return;
        }

        Aero a = (Aero) ce;

        if (a.isSpheroid() || client.game.getPlanetaryConditions().isVacuum()) {
            return;
        }

        if (!a.didFailManeuver() && ((null == cmd) || !cmd.contains(MovePath.STEP_MANEUVER))) {
            setManeuverEnabled(true);
        }
        return;
    }
View Full Code Here

Examples of megamek.common.Aero

                    // must be done with its movement
                    // it also must be same heading and velocity
                    if ((other instanceof Aero) && other.isDone() && other.canLoad(ce) && (cmd.getFinalFacing() == other.getFacing()) && !other.isCapitalFighter()) {
                        // now lets check velocity
                        // depends on movement rules
                        Aero oa = (Aero) other;
                        if (client.game.useVectorMove()) {
                            if (Compute.sameVectors(cmd.getFinalVectors(), oa.getVectors())) {
                                setRecoverEnabled(true);
                                isGood = true;
                            }
                        } else if (cmd.getFinalVelocity() == oa.getCurrentVelocity()) {
                            setRecoverEnabled(true);
                            isGood = true;
                        }
                    }
                }
View Full Code Here

Examples of megamek.common.Aero

                // must be done with its movement
                // it also must be same heading and velocity
                if (other.isCapitalFighter() && other.isDone() && other.canLoad(ce) && (cmd.getFinalFacing() == other.getFacing())) {
                    // now lets check velocity
                    // depends on movement rules
                    Aero oa = (Aero) other;
                    if (client.game.useVectorMove()) {
                        // can you do equality with vectors?
                        if (Compute.sameVectors(cmd.getFinalVectors(), oa.getVectors())) {
                            setJoinEnabled(true);
                            isGood = true;
                        }
                    } else if (cmd.getFinalVelocity() == oa.getCurrentVelocity()) {
                        setJoinEnabled(true);
                        isGood = true;
                    }
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.