11 #include <torchcraft/client.h> 22 tc::BW::UnitCommandType command) {
23 auto orders = tc::BW::commandToOrders(command);
24 auto res = std::find_first_of(
29 [](
tc::Order const& o1, tc::BW::Order o2) {
return o1.
type == o2; });
30 return res != unit.
orders.end();
35 tc::BW::UnitCommandType command) {
40 if ((cmd.code == tc::BW::Command::CommandUnit ||
41 cmd.code == tc::BW::Command::CommandUnitProtected) &&
42 cmd.args.size() > 0) {
49 if ((cmd.code == tc::BW::Command::CommandUnit ||
50 cmd.code == tc::BW::Command::CommandUnitProtected) &&
51 cmd.args.size() > 1) {
52 auto uct = tc::BW::UnitCommandType::_from_integral_nothrow(cmd.args[1]);
57 return tc::BW::UnitCommandType::MAX;
61 if ((cmd.code == tc::BW::Command::CommandUnit ||
62 cmd.code == tc::BW::Command::CommandUnitProtected) &&
63 cmd.args.size() > 5 && cmd.args[1] == tc::BW::UnitCommandType::Build) {
64 auto ut = tc::BW::UnitType::_from_integral_nothrow(cmd.args[5]);
69 return tc::BW::UnitType::MAX;
73 if ((cmd.code == tc::BW::Command::CommandUnit ||
74 cmd.code == tc::BW::Command::CommandUnitProtected) &&
75 cmd.args.size() > 2 && cmd.args[1] == tc::BW::UnitCommandType::Train) {
76 if (cmd.args[2] < 0) {
78 if (cmd.args.size() > 5) {
79 auto ut = tc::BW::UnitType::_from_integral_nothrow(cmd.args[5]);
84 return tc::BW::UnitType::MAX;
87 auto ut = tc::BW::UnitType::_from_integral_nothrow(cmd.args[2]);
93 return tc::BW::UnitType::MAX;
97 if ((cmd.code == tc::BW::Command::CommandUnit ||
98 cmd.code == tc::BW::Command::CommandUnitProtected) &&
99 cmd.args.size() > 4 && cmd.args[1] == tc::BW::UnitCommandType::Build) {
100 return Position(cmd.args[3], cmd.args[4]);
106 auto order = tc::BW::Order::_from_integral_nothrow(orderId);
113 case tc::BW::Order::Guard:
114 case tc::BW::Order::PlayerGuard:
115 case tc::BW::Order::TurretGuard:
116 case tc::BW::Order::BunkerGuard:
119 case tc::BW::Order::Attack1:
120 case tc::BW::Order::Attack2:
121 case tc::BW::Order::AttackUnit:
122 case tc::BW::Order::AttackFixedRange:
123 case tc::BW::Order::AttackTile:
125 case tc::BW::Order::AttackMove:
129 case tc::BW::Order::TowerGuard:
130 case tc::BW::Order::TowerAttack:
131 case tc::BW::Order::VultureMine:
132 case tc::BW::Order::StayInRange:
133 case tc::BW::Order::TurretAttack:
138 case tc::BW::Order::CastInfestation:
139 case tc::BW::Order::MoveToInfest:
140 case tc::BW::Order::InfestingCommandCenter:
164 case tc::BW::Order::CarrierAttack:
165 case tc::BW::Order::CarrierMoveToAttack:
167 case tc::BW::Order::CarrierFight:
168 case tc::BW::Order::CarrierHoldPosition:
170 case tc::BW::Order::ReaverAttack:
171 case tc::BW::Order::ReaverMoveToAttack:
172 case tc::BW::Order::ReaverFight:
173 case tc::BW::Order::ReaverHoldPosition:
175 case tc::BW::Order::InterceptorAttack:
176 case tc::BW::Order::ScarabAttack:
218 case tc::BW::Order::HoldPosition:
224 case tc::BW::Order::FireYamatoGun:
225 case tc::BW::Order::MoveToFireYamatoGun:
226 case tc::BW::Order::CastLockdown:
231 case tc::BW::Order::CastParasite:
232 case tc::BW::Order::CastSpawnBroodlings:
233 case tc::BW::Order::CastEMPShockwave:
238 case tc::BW::Order::NukeUnit:
239 case tc::BW::Order::CastNuclearStrike:
245 case tc::BW::Order::SuicideUnit:
247 case tc::BW::Order::SuicideHoldPosition:
254 case tc::BW::Order::CastIrradiate:
263 case tc::BW::Order::Patrol:
268 case tc::BW::Order::AtkMoveEP:
269 case tc::BW::Order::HarassMove:
270 case tc::BW::Order::AIPatrol:
293 case tc::BW::Order::CastMindControl:
295 case tc::BW::Order::CastFeedback:
296 case tc::BW::Order::CastOpticalFlare:
bool tcOrderIsAttack(int orderId)
Definition: commands.h:105
int32_t type
Definition: frame.h:56
int32_t UnitId
Definition: unitsinfo.h:26
Position buildCommandPosition(tc::Client::Command const &cmd)
Definition: commands.h:96
Represents a unit in the game.
Definition: unitsinfo.h:35
auto order(Unit *worker)
Definition: gatherermicro.cpp:84
tc::BW::UnitType buildCommandUnitType(tc::Client::Command const &cmd)
Definition: commands.h:60
bool isExecutingCommand(tc::Unit const &unit, tc::BW::UnitCommandType command)
Definition: commands.h:20
tc::Unit unit
A copy of the torchcraft unit data.
Definition: unitsinfo.h:81
tc::BW::UnitType trainCommandUnitType(tc::Client::Command const &cmd)
Definition: commands.h:72
std::vector< Order > orders
Definition: frame.h:94
UnitId commandUnitId(tc::Client::Command const &cmd)
Definition: commands.h:39
Main namespace for bot-related code.
Definition: areainfo.cpp:17
tc::BW::UnitCommandType commandUnitType(tc::Client::Command const &cmd)
Definition: commands.h:48
Vec2T< int > Position
Definition: basetypes.h:178