⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 battlearmor.java

📁 MegaMek is a networked Java clone of BattleTech, a turn-based sci-fi boardgame for 2+ players. Fight
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
/* * MegaMek - Copyright (C) 2002,2003,2004 Ben Mazur (bmazur@sev.org) *  *  This program 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 2 of the License, or (at your option)  *  any later version. *  *  This program 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. */package megamek.common;import java.io.Serializable;import java.util.Vector;/** * This class represents a squad or point of battle armor equiped infantry, * sometimes referred to as "Elementals".  Much of the behaviour of a * battle armor unit is identical to that of an infantry platoon, and is * rather different than that of a Mek or Tank. * * @author  Suvarov454@sourceforge.net (James A. Damour ) * @version $revision:$ *//* *   PLEASE NOTE!!!  My programming style is to put constants first in *                   tests so the compiler catches my "= for ==" errors. */public class BattleArmor    extends Infantry    implements Serializable{    /*     * Infantry have no critical slot limitations.     * IS squads usually have 4 men, Clan points usually have 5.     * Have a location that represents the entire squad.     */    private static final int[]    IS_NUM_OF_SLOTS   = {7,2,2,2,2,2};    private static final String[] IS_LOCATION_ABBRS = { "Squad",                                                        "Trooper 1",                                                        "Trooper 2",                                                        "Trooper 3",                                                        "Trooper 4",                                                        "Trooper 5"};    private static final String[] IS_LOCATION_NAMES = { "Squad",                                                        "Trooper 1",                                                        "Trooper 2",                                                        "Trooper 3",                                                        "Trooper 4",                                                        "Trooper 5" };    private static final int[]    CLAN_NUM_OF_SLOTS   = {10,2,2,2,2,2};    private static final String[] CLAN_LOCATION_ABBRS = { "Point",                                                          "Trooper 1",                                                          "Trooper 2",                                                          "Trooper 3",                                                          "Trooper 4",                                                          "Trooper 5"};    private static final String[] CLAN_LOCATION_NAMES = { "Point",                                                          "Trooper 1",                                                          "Trooper 2",                                                          "Trooper 3",                                                          "Trooper 4",                                                          "Trooper 5" };    public static final int MANIPULATOR_NONE = 0;    public static final int MANIPULATOR_ARMORED_GLOVE = 1;    public static final int MANIPULATOR_BASIC = 2;    public static final int MANIPULATOR_BASIC_MINE_CLEARANCE = 3;    public static final int MANIPULATOR_BATTLE = 4;    public static final int MANIPULATOR_BATTLE_MAGNET = 5;    public static final int MANIPULATOR_BATTLE_VIBRO = 6;    public static final int MANIPULATOR_HEAVY_BATTLE = 7;    public static final int MANIPULATOR_HEAVY_BATTLE_VIBRO = 8;    public static final int MANIPULATOR_SALVAGE_ARM = 9;    public static final int MANIPULATOR_CARGO_LIFTER = 10;    public static final int MANIPULATOR_INDUSTRIAL_DRILL = 11;    public static final String[] MANIPULATOR_TYPE_STRINGS = {"None",                                                              "Armored Glove",                                                              "Basic Manipulator",                                                              "Basic Manipulator (Mine Clearance)",                                                              "Battle Claw",                                                              "Battle Claw (Magnets)",                                                              "Battle Claw (Vibro-Claws)",                                                              "Heavy Battle Claw",                                                              "Heavy Battle Claw (Vibro-Claws)",                                                              "Salvage Arm",                                                              "Cargo Lifter",                                                              "Industrial Drill"};    /**     * The number of men alive in this unit at the beginning of the phase,     * before it begins to take damage.     */    private int         troopersShooting = 0;    /**     * The battle value of this unit.  This value should     * be set when the unit's file is read.     */    private int myBV = 0;    private int myCost = -1;    private int weightClass = -1;    private int chassisType = -1;    /**     * Flag that is <code>true</code> when this     * object's constructor has completed.     */    private boolean     isInitialized = false;    /**     * Flag that is <code>true</code> when this unit is equipped with stealth.     */    private boolean     isStealthy = false;    /**     * Flag that is <code>true</code> when this unit is equipped with mimetic     * Camo.     */    private boolean     isMimetic = false;    /**     * Flag that is <code>true</code> when this unit is equipped with simple     * Camo.     */    private boolean     isSimpleCamo = false;    /**     * Modifiers to <code>ToHitData</code> for stealth.     */    private int         shortStealthMod = 0;    private int         mediumStealthMod = 0;    private int         longStealthMod = 0;    private String      stealthName = null;    private int         vibroClawDamage = -1;        // Public and Protected constants, constructors, and methods.    /**     * Model name of the Clan's water elemental.     */    public static final String CLAN_WATER_ELEMENTAL = "Undine";    /**     * Internal name of the Inner Sphere's disposable SRM2 ammo pack.     */    public static final String IS_DISPOSABLE_SRM2_AMMO =        "BA-SRM2 (one shot) Ammo";    /**     * Internal name of the Inner Sphere's disposable NARC ammo pack.     */    public static final String IS_DISPOSABLE_NARC_AMMO =        "BA-Compact Narc Ammo";    /**     * The internal name for Boarding Claw equipment.     */    public static final String BOARDING_CLAW = "BA-Boarding Claw";    /**     * The internal name for Assault Claw equipment.     */    public static final String ASSAULT_CLAW = "BA-Assault Claws";    /**     * The internal name for Fire Protection equipment.     */    public static final String FIRE_PROTECTION = "BA-Fire Resistant Armor";    /**     * The internal name for Magnetic Clamp equipment.     */    public static final String MAGNETIC_CLAMP = "BA-Magnetic Clamp";    /**     * The internal name for the Mine Launcher weapon.     */    public static final String MINE_LAUNCHER = "BAMineLauncher";    /**     * The internal name for Stealth equipment.     */    public static final String STEALTH = "Basic Stealth";    /**     * The internal name for Advanced Stealth equipment.     */    public static final String ADVANCED_STEALTH = "Standard Stealth";    /**     * The internal name for Expert Stealth equipment.     */    public static final String EXPERT_STEALTH = "Improved Stealth";    /**     * The internal name for Mimetic Camo equipment.     */    public static final String MIMETIC_CAMO = "Mimetic Armor";    /**     * The internal name for Simple Camo equipment.     */    public static final String SIMPLE_CAMO = "Simple Camo";    /**     * The internal name for Single-Hex ECM equipment.     */    public static final String SINGLE_HEX_ECM = "Single-Hex ECM";    /**     * The name for Longinus squads.     */    public static final String LONGINUS_SQUAD = "Longinus";    /**     * The name for Purifier squads.     */    public static final String PURIFIER_SQUAD = "Purifier";    /**     * The maximum number of men in an Inner Sphere battle armor squad.     */    public static final int     BA_MAX_MEN = 4;    /**     * The maximum number of men in a Clan Elemental point.     */    public static final int     BA_CLAN_MAX_MEN = 5;    /**     * The location for infantry equipment.     */    public static final int     LOC_SQUAD       = 0;    // The next few things are never referenced!    // Why do we even have them?...    // This looks like the beginnings of implementing 6-man squads, though.    // Which we DO want.    //FIXME    public static final int     LOC_IS_1        = 1;    public static final int     LOC_IS_2        = 2;    public static final int     LOC_IS_3        = 3;    public static final int     LOC_IS_4        = 4;    public static final int     LOC_IS_5        = 5;    public static final int     LOC_IS_6        = 6;    public static final int     LOC_CLAN_1      = 1;    public static final int     LOC_CLAN_2      = 2;    public static final int     LOC_CLAN_3      = 3;    public static final int     LOC_CLAN_4      = 4;    public static final int     LOC_CLAN_5      = 5;    public static final int     LOC_CLAN_6      = 6;    public String[] getLocationAbbrs() {        if ( !this.isInitialized || this.isClan() ) {            return CLAN_LOCATION_ABBRS;        }        return IS_LOCATION_ABBRS;    }    public String[] getLocationNames() {        if ( !this.isInitialized || this.isClan() ) {            return CLAN_LOCATION_NAMES;        }        return IS_LOCATION_NAMES;    }    /**     * Returns the number of locations in this unit.     */    public int locations() {        int retVal = Math.round(getWeight());        if (retVal == 0) {            // Return one more than the maximum number of men in the unit.            if ( !this.isInitialized || this.isClan() ) {                retVal =  BA_CLAN_MAX_MEN + 1;            }            retVal =  BA_MAX_MEN + 1;        } else {            retVal++;        }        return retVal;    }    /**     * Generate a new, blank, battle armor unit.     * Hopefully, we'll be loaded from somewhere.     */    public BattleArmor() {        // Instantiate the superclass.        super();        // All Battle Armor squads are Clan until specified otherwise.        this.setTechLevel( TechConstants.T_CLAN_LEVEL_2 );        // Construction complete.        this.isInitialized = true;    }    /**     * Returns this entity's original jumping mp.     */    public int getOriginalJumpMP() {        return jumpMP;    }    /**    * Returns this entity's walking mp, factored    * for extreme temperatures and gravity.    */    public int getWalkMP() {        int i;        int j = applyGravityEffectsOnMP(getOriginalWalkMP());        if (game != null) {            i = game.getTemperatureDifference();            return Math.max(j - i, 0);        }        return j;    }    /**    * Returns this entity's running mp, factored    * for extreme temperatures and gravity.     */    public int getRunMP(boolean gravity) {        int i;        int j = applyGravityEffectsOnMP(getOriginalRunMP());        if (game != null) {            i = game.getTemperatureDifference();            return Math.max(j - i, 0);        }        return j;    }        /**     * Returns this entity's current jumping MP, not effected by terrain,     * factored for Gravity.     * Certain types of equipment prevent a squad from jumping.     */    public int getJumpMP() {        if ( this.isBurdened() ) {            return 0;        }		return super.getJumpMP();    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -