示例#1
0
  @Override
  public int getBVMod(Entity unit) {
    if (CampaignMain.cm.getBooleanConfig("USEFLATGUNNERYLASERMODIFIER")) {
      CampaignData.mwlog.debugLog("Using Flat GL Mod");
      return getBVModFlat(unit);
    }
    double laserBV = 0;
    double gunneryLaserBVBaseMod =
        megamek.common.Crew.getBVSkillMultiplier(
            unit.getCrew().getGunnery() - 1, unit.getCrew().getPiloting());
    double originalLaserBV = 0;
    for (Mounted weapon : unit.getWeaponList()) {
      if (weapon.getType().hasFlag(WeaponType.F_ENERGY)) {
        laserBV += weapon.getType().getBV(unit);
        originalLaserBV += weapon.getType().getBV(unit);
      }
    }
    // This is adding the base BV of the weapon twice - once originally, and once here.
    // Need to back out the original cost so that it only gets added once.
    CampaignData.mwlog.debugLog("Laser BV: " + laserBV);
    CampaignData.mwlog.debugLog("Original Laser BV: " + originalLaserBV);
    CampaignData.mwlog.debugLog(
        "Mod: " + (int) ((laserBV * gunneryLaserBVBaseMod) - originalLaserBV));

    return (int) ((laserBV * gunneryLaserBVBaseMod) - originalLaserBV);
  }
示例#2
0
  /**
   * Get the portrait for the given pilot.
   *
   * @return The <code>Image</code> of the pilot's portrait. This value will be <code>null</code> if
   *     no portrait was selected or if there was an error loading it.
   */
  public Image getPortrait(Crew pilot) {

    String category = pilot.getPortraitCategory();
    String file = pilot.getPortraitFileName();

    // Return a null if the player has selected no portrait file.
    if ((null == category) || (null == file) || (null == portraits)) {
      return null;
    }

    if (Crew.PORTRAIT_NONE.equals(file)) {
      file = "default.gif"; // $NON-NLS-1$
    }

    if (Crew.ROOT_PORTRAIT.equals(category)) {
      category = "";
    }

    // Try to get the player's portrait file.
    Image portrait = null;
    try {
      portrait = (Image) portraits.getItem(category, file);
      if (null == portrait) {
        // the image could not be found so switch to default one
        category = "";
        file = "default.gif";
        portrait = (Image) portraits.getItem(category, file);
      }
      // make sure no images are longer than 72 pixels
      if (null != portrait) {
        portrait = portrait.getScaledInstance(-1, 72, Image.SCALE_DEFAULT);
      }
    } catch (Exception err) {
      err.printStackTrace();
    }
    return portrait;
  }