Package megamek.client.bot.princess
Class UnitBehavior
java.lang.Object
megamek.client.bot.princess.UnitBehavior
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddEntityWaypoint(Entity entity, List<Coords> waypoints, Princess owner) booleanaddEntityWaypoint(Entity entity, Coords destination, Princess owner) Deprecated, for removal: This API element is subject to removal in a future version.voidclear()Clears the entity behavior cache, should be done at the start of each movement phasevoidvoidclearWaypoints(Entity entity) getBehaviorType(Entity entity, Princess owner) Gets (and calculates, if necessary), the behavior type for the given entity.getCachedBehaviorType(Entity entity) The behavior already worked out for this unit, without working one out if none has been.getWaypointForEntity(Entity entity) booleanisDestinationValidForEntity(Entity entity, Coords destination, Princess owner) voidoverrideBehaviorType(Entity entity, UnitBehavior.BehaviorType behaviorType) voidremoveHeadWaypoint(Entity entity) Removes the head waypoint from the entity's waypoint queue If waypoints were added (1,1) then (2,2), then (3,3), this would remove (1,1)voidremoveTailWaypoint(Entity entity) Removes the tail waypoint from the entity's waypoint queue If waypoints were added (1,1) then (2,2) then (3,3), this would remove (3,3), good for an "undo" behavior.voidsetEntityWaypoints(Entity entity, List<Coords> waypoints, Princess owner) Sets the entity's waypoints to the given destination
-
Constructor Details
-
UnitBehavior
public UnitBehavior()
-
-
Method Details
-
getBehaviorType
Gets (and calculates, if necessary), the behavior type for the given entity. -
getCachedBehaviorType
The behavior already worked out for this unit, without working one out if none has been.For logging and analysis only.
getBehaviorType(megamek.common.units.Entity, megamek.client.bot.princess.Princess)computes and caches on a miss, and what it computes depends on where everything is standing at the time - so asking early, for a unit that has not moved yet, would pin an answer the bot would otherwise have reached later with better information.- Parameters:
entity- the unit to look up- Returns:
- the cached behavior, or
nullif this unit has not been evaluated this turn
-
overrideBehaviorType
-
getWaypointForEntity
-
isDestinationValidForEntity
-
addEntityWaypoint
-
addEntityWaypoint
@Deprecated(since="0.51.0", forRemoval=true) public boolean addEntityWaypoint(Entity entity, Coords destination, Princess owner) Deprecated, for removal: This API element is subject to removal in a future version. -
removeHeadWaypoint
Removes the head waypoint from the entity's waypoint queue If waypoints were added (1,1) then (2,2), then (3,3), this would remove (1,1)- Parameters:
entity- the entity to remove the waypoint from
-
removeTailWaypoint
Removes the tail waypoint from the entity's waypoint queue If waypoints were added (1,1) then (2,2) then (3,3), this would remove (3,3), good for an "undo" behavior.- Parameters:
entity- the entity to remove the waypoint from
-
setEntityWaypoints
Sets the entity's waypoints to the given destination -
clearWaypoints
-
clearWaypoints
public void clearWaypoints() -
clear
public void clear()Clears the entity behavior cache, should be done at the start of each movement phase
-