TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
combatmicro.h
1 /*
2  * Copyright (c) 2017-present, Facebook, Inc.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #pragma once
9 
10 #include "module.h"
11 
12 namespace cherrypi {
13 
14 struct Unit;
15 
16 /**
17  * Unit micro-management for combats
18  *
19  * Used only for unit tests.
20  */
21 class CombatMicroModule : public Module {
22  public:
23  virtual void step(State* s) override;
24 
25  protected:
26  struct HealthInfo {
27  int hp;
28  int shield;
29  };
30 
31  void consumeUPC(State* s, int upcId, std::shared_ptr<UPCTuple> upc);
32  void updateTasks(State* s);
33  void updateTarget(
34  std::shared_ptr<Task> task,
35  std::unordered_map<Unit*, HealthInfo>* targetHealth);
36 };
37 
38 } // namespace cherrypi
Game state.
Definition: state.h:42
int shield
Definition: combatmicro.h:28
void updateTasks(State *s)
Definition: combatmicro.cpp:203
void consumeUPC(State *s, int upcId, std::shared_ptr< UPCTuple > upc)
Definition: combatmicro.cpp:184
int hp
Definition: combatmicro.h:27
replayer::Unit Unit
Definition: state.h:36
Unit micro-management for combats.
Definition: combatmicro.h:21
Definition: combatmicro.h:26
void updateTarget(std::shared_ptr< Task > task, std::unordered_map< Unit *, HealthInfo > *targetHealth)
Definition: combatmicro.cpp:248
virtual void step(State *s) override
Definition: combatmicro.cpp:161
Main namespace for bot-related code.
Definition: areainfo.cpp:17
Interface for bot modules.
Definition: module.h:30