private boolean isSupercharger() { return type.hasSubType(MiscType.S_SUPERCHARGER); }
private boolean isSupercharger() { return type.hasSubType(MiscType.S_SUPERCHARGER); }
public static double getTonnageIncrement(EquipmentType type) { if((type.hasFlag(MiscType.F_CLUB) && type.hasSubType(MiscType.S_RETRACTABLE_BLADE))) { return 0.5; } return 1; }
private void addArmorNotes(List<String> notes, EquipmentType armorKit) { if (armorKit.hasSubType(MiscType.S_DEST)) { notes.add(Messages.getString("TROView.InfantryNote.DESTArmor")); } if (armorKit.hasSubType(MiscType.S_SNEAK_CAMO)) { notes.add(Messages.getString("TROView.InfantryNote.CamoArmor")); } if (armorKit.hasSubType(MiscType.S_SNEAK_IR)) { notes.add(Messages.getString("TROView.InfantryNote.IRArmor")); } if (armorKit.hasSubType(MiscType.S_SNEAK_ECM)) { notes.add(Messages.getString("TROView.InfantryNote.ECMArmor")); } }
public static double getMaxTonnage(EquipmentType type) { if (type.hasFlag(MiscType.F_TALON)|| (type.hasFlag(MiscType.F_CLUB) && (type.hasSubType(MiscType.S_HATCHET) || type.hasSubType(MiscType.S_MACE_THB)))) { return 7; } else if (type.hasFlag(MiscType.F_CLUB) && (type.hasSubType(MiscType.S_LANCE) || type.hasSubType(MiscType.S_SWORD))) { return 5; } else if (type.hasFlag(MiscType.F_CLUB) && type.hasSubType(MiscType.S_MACE)) { return 10; } else if (type.hasFlag(MiscType.F_CLUB) && type.hasSubType(MiscType.S_RETRACTABLE_BLADE)) { return 5.5; } else if (type.hasFlag(MiscType.F_TARGCOMP)) { //direct fire weapon weight divided by 4 - what is reasonably the highest - 15 tons? return 15; } return 1; }
public static int maxJumpMP(Protomech proto) { if (proto.getMisc().stream().map(Mounted::getType) .anyMatch(eq -> eq.hasFlag(MiscType.F_JUMP_JET) && eq.hasSubType(MiscType.S_IMPROVED))) { return (int) Math.ceil(proto.getOriginalWalkMP() * 1.5); } return proto.getOriginalWalkMP(); }
@Override public double getTonnage() { double ton = 0.5; if(getUnitTonnage() >= 90) { ton = 2.0; } else if(getUnitTonnage() >= 60) { ton = 1.0; } if(type.hasSubType(MiscType.S_IMPROVED)) { ton *= 2; } return ton; }
/** * Returns the type of jump jet system the mech has. */ @Override public int getJumpType() { jumpType = JUMP_NONE; for (Mounted m : miscList) { if (m.getType().hasFlag(MiscType.F_JUMP_JET)) { if (m.getType().hasSubType(MiscType.S_IMPROVED) && m.getType().hasSubType(MiscType.S_PROTOTYPE)) { jumpType = JUMP_PROTOTYPE_IMPROVED; } else if (m.getType().hasSubType(MiscType.S_IMPROVED)) { jumpType = JUMP_IMPROVED; } else if (m.getType().hasSubType(MiscType.S_PROTOTYPE)) { jumpType = JUMP_PROTOTYPE; } else { jumpType = JUMP_STANDARD; } break; } else if (m.getType().hasFlag(MiscType.F_JUMP_BOOSTER)) { jumpType = JUMP_BOOSTER; break; } } return jumpType; }
@Override public boolean doomedInExtremeTemp() { if (getArmorKit() != null) { if (getArmorKit().hasSubType(MiscType.S_XCT_VACUUM)) { return false; } else if (getArmorKit().hasSubType(MiscType.S_COLD_WEATHER) && (game.getPlanetaryConditions().getTemperature() < -30)) { return false; } else if (getArmorKit().hasSubType(MiscType.S_HOT_WEATHER) && (game.getPlanetaryConditions().getTemperature() > 50)) { return false; } else { return true; } } if (hasSpaceSuit() || isMechanized()) { return false; } return true; }
@Override public double getTonnage() { double ton; if (type.hasFlag(MiscType.F_PROTOMECH_EQUIPMENT)) { if(getUnitTonnage() <=5) { ton = 0.05; } else if (getUnitTonnage() <= 9){ ton = 0.1; } else { ton = 0.15; } } else { if(getUnitTonnage() >= 90) { ton = 2.0; } else if(getUnitTonnage() >= 60) { ton = 1.0; } else { ton = 0.5; } } if(type.hasSubType(MiscType.S_IMPROVED)) { ton *= 2; } return ton; }
/** * checks if a mech has both a normal MASC system and a supercharger, * regardless of arming status */ public boolean hasMASCAndSuperCharger() { boolean hasMASC = false; boolean hasSuperCharger = false; for (Mounted m : getEquipment()) { if (!m.isInoperable() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_MASC) && m.getType().hasSubType(MiscType.S_SUPERCHARGER)) { hasSuperCharger = true; } if (!m.isInoperable() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_MASC) && !m.getType().hasSubType(MiscType.S_SUPERCHARGER)) { hasMASC = true; } } return hasMASC && hasSuperCharger; }
/** * Check to see how many shields of a certain size a mek has. you can have * up to shields per mek. However they can be of different size and each * size has its own draw backs. So check each size and add modifers based on * the number shields of that size. */ @Override public int getNumberOfShields(long size) { int raShield = 0; int laShield = 0; for (Mounted m : getMisc()) { EquipmentType type = m.getType(); if ((type instanceof MiscType) && type.hasFlag(MiscType.F_CLUB) && (type.hasSubType(size))) { // ok so we have a shield of certain size. no which arm is it. if (m.getLocation() == Mech.LOC_RARM) { raShield = 1; } if (m.getLocation() == Mech.LOC_LARM) { laShield = 1; } // break now. if ((raShield > 0) && (laShield > 0)) { return 2; } } } return raShield + laShield; }
/** * Check to see how many shields of a certain size a mek has. you can have * up to shields per mek. However they can be of different size and each * size has its own draw backs. So check each size and add modifers based on * the number shields of that size. */ @Override public int getNumberOfShields(long size) { int raShield = 0; int laShield = 0; for (Mounted m : getMisc()) { EquipmentType type = m.getType(); if ((type instanceof MiscType) && type.hasFlag(MiscType.F_CLUB) && (type.hasSubType(size))) { // ok so we have a shield of certain size. no which arm is it. if (m.getLocation() == Mech.LOC_RARM) { raShield = 1; } if (m.getLocation() == Mech.LOC_LARM) { laShield = 1; } // break now. if ((raShield > 0) && (laShield > 0)) { return 2; } } } return raShield + laShield; }
/** * Does this mech have an extended retractable blade in working condition? */ public boolean hasExtendedRetractableBlade() { for (Mounted m : getEquipment()) { if (!m.isInoperable() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_CLUB) && m.getType().hasSubType(MiscType.S_RETRACTABLE_BLADE) && m.curMode().equals("extended")) { return true; } } return false; }
/** * Set the retractable blade in the given location as extended Takes the * first piece of appropriate equipment */ public void extendBlade(int loc) { for (Mounted m : getEquipment()) { if ((m.getLocation() == loc) && !m.isDestroyed() && !m.isBreached() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_CLUB) && m.getType().hasSubType(MiscType.S_RETRACTABLE_BLADE)) { m.setMode("extended"); return; } } }
/** * Checks if a mech has an armed MASC system. Note that the mech will have * to exceed its normal run to actually engage the MASC system */ public boolean hasArmedMASC() { for (Mounted m : getEquipment()) { if (!m.isDestroyed() && !m.isBreached() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_MASC) && (m.curMode().equals("Armed") || m.getType().hasSubType( MiscType.S_JETBOOSTER))) { return true; } } return false; }
/** * Does the entity have a retracted blade in the given location */ @Override public boolean hasRetractedBlade(int loc) { for (Mounted m : getEquipment()) { if ((m.getLocation() == loc) && !m.isDestroyed() && !m.isBreached() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_CLUB) && m.getType().hasSubType(MiscType.S_RETRACTABLE_BLADE) && !m .curMode().equals("extended")) { return true; } } return false; }
/** * Does the entity have a retracted blade in the given location */ @Override public boolean hasRetractedBlade(int loc) { for (Mounted m : getEquipment()) { if ((m.getLocation() == loc) && !m.isDestroyed() && !m.isBreached() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_CLUB) && m.getType().hasSubType(MiscType.S_RETRACTABLE_BLADE) && !m.curMode().equals("extended")) { return true; } } return false; }
/** * checks if a mech has both a normal armed MASC system and a armed super- * charger. */ public boolean hasArmedMASCAndSuperCharger() { boolean hasMASC = false; boolean hasSuperCharger = false; for (Mounted m : getEquipment()) { if (!m.isDestroyed() && !m.isBreached() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_MASC) && m.curMode().equals("Armed") && m.getType().hasSubType(MiscType.S_SUPERCHARGER)) { hasSuperCharger = true; } if (!m.isDestroyed() && !m.isBreached() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_MASC) && m.curMode().equals("Armed") && !m.getType().hasSubType(MiscType.S_SUPERCHARGER)) { hasMASC = true; } } return hasMASC && hasSuperCharger; }
/** * destroys the first retractable blade critical slot found */ public void destroyRetractableBlade(int loc) { // check critical slots for (int i = 0; i < this.getNumberOfCriticals(loc); i++) { CriticalSlot slot = getCritical(loc, i); // ignore empty & system slots if ((slot == null) || (slot.getType() != CriticalSlot.TYPE_EQUIPMENT)) { continue; } Mounted m = slot.getMount(); if ((m.getLocation() == loc) && !m.isHit() && !m.isBreached() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_CLUB) && m.getType().hasSubType(MiscType.S_RETRACTABLE_BLADE)) { slot.setHit(true); m.setHit(true); return; } } }