Class PlanetaryConditions

java.lang.Object
megamek.common.planetaryConditions.PlanetaryConditions
All Implemented Interfaces:
Serializable

public class PlanetaryConditions extends Object implements Serializable
This class will hold all the information on planetary conditions and a variety of helper functions for those conditions
See Also:
  • Field Details

  • Constructor Details

    • PlanetaryConditions

      public PlanetaryConditions()
      Constructor
    • PlanetaryConditions

      public PlanetaryConditions(PlanetaryConditions other)
      Creates new PlanetaryConditions that is a duplicate of another
  • Method Details

    • clone

      public Object clone()
      clone!
      Overrides:
      clone in class Object
    • alterConditions

      public void alterConditions(PlanetaryConditions conditions)
    • setLight

      public void setLight(Light light)
    • getLight

      public Light getLight()
      Returns:
      The time of day lighting conditions (one of PlanetaryConditions.L_*).
    • setWeather

      public void setWeather(Weather weather)
    • getWeather

      public Weather getWeather()
    • setWind

      public void setWind(Wind wind)
    • getWind

      public Wind getWind()
    • setWindMin

      public void setWindMin(Wind windMin)
    • getWindMin

      public Wind getWindMin()
    • setWindMax

      public void setWindMax(Wind windMax)
    • getWindMax

      public Wind getWindMax()
    • setWindDirection

      public void setWindDirection(WindDirection windDirection)
    • getWindDirection

      public WindDirection getWindDirection()
    • setAtmosphere

      public void setAtmosphere(Atmosphere atmosphere)
    • getAtmosphere

      public Atmosphere getAtmosphere()
    • setAtmosphericTaint

      public void setAtmosphericTaint(AtmosphericTaint atmosphericTaint)
      Sets how badly the air is fouled and in what way, per Tainted and Toxic Atmospheres (TO:AR p.54). This is independent of setAtmosphere(Atmosphere), which sets how much air there is rather than what is in it.
      Parameters:
      atmosphericTaint - the taint category and severity to use
    • getAtmosphericTaint

      public AtmosphericTaint getAtmosphericTaint()
      Returns:
      how badly the air is fouled and in what way, per Tainted and Toxic Atmospheres (TO:AR p.54). AtmosphericTaint.BREATHABLE is the default and has no effect on play.
    • getFog

      public Fog getFog()
    • setFog

      public void setFog(Fog fog)
    • isFog

      public boolean isFog()
    • getBlowingSand

      public BlowingSand getBlowingSand()
    • setBlowingSand

      public void setBlowingSand(BlowingSand blowingSand)
    • isBlowingSand

      public boolean isBlowingSand()
    • setEMI

      public void setEMI(EMI emi)
    • getEMI

      public EMI getEMI()
    • isEMI

      public boolean isEMI()
    • getTemperatureDisplayableName

      public static String getTemperatureDisplayableName(int temp)
    • getLightHitPenalty

      public int getLightHitPenalty(boolean isWeapon)
      to-hit penalty for light TO:AR 6th ed. p. 56
    • getLightHeatBonus

      public int getLightHeatBonus(int heat)
      heat bonus to hit for being overheated in darkness TO:AR 6th ed. p. 56
    • getWeatherHitPenalty

      public int getWeatherHitPenalty(Entity en)
      to-hit penalty for weather
    • getWeatherPilotPenalty

      public int getWeatherPilotPenalty()
      piloting penalty for weather
    • getGravityPilotPenalty

      public int getGravityPilotPenalty()
      gravity penalties to PSRs According to email from TPTB, you apply a penalty for every 0.5 gravities above or below 1 (rounding up)
    • getWindPilotPenalty

      public int getWindPilotPenalty(Entity en)
      piloting penalty for wind
    • determineWind

      public void determineWind()
    • getIgniteModifiers

      public int getIgniteModifiers()
      modifiers for fire ignition
    • putOutFire

      public boolean putOutFire()
      Do a roll for these weather conditions putting out fire return boolean
    • getTemperatureDifference

      public int getTemperatureDifference(int high, int low)
      Returns how much higher or lower than a given range, divided by ten, rounded up, the temperature is
    • cannotStartFire

      public String cannotStartFire()
      Returns:
      a String with the reason why you cannot start a fire here
    • getMovementMods

      public int getMovementMods(Entity en)
      Planetary conditions on movement, except for gravity
      Parameters:
      en - - the entity in question
      Returns:
      an int with the modifier to movement
    • whyDoomed

      public String whyDoomed(Entity en, Game game)
      is the given entity type doomed in these conditions?
      Returns:
      a string given the reason for being doomed, null if not doomed
    • isLethalToEjectedCrew

      public boolean isLethalToEjectedCrew()
      Whether a crew that ejects into these conditions is killed by the environment alone.

      An ejected MekWarrior or vehicle crew arrives on the board as a conventional infantry platoon with no space suit and no XCT gear, so every condition that kills unprotected foot troops kills them: unbreathable air, a tainted or toxic atmosphere, a storm or tornado, and extreme heat or cold. With auto-ejection switched on, a survivable ammunition explosion therefore becomes a dead pilot, which is the trap RFE #5579 asks the player be warned about before deploying.

      Returns:
      true if an ejecting crew would be killed by the conditions themselves
    • whyLethalToEjectedCrew

      @Nullable public String whyLethalToEjectedCrew()
      What it is out there that would kill a crew that ejects, phrased to sit inside a sentence.

      Every condition that would do it is named, not just the first. Naming one when two apply invites the player to fix that one and think the crew is safe, when the other is still lethal.

      Returns:
      the conditions that would kill an ejecting crew, joined for reading, or null if none would
    • lethalEjectionHazards

      public Set<EjectionHazard> lethalEjectionHazards()
      Everything out there that would kill a crew who ejects into it, as separate hazards.

      The warning before deployment needs these one at a time rather than as a sentence, because a crew's armor kit answers some of them and not others.

      Returns:
      the hazards present, in reading order, or an empty set when ejecting is survivable
    • isBlowingSandActive

      public boolean isBlowingSandActive()
    • getVisualRange

      public int getVisualRange(Entity en, boolean targetIlluminated)
      visual range based on conditions TO:AR 6th ed. p. 189
    • getDropRate

      public int getDropRate()
    • setShiftingWindDirection

      public void setShiftingWindDirection(boolean b)
    • shiftingWindDirection

      public boolean shiftingWindDirection()
    • setShiftingWindStrength

      public void setShiftingWindStrength(boolean b)
    • shiftingWindStrength

      public boolean shiftingWindStrength()
    • setTemperature

      public void setTemperature(int tem)
    • getTemperature

      public int getTemperature()
    • isExtremeTemperature

      public static boolean isExtremeTemperature(int temperature)
    • isExtremeTemperature

      public boolean isExtremeTemperature()
    • setGravity

      public void setGravity(float f)
    • getGravity

      public float getGravity()
    • setTerrainAffected

      public void setTerrainAffected(boolean b)
    • isTerrainAffected

      public boolean isTerrainAffected()
    • isRecklessConditions

      public boolean isRecklessConditions()
    • setTempFromWeather

      public static int setTempFromWeather(Weather weather, int temperature)
    • setWindFromWeather

      public static Wind setWindFromWeather(Weather weather, Wind wind)
    • isSleeting

      public boolean isSleeting()
    • setSleet

      public void setSleet(boolean sleet)
    • setWindFromBlowingSand

      public static Wind setWindFromBlowingSand(BlowingSand blowingSand, Wind wind)
    • isExtremeTemperatureHeat

      public boolean isExtremeTemperatureHeat()
    • isExtremeTemperatureCold

      public boolean isExtremeTemperatureCold()
    • getGravityIndicator

      public String getGravityIndicator()
    • getTemperatureIndicator

      public String getTemperatureIndicator()
    • toString

      public String toString()
      Overrides:
      toString in class Object