📄 equipmenttype.java
字号:
/* * 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. *//* * EquipmentType.java * * Created on April 1, 2002, 1:35 PM */package megamek.common;import java.util.*;/** * Represents any type of equipment mounted on a mechs, excluding systems and * actuators. * * @author Ben * @version */public class EquipmentType { public static final float TONNAGE_VARIABLE = Float.MIN_VALUE; public static final int CRITICALS_VARIABLE = Integer.MIN_VALUE; public static final int BV_VARIABLE = Integer.MIN_VALUE; public static final int COST_VARIABLE = Integer.MIN_VALUE; public static final int T_ARMOR_UNKNOWN = -1; public static final int T_ARMOR_STANDARD = 0; public static final int T_ARMOR_FERRO_FIBROUS = 1; public static final int T_ARMOR_REACTIVE = 2; public static final int T_ARMOR_REFLECTIVE = 3; public static final int T_ARMOR_HARDENED = 4; public static final int T_ARMOR_LIGHT_FERRO = 5; public static final int T_ARMOR_HEAVY_FERRO = 6; public static final int T_ARMOR_PATCHWORK = 7; public static final int T_ARMOR_STEALTH = 8; public static final int T_ARMOR_FERRO_FIBROUS_PROTO = 9; public static final int T_STRUCTURE_UNKNOWN = -1; public static final int T_STRUCTURE_STANDARD = 0; public static final int T_STRUCTURE_ENDO_STEEL = 1; public static final int T_STRUCTURE_ENDO_PROTOTYPE = 2; public static final int T_STRUCTURE_REINFORCED = 3; public static final int T_STRUCTURE_COMPOSITE = 4; public static final String[] armorNames = {"Standard", "Ferro-Fibrous", "Reactive", "Reflective", "Hardened", "Light Ferro-Fibrous", "Heavy Ferro-Fibrous", "Patchwork", "Stealth", "Ferro-Fibrous Prototype"}; public static final String[] structureNames = {"Standard", "Endo Steel", "Endo Steel Prototype", "Reinforced", "Composite"}; public static final int[] structureLevels = {1, 2, 3, 3, 3}; public static final double[] structureCosts = {400, 1600, 1600, // Assume for now that prototype is not more expensive 6400, 1600}; public static final double[] armorCosts = {10000, 20000, 30000, 20000, 15000, 15000, 25000, 10000, // This is obviously wrong... 50000, 20000}; // Assume for now that prototype is not more expensive public static final double[] armorPointMultipliers = {1, 1.12, 1, 1, 1, 1.06, 1.24, 1, 1, 1.12}; public static final double POINT_MULTIPLIER_UNKNOWN = 1; public static final double POINT_MULTIPLIER_CLAN_FF = 1.2; protected String name = null; protected String internalName = null; private Vector namesVector = new Vector(); protected float tonnage = 0; protected int criticals = 0; protected boolean explosive = false; protected boolean hittable = true; // if false, reroll critical hits /** can the crits for this be spread over locations? */ protected boolean spreadable = false; protected int toHitModifier = 0; protected int techLevel = TechConstants.T_TECH_UNKNOWN; protected long flags = 0; protected int subType = 0; protected double bv = 0; // battle value point system protected double cost = 0; // The C-Bill cost of the item. /** * what modes can this equipment be in? */ protected Vector modes = null; /** * can modes be switched instantly, or at end of turn? */ protected boolean instantModeSwitch = true; // static list of eq protected static Vector allTypes; protected static Hashtable lookupHash; /** Creates new EquipmentType */ public EquipmentType() { } public void setFlags(long inF) { flags = inF; } public void setSubType(int newFlags) { subType = newFlags; } public void addSubType(int newFlag) { subType |= newFlag; } public boolean hasSubType(int testFlag) { return (subType & testFlag) != 0; } public String getName() { return name; } public String getDesc() { String result = EquipmentMessages.getString("EquipmentType."+name); if (result != null) return result; return name; } public String getInternalName() { return internalName; } public int getTechLevel() { return techLevel; } public float getTonnage(Entity entity) { return tonnage; } public int getCriticals(Entity entity) { return criticals; } public boolean isExplosive() { return explosive; } public boolean isHittable() { return hittable; } // like margarine! public boolean isSpreadable() { return spreadable; } public int getToHitModifier() { return toHitModifier; } public long getFlags() { return flags; } public boolean hasFlag(long flag) { return (flags & flag) != 0; } public double getBV(Entity entity) { return bv; } /** * * @return <code>true</code> if this type of equipment has set of modes * that it can be in. */ public boolean hasModes() { return modes != null; } /** * * @return the number of modes that this type of equipment can be in or * <code>0</code> if it doesn't have modes. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -