📄 weapontype.java
字号:
/* * 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;/** * A type of mech or vehicle weapon. There is only one instance of this * weapon for all weapons of this type. */public class WeaponType extends EquipmentType { public static final int DAMAGE_MISSILE = -2; public static final int DAMAGE_VARIABLE = -3; public static final int DAMAGE_SPECIAL = -4; public static final int DAMAGE_ARTILLERY = -5; public static final int WEAPON_NA = Integer.MIN_VALUE; // weapon flags (note: many weapons can be identified by their ammo type) public static final long F_DIRECT_FIRE = 0x000000001L; // marks any weapon affected by a targetting computer public static final long F_FLAMER = 0x000000002L; public static final long F_LASER = 0x000000004L; // for eventual glazed armor purposes public static final long F_PPC = 0x000000008L; // " public static final long F_AUTO_TARGET = 0x000000010L; // for weapons that target automatically (AMS) public static final long F_NO_FIRES = 0x000000020L; // cannot start fires public static final long F_PROTOMECH = 0x000000040L; // Protomech weapons, which need weird ammo stuff. public static final long F_SOLO_ATTACK = 0x000000080L; // must be only weapon attacking public static final long F_SPLITABLE = 0x000000100L; // Weapons that can be split between locations public static final long F_MG = 0x000000200L; // MGL; for rapid fire set up public static final long F_INFERNO = 0x000000400L; // Inferno weapon public static final long F_INFANTRY = 0x000000800L; // small calibre weapon, no ammo, damage based on # men shooting public static final long F_BATTLEARMOR = 0x000001000L; // multiple shots resolved in one to-hit (kinda like RAC, only not) public static final long F_DOUBLE_HITS = 0x000002000L; // two shots hit per one rolled public static final long F_MISSILE_HITS = 0x000004000L; // use missile rules or # of hits public static final long F_ONESHOT = 0x000008000L; // weapon is oneShot. public static final long F_ARTILLERY = 0x000010000L; public static final long F_BALLISTIC = 0x000020000L; // For Gunnery/Ballistic skill public static final long F_ENERGY = 0x000040000L; // For Gunnery/Energy skill public static final long F_MISSILE = 0x000080000L; // For Gunnery/Missile skill public static final long F_PLASMA = 0x000100000L; // For fires public static final long F_INCENDIARY_NEEDLES = 0x000200000L; // For fires public static final long F_PROTOTYPE = 0x000400000L; // for war of 3039 prototype weapons public static final long F_HEATASDICE = 0x000800000L; // heat is listed in dice, not points public static final long F_AMS = 0x001000000L; // Weapon is an anti-missile system. public static final long F_BOOST_SWARM = 0x002000000L; // boost leg & swarm public static final long F_INFANTRY_ONLY = 0x004000000L; // only target infantry public static final long F_TAG = 0x008000000L; // Target acquisition gear public static final long F_C3M = 0x010000000L; // C3 Master with Target acquisition gear public static final long F_PLASMA_MFUK = 0x020000000L; // Plasma Rifle public static final long F_EXTINGUISHER = 0x040000000L; // Fire extinguisher public static final long F_SINGLE_TARGET = 0x080000000L; // Does less damage to PBI in maxtech rules protected RangeType rangeL; protected int heat; protected int damage; private int rackSize; // or AC size, or whatever private int ammoType; private int minimumRange; private int shortRange; private int mediumRange; private int longRange; private int extremeRange; private int waterShortRange; private int waterMediumRange; private int waterLongRange; private int waterExtremeRange; public void setDamage(int inD) { damage = inD; } public void setName (String inN) { name = inN; setInternalName(inN); } public void setMinimumRange(int inMR) { minimumRange = inMR; } public void setRanges(int sho, int med, int lon, int ext) { shortRange = sho; mediumRange = med; longRange = lon; extremeRange = ext; } public void setWaterRanges(int sho, int med, int lon, int ext) { waterShortRange = sho; waterMediumRange = med; waterLongRange = lon; waterExtremeRange = ext; } public void setAmmoType(int inAT) { ammoType = inAT; } public void setRackSize(int inRS) { rackSize = inRS; } public WeaponType() { } public int getHeat() { return heat; } public int getFireTN() { if (hasFlag(F_NO_FIRES)) { return TargetRoll.IMPOSSIBLE; } else if (hasFlag(F_FLAMER)) { return 4; } else if (hasFlag(F_PLASMA)) { return 5; } else if (hasFlag(F_PLASMA_MFUK)) { return 5; } else if (hasFlag(F_INCENDIARY_NEEDLES)) { return 6; } else if (hasFlag(F_PPC) || hasFlag(F_LASER)) { return 7; } else { return 9; } } public int getDamage() { return damage; } public int getRackSize() { return rackSize; } public int getAmmoType() { return ammoType; } public int[] getRanges() { return new int[] {minimumRange, shortRange, mediumRange, longRange, extremeRange}; } public int getMinimumRange() { return minimumRange; } public int getShortRange() { return shortRange; } public int getMediumRange() { return mediumRange; } public int getLongRange() { return longRange; } public int getExtremeRange() { return extremeRange; } public int[] getWRanges() { return new int[] {minimumRange, waterShortRange, waterMediumRange, waterLongRange, waterExtremeRange}; } public int getWShortRange() { return waterShortRange; } public int getWMediumRange() { return waterMediumRange; } public int getWLongRange() { return waterLongRange; } public int getWExtremeRange() { return waterExtremeRange; } /** * Add all the types of weapons we can create to the list */ public static void initializeTypes() { // all tech level 1 weapons EquipmentType.addType(createFlamer()); EquipmentType.addType(createVehicleFlamer()); EquipmentType.addType(createSmallLaser()); EquipmentType.addType(createMediumLaser()); EquipmentType.addType(createLargeLaser()); EquipmentType.addType(createPPC()); EquipmentType.addType(createAC2()); EquipmentType.addType(createAC5()); EquipmentType.addType(createAC10()); EquipmentType.addType(createAC20()); EquipmentType.addType(createMG()); EquipmentType.addType(createLRM5()); EquipmentType.addType(createLRM10()); EquipmentType.addType(createLRM15()); EquipmentType.addType(createLRM20()); EquipmentType.addType(createSRM2()); EquipmentType.addType(createSRM4()); EquipmentType.addType(createSRM6()); EquipmentType.addType(createLRT5()); EquipmentType.addType(createLRT10()); EquipmentType.addType(createLRT15()); EquipmentType.addType(createLRT20()); EquipmentType.addType(createSRT2()); EquipmentType.addType(createSRT4()); EquipmentType.addType(createSRT6()); // Start of Infantry weapons (Level1) EquipmentType.addType(createInfRifle()); EquipmentType.addType(createInfMG()); EquipmentType.addType(createInfSRM()); EquipmentType.addType(createInfLRM()); EquipmentType.addType(createInfLaser()); EquipmentType.addType(createInfFlamer()); EquipmentType.addType(createInfInfernoSRM()); // Start of Inner Sphere Level2 weapons EquipmentType.addType(createISERPPC()); EquipmentType.addType(createISERLargeLaser()); EquipmentType.addType(createISERMediumLaser()); EquipmentType.addType(createISERSmallLaser()); EquipmentType.addType(createISLargePulseLaser()); EquipmentType.addType(createISMediumPulseLaser()); EquipmentType.addType(createISSmallPulseLaser()); EquipmentType.addType(createISLBXAC2()); EquipmentType.addType(createISLBXAC5()); EquipmentType.addType(createISLBXAC10()); EquipmentType.addType(createISLBXAC20()); EquipmentType.addType(createISGaussRifle()); EquipmentType.addType(createISLightGaussRifle()); EquipmentType.addType(createISHeavyGaussRifle()); EquipmentType.addType(createISUltraAC2()); EquipmentType.addType(createISUltraAC5()); EquipmentType.addType(createISUltraAC10()); EquipmentType.addType(createISUltraAC20()); EquipmentType.addType(createISRAC2()); EquipmentType.addType(createISRAC5()); EquipmentType.addType(createISStreakSRM2()); EquipmentType.addType(createISSRM2OS()); EquipmentType.addType(createISSRT2OS()); EquipmentType.addType(createISStreakSRM2OS()); EquipmentType.addType(createISStreakSRM4()); EquipmentType.addType(createISSRM4OS()); EquipmentType.addType(createISSRT4OS()); EquipmentType.addType(createISStreakSRM4OS()); EquipmentType.addType(createISStreakSRM6()); EquipmentType.addType(createISSRM6OS()); EquipmentType.addType(createISSRT6OS()); EquipmentType.addType(createISStreakSRM6OS()); EquipmentType.addType(createISMRM10()); EquipmentType.addType(createISMRM20()); EquipmentType.addType(createISMRM30()); EquipmentType.addType(createISMRM40()); EquipmentType.addType(createISMRM10OS()); EquipmentType.addType(createISMRM20OS()); EquipmentType.addType(createISMRM30OS()); EquipmentType.addType(createISMRM40OS()); EquipmentType.addType(createISLRM5OS()); EquipmentType.addType(createISLRM10OS()); EquipmentType.addType(createISLRM15OS()); EquipmentType.addType(createISLRM20OS()); EquipmentType.addType(createISLRT5OS()); EquipmentType.addType(createISLRT10OS()); EquipmentType.addType(createISLRT15OS()); EquipmentType.addType(createISLRT20OS()); EquipmentType.addType(createISAMS()); EquipmentType.addType(createISNarc()); EquipmentType.addType(createISNarcOS()); EquipmentType.addType(createISImprovedNarc()); EquipmentType.addType(createISImprovedNarcOS()); EquipmentType.addType(createISRL10()); EquipmentType.addType(createISRL15()); EquipmentType.addType(createISRL20()); EquipmentType.addType(createISArrowIVSystem()); EquipmentType.addType(createISLongTom()); EquipmentType.addType(createISSniper()); EquipmentType.addType(createISThumper()); EquipmentType.addType(createISTAG()); EquipmentType.addType(createISLightTAG()); EquipmentType.addType(createCLTAG()); EquipmentType.addType(createCLLightTAG()); // Start of Inner Sphere Level3 weapons EquipmentType.addType(createISLargeXPulseLaser()); EquipmentType.addType(createISMediumXPulseLaser()); EquipmentType.addType(createISSmallXPulseLaser()); EquipmentType.addType(createISLaserAMS()); EquipmentType.addType(createISLaserAMSTHB()); EquipmentType.addType(createISGaussRiflePrototype()); EquipmentType.addType(createISLBXAC10Prototype()); EquipmentType.addType(createISUltraAC5Prototype()); EquipmentType.addType(createISERLargeLaserPrototype()); EquipmentType.addType(createISMediumPulseLaserPrototype()); EquipmentType.addType(createISTHBLBXAC2()); EquipmentType.addType(createISTHBLBXAC5()); EquipmentType.addType(createISTHBLBXAC20()); EquipmentType.addType(createISTHBUltraAC2()); EquipmentType.addType(createISTHBUltraAC10()); EquipmentType.addType(createISTHBUltraAC20()); EquipmentType.addType(createISLAC2()); EquipmentType.addType(createISLAC5()); EquipmentType.addType(createISHeavyFlamer()); EquipmentType.addType(createISExtendedLRM5()); EquipmentType.addType(createISExtendedLRM10()); EquipmentType.addType(createISExtendedLRM15()); EquipmentType.addType(createISExtendedLRM20()); EquipmentType.addType(createISThunderbolt5()); EquipmentType.addType(createISThunderbolt10()); EquipmentType.addType(createISThunderbolt15()); EquipmentType.addType(createISThunderbolt20()); EquipmentType.addType(createISHERPPC()); EquipmentType.addType(createISSNPPC()); EquipmentType.addType(createISRailGun()); EquipmentType.addType(createISMagshotGR()); EquipmentType.addType(createFireExtinguisher()); EquipmentType.addType(createISLightPPC()); EquipmentType.addType(createISHeavyPPC()); EquipmentType.addType(createISRAC10()); //MFUK EquipmentType.addType(createISRAC20()); //MFUK EquipmentType.addType(createISLAC10()); //MFUK EquipmentType.addType(createISLAC20()); //MFUK EquipmentType.addType(createISStreakMRM10());//guessed from fluff EquipmentType.addType(createISStreakMRM20());//guessed from fluff EquipmentType.addType(createISStreakMRM30());//guessed from fluff EquipmentType.addType(createISStreakMRM40());//guessed from fluff EquipmentType.addType(createISHawkSRM2()); //guessed from fluff EquipmentType.addType(createISHawkSRM4()); //guessed from fluff EquipmentType.addType(createISHawkSRM6()); //guessed from fluff EquipmentType.addType(createISPXLRM5()); //guessed from fluff
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -