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 Union[Units, list[Unit]]

Nearby enemy.

grid ndarray

Grid we should check for safety.

attack_in_range_enemy bool(default=True)

Attack in range if weapon is ready.

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=True,
    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 (default: 0.0)

If unit has got this close, consider path behavior complete.

sensitivity int (default: 5)

Path precision.

smoothing bool (default: False)

Smooth out the path.

sense_danger bool (default: True)

Check for dangers, if none are present pathing query is skipped.

danger_distance float (default: 20.0)

If sense_danger=True, how far to check for dangers?

danger_threshold float (default: 5.0)

Influence at which a danger is respected.

prevent_duplicate bool (default: True)

Try to prevent spamming action.

StutterGroupBack dataclass

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

Bases: CombatGroupBehavior

Stutter a group back in unison.

Attributes:

Name Type Description
group Unit

The group of units we want to control.

group_tags Point2

The group unit tags.

group_position Point2

The position where this group is situated.

target Union[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 Union[Point2, Unit]

Target for the group. Used if no enemies present.

enemies Union[Units, list[Unit]]

The enemy units we want to stutter towards