/** * Creates a new mount for this equipment and adds it in. */ public Mounted addEquipment(EquipmentType etype, int loc, boolean rearMounted, int baMountLoc, boolean isArmored, boolean isTurreted) throws LocationFullException { return addEquipment(etype, loc, rearMounted, baMountLoc, isArmored, isTurreted, false, false, false); }
public Mounted addEquipment(EquipmentType etype, int loc, boolean rearMounted, int baMountLoc, boolean isArmored, boolean isTurreted, boolean isSponsonTurreted) throws LocationFullException { return addEquipment(etype, loc, rearMounted, baMountLoc, isArmored, isTurreted, isSponsonTurreted, false, false); }
/** * Creates a new mount for this equipment and adds it in. */ public Mounted addEquipment(EquipmentType etype, int loc, boolean rearMounted) throws LocationFullException { return addEquipment(etype, loc, rearMounted, BattleArmor.MOUNT_LOC_NONE, false, false, false, false, false); }
/** * Creates a new mount for this equipment and adds it in. */ public Mounted addEquipment(EquipmentType etype, int loc) throws LocationFullException { return addEquipment(etype, loc, false); }
public Mounted addEquipment(EquipmentType etype, int loc, boolean rearMounted, int baMountLoc, boolean isArmored, boolean isTurreted, boolean isSponsonTurreted, boolean isPintleTurreted) throws LocationFullException { return addEquipment(etype, loc, rearMounted, baMountLoc, isArmored, isTurreted, isSponsonTurreted, isPintleTurreted, false); }
protected void addBomb(Mounted mounted, int loc) throws LocationFullException { mounted.setBombMounted(true); addEquipment(mounted, loc, false); }
public Mounted addWeaponGroup(EquipmentType etype, int loc) throws LocationFullException { Mounted mounted = new Mounted(this, etype); addEquipment(mounted, loc, false, true); return mounted; }
protected void addEquipment(Mounted mounted, int loc, boolean rearMounted, boolean isWeaponGroup) throws LocationFullException { mounted.setWeaponGroup(true); addEquipment(mounted, loc, rearMounted); }
/** * mounting weapons needs to take account of ammo * * @param etype * @param loc * @param rearMounted * @param nAmmo * @return * @throws LocationFullException */ public Mounted addEquipment(EquipmentType etype, int loc, boolean rearMounted, int nAmmo) throws LocationFullException { Mounted mounted = new Mounted(this, etype); addEquipment(mounted, loc, rearMounted, nAmmo); return mounted; }
/** * Mounts the specified equipment in the specified location. */ @Override public void addEquipment(Mounted mounted, int loc, boolean rearMounted) throws LocationFullException { // Implement parent's behavior. super.addEquipment(mounted, loc, rearMounted); //we do need to equipment slots for ammo switching of field guns and field artillery // Add the piece equipment to our slots. addCritical(loc, new CriticalSlot(mounted)); }
@Override public void addEquipment(Mounted mounted, int loc, boolean rearMounted) throws LocationFullException { if (getEquipmentNum(mounted) == -1) { super.addEquipment(mounted, loc, rearMounted); } // Add the piece equipment to our slots. addCritical(loc, new CriticalSlot(mounted)); }
/** * indicate whether this is bodymounted for BAs */ public Mounted addEquipment(EquipmentType etype, int loc, boolean rearMounted, int baMountLoc, boolean dwpMounted) throws LocationFullException { Mounted mounted = new Mounted(this, etype); mounted.setBaMountLoc(baMountLoc); mounted.setDWPMounted(dwpMounted); addEquipment(mounted, loc, rearMounted); return mounted; }
public void setStructureType(String strucType) { if (!(strucType.startsWith("Clan ") || strucType.startsWith("IS "))) { strucType = isClan() ? "Clan " + strucType : "IS " + strucType; } EquipmentType et = EquipmentType.get(strucType); setStructureType(EquipmentType.getStructureType(et)); if (et == null) { structureTechLevel = TechConstants.T_TECH_UNKNOWN; } else { structureTechLevel = et.getTechLevel(year); // TODO: Is this needed? WTF is the point of it? if (et.getCriticals(this) == 0) { try { this.addEquipment(et, LOC_NONE); } catch (LocationFullException e) { // can't happen e.printStackTrace(); } } } recalculateTechAdvancement(); }
protected void addEquipment(Mounted mounted, int loc, boolean rearMounted, int nAmmo) throws LocationFullException { if ((mounted.getType() instanceof AmmoType) && (nAmmo > 1)) { mounted.setByShot(true); mounted.setShotsLeft(nAmmo); mounted.setOriginalShots(nAmmo); double tonnage = Math.max(1, nAmmo / ((AmmoType) mounted.getType()).getShots()) * ((AmmoType) mounted.getType()).getTonnage(this); mounted.setAmmoCapacity(tonnage); } addEquipment(mounted, loc, rearMounted); }
public void setArmorType(String armType) { if (!(armType.startsWith("Clan ") || armType.startsWith("IS "))) { armType = TechConstants.isClan(getArmorTechLevel(0)) ? "Clan " + armType : "IS " + armType; } EquipmentType et = EquipmentType.get(armType); if (et == null) { setArmorType(EquipmentType.T_ARMOR_UNKNOWN); } else { setArmorType(EquipmentType.getArmorType(et)); // TODO: Is this needed? WTF is the point of it? if (et.getCriticals(this) == 0) { try { this.addEquipment(et, LOC_NONE); } catch (LocationFullException e) { // can't happen e.printStackTrace(); } } } recalculateTechAdvancement(); }
public void setArmorType(String armType, int loc) { if (!(armType.startsWith("Clan ") || armType.startsWith("IS "))) { armType = TechConstants.isClan(getArmorTechLevel(0)) ? "Clan " + armType : "IS " + armType; } EquipmentType et = EquipmentType.get(armType); if (et == null) { setArmorType(EquipmentType.T_ARMOR_UNKNOWN, loc); } else { setArmorType(EquipmentType.getArmorType(et), loc); // TODO: Is this needed? WTF is the point of it? if (et.getCriticals(this) == 0) { try { this.addEquipment(et, LOC_NONE); } catch (LocationFullException e) { // can't happen e.printStackTrace(); } } } recalculateTechAdvancement(); }
/** * Worker function that takes an entity, a location, an ammo type string and the critical index * of a weapons bay in the given location and attempts to add the ammo type there. * @param entity The entity we're working on loading * @param loc The location index on the entity * @param type The ammo type string * @param bayIndex The crit index of the bay where we want to load the ammo on the location where the bay is * @return A generated critical slot entry */ private void addExtraAmmoToBay(Entity entity, int loc, String type, String bayIndex) { // here, we need to do the following: // 1: get the bay to which this ammo belongs, and add it to said bay // 2: add the ammo to the entity as a "new" piece of equipment // 3: add the ammo to a crit slot on the bay's location int bayCritIndex = Integer.parseInt(bayIndex); Mounted bay = entity.getCritical(loc, bayCritIndex - 1).getMount(); Mounted ammo = new Mounted(entity, AmmoType.get(type)); try { entity.addEquipment(ammo, loc, bay.isRearMounted()); } catch(LocationFullException lfe) { // silently swallow it, since dropship locations have about a hundred crit slots } bay.addAmmoToBay(entity.getEquipmentNum(ammo)); }
public Mounted addEquipment(EquipmentType etype, int loc, boolean rearMounted, int baMountLoc, boolean isArmored, boolean isTurreted, boolean isSponsonTurreted, boolean isPintleTurreted, boolean isOmniPodded) throws LocationFullException { Mounted mounted = new Mounted(this, etype); mounted.setArmored(isArmored); mounted.setBaMountLoc(baMountLoc); mounted.setMechTurretMounted(isTurreted); mounted.setSponsonTurretMounted(isSponsonTurreted); mounted.setPintleTurretMounted(isPintleTurreted); mounted.setOmniPodMounted(isOmniPodded); addEquipment(mounted, loc, rearMounted); return mounted; }
@Override public void addEquipment(Mounted mounted, int loc, boolean rearMounted) throws LocationFullException { if (getEquipmentNum(mounted) == -1) { super.addEquipment(mounted, loc, rearMounted); } // Add the piece equipment to our slots. addCritical(loc, new CriticalSlot(mounted)); if ((mounted.getType() instanceof MiscType) && mounted.getType().hasFlag(MiscType.F_JUMP_JET)) { setOriginalJumpMP(getOriginalJumpMP() + 1); } }
public Mounted addEquipment(EquipmentType etype, EquipmentType etype2, int loc, boolean omniPod) throws LocationFullException { Mounted mounted = new Mounted(this, etype); Mounted mounted2 = new Mounted(this, etype2); mounted.setOmniPodMounted(omniPod); mounted2.setOmniPodMounted(omniPod); // check criticals for space if (getEmptyCriticals(loc) < 1) { throw new LocationFullException(mounted.getName() + " and " + mounted2.getName() + " do not fit in " + getLocationAbbr(loc) + " on " + getDisplayName() + "\n free criticals in location: " + getEmptyCriticals(loc) + ", criticals needed: " + 1); } super.addEquipment(mounted, loc, false); super.addEquipment(mounted2, loc, false); CriticalSlot cs = new CriticalSlot(mounted); cs.setMount2(mounted2); addCritical(loc, cs); return mounted; }