/** * Firing arc abbreviation, which may be different than mounting location for * side arcs on small craft and dropships * * @param Mounted * The weapon mount * @return The arc abbreviation. */ protected String getArcAbbr(Mounted m) { return aero.getLocationAbbr(m.getLocation()); }
public boolean hasFieldGun() { for (Mounted m : getWeaponList()) { if (m.getLocation() == Infantry.LOC_FIELD_GUNS) { return true; } } return false; }
public boolean hasWeaponInArc(int loc) { boolean hasWeapons = false; for (Mounted weap : getWeaponList()) { if (weap.getLocation() == loc) { hasWeapons = true; } } return hasWeapons; }
@Override public boolean loadWeaponWithSameAmmo(Mounted mounted, Mounted mountedAmmo) { // BA must carry the ammo in same location as the weapon. // except for mine launcher mines // This allows for squad weapons and individual trooper weapons // such as NARC and the support weapons in TW/TO AmmoType at = (AmmoType) mountedAmmo.getType(); if (!(at.getAmmoType() == AmmoType.T_MINE) && (mounted.getLocation() != mountedAmmo.getLocation())) { return false; } return super.loadWeaponWithSameAmmo(mounted, mountedAmmo); }
public static boolean compareMounted (Mounted a, Mounted b) { if (!a.getType().equals(b.getType())) return false; if (!a.getClass().equals(b.getClass())) return false; if (!a.getName().equals(b.getName())) return false; if (a.getLocation()!=b.getLocation()) return false; return true; }
/** * Returns true if this weapon fires into the secondary facing arc. If * false, assume it fires into the primary. */ @Override public boolean isSecondaryArcWeapon(int weaponId) { // for quads, only the main gun weapons can rotate if (isQuad()) { return getEquipment(weaponId).getLocation() == LOC_MAINGUN; } return true; }
/** * Returns true if this weapon fires into the secondary facing arc. If * false, assume it fires into the primary. */ @Override public boolean isSecondaryArcWeapon(int weaponId) { if (getEquipment(weaponId).getLocation() == getLocTurret()) { return true; } return false; }
public boolean hasWeaponInArc(int loc, boolean rearMount) { boolean hasWeapons = false; for (Mounted weap : getWeaponList()) { if ((weap.getLocation() == loc) && (weap.isRearMounted() == rearMount)) { hasWeapons = true; } } return hasWeapons; }
@Override public String getLocationName() { if(null != unit) { Mounted mounted = unit.getEntity().getEquipment(equipmentNum); if(null != mounted && mounted.getLocation() != -1) { return unit.getEntity().getLocationName(mounted.getLocation()); } } return null; }
public int getLocation() { if(null != unit) { Mounted mounted = unit.getEntity().getEquipment(equipmentNum); if(null != mounted) { return mounted.getLocation(); } } return -1; }
/** * Infantry can fire all around themselves. But field guns act like turret * mounted on a tank */ @Override public boolean isSecondaryArcWeapon(int wn) { if ((getEquipment(wn).getLocation() == LOC_FIELD_GUNS) && !hasActiveFieldArtillery()) { return true; } return false; }
@Override protected String formatLocationTableEntry(Entity entity, Mounted mounted) { String loc = entity.getLocationAbbr(mounted.getLocation()); if (mounted.isRearMounted()) { loc += "(R)"; } return loc; } }
@Override protected String formatLocationTableEntry(Entity entity, Mounted mounted) { if (mounted.isSponsonTurretMounted()) { return Messages.getString("TROView.Sponson"); } return entity.getLocationName(mounted.getLocation()); } }
@Override public StringBuffer printAmmo(StringBuffer buff, int posLoc, int posWeight) { for (Mounted m : getEntity().getAmmo()) { AmmoType mt = (AmmoType) m.getType(); buff.append(StringUtil.makeLength(mt.getName(), 20)); buff.append(" ").append( StringUtil.makeLength(getLocationAbbr(m.getLocation()), getPrintSize() - 5 - 20)) .append(TestEntity.makeWeightString( Math.ceil(mt.getKgPerShot() * m.getBaseShotsLeft()) / 1000.0)).append("\n"); } return buff; }
@Override public boolean hasCASEII(int location) { for (Mounted mount : this.getEquipment()) { if ((mount.getLocation() == location) && (mount.getType() instanceof MiscType) && ((MiscType) mount.getType()).hasFlag(MiscType.F_CASEII)) { return true; } } return false; }
RapidfireMGPanel(Mounted m) { m_mounted = m; int loc = m.getLocation(); String sDesc = Messages .getString( "CustomMechDialog.switchToRapidFire", new Object[] { entity.getLocationAbbr(loc) }); //$NON-NLS-1$ JLabel labRapid = new JLabel(sDesc); GridBagLayout g = new GridBagLayout(); setLayout(g); add(labRapid, GBC.std().anchor(GridBagConstraints.EAST)); chRapid.setSelected(m.isRapidfire()); add(chRapid, GBC.eol()); }
public boolean hasLinkedMGA(Mounted mounted) { for (Mounted m : getWeaponList()) { if ((m.getLocation() == mounted.getLocation()) && m.getType().hasFlag(WeaponType.F_MGA) && !(m.isDestroyed() || m.isBreached()) && m.getBayWeapons().contains(getEquipmentNum(mounted)) && m.getType().hasModes() && m.curMode().equals("Linked")) { return true; } } return false; }
/** * Returns whether there is CASE protecting the location. */ public boolean locationHasCase(int loc) { for (Mounted mounted : getMisc()) { if ((mounted.getLocation() == loc) && mounted.getType().hasFlag(MiscType.F_CASE)|(mounted.getType().hasFlag(MiscType.F_CASEP))) { return true; } } return false; }
@Override protected String formatLocationTableEntry(Entity entity, Mounted mounted) { if (mounted.isPintleTurretMounted()) { return Messages.getString("TROView.Pintle"); } else if (mounted.isSponsonTurretMounted()) { return Messages.getString("TROView.Sponson"); } return entity.getLocationName(mounted.getLocation()); }
public boolean hasModularArmor(int loc) { for (Mounted mount : this.getEquipment()) { if ((loc == -1) || (mount.getLocation() == loc)) { if (!mount.isDestroyed() && (mount.getType() instanceof MiscType) && ((MiscType) mount.getType()) .hasFlag(MiscType.F_MODULAR_ARMOR)) { return true; } } } return false; }