Class Terrains

java.lang.Object
megamek.common.units.Terrains
All Implemented Interfaces:
Serializable

public class Terrains extends Object implements Serializable
See Also:
  • Field Details

  • Constructor Details

    • Terrains

      public Terrains()
  • Method Details

    • exitableTerrain

      public static boolean exitableTerrain(int terrType)
      Checks to see if the given terrain type can have exits.
      Parameters:
      terrType - The terrain type to test
      Returns:
      True if the input terrain type can have exits, else false.
    • getName

      public static String getName(int type)
      Parameters:
      type - the type of terrain to get the name for
      Returns:
      the name of the specified type of terrain
    • getEditorName

      public static String getEditorName(int type)
      Parameters:
      type - the type of terrain to get a localized name for
      Returns:
      the localised name of the type of terrain
    • getEditorTooltip

      public static String getEditorTooltip(int type)
      Parameters:
      type - the type of terrain to get a localized name for
      Returns:
      the localised tool tip for the type of terrain
    • getDisplayName

      public static String getDisplayName(int type, int level)
      Returns a name to be displayed in tooltips. Intentionally returns null for terrains that should be treated separately such as buildings and for terrains that should not be listed such as cliff-tops.
      Parameters:
      type - the type of terrain to get the name for
      level - the level of the terrain to get the specific name
      Returns:
      a displayable name for this terrain (for tooltips)
    • getType

      public static int getType(String name)
      This function converts the name of a terrain into the constant.
      Parameters:
      name - the name of the terrain (from the names list above)
      Returns:
      an integer corresponding to the terrain, or 0 if no match (terrain none)
    • getHash

      protected static Hashtable<String,Integer> getHash()
    • getTerrainFactor

      public static int getTerrainFactor(int type, int level)
      Parameters:
      type - the type of terrain specified
      level - the level of the specified terrain
      Returns:
      the terrain factor for the given type and level - pg. 64, TacOps
    • getTerrainElevation

      public static int getTerrainElevation(int terrainType, int terrainLevel, boolean inAtmosphere)
      Returns the number of elevations or altitudes above the hex level a given terrainType rises. Has to be explicit about the *_ELEV values, because _everything else_ that comes through here is a "level", a ranking of "denseness", not an elevation _or_ altitude.
      Parameters:
      terrainType - this specifies the type of terrain to get the information for
      inAtmosphere - Flag that determines whether elevations or altitudes should be returned.
      Returns:
      The number of altitudes or elevations the given terrain type rises above the hex level.
    • landingModifier

      public static int landingModifier(int terrainType, int terrainLevel)
      Modifier to control roll when the terrain is in the landing path.
      Parameters:
      terrainType - Type of terrain
      terrainLevel - The level of the terrain
      Returns:
      The control roll modifier
    • isBaseTerrain

      public static boolean isBaseTerrain(int terrainType)
      Returns true if the terrain is a base terrain type, excluding "Clear"