Allow targeting both units and positions
@@ -23,8 +23,15 @@ def combine_actions(action_iter, game_data):
queue_command=queue,
target_world_space_pos=common_pb.Point2D(x=target.x, y=target.y)
)
+ elif isinstance(target, Unit):
+ cmd = raw_pb.ActionRawUnitCommand(
+ ability_id=ability_id,
+ unit_tags=[u.unit.tag for u in items],
+ queue_command=queue,
+ target_unit_tag=target.tag
+ )
else:
- raise "ERROR"
+ raise RuntimeError(f"Must target an unit or a point or None, found '{target !r}'")
yield raw_pb.ActionRaw(unit_command=cmd)
@@ -42,3 +49,6 @@ class UnitCommand(object):
@property
def combining_tuple(self):
return (self.ability_name, self.target, self.queue)
+
+ def __repr__(self):
+ return f"UnitCommand({self.ability_name}, {self.unit}, {self.target}, {self.queue})"
