Class ToHitData

All Implemented Interfaces:
Serializable

public class ToHitData extends TargetRoll
Contains the to-hit number and a short description of how it was reached
See Also:
  • Field Details

  • Constructor Details

    • ToHitData

      public ToHitData()
      Construct default.
    • ToHitData

      public ToHitData(TargetRollModifier targetRollModifier)
      Construct with a target roll modifier right off the bat.
      Parameters:
      targetRollModifier - The TargetRollModifier that applies immediately.
    • ToHitData

      public ToHitData(int value, String desc)
      Construct with value and desc. Other values default.
    • ToHitData

      public ToHitData(int value, String desc, int hitTable, int sideTable)
      Construct with all variables.
  • Method Details

    • getHitTable

      public int getHitTable()
    • setHitTable

      public void setHitTable(int hitTable)
    • getSideTable

      public int getSideTable()
      Get the side being targeted. If the targeted side is determined randomly, the calculation occurs each time the side is requested.
      Returns:
      an int that represents the side being targeted; the value will be one of SIDE_FRONT, SIDE_REAR, SIDE_LEFT, or SIDE_RIGHT, and *never* SIDE_RANDOM.
    • setSideTable

      public void setSideTable(int sideTable)
    • getTableDesc

      public String getTableDesc()
      Describes the table and side we're turn hitting on
    • getCover

      public int getCover()
    • setCover

      public void setCover(int cover)
    • getMoS

      public int getMoS()
      Determines whether the Margin of success or failure for a given roll. MoS returns a positive while MoF returns a negative
      Returns:
      int
    • setMoS

      public void setMoS(int moS)
    • setLocation

      public void setLocation(Coords l)
    • getLocation

      public Coords getLocation()
    • setRange

      public void setRange(int r)
    • getRange

      public int getRange()
    • setDamagableCoverTypePrimary

      public void setDamagableCoverTypePrimary(int damagableCoverType)
    • getDamagableCoverTypePrimary

      public int getDamagableCoverTypePrimary()
    • getCoverDropshipPrimary

      public Entity getCoverDropshipPrimary()
    • setCoverDropshipPrimary

      public void setCoverDropshipPrimary(Entity coverDropship)
    • getCoverBuildingPrimary

      public IBuilding getCoverBuildingPrimary()
    • setCoverBuildingPrimary

      public void setCoverBuildingPrimary(IBuilding coverBuilding)
    • getCoverLocPrimary

      public Coords getCoverLocPrimary()
    • setCoverLocPrimary

      public void setCoverLocPrimary(Coords coverLoc)
    • setDamagableCoverTypeSecondary

      public void setDamagableCoverTypeSecondary(int damagableCoverType)
    • getDamagableCoverTypeSecondary

      public int getDamagableCoverTypeSecondary()
    • getCoverDropshipSecondary

      public Entity getCoverDropshipSecondary()
    • setCoverDropshipSecondary

      public void setCoverDropshipSecondary(Entity coverDropship)
    • getCoverBuildingSecondary

      public IBuilding getCoverBuildingSecondary()
    • setCoverBuildingSecondary

      public void setCoverBuildingSecondary(IBuilding coverBuilding)
    • getCoverLocSecondary

      public Coords getCoverLocSecondary()
    • setCoverLocSecondary

      public void setCoverLocSecondary(Coords coverLoc)
    • getThruBldg

      public IBuilding getThruBldg()
    • setThruBldg

      public void setThruBldg(IBuilding b)
    • addEiReduction

      public void addEiReduction(int amount)
      Adds to the accumulated Enhanced Imaging (EI) terrain reduction. Call this instead of directly adding an EI modifier. Use finalizeEiModifier() to add the combined EI modifier after all terrain calculations are complete.
      Parameters:
      amount - the EI reduction amount to add (should be positive)
    • getEiReduction

      @Deprecated(since="0.51.0", forRemoval=true) public int getEiReduction()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the accumulated EI terrain reduction.
      Returns:
      the total EI reduction accumulated
    • finalizeEiModifier

      public void finalizeEiModifier()
      Adds the accumulated EI terrain reduction as a single modifier, if any reduction has been accumulated. Call this after all terrain modifiers have been added. This method clears the accumulated reduction after adding the modifier.
    • append

      public void append(TargetRoll other, boolean appendNonCumulative)
      Appends another TargetRoll's modifiers to this one. If the other is a ToHitData, also combines the EI reductions.
      Overrides:
      append in class TargetRoll
      Parameters:
      other - the TargetRoll to append (may be null)
      appendNonCumulative - True to append all modifiers, false to append only cumulative
    • adjustSwarmToHit

      public void adjustSwarmToHit()
      Remove extraneous mods from a ToHitData instance in preparation for recalculating mods.