
syntax = "proto2";

package SC2APIProtocol;

import "s2clientprotocol/common.proto";

// May not relevant: queueable (everything is queueable).
// May not be important: AbilSetId - marine stim, marauder stim.
// Stuff omitted: transient.
// Stuff that may be important: cost, range, Alignment, targetfilters.
message AbilityData {
  optional uint32 ability_id = 1;                                 // Stable ID.
  optional string link_name = 2;                                  // Catalog name of the ability.
  optional uint32 link_index = 3;                                 // Catalog index of the ability.
  optional string button_name = 4;                                // Name used for the command card. May not always be set.
  optional string friendly_name = 5;                              // A human friendly name when the button name or link name isn't descriptive.
  optional string hotkey = 6;                                     // Hotkey. May not always be set.
  optional uint32 remaps_to_ability_id = 7;                       // This ability id may be represented by the given more generic id.

  enum Target {
    None = 1;                                                     // Does not require a target.
    Point = 2;                                                    // Requires a target position.
    Unit = 3;                                                     // Requires a unit to target. Given by position using feature layers.
    PointOrUnit = 4;                                              // Requires either a target point or target unit.
    PointOrNone = 5;                                              // Requires either a target point or no target. (eg. building add-ons)
  }

  optional bool available = 8;                                    // If true, the ability may be used by this set of mods/map.
  optional Target target = 9;                                     // Determines if a point is optional or required.
  optional bool allow_minimap = 10;                               // Can be cast in the minimap.
  optional bool allow_autocast = 11;                              // Autocast can be set.
  optional bool is_building = 12;                                 // Requires placement to construct a building.
  optional float footprint_radius = 13;                           // Estimation of the footprint size. Need a better footprint.
  optional bool is_instant_placement = 14;                        // Placement next to an existing structure, e.g., an add-on like a Tech Lab.
  optional float cast_range = 15;                                 // Range unit can cast ability without needing to approach target.
}

enum Attribute {
  Light = 1;
  Armored = 2;
  Biological = 3;
  Mechanical = 4;
  Robotic = 5;
  Psionic = 6;
  Massive = 7;
  Structure = 8;
  Hover = 9;
  Heroic = 10;
  Summoned = 11;
}

message DamageBonus {
  optional Attribute attribute = 1;
  optional float bonus = 2;
}

message Weapon {
  enum TargetType {
    Ground = 1;
    Air = 2;
    Any = 3;
  }
  optional TargetType type = 1;
  optional float damage = 2;
  repeated DamageBonus damage_bonus = 3;
  optional uint32 attacks = 4;              // Number of hits per attack. (eg. Colossus has 2 beams)
  optional float range = 5;
  optional float speed = 6;                 // Time between attacks.
}

message UnitTypeData {
  optional uint32 unit_id = 1;                                    // Stable ID.
  optional string name = 2;                                       // Catalog name of the unit.
  optional bool available = 3;                                    // If true, the ability may be used by this set of mods/map.
  optional uint32 cargo_size = 4;                                 // Number of cargo slots it occupies in transports.
  optional uint32 mineral_cost = 12;
  optional uint32 vespene_cost = 13;
  optional float food_required = 14;
  optional float food_provided = 18;
  optional uint32 ability_id = 15;                                // The ability that builds this unit.
  optional Race race = 16;
  optional float build_time = 17;
  optional bool has_vespene = 19;
  optional bool has_minerals = 20;
  optional float sight_range = 25;                                // Range unit reveals vision.

  repeated uint32 tech_alias = 21;                                // Other units that satisfy the same tech requirement.
  optional uint32 unit_alias = 22;                                // The morphed variant of this unit.

  optional uint32 tech_requirement = 23;                          // Structure required to build this unit. (Or any with the same tech_alias)
  optional bool require_attached = 24;                            // Whether tech_requirement is an add-on.

  // Values include changes from upgrades
  repeated Attribute attributes = 8;
  optional float movement_speed = 9;
  optional float armor = 10;
  repeated Weapon weapons = 11;
}

message UpgradeData {
  optional uint32 upgrade_id = 1;       // Stable ID.
  optional string name = 2;
  optional uint32 mineral_cost = 3;
  optional uint32 vespene_cost = 4;
  optional float research_time = 5;
  optional uint32 ability_id = 6;
}

message BuffData {
  optional uint32 buff_id = 1;          // Stable ID.
  optional string name = 2;
}

message EffectData {
  optional uint32 effect_id = 1;          // Stable ID.
  optional string name = 2;
  optional string friendly_name = 3;
  optional float radius = 4;
}
