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

📄 ammotype.java

📁 MegaMek is a networked Java clone of BattleTech, a turn-based sci-fi boardgame for 2+ players. Fight
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/* * MegaMek - * Copyright (C) 2000,2001,2002,2003,2004,2005 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.util.Enumeration;import java.util.Vector;public class AmmoType extends EquipmentType {    // ammo types    public static final int     T_BA_SMALL_LASER    = -3; // !usesAmmo(), 3 damage per hit    public static final int     T_BA_MG             = -2; // !usesAmmo(), 2 damage per hit    public static final int     T_NA                = -1;    public static final int     T_AC                = 1;    public static final int     T_VEHICLE_FLAMER    = 2;    public static final int     T_MG                = 3;    public static final int     T_MG_HEAVY          = 4;    public static final int     T_MG_LIGHT          = 5;    public static final int     T_GAUSS             = 6;    public static final int     T_LRM               = 7;    public static final int     T_LRM_TORPEDO       = 8;    public static final int     T_SRM               = 9;    public static final int     T_SRM_TORPEDO       = 10;    public static final int     T_SRM_STREAK        = 11;    public static final int     T_MRM               = 12;    public static final int     T_NARC              = 13;    public static final int     T_AMS               = 14;    public static final int     T_ARROW_IV          = 15;    public static final int     T_LONG_TOM          = 16;    public static final int     T_SNIPER            = 17;    public static final int     T_THUMPER           = 18;    public static final int     T_AC_LBX            = 19;    public static final int     T_AC_ULTRA          = 20;    public static final int     T_GAUSS_LIGHT       = 21;    public static final int     T_GAUSS_HEAVY       = 22;    public static final int     T_AC_ROTARY         = 23;    public static final int     T_SRM_ADVANCED      = 24;    public static final int     T_BA_INFERNO        = 25;    public static final int     T_BA_MICRO_BOMB     = 26;    public static final int     T_LRM_TORPEDO_COMBO = 27;    public static final int     T_MINE              = 28;    public static final int     T_ATM               = 29; // Clan ATM missile systems    public static final int     T_ROCKET_LAUNCHER   = 30;    public static final int     T_INARC             = 31;    public static final int     T_LRM_STREAK        = 32;    public static final int     T_AC_LBX_THB        = 33;    public static final int     T_AC_ULTRA_THB      = 34;    public static final int     T_LAC               = 35;    public static final int     T_HEAVY_FLAMER      = 36;    public static final int     T_COOLANT_POD       = 37; // not really ammo, but explodes and is depleted    public static final int     T_EXLRM             = 38;    public static final int     T_TBOLT5            = 39;    public static final int     T_TBOLT10           = 40;    public static final int     T_TBOLT15           = 41;    public static final int     T_TBOLT20           = 42;    public static final int     T_RAIL_GUN          = 43;    public static final int     T_MAGSHOT           = 44; // Magshot from TR3055U and S7 Pack    public static final int     T_PXLRM             = 45;    public static final int     T_HSRM              = 46;    public static final int     T_MRM_STREAK        = 47;    public static final int     T_MPOD              = 48;    public static final int     NUM_TYPES           = 49;        // ammo flags    public static final long     F_MG                = 0x0001L;    public static final long     F_BATTLEARMOR       = 0x0002L; // only used by BA squads    public static final long     F_PROTOMECH         = 0x0004L; // only used by Protomechs    public static final long     F_HOTLOAD           = 0x0008L; // Ammo Can be hotloaded    // ammo munitions, used for custom loadouts    // N.B. we play bit-shifting games to allow "incendiary"    //      to be combined to other munition types.    // M_STANDARD can be used for anything.    public static final long     M_STANDARD          = 0;    // AC Munition Types    public static final long     M_CLUSTER           = 0x000000001L;    public static final long     M_ARMOR_PIERCING    = 0x000000002L;    public static final long     M_FLECHETTE         = 0x000000004L;    public static final long     M_INCENDIARY_AC     = 0x000000008L;    public static final long     M_PRECISION         = 0x000000010L;    public static final long     M_TRACER            = 0x400000000L;    // ATM Munition Types    public static final long     M_EXTENDED_RANGE    = 0x000000020L;    public static final long     M_HIGH_EXPLOSIVE    = 0x000000040L;    // LRM & SRM Munition Types    public static final long     M_FRAGMENTATION     = 0x000000080L;    public static final long     M_LISTEN_KILL       = 0x000000100L;    public static final long     M_ANTI_TSM          = 0x000000200L;    public static final long     M_NARC_CAPABLE      = 0x000000400L;    public static final long     M_ARTEMIS_CAPABLE   = 0x000000800L;    // LRM Munition Types    // Incendiary is special, though...    //FIXME - I'm not implemented!!!    public static final long     M_INCENDIARY_LRM    = 0x000001000L;    public static final long     M_FLARE             = 0x000002000L;    public static final long     M_SEMIGUIDED        = 0x000004000L;    public static final long     M_SWARM             = 0x000008000L;    public static final long     M_SWARM_I           = 0x000010000L;    public static final long     M_THUNDER           = 0x000020000L;    public static final long     M_THUNDER_AUGMENTED = 0x000040000L;    public static final long     M_THUNDER_INFERNO   = 0x000080000L;    public static final long     M_THUNDER_VIBRABOMB = 0x000100000L;    public static final long     M_THUNDER_ACTIVE    = 0x000200000L;    // SRM Munition Types    public static final long     M_INFERNO           = 0x000400000L;    public static final long     M_AX_HEAD           = 0x000800000L;    // iNarc Munition Types    public static final long     M_EXPLOSIVE         = 0x001000000L;    public static final long     M_ECM               = 0x002000000L;    public static final long     M_HAYWIRE           = 0x004000000L;    public static final long     M_NEMESIS           = 0x008000000L;    // Narc Munition Types    public static final long     M_NARC_EX           = 0x010000000L;    // Arrow IV Munition Types    public static final long     M_HOMING            = 0x020000000L;    public static final long     M_FASCAM            = 0x040000000L;    public static final long     M_INFERNO_IV        = 0x080000000L;    public static final long     M_VIBRABOMB_IV      = 0x100000000L;    public static final long     M_SMOKE             = 0x200000000L;    // Nuclear Munitions    public static final long     M_DAVY_CROCKETT_M   = 0x800000000L;    /*public static final String[] MUNITION_NAMES = { "Standard",        "Cluster", "Armor Piercing", "Flechette", "Incendiary", "Incendiary", "Precision",        "Extended Range", "High Explosive", "Flare", "Fragmentation", "Inferno",        "Semiguided", "Swarm", "Swarm-I", "Thunder", "Thunder/Augmented",        "Thunder/Inferno", "Thunder/Vibrabomb", "Thunder/Active", "Explosive",        "ECM", "Haywire", "Nemesis", "Homing", "FASCAM", "Inferno-IV",        "Vibrabomb-IV", "Smoke", "Narc-Capable", "Artemis-Capable",        "Listen-Kill", "Anti-TSM", "Acid-Head" };        */    private static Vector[] m_vaMunitions = new Vector[NUM_TYPES];    public static Vector getMunitionsFor(int nAmmoType) {        return m_vaMunitions[nAmmoType];    }    protected int damagePerShot;    protected int rackSize;    private int ammoType;    private long munitionType;    protected int shots;            public AmmoType() {        criticals = 1;        tonnage = 1.0f;        explosive = true;        instantModeSwitch = false;    }    /**     * When comparing <code>AmmoType</code>s, look at the ammoType and rackSize.     *     * @param   other the <code>Object</code> to compare to this one.     * @return  <code>true</code> if the other is an <code>AmmoType</code>     *          object of the same <code>ammoType</code> as this object.     *          N.B. different munition types are still equal.     */    public boolean equals( Object other ) {        if ( !(other instanceof AmmoType) ) {            return false;        }        return (this.getAmmoType() == ( (AmmoType) other ).getAmmoType() && this.getRackSize() == ((AmmoType)other).getRackSize());    }    public int getAmmoType() {        return ammoType;    }    public long getMunitionType() {        return munitionType;    }    protected int heat;    protected RangeType range;    protected int tech;    public int getDamagePerShot() {        return damagePerShot;    }    public int getRackSize() {        return rackSize;    }    public int getShots() {        return shots;    }    // Returns the first usable ammo type for the given oneshot launcher    public static AmmoType getOneshotAmmo(Mounted mounted) {        WeaponType wt = (WeaponType)mounted.getType();        Vector Vammo = AmmoType.getMunitionsFor(wt.getAmmoType());        AmmoType at = null;        for (int i = 0; i < Vammo.size(); i++) {            at = (AmmoType)Vammo.elementAt(i);            if ((at.getRackSize() == wt.getRackSize()) && (TechConstants.isLegal(mounted.getType().getTechLevel(),at.getTechLevel()))) {                return at;            }        }        return null; //couldn't find any ammo for this weapon type    }    public static void initializeTypes() {        // Save copies of the SRM and LRM ammos to use to create munitions.        Vector srmAmmos = new Vector(11);        Vector clanSrmAmmos = new Vector();        Vector lrmAmmos = new Vector(26);        Vector clanLrmAmmos = new Vector();        Vector acAmmos  = new Vector(4);        Vector arrowAmmos = new Vector(4);        Vector clanArrowAmmos = new Vector(4);        Vector thumperAmmos = new Vector(2);        Vector artyAmmos = new Vector(6);        Vector clanArtyAmmos = new Vector(6);        Vector munitions = new Vector();        Enumeration baseTypes = null;        Enumeration mutators = null;        AmmoType base = null;        MunitionMutator mutator = null;        // all level 1 ammo        EquipmentType.addType(createISVehicleFlamerAmmo());        EquipmentType.addType(createISMGAmmo());        EquipmentType.addType(createISMGAmmoHalf());        base = createISAC2Ammo();        acAmmos.addElement( base );        EquipmentType.addType( base );        base = createISAC5Ammo();        acAmmos.addElement( base );        EquipmentType.addType( base );        base = createISAC10Ammo();        acAmmos.addElement( base );        EquipmentType.addType( base );        base = createISAC20Ammo();        acAmmos.addElement( base );        EquipmentType.addType( base );        base = createISLRM5Ammo();        lrmAmmos.addElement( base );        EquipmentType.addType( base );        base = createISLRM10Ammo();        lrmAmmos.addElement( base );        EquipmentType.addType( base );        base = createISLRM15Ammo();        lrmAmmos.addElement( base );        EquipmentType.addType( base );        base = createISLRM20Ammo();        lrmAmmos.addElement( base );        EquipmentType.addType( base );        base = createISSRM2Ammo();        srmAmmos.addElement( base );        EquipmentType.addType( base );        base = createISSRM4Ammo();        srmAmmos.addElement( base );        EquipmentType.addType( base );        base = createISSRM6Ammo();        srmAmmos.addElement( base );        EquipmentType.addType( base );        // Level 3 Ammo        // Note, some level 3 stuff is mixed into level 2.        base = createISLAC2Ammo();        acAmmos.add(base);        EquipmentType.addType(base);        base = createISLAC5Ammo();        acAmmos.add(base);        EquipmentType.addType(base);        base = createISLAC10Ammo();        acAmmos.add(base);        EquipmentType.addType(base);        base = createISLAC20Ammo();        acAmmos.add(base);        EquipmentType.addType(base);        EquipmentType.addType(createISHeavyFlamerAmmo());        EquipmentType.addType(createCoolantPod());        EquipmentType.addType(createISRailGunAmmo());        EquipmentType.addType(createISMPodAmmo());                // Start of Level2 Ammo        EquipmentType.addType(createISLB2XAmmo());        EquipmentType.addType(createISLB5XAmmo());        EquipmentType.addType(createISLB10XAmmo());        EquipmentType.addType(createISLB20XAmmo());        EquipmentType.addType(createISLB2XClusterAmmo());        EquipmentType.addType(createISLB5XClusterAmmo());        EquipmentType.addType(createISLB10XClusterAmmo());

⌨️ 快捷键说明

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