diff --git a/MekHQ/src/mekhq/campaign/parts/MekLocation.java b/MekHQ/src/mekhq/campaign/parts/MekLocation.java index 4b785902e1..411b100f3f 100644 --- a/MekHQ/src/mekhq/campaign/parts/MekLocation.java +++ b/MekHQ/src/mekhq/campaign/parts/MekLocation.java @@ -1,20 +1,20 @@ /* * Location.java - * + * * Copyright (c) 2009 Jay Lawson . All rights reserved. - * + * * This file is part of MekHQ. - * + * * MekHQ is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * MekHQ is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with MekHQ. If not, see . */ @@ -56,7 +56,7 @@ public class MekLocation extends Part { boolean breached; boolean blownOff; boolean forQuad; - + //system components for head protected boolean sensors; protected boolean lifeSupport; @@ -64,7 +64,7 @@ public class MekLocation extends Part { public MekLocation() { this(0, 0, 0, false, false, false, false, false, null); } - + public MekLocation clone() { MekLocation clone = new MekLocation(loc, getUnitTonnage(), structureType, clan, tsm, forQuad, sensors, lifeSupport, campaign); @@ -74,7 +74,7 @@ public MekLocation clone() { clone.blownOff = this.blownOff; return clone; } - + public int getLoc() { return loc; } @@ -86,11 +86,11 @@ public boolean isTsm() { public int getStructureType() { return structureType; } - + public void setClan(boolean clan) { this.clan = clan; } - + public MekLocation(int loc, int tonnage, int structureType, boolean clan, boolean hasTSM, boolean quad, boolean sensors, boolean lifeSupport, Campaign c) { super(tonnage, c); @@ -153,12 +153,12 @@ public MekLocation(int loc, int tonnage, int structureType, boolean clan, this.name += " (TSM)"; } } - + public double getTonnage() { //TODO: how much should this weigh? return 0; } - + @Override public Money getStickerPrice() { double totalStructureCost = EquipmentType.getStructureCost(getStructureType()) * getUnitTonnage(); @@ -180,11 +180,11 @@ public Money getStickerPrice() { private boolean isArm() { return loc == Mech.LOC_RARM || loc == Mech.LOC_LARM; } - + public boolean forQuad() { return forQuad; } - + @Override public boolean isSamePartType(Part part) { return part instanceof MekLocation @@ -200,7 +200,7 @@ && getStructureType() == ((MekLocation) part).getStructureType() || (hasSensors() == ((MekLocation)part).hasSensors() && hasLifeSupport() == ((MekLocation)part).hasLifeSupport())); } - + @Override public boolean isSameStatus(Part part) { return super.isSameStatus(part) && this.getPercent() == ((MekLocation)part).getPercent(); @@ -255,10 +255,10 @@ public void writeToXml(PrintWriter pw1, int indent) { @Override protected void loadFieldsFromXmlNode(Node wn) { NodeList nl = wn.getChildNodes(); - + for (int x=0; x 0 || (unit.getEntity().hasRearArmor(loc) && unit.getEntity().getArmorForReal(loc, true) > 0 )) { @@ -545,9 +598,9 @@ else if(isSalvaging()) { if ((slot == null) || !slot.isEverHittable()) { continue; } - + //certain other specific crits need to be left out (uggh, must be a better way to do this!) - if(slot.getType() == CriticalSlot.TYPE_SYSTEM + if(slot.getType() == CriticalSlot.TYPE_SYSTEM && (slot.getIndex() == Mech.ACTUATOR_HIP || slot.getIndex() == Mech.ACTUATOR_SHOULDER || slot.getIndex() == Mech.SYSTEM_LIFE_SUPPORT @@ -556,7 +609,7 @@ else if(isSalvaging()) { } if (slot.isRepairable()) { return "Repairable parts in " + unit.getEntity().getLocationName(loc) + " must be salvaged or scrapped first."; - } + } } } else if (!isBreached() && !isBlownOff()) { //check for damaged hips and shoulders @@ -565,23 +618,23 @@ else if(isSalvaging()) { if ((slot == null) || !slot.isEverHittable()) { continue; } - if(slot.getType() == CriticalSlot.TYPE_SYSTEM + if(slot.getType() == CriticalSlot.TYPE_SYSTEM && slot.getIndex() == Mech.ACTUATOR_HIP && slot.isDestroyed()) { return "You cannot repair a leg with a damaged hip. This leg must be scrapped and replaced instead."; - + } - if(slot.getType() == CriticalSlot.TYPE_SYSTEM + if(slot.getType() == CriticalSlot.TYPE_SYSTEM && slot.getIndex() == Mech.ACTUATOR_SHOULDER && slot.isDestroyed()) { return "You cannot repair an arm with a damaged shoulder. This arm must be scrapped and replaced instead."; - + } } } return null; } - + @Override public boolean isSalvaging() { //cant salvage a center torso @@ -590,7 +643,7 @@ public boolean isSalvaging() { } return super.isSalvaging(); } - + @Override public String checkScrappable() { //cant scrap a center torso @@ -598,7 +651,7 @@ public String checkScrappable() { return "Mech Center Torso's cannot be scrapped"; } //only allow scrapping of locations with nothing on them - //otherwise you will get weirdness where armor and actuators are + //otherwise you will get weirdness where armor and actuators are //still attached but everything else is scrapped //cant salvage torsos until arms and legs are gone if(unit.getEntity() instanceof Mech && loc == Mech.LOC_RT && !unit.getEntity().isLocationBad(Mech.LOC_RARM)) { @@ -606,7 +659,7 @@ public String checkScrappable() { } if(unit.getEntity() instanceof Mech && loc == Mech.LOC_LT && !unit.getEntity().isLocationBad(Mech.LOC_LARM)) { return "You must first remove the left arm before you scrap the left torso"; - } + } //check for armor if(unit.getEntity().getArmor(loc, false) > 0 || (unit.getEntity().hasRearArmor(loc) && unit.getEntity().getArmor(loc, true) > 0 )) { @@ -619,9 +672,9 @@ public String checkScrappable() { if ((slot == null) || !slot.isEverHittable()) { continue; } - + //certain other specific crits need to be left out (uggh, must be a better way to do this!) - if(slot.getType() == CriticalSlot.TYPE_SYSTEM + if(slot.getType() == CriticalSlot.TYPE_SYSTEM && (slot.getIndex() == Mech.SYSTEM_COCKPIT || slot.getIndex() == Mech.ACTUATOR_HIP || slot.getIndex() == Mech.ACTUATOR_SHOULDER)) { @@ -629,11 +682,11 @@ public String checkScrappable() { } if (slot.isRepairable()) { return "You must first remove all equipment from this location before you scrap it"; - } + } } return null; } - + @Override public TargetRoll getAllMods(Person tech) { if(isBreached() && !isSalvaging()) { @@ -644,7 +697,7 @@ public TargetRoll getAllMods(Person tech) { } return super.getAllMods(tech); } - + public String getDesc() { if((!isBreached() && !isBlownOff()) || isSalvaging()) { return super.getDesc(); @@ -654,7 +707,7 @@ public String getDesc() { if (getTeamId() != null) { scheduled = " (scheduled) "; } - + toReturn += ">"; if(isBlownOff()) { toReturn += "Re-attach " + getName() + "
"; @@ -684,33 +737,33 @@ public String getDesc() { toReturn += ""; return toReturn; } - + @Override public boolean onBadHipOrShoulder() { return null != unit && unit.hasBadHipOrShoulder(loc); } - + @Override public boolean isRightTechType(String skillType) { return skillType.equals(SkillType.S_TECH_MECH); } - + public boolean hasSensors() { return sensors; } - + public void setSensors(boolean b) { sensors = b; } - + public boolean hasLifeSupport() { return lifeSupport; } - + public void setLifeSupport(boolean b) { lifeSupport = b; } - + private void removeHeadComponents() { MekSensor sensor = null; MekLifeSupport support = null; @@ -734,7 +787,7 @@ private void removeHeadComponents() { lifeSupport = true; } } - + public void doMaintenanceDamage(int d) { int points = unit.getEntity().getInternal(loc); points = Math.max(points -d, 1); @@ -752,17 +805,17 @@ public String getLocationName() { public int getLocation() { return Entity.LOC_NONE; } - + @Override public TechAdvancement getTechAdvancement() { return EquipmentType.getStructureTechAdvancement(structureType, clan); } - + @Override public int getMassRepairOptionType() { return Part.REPAIR_PART_TYPE.GENERAL_LOCATION; } - + @Override public int getRepairPartType() { return Part.REPAIR_PART_TYPE.MEK_LOCATION;