@Override /** * returns the battle force structure points for a vehicle. * Composite and Reinforced structures are Mech only, so we don't need to worry */ public int getBattleForceStructurePoints() { int struct = 0; for (int i = 0; i < getLocationNames().length; i++) { struct += this.getInternal(i); } return (int) Math.ceil(struct / 10.0); }
public void setEntity(Entity e) { Tank t = (Tank) e; int a = 1; int a0 = 1; for (int i = 1; i < 6; i++) { a = t.getArmor(i); a0 = t.getOArmor(i); vLabels[i].setValue(t.getArmorString(i)); WidgetUtils.setAreaColor(areas[i], vLabels[i], (double) a / (double) a0); } for (int i = 7; i < 12; i++) { a = t.getInternal(i - 6); a0 = t.getOInternal(i - 6); vLabels[i].setValue(t.getInternalString(i - 6)); WidgetUtils.setAreaColor(areas[i], vLabels[i], (double) a / (double) a0); } if (!t.hasPatchworkArmor() && t.hasBARArmor(1)) { vLabels[12].setValue(String.valueOf(((SupportTank)t).getBARRating(1))); } else { labels[12].setVisible(false); vLabels[12].setVisible(false); } }
/** * Determine if the unit can be repaired, or only harvested for spares. * * @return A <code>boolean</code> that is <code>true</code> if the unit can * be repaired (given enough time and parts); if this value is * <code>false</code>, the unit is only a source of spares. * @see Entity#isSalvage() */ @Override public boolean isRepairable() { // A tank is repairable if it is salvageable, // and none of its body internals are gone. boolean retval = isSalvage(); int loc = Tank.LOC_FRONT; while (retval && (loc < getLocTurret())) { int loc_is = this.getInternal(loc); loc++; retval = (loc_is != IArmorState.ARMOR_DOOMED) && (loc_is != IArmorState.ARMOR_DESTROYED); } return retval; }
sb.append(renderArmor(t.getInternal(Tank.LOC_FRONT))).append(" / |") .append(CommonConstants.NL) .append(" | \\__/ | | \\__/ |") sb.append(renderArmor(t.getInternal(Tank.LOC_LEFT))).append("/"); if (t.hasNoTurret()) { sb.append(renderArmor(t.getInternal(t.getLocTurret()))) .append("\\"); } else { sb.append(" \\"); sb.append(renderArmor(t.getInternal(Tank.LOC_RIGHT))).append("|") .append(CommonConstants.NL); .append(renderArmor(t.getArmor(Tank.LOC_REAR))) .append(" \\ | | / "); sb.append(renderArmor(t.getInternal(Tank.LOC_REAR))).append(" \\ |") .append(CommonConstants.NL) .append(" |/______\\| |/______\\|")
private JMenu createTorsoTwistMenu() { JMenu menu = new JMenu(); if (myEntity instanceof BipedMech) { menu.setText("Torso Twist"); if (coords.equals(myEntity.getPosition())) { menu.add(createTorsoTwistJMenuItem(1)); menu.add(createTorsoTwistJMenuItem(0)); } else { menu.add(createTorsoTwistJMenuItem(coords)); } } else if ((myEntity instanceof Tank) && (((Tank) myEntity).getInternal(((Tank) myEntity) .getLocTurret()) > -1)) { menu.setText("Turret Twist"); if (coords.equals(myEntity.getPosition())) { menu.add(createTorsoTwistJMenuItem(1)); menu.add(createTorsoTwistJMenuItem(0)); } else { menu.add(createTorsoTwistJMenuItem(coords)); } } if ((myEntity instanceof Tank) && !((Tank) myEntity).hasNoDualTurret()) { menu.add(createRotateDualTurretJMenuItem((Tank) myEntity)); } return menu; }