Class ArenaPos

java.lang.Object
gg.xp.xivsupport.models.ArenaPos

public class ArenaPos extends Object
Class to represent an arena, and divide it into cardinals and intercards.
  • Constructor Details

    • ArenaPos

      public ArenaPos(double xCenter, double yCenter, double xDiff, double yDiff)
      Defines the geometry of the arena. This divides the arena into nine areas (cards, intercards, center).

      This definition consists of a center point, and a delta for X and Y directions. If a combatant's position is within xCenter +/- xDiff, and yCenter +/- yDiff, they are considered to be in the center of the arena.

      If they are outside the xDiff but inside yDiff, they are considered to be west or east. If they are outside yDiff but inside xDiff, they are considered to be north or south. If they are outside of both, they are considered to be in an intercard.

      In other words, you can visualize the sectors by drawing vertical lines at xCenter - xDiff and xCenter + xDiff, and horizontal lines at yCenter - yDiff and yCenter + yDiff. These four lines will divide the arena into nine distinct areas.

      Parameters:
      xCenter - Center X value (usually 100)
      yCenter - Center Y value (usually 100)
      xDiff - How far west/east away from center you can get before you're actually considered west/east.
      yDiff - How far north/south away from center you can get before you're actually considered north/south.
  • Method Details

    • forCombatant

      public ArenaSector forCombatant(XivCombatant cbt)
      Parameters:
      cbt - A combatant to compute the sector of. Must not be null.
      Returns:
      The arena sector in which the combatant lies, or null if the combatant's position is null.
    • forPosition

      public ArenaSector forPosition(Position pos)
      Parameters:
      pos - A position to compute the sector of. Must not be null.
      Returns:
      The arena sector in which the position lies.
    • combatantFacing

      public static ArenaSector combatantFacing(XivCombatant cbt)
      Parameters:
      cbt - A combatant to compute the facing angle of.
      Returns:
      The facing angle expressed as a card/intercard, or 'unknown' if the combatant's position is null.
    • combatantFacing

      public static ArenaSector combatantFacing(double heading)
      Parameters:
      heading - a raw facing angle.
      Returns:
      The facing angle expressed as a card/intercard, or 'unknown' if the combatant's position is null.
    • distanceFromCenter

      public double distanceFromCenter(XivCombatant cbt)
      Parameters:
      cbt - A combatant.
      Returns:
      The distance from this combatant to the center of the arena.
      Throws:
      IllegalArgumentException - if the combatant's position is null.
    • distanceFromCenter

      public double distanceFromCenter(Position pos)
      Parameters:
      pos - A position
      Returns:
      The distance from this position to the center of the arena.