📄 battlearmor.java
字号:
// Clan Elemental points are never burdened by equipment. if ( !this.isClan() ) { // As of 2004-04-04 only Longinus and Purifier squads get burdened. String name = this.getShortName(); if ( -1 == name.indexOf( LONGINUS_SQUAD ) && -1 == name.indexOf( PURIFIER_SQUAD ) ) { return false; } // As of 2003-01-03, only ammo burdens the jump // Loop through the squad's equipment. for (Mounted mounted : this.getAmmo()) { EquipmentType type = mounted.getType(); // Un-jettisoned ammo packs burden squads. if ( mounted.getShotsLeft() > 0 && (type.getInternalName().equals(IS_DISPOSABLE_SRM2_AMMO) || type.getInternalName().equals(IS_DISPOSABLE_NARC_AMMO)) ) { return true; } } // Check the next piece of equipment } // End is-inner-sphere-squad // Unit isn't burdened. return false; } /** * Determine if this unit has an active stealth system. * <p/> * Sub-classes are encouraged to override this method. * * @return <code>true</code> if this unit has a stealth system that * is currently active, <code>false</code> if there is no * stealth system or if it is inactive. */ public boolean isStealthActive() { return (isStealthy || isMimetic || isSimpleCamo); } /** * Determine the stealth modifier for firing at this unit from the * given range. If the value supplied for <code>range</code> is not * one of the <code>Entity</code> class range constants, an * <code>IllegalArgumentException</code> will be thrown. * <p/> * Sub-classes are encouraged to override this method. * * @param range - an <code>int</code> value that must match one * of the <code>Compute</code> class range constants. * @return a <code>TargetRoll</code> value that contains the stealth * modifier for the given range. */ public TargetRoll getStealthModifier(int range) { TargetRoll result = null; //TODO: eliminate duplicate code if (armorType != -1) { /* Here, in order, are the armor types used by custom Battle Armor at this point: 0: "Standard", 1: "Advanced", 2: "Prototype", 3: "Basic Stealth", 4: "Prototype Stealth", 5: "Standard Stealth", 6: "Improved Stealth", 7: "Fire Resistant", 8: "Mimetic" */ if (armorType == 3) { // Basic Stealth switch (range) { case RangeType.RANGE_MINIMUM: case RangeType.RANGE_SHORT: // At short range, basic stealth doesn't get a mod! break; case RangeType.RANGE_MEDIUM: result = new TargetRoll(+1, "Basic Stealth Armor"); break; case RangeType.RANGE_LONG: case RangeType.RANGE_EXTREME: // TODO : what's the *real* modifier? result = new TargetRoll(+2, "Basic Stealth Armor"); break; default: throw new IllegalArgumentException ("Unknown range constant: " + range); } } else if (armorType == 4) { // Prototype Stealth switch (range) { case RangeType.RANGE_MINIMUM: case RangeType.RANGE_SHORT: // At short range, prototype stealth doesn't get a mod! break; case RangeType.RANGE_MEDIUM: result = new TargetRoll(+1, "Prototype Stealth Armor"); break; case RangeType.RANGE_LONG: case RangeType.RANGE_EXTREME: // TODO : what's the *real* modifier? result = new TargetRoll(+2, "Prototype Stealth Armor"); break; default: throw new IllegalArgumentException ("Unknown range constant: " + range); } } else if (armorType == 5) { // Standard Stealth switch (range) { case RangeType.RANGE_MINIMUM: case RangeType.RANGE_SHORT: result = new TargetRoll(+1, "Standard Stealth Armor"); break; case RangeType.RANGE_MEDIUM: result = new TargetRoll(+1, "Standard Stealth Armor"); break; case RangeType.RANGE_LONG: case RangeType.RANGE_EXTREME: // TODO : what's the *real* modifier? result = new TargetRoll(+2, "Standard Stealth Armor"); break; default: throw new IllegalArgumentException ("Unknown range constant: " + range); } } else if (armorType == 6) { // Improved Stealth switch (range) { case RangeType.RANGE_MINIMUM: case RangeType.RANGE_SHORT: result = new TargetRoll(+1, "Improved Stealth Armor"); break; case RangeType.RANGE_MEDIUM: result = new TargetRoll(+2, "Improved Stealth Armor"); break; case RangeType.RANGE_LONG: case RangeType.RANGE_EXTREME: // TODO : what's the *real* modifier? result = new TargetRoll(+3, "Improved Stealth Armor"); break; default: throw new IllegalArgumentException ("Unknown range constant: " + range); } } else if (armorType == 8) { // Mimetic Armor int mmod = 3 - delta_distance; mmod -= Compute.getTargetMovementModifier(game,getId()).getValue(); if (mmod < 0) { result = new TargetRoll(mmod, "mimetic armor cancels movement bonus"); } else { result = new TargetRoll(mmod, "mimetic armor"); } } } else { // Mimetic armor modifier is based upon and replaces the movement // bonus as listed below (BMRr, pg. 71): // 0 hexes moved +3 movement modifier // 1 hex moved +2 movement modifier // 2 hexes moved +1 movement modifier // 3 hexes moved +0 movement modifier // N.B. Rather than mucking with Compute#getTargetMovementModifier, // I decided to apply a -1 modifier here... the total works out. // FIXME: TotalWarfare pg 228 changes the mimetic mod to just add to other mods if (isMimetic) { int mmod = 3 - delta_distance; mmod -= Compute.getTargetMovementModifier(game,getId()).getValue(); if (mmod < 0) { result = new TargetRoll(mmod, "mimetic armor cancels movement bonus"); } else { result = new TargetRoll(mmod, "mimetic armor"); } } // Stealthy units alreay have their to-hit mods defined. if (isStealthy) { switch (range) { case RangeType.RANGE_MINIMUM: case RangeType.RANGE_SHORT: result = new TargetRoll(this.shortStealthMod, this.stealthName); break; case RangeType.RANGE_MEDIUM: result = new TargetRoll(this.mediumStealthMod, this.stealthName); break; case RangeType.RANGE_LONG: case RangeType.RANGE_EXTREME: // TODO : what's the *real* modifier? result = new TargetRoll(this.longStealthMod, this.stealthName); break; default: throw new IllegalArgumentException ("Unknown range constant: " + range); } } } // Simple camo modifier is on top of the movement modifier // 0 hexes moved +2 movement modifier // 1+ hexes moved +1 movement modifier // This can also be in addition to any armor except Mimetic! if (isSimpleCamo && delta_distance < 2) { int mod = 0; if (0 == this.delta_distance) { mod = 2; } else { mod = 1; } if (result == null) result = new TargetRoll(mod, "camoflage"); else result.append(new TargetRoll(mod, "camoflage")); } if (result == null) result = new TargetRoll(0, "stealth not active"); // Return the result. return result; } // End public TargetRoll getStealthModifier( char ) public int getVibroClawDamage() { if (vibroClawDamage < 0) { vibroClawDamage = 0; for (Mounted mounted : getWeaponList()) { if (mounted.getType().hasFlag(WeaponType.F_BOOST_SWARM)) { vibroClawDamage = ((WeaponType)(mounted.getType())).getRackSize(); break; } } } return vibroClawDamage; } public double getCost() { // Hopefully the cost is correctly set. if (myCost > 0) return myCost; // If it's not, I guess we default to the book values... if (chassis.equals("Clan Elemental")) return 3500000; if (chassis.equals("Clan Gnome")) return 5250000; if (chassis.equals("Clan Salamander")) return 3325000; if (chassis.equals("Clan Sylph")) return 3325000; if (chassis.equals("Clan Undine")) return 3500000; if (chassis.equals("IS Standard")) return 2400000; if (chassis.equals("Achileus")) return 1920000; if (chassis.equals("Cavalier")) return 2400000; if (chassis.equals("Fa Shih")) return 2250000; if (chassis.equals("Fenrir")) return 2250000; if (chassis.equals("Gray Death Light Scout")) return 1650000; if (chassis.equals("Gray Death Standard")) return 2400000; if (chassis.equals("Infiltrator")) { if (model.equals("Mk I")) return 1800000; return 2400000; // Mk II } if (chassis.equals("Kage")) return 1850000; if (chassis.equals("Kanazuchi")) return 3300000; if (chassis.equals("Longinus")) return 2550000; if (chassis.equals("Purifier")) return 2400000; if (chassis.equals("Raiden")) return 2400000; if (chassis.equals("Sloth")) return 1800000; return 0; } public boolean hasEiCockpit() { return true; } public void setWeightClass(int inWC) { weightClass = inWC; } public int getWeightClass() { return weightClass; } public void setChassisType(int inCT) { chassisType = inCT; } public int getChassisType() { return chassisType; } public boolean canAssaultDrop() { return true; } public boolean isNuclearHardened() { return true; } public boolean isTrooperActive(int trooperNum) { return (getInternal(trooperNum) > 0); } public int getNumberActiverTroopers() { int count = 0; // Initialize the troopers. for (int loop = 1; loop < this.locations(); loop++) if (isTrooperActive(loop)) count++; return count; } public int getRandomTrooper() { Vector activeTroops = new Vector(); for (int loop = 1; loop < this.locations(); loop++) if (isTrooperActive(loop)) activeTroops.add(loop); int locInt = Compute.randomInt(activeTroops.size()); return (Integer)(activeTroops.elementAt(locInt)); } public boolean loadWeapon(Mounted mounted, Mounted mountedAmmo) { //BA must carry the ammo in same location as the weapon. //This allows for squad weapons and individual trooper weapons //such as NARC and the support weapons in TW/TO if(mounted.getLocation() != mountedAmmo.getLocation()) return false; return super.loadWeapon(mounted, mountedAmmo); } public boolean loadWeaponWithSameAmmo(Mounted mounted, Mounted mountedAmmo) { //BA must carry the ammo in same location as the weapon. //This allows for squad weapons and individual trooper weapons //such as NARC and the support weapons in TW/TO if(mounted.getLocation() != mountedAmmo.getLocation()) return false; return super.loadWeaponWithSameAmmo(mounted, mountedAmmo); }} // End public class BattleArmor extends Infantry implements Serializable
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -