megamek.common
Class InfernoTracker

java.lang.Object
  extended by megamek.common.InfernoTracker
All Implemented Interfaces:
java.io.Serializable, RoundUpdated

public class InfernoTracker
extends java.lang.Object
implements java.io.Serializable, RoundUpdated

This class records and defines the effects of hits by Inferno rounds on units and hexes. It does not *apply* the effect, it just defines it.

It makes use of an inner class to define an Inferno round. This inner class should not be directly accessed, but instead refered to by the constants: STANDARD_ROUND and INFERNO_IV_ROUND.

See Also:
Serialized Form

Nested Class Summary
(package private) static class InfernoTracker.Inferno
          This class defines the effects of a single hit by an Inferno round.
 
Field Summary
static InfernoTracker.Inferno INFERNO_IV_ROUND
          The hit from a Inferno IV round.
static InfernoTracker.Inferno INFERNO_IV_TURN
          A single burn turn from an Inferno IV round.
static InfernoTracker.Inferno STANDARD_ROUND
          The hit from a standard Inferno round.
static InfernoTracker.Inferno STANDARD_TURN
          A single burn turn from a standard Inferno round.
 
Constructor Summary
InfernoTracker()
          Create an empty tracker.
 
Method Summary
 void add(InfernoTracker.Inferno round, int hits)
          Add the number of hits with the given inferno round to the tracker.
 void clear()
          Clear the effects of the inferno rounds (the unit got a bath).
 int getArrowIVTurnsLeftToBurn()
          Determine just the number of turns left for Arrow IV Infernos to burn.
 int getHeat()
          Determine the number of heat points generated in the current turn.
 int getTurnsLeftToBurn()
          Determine the total number of turns left for the Infernos to burn.
 boolean isStillBurning()
          Determine if the unit or hex still has inferno rounds that are burning.
 void newRound(int roundNumber)
          The infernos have burned for a round.
 void setTurnsLeftToBurn(int turnsLeftToBurn)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STANDARD_ROUND

public static final InfernoTracker.Inferno STANDARD_ROUND
The hit from a standard Inferno round.


INFERNO_IV_ROUND

public static final InfernoTracker.Inferno INFERNO_IV_ROUND
The hit from a Inferno IV round.


STANDARD_TURN

public static final InfernoTracker.Inferno STANDARD_TURN
A single burn turn from a standard Inferno round.


INFERNO_IV_TURN

public static final InfernoTracker.Inferno INFERNO_IV_TURN
A single burn turn from an Inferno IV round.

Constructor Detail

InfernoTracker

public InfernoTracker()
Create an empty tracker.

Method Detail

add

public void add(InfernoTracker.Inferno round,
                int hits)
Add the number of hits with the given inferno round to the tracker.

Parameters:
round - - the Inferno round that hits. If this value is not STANDARD_ROUND or INFERNO_IV_ROUND, then an IllegalArgumentException will be thrown.
hits - - the int number of rounds that hit. If a negative number is passed, then an IllegalArgumentException will be thrown.

clear

public void clear()
Clear the effects of the inferno rounds (the unit got a bath).


isStillBurning

public boolean isStillBurning()
Determine if the unit or hex still has inferno rounds that are burning.

Returns:
true if there are inferno rounds that are still still burning. false if no inferno rounds have hit yet, or if they have burned out.

newRound

public void newRound(int roundNumber)
The infernos have burned for a round.

Specified by:
newRound in interface RoundUpdated

getTurnsLeftToBurn

public int getTurnsLeftToBurn()
Determine the total number of turns left for the Infernos to burn.

Returns:
The int number of turns that this unit or hex will suffer the effects of an Inferno round (either standard or Inferno IV). This number will be positive when the isStillBurning() method returns true. It will not be negative.

getArrowIVTurnsLeftToBurn

public int getArrowIVTurnsLeftToBurn()
Determine just the number of turns left for Arrow IV Infernos to burn.

Returns:
The int number of turns that this unit or hex will suffer the effects of an Inferno IV round (ignore any standard inferno rounds). This number will be positive when the isStillBurning() method returns true. It will not be negative.

getHeat

public int getHeat()
Determine the number of heat points generated in the current turn.

Returns:
the int number of heat points added this turn. This value will be positive when isStillBurning() returns true. It will not be negative.

setTurnsLeftToBurn

public void setTurnsLeftToBurn(int turnsLeftToBurn)