if (game.getPhase() == IGame.PHASE_MOVEMENT) {
if (!autoEject) {
    public Vector ejectEntity(Entity entity, boolean autoEject) {        Vector vDesc = new Vector();        Report r;        // An entity can only eject it's crew once.        if (entity.getCrew().isEjected())            return vDesc;        // Mek pilots may get hurt during ejection,        // and run around the board afterwards.        if (entity instanceof Mech) {            PilotingRollData rollTarget = new PilotingRollData(entity.getId(), entity.getCrew().getPiloting(), "ejecting");            if (entity.isProne()) {                rollTarget.addModifier(5, "Mech is prone");            }            if (entity.getCrew().isUnconscious()) {                rollTarget.addModifier(3, "pilot unconscious");            }            if (autoEject) {                rollTarget.addModifier(1, "automatic ejection");            }            if (entity.getInternal(Mech.LOC_HEAD) < 3) {                rollTarget.addModifier(Math.min(3 - entity.getInternal(Mech.LOC_HEAD),2), "Head Internal Structure Damage");            }            int facing = entity.getFacing();            Coords targetCoords = entity.getPosition().translated((facing + 3)%6);            IHex targetHex = game.getBoard().getHex(targetCoords);            if (targetHex != null) {                if (targetHex.terrainLevel(Terrains.WATER) > 0 && !(targetHex.containsTerrain(Terrains.ICE))) {                    rollTarget.addModifier(-1, "landing in water");                } else if (targetHex.containsTerrain(Terrains.ROUGH)) {                    rollTarget.addModifier(0, "landing in rough");                } else if (targetHex.containsTerrain(Terrains.RUBBLE)) {                    rollTarget.addModifier(0, "landing in rubble");                } else if (targetHex.terrainLevel(Terrains.WOODS) == 1) {                    rollTarget.addModifier(2, "landing in light woods");                } else if (targetHex.terrainLevel(Terrains.WOODS) == 2) {                    rollTarget.addModifier(3, "landing in heavy woods");                } else if (targetHex.terrainLevel(Terrains.WOODS) == 3) {                    rollTarget.addModifier(4, "landing in ultra heavy woods");                } else if (targetHex.terrainLevel(Terrains.JUNGLE) == 1) {                    rollTarget.addModifier(3, "landing in light jungle");                } else if (targetHex.terrainLevel(Terrains.JUNGLE) == 2) {                    rollTarget.addModifier(5, "landing in heavy jungle");                } else if (targetHex.terrainLevel(Terrains.JUNGLE) == 3) {                    rollTarget.addModifier(7, "landing in ultra heavy jungle");                } else if (targetHex.terrainLevel(Terrains.BLDG_ELEV) > 0) {                    rollTarget.addModifier(targetHex.terrainLevel(Terrains.BLDG_ELEV), "landing in a building");                } else rollTarget.addModifier(-2, "landing in clear terrain");            } else {                    rollTarget.addModifier(-2, "landing off the board");            }            if (autoEject) {                r = new Report(6395);                r.subject = entity.getId();                r.addDesc(entity);                r.indent(2);                r.newlines = 0;                vDesc.addElement(r);            }            // okay, print the info            r = new Report(2180);            r.subject = entity.getId();            r.addDesc(entity);            r.add(rollTarget.getLastPlainDesc(), true);            r.indent(3);            vDesc.addElement(r);            // roll            final int diceRoll = Compute.d6(2);            r = new Report(2190);            r.subject = entity.getId();            r.add(rollTarget.getValueAsString());            r.add(rollTarget.getDesc());            r.add(diceRoll);            r.indent(4);            r.newlines = 0;            // create the MechWarrior in any case, for campaign tracking            MechWarrior pilot = new MechWarrior(entity);            pilot.setDeployed(true);            pilot.setId(getFreeEntityId());            game.addEntity(pilot.getId(), pilot);            send(createAddEntityPacket(pilot.getId()));            // make him not get a move this turn            pilot.setDone(true);            if (diceRoll < rollTarget.getValue()) {                r.choose(false);                vDesc.addElement(r);                Report.addNewline(vDesc);                Vector v = damageCrew(pilot, 1);                r = (Report)v.firstElement();                r.indent(3);                vDesc.addElement(r);            } else {                r.choose(true);                vDesc.addElement(r);            }            if (entity.getCrew().isDoomed()) {                vDesc.addAll(                                      destroyEntity(pilot, "deadly ejection", false, false));            }            else {                // Add the pilot as an infantry unit on the battlefield.                if (game.getBoard().contains(targetCoords)) {                    pilot.setPosition(targetCoords);/* Can pilots eject into water???   ASSUMPTION : They can (because they get a -1 mod to the PSR.                    // Did the pilot land in water?                    if ( game.getBoard().getHex( targetCoords).levelOf                         ( Terrain.WATER ) > 0 ) {                         //report missing                        desc.append("and the pilot ejects, but lands in water!!!\n");                        //report missing                        desc.append(destroyEntity( pilot, "a watery grave", false ));                    } else {                        //report missing                        desc.append("and the pilot ejects safely!\n");                    }*/                    //report safe ejection                    r = new Report(6400);                    r.subject = entity.getId();                    r.indent(5);                    vDesc.addElement(r);                    if (game.getOptions().booleanOption("vacuum")) {                        //ended up in a vacuum                        r = new Report(6405);                        r.subject = entity.getId();                        r.indent(3);                        vDesc.addElement(r);                        vDesc.addAll(                            destroyEntity(pilot, "explosive decompression", false, false));                    }                    // Update the entity                    this.entityUpdate(pilot.getId());                    // check if the pilot lands in a minefield                    doEntityDisplacementMinefieldCheck( pilot,                            entity.getPosition(),                            targetCoords );                } else {                    //ejects safely                    r = new Report(6410);                    r.subject = entity.getId();                    r.indent(3);                    vDesc.addElement(r);                    if (game.getOptions().booleanOption("vacuum")) {                        //landed in vacuum                        r = new Report(6405);                        r.subject = entity.getId();                        r.indent(3);                        vDesc.addElement(r);                        vDesc.addAll(                            destroyEntity(pilot, "explosive decompression", false, false));                    } else {                        game.removeEntity( pilot.getId(), IEntityRemovalConditions.REMOVE_IN_RETREAT );                        send(createRemoveEntityPacket(pilot.getId(), IEntityRemovalConditions.REMOVE_IN_RETREAT) );                    }                }                if (game.getOptions().booleanOption("ejected_pilots_flee")) {                    game.removeEntity(pilot.getId(), IEntityRemovalConditions.REMOVE_IN_RETREAT);                    send(createRemoveEntityPacket(pilot.getId(), IEntityRemovalConditions.REMOVE_IN_RETREAT));                }            } // Pilot safely ejects.        } // End entity-is-Mek        // Mark the entity's crew as "ejected".        entity.getCrew().setEjected( true );        vDesc.addAll(            destroyEntity(entity, "ejection", true, true));        // only remove the unit that ejected in the movement phase        if (game.getPhase() == IGame.PHASE_MOVEMENT) {            game.removeEntity( entity.getId(), IEntityRemovalConditions.REMOVE_EJECTED );            send(createRemoveEntityPacket(entity.getId(), IEntityRemovalConditions.REMOVE_EJECTED));        }        return vDesc;    }