/** * @param name mode name * @return unique mode that corresponds to the given name */ public static EquipmentMode getMode(String name) { EquipmentMode mode = modesHash.get(name); if (mode == null) { mode = new EquipmentMode(name); modesHash.put(name, mode); } return mode; }
/** * Method that checks to see if our capital missile bay is in waypoint launch mode * Only available in space games * @return */ public boolean isInWaypointLaunchMode() { if ((curMode().equals(Weapon.Mode_CapMissile_Waypoint_Bearing_Ext) || curMode().equals(Weapon.Mode_CapMissile_Waypoint_Bearing_Long) || curMode().equals(Weapon.Mode_CapMissile_Waypoint_Bearing_Med) || curMode().equals(Weapon.Mode_CapMissile_Waypoint_Bearing_Short) || curMode().equals(Weapon.Mode_CapMissile_Waypoint)) && getEntity().isSpaceborne()) { return true; } return false; }
if (m.curMode().getDisplayableName().length() > 0) { sb.append(" ("); //$NON-NLS-1$ sb.append(m.curMode().getDisplayableName()); sb.append(')'); //$NON-NLS-1$ if (!m.pendingMode().equals("None")) { //$NON-NLS-1$ sb.append(" (next turn, "); //$NON-NLS-1$ sb.append(m.pendingMode().getDisplayableName()); sb.append(')'); //$NON-NLS-1$
public String toString() { return getName(); } }
&& ((wtype.getAmmoType() == AmmoType.T_AC_ULTRA) || (wtype .getAmmoType() == AmmoType.T_AC_ULTRA_THB)) && !weapon.curMode().equals("Single")) { numAttacks = 2; EquipmentMode mode = (weapon.curMode()); if (mode != null) { if (mode.getName() == "1-shot") { priority = 1; } else if (mode.getName() == "2-shot") { priority = 2; } else if (mode.getName() == "3-shot") { priority = 3; } else if (mode.getName() == "4-shot") { priority = 4;
/** * Remove a specific mode from the list of modes. * * @param mode * @return */ public boolean removeMode(String mode) { if (modes != null) { return modes.remove(EquipmentMode.getMode(mode)); } else { return false; } }
&& (m.getType() instanceof WeaponType) && ((WeaponType)m.getType()).hasFlag(WeaponType.F_BA_INDIVIDUAL) && (m.curMode().getName().contains("-shot")) && (Integer.parseInt(m.curMode().getName().replace("-shot", "")) > ce().getTotalInternal())) { m.setMode(0); clientgui.systemMessage(Messages.getString( "FiringDisplay.switched", new Object[] { m.getName(), m.curMode().getDisplayableName(true) })); //$NON-NLS-1$ } else { clientgui.systemMessage(Messages.getString( "FiringDisplay.willSwitch", new Object[] { m.getName(), //$NON-NLS-1$ m.pendingMode().getDisplayableName(true) }));
/** * @return the localized displayable name presented by the GUI to the user. */ public String getDisplayableName() { return getDisplayableName(false); }
private static void createFireSupportLance() { FormationType ft = new FormationType("Fire Support", "Fire"); ft.allowedUnitTypes = FLAG_GROUND; ft.otherCriteria.add(new CountConstraint(3, ms -> ms.getEquipmentNames().stream() .map(name -> EquipmentType.get(name)) .filter(eq -> eq instanceof WeaponType && eq.hasModes()) .anyMatch(eq -> { for (Enumeration<EquipmentMode> e = eq.getModes(); e.hasMoreElements();) { if (e.nextElement().toString().equals("Indirect")) { return true; } } return false; }), "Indirect fire weapon")); ft.reportMetrics.put("Indirect", ms -> ft.otherCriteria.get(0).criterion.test(ms)); allFormationTypes.put(ft.name, ft); }
@Override protected boolean handleSpecialMiss(Entity entityTarget, boolean bldgDamagedOnMiss, Building bldg, Vector<Report> vPhaseReport) { int priority = 1; EquipmentMode mode = (weapon.curMode()); if (mode != null) { if (mode.getName().equals("1-shot")) { priority = 1; } else if (mode.getName().equals("2-shot")) { priority = 2; } else if (mode.getName().equals("3-shot")) { priority = 3; } else if (mode.getName().equals("4-shot")) { priority = 4; } } // add even misses, as they waste homing missiles. TagInfo info = new TagInfo(ae.getId(), target.getTargetType(), target, priority, true); game.addTagInfo(info); return false; }
|| (wt.getAmmoType() == AmmoType.T_AC_ULTRA_THB) || (wt.getAmmoType() == AmmoType.T_AC_ROTARY)) { if ((weapon.curMode().getName().equals("Ultra")) || (weapon.curMode().getName().equals("2-shot")) || (weapon.curMode().getName().equals("3-shot")) || (weapon.curMode().getName().equals("4-shot")) || (weapon.curMode().getName().equals("5-shot")) || (weapon.curMode().getName().equals("6-shot"))) { use_table = true; || (wt.getAmmoType() == AmmoType.T_AC_ULTRA_THB) || (wt.getAmmoType() == AmmoType.T_AC_ROTARY)) { if ((weapon.curMode().getName().equals("Ultra")) || (weapon.curMode().getName().equals("2-shot"))) { fHits = expectedHitsByRackSize[2]; if (weapon.curMode().getName().equals("3-shot")) { fHits = expectedHitsByRackSize[3]; if (weapon.curMode().getName().equals("4-shot")) { fHits = expectedHitsByRackSize[4]; if (weapon.curMode().getName().equals("5-shot")) { fHits = expectedHitsByRackSize[5]; if (weapon.curMode().getName().equals("6-shot")) { fHits = expectedHitsByRackSize[6]; if (((weapon.curMode() == null) || !weapon.curMode().equals("Indirect"))
/** * Add a mode to the Equipment * * @param mode The mode to be added * @return true if the mode was added; false if modes was null or the mode was already present * @author Simon (Juliez) */ public boolean addMode(String mode) { if (modes == null) { modes = new Vector<EquipmentMode>(); } if (!modes.contains(EquipmentMode.getMode(mode))) { return modes.add(EquipmentMode.getMode(mode)); } else { return false; } }
private JMenuItem createModeJMenuItem(Mounted mounted, int position) { JMenuItem item = new JMenuItem(); EquipmentMode mode = mounted.getType().getMode(position); if (mode.equals(mounted.curMode())) { item.setText("* " + mode.getDisplayableName()); } else { item.setText(mode.getDisplayableName()); } item.setActionCommand(Integer.toString(position)); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { int modePosition = Integer.parseInt(e.getActionCommand()); int weaponNum = gui.mechD.wPan.getSelectedWeaponNum(); Mounted equip = myEntity.getEquipment(weaponNum); equip.setMode(modePosition); client.sendModeChange(myEntity.getId(), weaponNum, modePosition); } catch (Exception ex) { ex.printStackTrace(); } } }); return item; }
/** * Method that checks to see if our capital missile bay is in bearings-only mode * Only available in space games * @return */ public boolean isInBearingsOnlyMode() { if ((curMode().equals(Weapon.Mode_CapMissile_Bearing_Ext) || curMode().equals(Weapon.Mode_CapMissile_Bearing_Long) || curMode().equals(Weapon.Mode_CapMissile_Bearing_Med) || curMode().equals(Weapon.Mode_CapMissile_Bearing_Short) || curMode().equals(Weapon.Mode_CapMissile_Waypoint_Bearing_Ext) || curMode().equals(Weapon.Mode_CapMissile_Waypoint_Bearing_Long) || curMode().equals(Weapon.Mode_CapMissile_Waypoint_Bearing_Med) || curMode().equals(Weapon.Mode_CapMissile_Waypoint_Bearing_Short)) && getEntity().isSpaceborne()) { return true; } return false; }
wn.append(' '); wn.append(mounted.curMode().getDisplayableName()); if (!mounted.pendingMode().equals("None")) { wn.append(" (next turn, "); wn.append(mounted.pendingMode().getDisplayableName()); wn.append(')');
/** * Method computes how much damage a dial down weapon has done * * @param weapon * @param wtype * @param range * @return new damage */ public static int dialDownDamage(Mounted weapon, WeaponType wtype, int range) { int toReturn = wtype.getDamage(range); if (!wtype.hasModes()) { return toReturn; } String damage = weapon.curMode().getName(); // Vehicle flamers have damage and heat modes so lets make sure this is // an actual dial down Damage. if ((damage.trim().toLowerCase().indexOf("damage") == 0) && (damage.trim().length() > 6)) { toReturn = Integer.parseInt(damage.substring(6).trim()); } return Math.min(wtype.getDamage(range), toReturn); }
/** * Sets the modes that this type of equipment can be in. By default the * EquipmentType doesn't have the modes, so don't try to call this method * with null or empty argument. * * @param modes * non null, non empty list of available mode names. */ protected void setModes(String[] modes) { assert ((modes != null) && (modes.length >= 0)) : "List of modes must not be null or empty"; Vector<EquipmentMode> newModes = new Vector<EquipmentMode>(modes.length); for (String mode : modes) { newModes.addElement(EquipmentMode.getMode(mode)); } this.modes = newModes; }
clientgui.systemMessage(Messages.getString( "FiringDisplay.switched", new Object[] { m.getName(), m.curMode().getDisplayableName() })); m.pendingMode().getDisplayableName() })); //$NON-NLS-1$
/** * * adjustment factor on attack value for fighter squadrons */ protected double getBracketingMultiplier() { double mult = 1.0; if (wtype.hasModes() && weapon.curMode().equals("Bracket 80%")) { mult = 0.8; } if (wtype.hasModes() && weapon.curMode().equals("Bracket 60%")) { mult = 0.6; } if (wtype.hasModes() && weapon.curMode().equals("Bracket 40%")) { mult = 0.4; } return mult; }
if (em.equals("HotLoad") && en instanceof Mech && !client.getGame().getOptions().booleanOption(OptionsConstants.ADVCOMBAT_HOTLOAD_IN_GAME)) { continue; m_chMode.addItem(em.getDisplayableName()); m_chMode.setEnabled(false); } else { if (m.pendingMode().equals("None")) { m_chMode.setSelectedItem(m.curMode() .getDisplayableName()); } else { m_chMode.setSelectedItem(m.pendingMode() .getDisplayableName());