megamek.common
Class EquipmentType

java.lang.Object
  extended by megamek.common.EquipmentType
Direct Known Subclasses:
AmmoType, MiscType, WeaponType

public class EquipmentType
extends java.lang.Object

Represents any type of equipment mounted on a mechs, excluding systems and actuators.

Version:
Author:
Ben

Field Summary
protected static java.util.Vector<EquipmentType> allTypes
           
static double[] armorCosts
           
static java.lang.String[] armorNames
           
static double[] armorPointMultipliers
           
protected  int[] availRating
           
protected  double bv
           
static int BV_VARIABLE
           
protected  double cost
           
static int COST_VARIABLE
           
protected  int criticals
           
static int CRITICALS_VARIABLE
           
static int DATE_NONE
           
 java.util.Vector<java.lang.String> endTurnModes
          sometimes some modes can be switched at the end of turn and some instantly In that case, the specific end of turn mode names can be added here
static int ERA_CLAN
           
static int ERA_SL
           
static int ERA_SW
           
protected  boolean explosive
           
protected  int extinctDate
           
protected  java.math.BigInteger flags
           
protected  boolean hittable
           
protected  boolean instantModeSwitch
          can modes be switched instantly, or at end of turn?
protected  java.lang.String internalName
           
protected  int introDate
           
protected static java.util.Hashtable<java.lang.String,EquipmentType> lookupHash
           
protected  java.util.Vector<EquipmentMode> modes
          what modes can this equipment be in?
protected  java.lang.String name
           
static double POINT_MULTIPLIER_CLAN_FF
           
static double POINT_MULTIPLIER_UNKNOWN
           
static int RATING_A
           
static int RATING_B
           
static int RATING_C
           
static int RATING_D
           
static int RATING_E
           
static int RATING_F
           
static int RATING_X
           
static java.lang.String[] ratingNames
           
protected  int reintroDate
           
protected  boolean spreadable
          can the crits for this be spread over locations?
static double[] structureCosts
           
static java.lang.String[] structureNames
           
protected  long subType
           
static int T_ARMOR_COMMERCIAL
           
static int T_ARMOR_FERRO_CARBIDE
           
static int T_ARMOR_FERRO_FIBROUS
           
static int T_ARMOR_FERRO_FIBROUS_PROTO
           
static int T_ARMOR_FERRO_IMP
           
static int T_ARMOR_FERRO_LAMELLOR
           
static int T_ARMOR_HARDENED
           
static int T_ARMOR_HEAVY_FERRO
           
static int T_ARMOR_HEAVY_INDUSTRIAL
           
static int T_ARMOR_INDUSTRIAL
           
static int T_ARMOR_LAMELLOR_FERRO_CARBIDE
           
static int T_ARMOR_LIGHT_FERRO
           
static int T_ARMOR_PATCHWORK
           
static int T_ARMOR_REACTIVE
           
static int T_ARMOR_REFLECTIVE
           
static int T_ARMOR_STANDARD
           
static int T_ARMOR_STEALTH
           
static int T_ARMOR_UNKNOWN
           
static int T_STRUCTURE_COMPOSITE
           
static int T_STRUCTURE_ENDO_COMPOSITE
           
static int T_STRUCTURE_ENDO_PROTOTYPE
           
static int T_STRUCTURE_ENDO_STEEL
           
static int T_STRUCTURE_INDUSTRIAL
           
static int T_STRUCTURE_REINFORCED
           
static int T_STRUCTURE_STANDARD
           
static int T_STRUCTURE_UNKNOWN
           
protected  int techLevel
           
protected  int techRating
           
protected  int toHitModifier
           
protected  float tonnage
           
static float TONNAGE_VARIABLE
           
 
Constructor Summary
EquipmentType()
          Creates new EquipmentType
 
Method Summary
 void addEndTurnMode(java.lang.String mode)
           
 void addLookupName(java.lang.String s)
           
 void addSubType(int newFlag)
           
protected static void addType(EquipmentType type)
           
 boolean equals(EquipmentType e)
           
static EquipmentType get(java.lang.String key)
           
static java.util.Enumeration<EquipmentType> getAllTypes()
           
static double getArmorCost(int inArmor)
           
static double getArmorPointMultiplier(int inArmor)
           
static double getArmorPointMultiplier(int inArmor, boolean clanArmor)
           
static double getArmorPointMultiplier(int inArmor, int inTechLevel)
           
static int getArmorType(java.lang.String inType)
           
static java.lang.String getArmorTypeName(int armorType)
           
 int getAvailability(int era)
           
 java.lang.String getAvailabilityName(int era)
           
 double getBV(Entity entity)
           
 double getCost(Entity entity, boolean isArmored)
           
 int getCriticals(Entity entity)
           
 java.lang.String getDesc()
           
 int getExtinctionDate()
           
 java.math.BigInteger getFlags()
           
 java.lang.String getInternalName()
           
 int getIntroductionDate()
           
 EquipmentMode getMode(int modeNum)
           Returns the mode number modeNum from the list of modes available for this type of equipment.
 java.util.Enumeration<EquipmentMode> getModes()
           
 int getModesCount()
           
 java.lang.String getName()
           
 java.util.Enumeration<java.lang.String> getNames()
           
static java.lang.String getRatingName(int rating)
           
 int getReintruductionDate()
           
static double getStructureCost(int inStructure)
           
static int getStructureType(java.lang.String inType)
           
static java.lang.String getStructureTypeName(int structureType)
           
 int getTechLevel()
           
 int getTechRating()
           
 java.lang.String getTechRatingName()
           
 int getToHitModifier()
           
 float getTonnage(Entity entity)
           
 boolean hasFlag(java.math.BigInteger flag)
           
 boolean hasInstantModeSwitch()
           
 boolean hasModes()
           
 boolean hasSubType(long testFlag)
           
static void initializeTypes()
           
 boolean isAvailableIn(int year)
           
 boolean isExplosive()
           
 boolean isHittable()
           
 boolean isNextTurnModeSwitch(java.lang.String mode)
          Some equipment types might have both instant and next turn mode switching.
 boolean isSpreadable()
           
 int resolveVariableCost(Entity entity, boolean isArmored)
          stuff like hatchets, which depend on an unknown quality (usually tonnage of the unit.) entity is whatever has this item
 void setFlags(java.math.BigInteger inF)
           
 void setInstantModeSwitch(boolean b)
           
 void setInternalName(java.lang.String s)
           
protected  void setModes(java.lang.String[] modes)
          Sets the modes that this type of equipment can be in.
 void setSubType(int newFlags)
           
 void setTonnage(float tonnage)
           
 java.lang.String toString()
           
static void writeEquipmentDatabase(java.io.File f)
           
static void writeEquipmentExtendedDatabase(java.io.File f)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TONNAGE_VARIABLE

public static final float TONNAGE_VARIABLE
See Also:
Constant Field Values

CRITICALS_VARIABLE

public static final int CRITICALS_VARIABLE
See Also:
Constant Field Values

BV_VARIABLE

public static final int BV_VARIABLE
See Also:
Constant Field Values

COST_VARIABLE

public static final int COST_VARIABLE
See Also:
Constant Field Values

T_ARMOR_UNKNOWN

public static final int T_ARMOR_UNKNOWN
See Also:
Constant Field Values

T_ARMOR_STANDARD

public static final int T_ARMOR_STANDARD
See Also:
Constant Field Values

T_ARMOR_FERRO_FIBROUS

public static final int T_ARMOR_FERRO_FIBROUS
See Also:
Constant Field Values

T_ARMOR_REACTIVE

public static final int T_ARMOR_REACTIVE
See Also:
Constant Field Values

T_ARMOR_REFLECTIVE

public static final int T_ARMOR_REFLECTIVE
See Also:
Constant Field Values

T_ARMOR_HARDENED

public static final int T_ARMOR_HARDENED
See Also:
Constant Field Values

T_ARMOR_LIGHT_FERRO

public static final int T_ARMOR_LIGHT_FERRO
See Also:
Constant Field Values

T_ARMOR_HEAVY_FERRO

public static final int T_ARMOR_HEAVY_FERRO
See Also:
Constant Field Values

T_ARMOR_PATCHWORK

public static final int T_ARMOR_PATCHWORK
See Also:
Constant Field Values

T_ARMOR_STEALTH

public static final int T_ARMOR_STEALTH
See Also:
Constant Field Values

T_ARMOR_FERRO_FIBROUS_PROTO

public static final int T_ARMOR_FERRO_FIBROUS_PROTO
See Also:
Constant Field Values

T_ARMOR_COMMERCIAL

public static final int T_ARMOR_COMMERCIAL
See Also:
Constant Field Values

T_ARMOR_FERRO_CARBIDE

public static final int T_ARMOR_FERRO_CARBIDE
See Also:
Constant Field Values

T_ARMOR_LAMELLOR_FERRO_CARBIDE

public static final int T_ARMOR_LAMELLOR_FERRO_CARBIDE
See Also:
Constant Field Values

T_ARMOR_FERRO_IMP

public static final int T_ARMOR_FERRO_IMP
See Also:
Constant Field Values

T_ARMOR_INDUSTRIAL

public static final int T_ARMOR_INDUSTRIAL
See Also:
Constant Field Values

T_ARMOR_HEAVY_INDUSTRIAL

public static final int T_ARMOR_HEAVY_INDUSTRIAL
See Also:
Constant Field Values

T_ARMOR_FERRO_LAMELLOR

public static final int T_ARMOR_FERRO_LAMELLOR
See Also:
Constant Field Values

T_STRUCTURE_UNKNOWN

public static final int T_STRUCTURE_UNKNOWN
See Also:
Constant Field Values

T_STRUCTURE_STANDARD

public static final int T_STRUCTURE_STANDARD
See Also:
Constant Field Values

T_STRUCTURE_INDUSTRIAL

public static final int T_STRUCTURE_INDUSTRIAL
See Also:
Constant Field Values

T_STRUCTURE_ENDO_STEEL

public static final int T_STRUCTURE_ENDO_STEEL
See Also:
Constant Field Values

T_STRUCTURE_ENDO_PROTOTYPE

public static final int T_STRUCTURE_ENDO_PROTOTYPE
See Also:
Constant Field Values

T_STRUCTURE_REINFORCED

public static final int T_STRUCTURE_REINFORCED
See Also:
Constant Field Values

T_STRUCTURE_COMPOSITE

public static final int T_STRUCTURE_COMPOSITE
See Also:
Constant Field Values

T_STRUCTURE_ENDO_COMPOSITE

public static final int T_STRUCTURE_ENDO_COMPOSITE
See Also:
Constant Field Values

armorNames

public static final java.lang.String[] armorNames

structureNames

public static final java.lang.String[] structureNames

structureCosts

public static final double[] structureCosts

armorCosts

public static final double[] armorCosts

armorPointMultipliers

public static final double[] armorPointMultipliers

POINT_MULTIPLIER_UNKNOWN

public static final double POINT_MULTIPLIER_UNKNOWN
See Also:
Constant Field Values

POINT_MULTIPLIER_CLAN_FF

public static final double POINT_MULTIPLIER_CLAN_FF
See Also:
Constant Field Values

RATING_A

public static final int RATING_A
See Also:
Constant Field Values

RATING_B

public static final int RATING_B
See Also:
Constant Field Values

RATING_C

public static final int RATING_C
See Also:
Constant Field Values

RATING_D

public static final int RATING_D
See Also:
Constant Field Values

RATING_E

public static final int RATING_E
See Also:
Constant Field Values

RATING_F

public static final int RATING_F
See Also:
Constant Field Values

RATING_X

public static final int RATING_X
See Also:
Constant Field Values

ERA_SL

public static final int ERA_SL
See Also:
Constant Field Values

ERA_SW

public static final int ERA_SW
See Also:
Constant Field Values

ERA_CLAN

public static final int ERA_CLAN
See Also:
Constant Field Values

DATE_NONE

public static final int DATE_NONE
See Also:
Constant Field Values

ratingNames

public static final java.lang.String[] ratingNames

name

protected java.lang.String name

internalName

protected java.lang.String internalName

tonnage

protected float tonnage

criticals

protected int criticals

explosive

protected boolean explosive

hittable

protected boolean hittable

spreadable

protected boolean spreadable
can the crits for this be spread over locations?


toHitModifier

protected int toHitModifier

techLevel

protected int techLevel

flags

protected java.math.BigInteger flags

subType

protected long subType

bv

protected double bv

cost

protected double cost

techRating

protected int techRating

availRating

protected int[] availRating

introDate

protected int introDate

extinctDate

protected int extinctDate

reintroDate

protected int reintroDate

modes

protected java.util.Vector<EquipmentMode> modes
what modes can this equipment be in?


instantModeSwitch

protected boolean instantModeSwitch
can modes be switched instantly, or at end of turn?


endTurnModes

public java.util.Vector<java.lang.String> endTurnModes
sometimes some modes can be switched at the end of turn and some instantly In that case, the specific end of turn mode names can be added here


allTypes

protected static java.util.Vector<EquipmentType> allTypes

lookupHash

protected static java.util.Hashtable<java.lang.String,EquipmentType> lookupHash
Constructor Detail

EquipmentType

public EquipmentType()
Creates new EquipmentType

Method Detail

setFlags

public void setFlags(java.math.BigInteger inF)

setSubType

public void setSubType(int newFlags)

addSubType

public void addSubType(int newFlag)

hasSubType

public boolean hasSubType(long testFlag)

getName

public java.lang.String getName()

getDesc

public java.lang.String getDesc()

getInternalName

public java.lang.String getInternalName()

getTechLevel

public int getTechLevel()

getTonnage

public float getTonnage(Entity entity)

setTonnage

public void setTonnage(float tonnage)

getCriticals

public int getCriticals(Entity entity)

isExplosive

public boolean isExplosive()

isHittable

public boolean isHittable()

isSpreadable

public boolean isSpreadable()

getToHitModifier

public int getToHitModifier()

getFlags

public java.math.BigInteger getFlags()

hasFlag

public boolean hasFlag(java.math.BigInteger flag)

getBV

public double getBV(Entity entity)

hasModes

public boolean hasModes()
Returns:
true if this type of equipment has set of modes that it can be in.

getModesCount

public int getModesCount()
Returns:
the number of modes that this type of equipment can be in or 0 if it doesn't have modes.

getModes

public java.util.Enumeration<EquipmentMode> getModes()
Returns:
Enumeration of the EquipmentMode that this type of equipment can be in

setModes

protected void setModes(java.lang.String[] modes)
Sets the modes that this type of equipment can be in. By default the EquipmentType doesn't have the modes, so don't try to call this method with null or empty argument.

Parameters:
modes - non null, non empty list of available mode names.

addEndTurnMode

public void addEndTurnMode(java.lang.String mode)

isNextTurnModeSwitch

public boolean isNextTurnModeSwitch(java.lang.String mode)
Some equipment types might have both instant and next turn mode switching. This method checks for end of turn modes that are kept in a vector of names. It is used by the Mounted.setMode(int) method to distinguish instant and end of turn switching.

Parameters:
mode - - the String of the mode name involved in the switch
Returns:
true if the mode name is found in the next turn mode vector

getMode

public EquipmentMode getMode(int modeNum)

Returns the mode number modeNum from the list of modes available for this type of equipment. Modes are numbered from 0 to getModesCount()-1

Fails if this type of the equipment doesn't have modes, or given mode is out of the valid range.

Parameters:
modeNum -
Returns:
mode number modeNum from the list of modes available for this type of equipment.
See Also:
hasModes()

setInstantModeSwitch

public void setInstantModeSwitch(boolean b)

hasInstantModeSwitch

public boolean hasInstantModeSwitch()

setInternalName

public void setInternalName(java.lang.String s)

addLookupName

public void addLookupName(java.lang.String s)

get

public static EquipmentType get(java.lang.String key)

getNames

public java.util.Enumeration<java.lang.String> getNames()

initializeTypes

public static void initializeTypes()

getAllTypes

public static java.util.Enumeration<EquipmentType> getAllTypes()

addType

protected static void addType(EquipmentType type)

getArmorType

public static int getArmorType(java.lang.String inType)

getArmorTypeName

public static java.lang.String getArmorTypeName(int armorType)

getStructureType

public static int getStructureType(java.lang.String inType)

getStructureTypeName

public static java.lang.String getStructureTypeName(int structureType)

getCost

public double getCost(Entity entity,
                      boolean isArmored)
Returns:
The C-Bill cost of the piece of equipment.

getRatingName

public static java.lang.String getRatingName(int rating)

getTechRating

public int getTechRating()

getTechRatingName

public java.lang.String getTechRatingName()

getAvailability

public int getAvailability(int era)

getAvailabilityName

public java.lang.String getAvailabilityName(int era)

getIntroductionDate

public int getIntroductionDate()

getExtinctionDate

public int getExtinctionDate()

getReintruductionDate

public int getReintruductionDate()

isAvailableIn

public boolean isAvailableIn(int year)

getArmorCost

public static double getArmorCost(int inArmor)

getStructureCost

public static double getStructureCost(int inStructure)

getArmorPointMultiplier

public static double getArmorPointMultiplier(int inArmor)

getArmorPointMultiplier

public static double getArmorPointMultiplier(int inArmor,
                                             int inTechLevel)

getArmorPointMultiplier

public static double getArmorPointMultiplier(int inArmor,
                                             boolean clanArmor)

resolveVariableCost

public int resolveVariableCost(Entity entity,
                               boolean isArmored)
stuff like hatchets, which depend on an unknown quality (usually tonnage of the unit.) entity is whatever has this item


equals

public boolean equals(EquipmentType e)

writeEquipmentDatabase

public static void writeEquipmentDatabase(java.io.File f)

writeEquipmentExtendedDatabase

public static void writeEquipmentExtendedDatabase(java.io.File f)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object