Examples of Bay


Examples of megamek.common.Bay

                    .println("MovementDisplay#getUnloadedUnit() called without loaded units."); //$NON-NLS-1$

        } else {
            // cycle through the fighter bays and then the small craft bays
            int bayNum = 1;
            Bay currentBay;
            Vector<Entity> currentFighters = new Vector<Entity>();
            int doors = 0;
            Vector<Bay> FighterBays = ce.getFighterBays();
            for (int i = 0; i < FighterBays.size(); i++) {
                currentBay = FighterBays.elementAt(i);
                Vector<Integer> bayChoices = new Vector<Integer>();
                currentFighters = currentBay.getLaunchableUnits();
                /*
                 * We will assume that if more fighters are launched than is
                 * safe, that these excess fighters will be distributed equally
                 * among available doors
                 */
                doors = currentBay.getDoors();
                if (currentFighters.size() > 0) {
                    String[] names = new String[currentFighters.size()];
                    String question = Messages
                            .getString(
                                    "MovementDisplay.LaunchFighterDialog.message", new Object[] { //$NON-NLS-1$
                                    ce.getShortName(), doors * 2, bayNum });
                    for (int loop = 0; loop < names.length; loop++) {
                        names[loop] = currentFighters.elementAt(loop)
                                .getShortName();
                    }
                    ChoiceDialog choiceDialog = new ChoiceDialog(
                            clientgui.frame,
                            Messages
                                    .getString(
                                            "MovementDisplay.LaunchFighterDialog.title", new Object[] { //$NON-NLS-1$
                                            currentBay.getType(), bayNum }),
                            question, names);
                    choiceDialog.setVisible(true);
                    if (choiceDialog.getAnswer() == true) {
                        // load up the choices
                        int[] unitsLaunched = choiceDialog.getChoices();
View Full Code Here

Examples of megamek.common.Bay

            System.err.println("MovementDisplay#getUnloadedUnit() called without loaded units."); //$NON-NLS-1$

        } else {
            // cycle through the fighter bays and then the small craft bays
            int bayNum = 1;
            Bay currentBay;
            Vector<Entity> currentFighters = new Vector<Entity>();
            int doors = 0;
            Vector<Bay> FighterBays = ce.getFighterBays();
            for (int i = 0; i < FighterBays.size(); i++) {
                currentBay = FighterBays.elementAt(i);
                Vector<Integer> bayChoices = new Vector<Integer>();
                currentFighters = currentBay.getLaunchableUnits();
                /*
                 * We will assume that if more fighters are launched than is safe, that these excess fighters
                 * will be distributed equally among available doors
                 */
                doors = currentBay.getDoors();
                if (currentFighters.size() > 0) {
                    String[] names = new String[currentFighters.size()];
                    String question = Messages.getString("MovementDisplay.LaunchFighterDialog.message", new Object[] { //$NON-NLS-1$
                            ce.getShortName(), doors*2, bayNum});
                    for(int loop = 0; loop < names.length; loop++) {
                        names[loop] = currentFighters.elementAt(loop).getShortName();
                    }
                    ChoiceDialog choiceDialog = new ChoiceDialog(clientgui.frame, Messages.getString("MovementDisplay.LaunchFighterDialog.title", new Object[] { //$NON-NLS-1$
                            currentBay.getType(), bayNum}),
                            question, names);
                    choiceDialog.setVisible(true);
                    if (choiceDialog.getAnswer() == true) {
                        // load up the choices
                        int[] unitsLaunched = choiceDialog.getChoices();
View Full Code Here

Examples of megamek.common.Bay

                // handle fighter launching
                if (step.getType() == MovePath.STEP_LAUNCH) {
                    TreeMap<Integer, Vector<Integer>> launched = step.getLaunched();
                    Set<Integer> bays = launched.keySet();
                    Iterator<Integer> bayIter = bays.iterator();
                    Bay currentBay;
                    while(bayIter.hasNext()) {
                        int bayId = bayIter.next();
                        currentBay = entity.getFighterBays().elementAt(bayId);
                        Vector<Integer> launches = launched.get(bayId);
                        int nLaunched = launches.size();
                        //need to make some decisions about how to handle the distribution
                        //of fighters to doors beyond the launch rate. The most sensible thing
                        //is probably to distribut them evenly.
                        int doors = currentBay.getDoors();
                        int[] distribution = new int[doors];
                        for(int l = 0; l < nLaunched; l++) {
                            distribution[l % doors] = distribution[l % doors] + 1;
                        }
                        //ok, now lets launch them
                        r = new Report(9380);
                        r.add(entity.getDisplayName());
                        r.subject = entity.getId();
                        r.newlines = 0;
                        r.add(nLaunched);
                        addReport(r);
                        int currentDoor = 0;
                        int fighterCount = 0;
                        boolean doorDamage = false;
                        for(int fighterId : launches) {
                            //check to see if we are in the same door
                            fighterCount++;
                            if(fighterCount > distribution[currentDoor]) {
                                //move to a new door
                                currentDoor++;
                                fighterCount = 0;
                                doorDamage = false;
                            }
                            int bonus = Math.max(0, distribution[currentDoor] - 2);
                            //check for door damage
                            if(!doorDamage && (distribution[currentDoor] > 2) && (Compute.d6(2) == 2)) {
                                doorDamage = true;
                                r = new Report(9390);
                                r.subject = entity.getId();
                                r.indent(1);
                                r.newlines = 0;
                                r.add(currentBay.getType());
                                addReport(r);
                                currentBay.destroyDoorNext();
                            }
                            Entity fighter = game.getEntity(fighterId);
                            if (!launchUnit(entity, fighter, curPos, curFacing, step.getVelocity(), step.getElevation(), step.getVectors(), bonus)) {
                                System.err.println("Error! Server was told to unload " + fighter.getDisplayName() + " from " + entity.getDisplayName() + " into " + curPos.getBoardNum());
                            }
View Full Code Here

Examples of megamek.common.Bay

                } else if (transporter.startsWith("Bay:", 0)) {
                    String numbers = transporter.substring(4);
                    String temp[] = numbers.split(":");
                    int size = Integer.parseInt(temp[0]);
                    int doors = Integer.parseInt(temp[1]);
                    a.addTransporter(new Bay(size, doors));
                }
            }
        }

        // get docking collars
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.