14 #include "../squadcombat.h" 15 #include "basetypes.h" 37 class SquadTask :
public Task {
78 std::unordered_map<Unit const*, Agent>*
agents_;
81 std::unordered_map<std::string, std::shared_ptr<MicroModel>>*
models;
97 return relevantUnits_;
102 std::shared_ptr<UPCTuple> upc,
103 std::unordered_set<Unit*> units,
104 std::vector<Unit*> targets,
105 std::unordered_map<Unit const*, EnemyState>* enemyStates,
106 std::unordered_map<Unit const*, Agent>* agents,
107 std::unordered_map<std::string, std::shared_ptr<MicroModel>>* models)
108 :
Task(upcId, units),
109 targets(
std::move(targets)),
110 targetingLocation(false),
114 enemyStates_(enemyStates),
120 std::shared_ptr<UPCTuple> upc,
121 std::unordered_set<Unit*> units,
124 std::unordered_map<Unit const*, EnemyState>* enemyStates,
125 std::unordered_map<Unit const*, Agent>* agents,
126 std::unordered_map<std::string, std::shared_ptr<MicroModel>>* models)
127 :
Task(upcId, units),
130 targetingLocation(true),
134 enemyStates_(enemyStates),
146 std::vector<std::shared_ptr<UPCTuple>>
makeUPCs(
State* state);
153 virtual const char*
getName()
const override {
std::shared_ptr< UPCTuple > sourceUpc
What UPC – presumably from Tactics – is directing this squad?
Definition: squadtask.h:66
Game state.
Definition: state.h:42
bool hasCloakedFighters
Does this Squad have any cloaked units that can kill things?
Definition: squadtask.h:56
std::unordered_set< Unit * > relevantUnits_
All units relevant to this squad.
Definition: squadtask.h:90
std::vector< Unit * > targets_
Enemies this Squad should target.
Definition: squadtask.h:84
void update(State *state) override
Definition: squadtask.cpp:24
Command
Abstract "meta" commands for UPCTuples.
Definition: basetypes.h:314
const std::unordered_set< Unit * > & relevantUnits() const
Definition: squadtask.h:96
std::unordered_map< Unit const *, EnemyState > * enemyStates_
Stateful information about enemy units.
Definition: squadtask.h:75
std::vector< Unit * > targets
Enemies this Squad should target.
Definition: squadtask.h:40
std::unordered_set< Unit * > const & units() const
A set of units occupied performing this task.
Definition: task.h:94
std::unordered_map< Unit const *, Agent > * agents_
Stateful information about our units.
Definition: squadtask.h:78
bool targetingLocation
Whether to consider targets or targetX/targetY.
Definition: squadtask.h:47
int targetY
Definition: squadtask.h:44
std::vector< Unit * > threats_
Threatening enemies this Squad should be aware of.
Definition: squadtask.h:87
bool isImportantTarget(Unit const *u) const
Should we prioritze this target?
Definition: squadtask.cpp:768
std::vector< std::shared_ptr< UPCTuple > > makeUPCs(State *state)
Get micro decisions for all units.
Definition: squadtask.cpp:690
Position center_
Centroid of the Squad units.
Definition: squadtask.h:69
bool hasAirUnits
Does this Squad have any air units?
Definition: squadtask.h:50
The primary way for modules to publish their activity.
Definition: task.h:50
double delProb
What is the probability – presumably coming from combat simulation via Tactics – that we will win t...
Definition: squadtask.h:60
std::vector< Unit * > getGroupTargets(State *state) const
Definition: squadtask.cpp:96
std::vector< Unit * > getGroupThreats(State *state) const
Definition: squadtask.cpp:102
Represents a unit in the game.
Definition: unitsinfo.h:35
bool isThreat(Unit const *u) const
Can this unit hurt us?
Definition: squadtask.cpp:746
double fleeProb
What is the probability that we should flee?
Definition: squadtask.h:63
SquadTask(int upcId, std::shared_ptr< UPCTuple > upc, std::unordered_set< Unit * > units, int x, int y, std::unordered_map< Unit const *, EnemyState > *enemyStates, std::unordered_map< Unit const *, Agent > *agents, std::unordered_map< std::string, std::shared_ptr< MicroModel >> *models)
Definition: squadtask.h:118
void formation(State *state)
Calculate a combat formation position for all Agents.
Definition: squadtask.cpp:541
Definition: basetypes.h:324
SquadTask(int upcId, std::shared_ptr< UPCTuple > upc, std::unordered_set< Unit * > units, std::vector< Unit * > targets, std::unordered_map< Unit const *, EnemyState > *enemyStates, std::unordered_map< Unit const *, Agent > *agents, std::unordered_map< std::string, std::shared_ptr< MicroModel >> *models)
Definition: squadtask.h:100
Definition: basetypes.h:319
bool hasGroundUnits
Does this Squad have any ground units?
Definition: squadtask.h:53
int targetX
Location this Squad should defend or attack.
Definition: squadtask.h:43
std::unordered_map< std::string, std::shared_ptr< MicroModel > > * models
Models to solicit for UPCs.
Definition: squadtask.h:81
void pickTargets(State *state)
Select which units are valid targets for this Squad.
Definition: squadtask.cpp:113
Main namespace for bot-related code.
Definition: areainfo.cpp:17
virtual const char * getName() const override
A name for this task, for debugging purposes.
Definition: squadtask.h:153
std::vector< Position > storms_
Known locations of Psionic Storms (so we can dodge them)
Definition: squadtask.h:72
bool isRelevantDetector(Unit const *u) const
Is this unit helping detect allied cloaked fighters?
Definition: squadtask.cpp:738
const std::unordered_set< Unit * > & squadUnits() const
Definition: squadtask.h:92
bool isIrrelevantTarget(Unit const *u) const
Can we ignore this target?
Definition: squadtask.cpp:732