Examples of Aero


Examples of megamek.common.Aero

            }

            // draw condition strings

            if(entity instanceof Aero) {
                Aero a = (Aero)entity;

                //draw altitude if Aero in atmosphere
                if(game.getBoard().inAtmosphere()) {
                    graph.setColor(Color.darkGray);
                    graph.drawString(Integer.toString(a.getElevation()), 26, 15);
                    graph.setColor(Color.PINK);
                    graph.drawString(Integer.toString(a.getElevation()), 25, 14);
                }

                if(a.isRolled()) {
                    // draw "rolled"
                    graph.setColor(Color.darkGray);
                    graph.drawString(Messages.getString("BoardView1.ROLLED"), 18, 15); //$NON-NLS-1$
                    graph.setColor(Color.red);
                    graph.drawString(Messages.getString("BoardView1.ROLLED"), 17, 14); //$NON-NLS-1$
                }

                if(a.isOutControlTotal() & a.isRandomMove()) {
                    // draw "RANDOM"
                    graph.setColor(Color.darkGray);
                    graph.drawString(Messages.getString("BoardView1.RANDOM"), 18, 35); //$NON-NLS-1$
                    graph.setColor(Color.red);
                    graph.drawString(Messages.getString("BoardView1.RANDOM"), 17, 34); //$NON-NLS-1$
                } else if (a.isOutControlTotal()) {
                    //draw "CONTROL"
                    graph.setColor(Color.darkGray);
                    graph.drawString(Messages.getString("BoardView1.CONTROL"), 18, 39); //$NON-NLS-1$
                    graph.setColor(Color.red);
                    graph.drawString(Messages.getString("BoardView1.CONTROL"), 17, 38); //$NON-NLS-1$
                }

                if(a.isEvading()) {
                    //draw "EVADE" - can't overlap with out of control
                    graph.setColor(Color.darkGray);
                    graph.drawString(Messages.getString("BoardView1.EVADE"), 18, 39); //$NON-NLS-1$
                    graph.setColor(Color.red);
                    graph.drawString(Messages.getString("BoardView1.EVADE"), 17, 38); //$NON-NLS-1$
View Full Code Here

Examples of megamek.common.Aero

        //Set the base BTH      
        int base = 6 + te.getCrew().getPiloting() - ae.getCrew().getPiloting();
       
        toHit = new ToHitData(base, "base");

        Aero a = (Aero)ae;
       
        //target type
        if(target instanceof SpaceStation) {
            toHit.addModifier(-1,"target is a space station");
        } else if(target instanceof Warship) {
            toHit.addModifier(+1,"target is a warship");
        } else if(target instanceof Jumpship) {
            toHit.addModifier(+0,"target is a jumpship");
        } else if(target instanceof Dropship) {
            toHit.addModifier(+2,"target is a dropship");
        } else {
            toHit.addModifier(+4,"target is a fighter/small craft");
        }
       
        //attacker type
        if(a instanceof SpaceStation) {
            toHit.addModifier(+0,"attacker is a space station");
        } else if(a instanceof Warship) {
            toHit.addModifier(+1,"attacker is a warship");
        } else if(a instanceof Jumpship) {
            toHit.addModifier(+0,"attacker is a jumpship");
        } else if(a instanceof Dropship) {
            toHit.addModifier(-1,"attacker is a dropship");
        } else {
            toHit.addModifier(-2,"attacker is a fighter/small craft");
        }
       
        //can the target unit move
        if(target.isImmobile() || te.getWalkMP() == 0)
            toHit.addModifier(-2,"target cannot spend thrust");
           
        //sensor damage
        if(a.getSensorHits() > 0)
            toHit.addModifier(+1, "sensor damage");
           
        //avionics damage
        int avionics = a.getAvionicsHits();
        if(avionics > 3)
            avionics = 3;
        if(avionics > 0)
            toHit.addModifier(avionics, "avionics damage");
       
View Full Code Here

Examples of megamek.common.Aero

                ge = true;
            }

            // draw condition strings
            if(entity instanceof Aero) {
                Aero a = (Aero)entity;

                //                draw altitude if Aero in atmosphere
                if(game.getBoard().inAtmosphere()) {
                    graph.setColor(Color.darkGray);
                    graph.drawString(Integer.toString(a.getElevation()), 26, 15);
                    graph.setColor(Color.PINK);
                    graph.drawString(Integer.toString(a.getElevation()), 25, 14);
                }

                if(a.isRolled()) {
                    // draw "rolled"
                    graph.setColor(Color.darkGray);
                    graph.drawString(Messages.getString("BoardView1.ROLLED"), 18, 15); //$NON-NLS-1$
                    graph.setColor(Color.red);
                    graph.drawString(Messages.getString("BoardView1.ROLLED"), 17, 14); //$NON-NLS-1$
                }

                if(a.isOutControlTotal() & a.isRandomMove()) {
                    // draw "RANDOM"
                    graph.setColor(Color.darkGray);
                    graph.drawString(Messages.getString("BoardView1.RANDOM"), 18, 35); //$NON-NLS-1$
                    graph.setColor(Color.red);
                    graph.drawString(Messages.getString("BoardView1.RANDOM"), 17, 34); //$NON-NLS-1$
                } else if (a.isOutControlTotal()) {
                    //                     draw "CONTROL"
                    graph.setColor(Color.darkGray);
                    graph.drawString(Messages.getString("BoardView1.CONTROL"), 18, 39); //$NON-NLS-1$
                    graph.setColor(Color.red);
                    graph.drawString(Messages.getString("BoardView1.CONTROL"), 17, 38); //$NON-NLS-1$
                }

                if(a.isEvading()) {
                    //draw "EVADE" - can't overlap with out of control
                    graph.setColor(Color.darkGray);
                    graph.drawString(Messages.getString("BoardView1.EVADE"), 18, 39); //$NON-NLS-1$
                    graph.setColor(Color.red);
                    graph.drawString(Messages.getString("BoardView1.EVADE"), 17, 38); //$NON-NLS-1$
View Full Code Here

Examples of megamek.common.Aero

            GunEmplacement ge = null;
            if (entity instanceof GunEmplacement) {
                ge = (GunEmplacement) entity;
            }

            Aero a = null;
            if(entity instanceof Aero) {
                a = (Aero) entity;
            }

            buffer = new StringBuffer();
View Full Code Here

Examples of megamek.common.Aero

    private synchronized void moveTo(MovePath md) {

        final Entity ce = ce();
        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;

                    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$
View Full Code Here

Examples of megamek.common.Aero

                        .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(
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
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.