Skip to content

Group Combat Behaviors

AMoveGroup dataclass

AMoveGroup(group, group_tags, target)

Bases: CombatGroupBehavior

A-Move group to a target.

Example:

from ares.behaviors.combat.group import AMoveGroup

self.register_behavior(AMoveGroup(units, self.game_info.map_center))

Attributes:

Name Type Description
group list[Unit]

Units we want to control.

group_tags set[int]

The group unit tags.

target Point2

Where the unit is going.

KeepGroupSafe dataclass

KeepGroupSafe(group, close_enemy, grid, attack_in_range_enemy=True)

Bases: CombatGroupBehavior

A-Move group to a target.

Example:

from ares.behaviors.combat.group import AMoveGroup

self.register_behavior(AMoveGroup(units, self.game_info.map_center))

Attributes:

Name Type Description
group list[Unit]

Units we want to control.

close_enemy list[Unit] | Units

Nearby enemy.

grid ndarray

Grid we should check for safety.

attack_in_range_enemy bool

Whether to attack in range if weapon is ready. Defaults to True.

PathGroupToTarget dataclass

PathGroupToTarget(start, group, group_tags, grid, target, distance_check_squared=26.25, success_at_distance=0.0, sensitivity=12, smoothing=False, sense_danger=False, danger_distance=20.0, danger_threshold=5.0, prevent_duplicate=True)

Bases: CombatGroupBehavior

Path a group to its target destination.

We issue only one action for the whole group and attempt to filter spammed actions.

Example:

from ares.behaviors.combat.group import PathGroupToTarget

group: list[Unit] = [u for u in self.units]
group_tags: set[int] = {u.tag for u in group}
grid: np.ndarray = self.mediator.get_ground_grid
start: Point2 = self.ai.start_location
target: Point2 = self.game_info.map_center

self.register_behavior(
    PathGroupToTarget(start, group, group_tags, grid, target)
)

Attributes:

Name Type Description
start Point2

Where to start the path query.

group list[Unit]

The actual group units.

group_tags set[int]

The units to path.

grid ndarray

2D grid to path on.

target Point2

Target destination.

success_at_distance float

If the unit has gotten this close, consider the path behavior complete. Defaults to 0.0.

sensitivity int

Path precision. Defaults to 5.

smoothing bool

Whether to smooth out the path. Defaults to False.

sense_danger bool

Whether to check for dangers. If none are present, the pathing query is skipped. Defaults to False.

danger_distance float

If sense_danger is True, how far to check for dangers. Defaults to 20.0.

danger_threshold float

Influence at which a danger is respected. Defaults to 5.0.

prevent_duplicate bool

Whether to try to prevent spamming actions. Defaults to True.

StutterGroupBack dataclass

StutterGroupBack(group, group_tags, group_position, target, grid)

Bases: CombatGroupBehavior

Stutter a group back in unison.

Attributes:

Name Type Description
group list[Unit]

The group of units we want to control.

group_tags set[int]

The group unit tags.

group_position Point2

The position where this group is situated.

target Point2 | Unit

Target for the group.

grid ndarray

Grid this group will use to path on.

StutterGroupForward dataclass

StutterGroupForward(group, group_tags, group_position, target, enemies)

Bases: CombatGroupBehavior

Stutter a group forward in unison.

Attributes:

Name Type Description
group list[Unit]

The group of units we want to control.

group_tags set[int]

The group unit tags.

group_position Point2

The position where this group is situated.

target Point2 | Unit

Target for the group, used if no enemies are present.

enemies list[Unit] | Units

The enemy units we want to stutter towards.

GroupUseAbility dataclass

GroupUseAbility(ability, group, group_tags, target, sync_command=True)

Bases: CombatGroupBehavior

Issue a single ability command for a group of units.

Example:

from ares.behaviors.combat.group import GroupUseAbility

self.register_behavior(
    GroupUseAbility(
        AbilityId.MOVE_MOVE,
        units,
        {u.tag for u in units}
        self.game_info.map_center
    )
)

Attributes:

Name Type Description
ability AbilityId

Ability we want to use.

group list[Unit]

Units we want to control.

group_tags set[int]

The group unit tags.

target Point2 | Unit | None

The target for this ability.

sync_command bool

(default=True) If True, wait for all units to be ready before trying ability.