megamek.client.bot
Class CEntity

java.lang.Object
  extended by megamek.client.bot.CEntity

public class CEntity
extends java.lang.Object


Nested Class Summary
(package private) static class CEntity.Table
           
 
Field Summary
(package private)  double[] armor_health
           
(package private)  double[] armor_percent
           
(package private)  double avg_armor
           
(package private)  double avg_iarmor
           
(package private)  double base_psr_odds
           
(package private)  int bv
           
(package private) static double[][] CLBA_ARMOR
           
(package private)  MoveOption current
           
(package private)  double[][] damages
           
(package private)  int enemy_num
           
(package private)  boolean engaged
           
(package private)  Entity entity
           
(package private)  double[] expected_damage
           
static int FIRST_ARC
           
(package private) static double[][] GUN_EMPLACEMENT_ARMOR
           
(package private) static double[][] GUN_EMPLACEMENT_TURRET_ARMOR
           
(package private)  boolean hasTakenDamage
           
(package private) static double[][] INFANTRY_ARMOR
           
(package private) static double[][] ISBA_ARMOR
           
(package private)  boolean isPhysicalTarget
           
 int jumpMP
           
(package private)  boolean justMoved
           
(package private)  MoveOption last
           
static int LAST_ARC
           
static int LAST_PRIMARY_ARC
           
static int LEFT_LEG
           
(package private)  double[] leg_health
           
(package private)  int long_range
           
 boolean masc_threat
           
static int MAX_RANGE
           
(package private) static double[][] MECH_ARMOR
           
static int MIN_BRACKET
           
(package private)  int[] minRangeMods
           
(package private)  boolean moved
           
(package private)  double overall_armor_percent
           
(package private)  int overheat
           
static int OVERHEAT_HIGH
           
static int OVERHEAT_LOW
           
static int OVERHEAT_NONE
           
(package private)  MoveOption.Table pass
           
(package private)  double[] possible_damage
           
(package private) static double[][] PROTOMECH_ARMOR
           
(package private) static double[][] PROTOMECH_MG_ARMOR
           
(package private)  int range
           
static int RANGE_ALL
           
(package private)  double[] range_damages
           
static int RANGE_LONG
           
static int RANGE_MEDIUM
           
static int RANGE_SHORT
           
(package private)  int rd_bracket
           
static int RIGHT_LEG
           
 int runMP
           
 Strategy strategy
           
(package private) static double[][] TANK_ARMOR
           
(package private) static double[][] TANK_WT_ARMOR
           
(package private)  boolean tsm_offset
           
static int TT
           
 
Constructor Summary
CEntity(Entity en, TestBot tb)
           
 
Method Summary
protected  MoveOption.Table calculateMoveOptions(MoveOption base, Client client)
          From the current state, explore based upon an implementation of Dijkstra's algorithm.
 boolean canMove()
           
 void characterize()
           
 void computeRange(int arc)
          Fills range damage values for short, medium, long, and all, plus sets the range bracket for the entity, which is 1/3 of long range or 1/4 extreme range.
 boolean equals(java.lang.Object obj)
           
 java.util.ArrayList<MoveOption> findMoves(Coords dest, Client client)
          find all moves that get into dest
static int firingArcToHitArc(int arc)
           
 MoveOption.Table getAllMoves(Client client)
           
protected  int getArmorValue(int loc, boolean rear)
          Returns the value of the armor in the indicated location.
 Entity getEntity()
           
static double getExpectedDamage(Entity attacker, Mounted weapon, int range, int gunskill)
          Determines the expected damage of a weapon attack, based on to-hit, salvo sizes, and so on.
static int getFiringAngle(Coords dest, int dest_facing, Coords src)
           
 java.lang.Integer getKey()
           
 double getModifiedDamage(int arc, int a_range, int modifier)
          Returns an estimate of damage given the range to the target and a modifier to the to-hit number.
 TestBot getTb()
           
static int getThreatHitArc(Coords dest, int dest_facing, Coords src)
           
 double getThreatUtility(double threat, int arc)
          The utility of something done against me. -- uses the arcs defined by ToHitData (FRONT, REAR, LEFT, RIGHT).
 int hashCode()
           
 boolean justMoved()
           
 void refresh()
           
 void reset()
           
 void resetPossibleDamage()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TANK_ARMOR

static final double[][] TANK_ARMOR

TANK_WT_ARMOR

static final double[][] TANK_WT_ARMOR

INFANTRY_ARMOR

static final double[][] INFANTRY_ARMOR

ISBA_ARMOR

static final double[][] ISBA_ARMOR

CLBA_ARMOR

static final double[][] CLBA_ARMOR

PROTOMECH_ARMOR

static final double[][] PROTOMECH_ARMOR

PROTOMECH_MG_ARMOR

static final double[][] PROTOMECH_MG_ARMOR

MECH_ARMOR

static final double[][] MECH_ARMOR

GUN_EMPLACEMENT_ARMOR

static final double[][] GUN_EMPLACEMENT_ARMOR

GUN_EMPLACEMENT_TURRET_ARMOR

static final double[][] GUN_EMPLACEMENT_TURRET_ARMOR

MAX_RANGE

public static final int MAX_RANGE
See Also:
Constant Field Values

MIN_BRACKET

public static final int MIN_BRACKET
See Also:
Constant Field Values

OVERHEAT_NONE

public static final int OVERHEAT_NONE
See Also:
Constant Field Values

OVERHEAT_LOW

public static final int OVERHEAT_LOW
See Also:
Constant Field Values

OVERHEAT_HIGH

public static final int OVERHEAT_HIGH
See Also:
Constant Field Values

RANGE_SHORT

public static final int RANGE_SHORT
See Also:
Constant Field Values

RANGE_MEDIUM

public static final int RANGE_MEDIUM
See Also:
Constant Field Values

RANGE_LONG

public static final int RANGE_LONG
See Also:
Constant Field Values

RANGE_ALL

public static final int RANGE_ALL
See Also:
Constant Field Values

FIRST_ARC

public static final int FIRST_ARC
See Also:
Constant Field Values

LAST_PRIMARY_ARC

public static final int LAST_PRIMARY_ARC
See Also:
Constant Field Values

LAST_ARC

public static final int LAST_ARC
See Also:
Constant Field Values

TT

public static final int TT
See Also:
Constant Field Values

LEFT_LEG

public static final int LEFT_LEG
See Also:
Constant Field Values

RIGHT_LEG

public static final int RIGHT_LEG
See Also:
Constant Field Values

entity

Entity entity

current

MoveOption current

last

MoveOption last

pass

MoveOption.Table pass

runMP

public int runMP

jumpMP

public int jumpMP

masc_threat

public boolean masc_threat

isPhysicalTarget

boolean isPhysicalTarget

overheat

int overheat

range

int range

long_range

int long_range

range_damages

double[] range_damages

rd_bracket

int rd_bracket

base_psr_odds

double base_psr_odds

hasTakenDamage

boolean hasTakenDamage

strategy

public Strategy strategy

armor_health

double[] armor_health

armor_percent

double[] armor_percent

avg_armor

double avg_armor

avg_iarmor

double avg_iarmor

expected_damage

double[] expected_damage

possible_damage

double[] possible_damage

leg_health

double[] leg_health

overall_armor_percent

double overall_armor_percent

damages

double[][] damages

bv

int bv

enemy_num

int enemy_num

engaged

boolean engaged

moved

boolean moved

justMoved

boolean justMoved

tsm_offset

boolean tsm_offset

minRangeMods

int[] minRangeMods
Constructor Detail

CEntity

public CEntity(Entity en,
               TestBot tb)
Method Detail

getEntity

public Entity getEntity()

canMove

public boolean canMove()

justMoved

public boolean justMoved()

reset

public void reset()

refresh

public void refresh()

resetPossibleDamage

public void resetPossibleDamage()

characterize

public void characterize()

computeRange

public void computeRange(int arc)
Fills range damage values for short, medium, long, and all, plus sets the range bracket for the entity, which is 1/3 of long range or 1/4 extreme range. The arc argument follows Compute.ARC_XXX format.


getArmorValue

protected int getArmorValue(int loc,
                            boolean rear)
Returns the value of the armor in the indicated location. Conventional infantry and battle armor behave differently than other units. Armor is in integer units.


getThreatUtility

public double getThreatUtility(double threat,
                               int arc)
The utility of something done against me. -- uses the arcs defined by ToHitData (FRONT, REAR, LEFT, RIGHT). Takes a damage value and adjusts it based on the characterized entities armor/internal values in that arc. Also adjusts based on the strategy module being used by this entity.


getKey

public java.lang.Integer getKey()

getAllMoves

public MoveOption.Table getAllMoves(Client client)

calculateMoveOptions

protected MoveOption.Table calculateMoveOptions(MoveOption base,
                                                Client client)
From the current state, explore based upon an implementation of Dijkstra's algorithm.


findMoves

public java.util.ArrayList<MoveOption> findMoves(Coords dest,
                                                 Client client)
find all moves that get into dest


getModifiedDamage

public double getModifiedDamage(int arc,
                                int a_range,
                                int modifier)
Returns an estimate of damage given the range to the target and a modifier to the to-hit number. An approximation of the original to-hit odds is extracted from the damage at that range leaving the damage that is (hopefully) close to the original value. New odds are generated based on the units gunnery skill and the modifier and factored back into the returned damage value.


getExpectedDamage

public static double getExpectedDamage(Entity attacker,
                                       Mounted weapon,
                                       int range,
                                       int gunskill)
Determines the expected damage of a weapon attack, based on to-hit, salvo sizes, and so on. Note that this is against a generic target, so defensive coverage, whether trees, ECM, or AMS is not considered. Built in offensive equipment will be counted, such as Artemis IV/V, as will minimum range modifiers and inherent weapon modifiers.


getFiringAngle

public static int getFiringAngle(Coords dest,
                                 int dest_facing,
                                 Coords src)

getThreatHitArc

public static int getThreatHitArc(Coords dest,
                                  int dest_facing,
                                  Coords src)

firingArcToHitArc

public static int firingArcToHitArc(int arc)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getTb

public TestBot getTb()